Skip to content
Advertisement

While loop not taking ‘if’ statement into account

I’m trying to write a program in Python where the user is asked to input a number of hours after which a countdown starts in seconds, however I want to also make sure that no floats/strings are inputted and if they are, the user needs to be prompted with the same question and input a correct value. If an integer is inputted then I want the program to jump to the next statement (hence ‘pass’ on line 4). However, whatever I type in, the program always jumps to the next statement, regardless of whether it’s a string or a float.

JavaScript

I tried using if statements and defining functions, but I can’t seem to make it work.

Advertisement

Answer

like this

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement