sameh_mo
sameh_mo

Reputation: 1

While loops and some help around it

Can someone help me with this piece of code ?

Write a python program that shows the first 20 results of the hitting process in .7

a=0
while a<=20:
    a+=1
    print(a*7)

Upvotes: 0

Views: 49

Answers (2)

okie
okie

Reputation: 881

you could try using for instead of while

for n in range(1,21):
    print(n*7)

Or

[print(n*7) for n in range(1,21)]

For faster process

Upvotes: 0

Rand
Rand

Reputation: 13

Your code does what it is supposed to. You just need to watch out how you indent it, try this:

a=0
while a<=20:
    a+=1
    print(a*7)

Upvotes: 1

Related Questions