47.7k views
4 votes
Use a for loop to output every third number from 0 to 51? This is python

User MindHacks
by
5.8k points

1 Answer

3 votes

Answer:

def main():

for i in range(3,52,3):

print(str(i))

main()

Step-by-step explanation:

def main(): # Creates main function

for i in range(3,52,3): # is an iteration that starts at 3, ends at 51 and skips 3 numbers per iteration

print(str(i)) # Outputs each 3rd integer

main() # Calls the main function

User Alextsc
by
6.2k points