Skip to content

Commit 9e05b2f

Browse files
committed
doc: add comments
Loop structure: for. Arithmetic progression.
1 parent 7bf18c9 commit 9e05b2f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

ex051.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1+
#Arithmetic Progression
12
#51-Develop a program that reads the first term and the ratio of an AP. At the end, show the first 10 terms
23
# of this progression.
34
first = int(input('First term:'))
45
ratio = int(input('Ratio:'))
5-
tenth = first +(10-1) * ratio
6+
tenth = first + (10-1) * ratio
67
for c in range(first,tenth + ratio, ratio):
78
print(f'{c}', end=' -> ')
89
print('He finished')
10+
11+
12+
#Progressão Aritmética
13+
# 51: Desenvolva um programa que leia o primeiro termo e a razão de uma PA. No final, mostre os 10 primeiros termos
14+
# dessa progressão.
15+
primeiro = int(input('Digite o primeiro termo da PA:'))
16+
razao = int(input('Digite a razão da PA:'))
17+
dez = primeiro + (10 - 1) * razao
18+
for contador in range(primeiro, dez + razao, razao):
19+
print(f'{contador}', end='-')
20+
print('Fim')
21+
22+
23+
#PT- Estruturas de repetições: For.
24+
#EN- Loop structures: For.

0 commit comments

Comments
 (0)