Skip to content

Commit e7a4db1

Browse files
committed
new
1 parent 3e41ff3 commit e7a4db1

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

ex039.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Write a program that reads the year of birth of a young person and informs, according to his age, whether he is
22
# still going to enlist in the military service, whether it is the exact time to enlist or if it is past the
33
# enlistment period. Your program should also show the time remaining or the time that has passed.
4-
54
from datetime import date
65
from xml.sax.handler import property_interning_dict
76

ex062.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
11
# Improve challenge 61 by asking the user if he wants to show some more terms. The program will exit when he says he
22
# wants to show 0 terms.
3+
print("Arithmetic progression generator")
4+
print("-=-" * 20)
5+
first_term = int(input("Enter the first term:"))
6+
reason = int(input("Enter the reason of the arithmetic progression:"))
7+
term = first_term
8+
counter = 1
9+
total = 0
10+
more = 10
11+
while more != 0:
12+
total = more + total
13+
while counter <= total:
14+
print(f"{term}", end=' ')
15+
term += reason
16+
counter += 1
17+
print("Pause")
18+
more = int(input("How many more terms do you want to show?"))

ex063.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#Write a program that reads any integer number N and displays on the screen the first N elements of a
2+
# Fibonacci Sequence.
3+
terms = int(input("How many terms do you want to show?"))
4+
first_term = 0
5+
second_term = 1
6+
print(f"{first_term} -> {second_term}", end='')
7+
counter = 3
8+
while counter <= terms:
9+
third_term = first_term + second_term
10+
print(f" -> {third_term}", end='')
11+
first_term = second_term
12+
second_term = third_term
13+
counter += 1

ex064.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#Create a program that reads several integers from the keyboard. The program will only stop when the user enters the
2+
# value 999, which is the stopping condition. At the end, show how many numbers were entered and what the sum of them
3+
# was (disregarding the flag).
4+
number = counter = amount = 0
5+
number = int(input("Enter an integer [999 to stop]:"))
6+
while number != 999:
7+
amount += number
8+
counter += 1
9+
number = int(input("Enter an integer [999 to stop]:"))
10+
print(f"You enter {number} numbers and the sum between them is {amount} ")

ex065.py

Whitespace-only changes.

0 commit comments

Comments
 (0)