FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Basic-Python-Programs/arithmetic_progression.py at main · gitishman/Basic-Python-Programs · GitHub
gitishman
/
Basic-Python-Programs
Public
forked from
souravjain540/Basic-Python-Programs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Basic-Python-Programs
/
arithmetic_progression.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (25 loc) · 990 Bytes
Breadcrumbs
Basic-Python-Programs
/
arithmetic_progression.py
Copy path
File metadata and controls
31 lines (25 loc) · 990 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
###########################################################################
# Question - Arithmetic Progression Generator
# # Develop a program that:
# 1- read the first term and the common difference of a arithmetic progression
# 2- show the first 10 terms of this progression
# 3- ask to user if he wants show some more terms
# 4- finish the program when user says he wants to show 0 terms
###########################################################################
print
(
"Arithmetic Progression Generator"
)
print
(
"-="
*
50
)
first_term
=
int
(
input
(
"First term: "
))
common_difference
=
int
(
input
(
"Common difference: "
))
term
=
first_term
cont
=
1
more
=
10
total
=
0
while
more
!=
0
:
total
+=
more
while
cont
<=
total
:
print
(
f"
{
term
}
"
,
end
=
" --> "
)
term
+=
common_difference
cont
+=
1
print
(
"PAUSE.
\n
"
)
more
=
int
(
input
(
"How many terms you want to show more? "
))
print
(
f"
\n
\n
Arithmetic Progression was finished with
{
total
}
terms shown.
\n
\n
"
)
Back
|
FazBrowse Home
|
New Git URL