Dec-23-2017, 07:02 PM
Hello, I am very new to programming - so please excuse the incredibly beginner question.
I have been trying to a write a couple of lines of code and am struggling to make sure that the input is a number (either int or float).
I have looked online, and have struggled to execute the suggestions of using try/except, while and .isdigit(). I am sure that it is probably a grossly easy question, but I can't seem to figure it out.
I am using Python 3.6.3.
Amongst others, I have written the below:
I have been trying to a write a couple of lines of code and am struggling to make sure that the input is a number (either int or float).
I have looked online, and have struggled to execute the suggestions of using try/except, while and .isdigit(). I am sure that it is probably a grossly easy question, but I can't seem to figure it out.

I am using Python 3.6.3.
Amongst others, I have written the below:
odds_text = ("The number is ") odds_input = input("Enter a number: ") strip_input = odds_input.strip() while str(strip_input): # Trying to ensure that the input was not a string. print("Sorry, please enter a valid number") break else: print(odds_text.format(odds=strip_input))Thanks for any help!
