Please tell me how to print out Python

Asked 1 weeks ago, Updated 1 weeks ago, 1 views

Output the sum of 5 multiples from 1 to 1000, but produce the output as shown in the following form. (Submit both programs using for statements and programs using while statements.) However, the for statement is used only once in the program.)

<Output results>

The sum up to 5 is 5

The sum up to 10 is 15

The sum up to 15 is 30

The sum up to 20 is 50

The sum up to 25 is 75.

..............

..............

The sum up to 95 is 950

The sum up to 100 is 1050

................

................

The sum up to 1000 is ..........

python

2022-09-20 16:28

1 Answers

Please, let's do this much.

count = 0
for i in range(5, 1001, 5):
    count += ?
    The sum up to print(str(?) + " is " + str(?) + "")
count = 0
i = ?
while i ? 1001:
    i += ?
    ? ? += i
    The sum up to print(str(?) + " is " + str(?) + "")


2022-09-20 16:28

If you have any answers or tips


© 2022 pinfo. All rights reserved.