wiki:ProgrammingAnswerPotatoExercise

Version 2 (modified by cdelgigante, 8 years ago) (diff)

--

Back to: Programming?

count=1
while (count<=7):
   if (count==4):
      print("more!")
   else: 
      for r in range(0,count):
         print(count, "potato, ", end="")
      print("")
   count+=1
print("score!")

Output is:

1 potato,                                                                                                                                                                                                                                              
2 potato, 2 potato,                                                                                                                                                                                                                                    
3 potato, 3 potato, 3 potato,                                                                                                                                                                                                                          
more!                                                                                                                                                                                                                                                  
5 potato, 5 potato, 5 potato, 5 potato, 5 potato,                                                                                                                                                                                                      
6 potato, 6 potato, 6 potato, 6 potato, 6 potato, 6 potato,                                                                                                                                                                                            
7 potato, 7 potato, 7 potato, 7 potato, 7 potato, 7 potato, 7 potato,                                                                                                                                                                                  
score!