Skip to content

Tag: while-loop

repeating a program using while loop failed

I coded a program that is meant to repeat itself over and over until the to_continue loop is broken by the input “N”. However, it didn’t seem to work. Output: whilst I meant for it to output Full program if that’s helpful: Any help would be deeply appreciated :) Please comment if any o…

Should I be using an if statement or a loop?

It’s me, your friendly Python noob! I’m working on this program and I’m trying to figure out how to get the program to stop if the number exceeds a certain threshold OR if the user enters anything other than a number to loop back around and try again. Here is what I have so far: The if state…

Python while loop not working as intended

I don’t know how to get over this problem with while loop. So basically I want to return the number of zeros at the end of a number’s factorial. After the while loop runs only 1 time, it breaks; I don’t know why. Help would be very appreciated. Thanks! Answer After multiplying your value by …

Iteration numbers with True False condition

Please HELP!! I have a list: I want to generate iteration number if it’s False the number continues and if it’s True the number stays. I Try this code: it’s just keep running and did not show any output. the desired output will be [1,2,3,3,3,4,5,6,6] I have no idea what’s wrong with it…