Answer to Question #269685 in Python for Sibongile

Question #269685

Ask the user for a random number and assign the value to a variable named starting. Then using a for loop and write a program that asks the user for input of 5 numbers. Each of these numbers must be added to the initial value of the variable starting. The output must be the initial and final value of the variable starting. Please name the program and provide at least one code comment.


1
Expert's answer
2021-11-22T09:52:54-0500
n = int(input())


c = n
for i in range(0,5):
    x = int(input())
    c = c + x
print('initial',n)
print('final',c)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS