Linked Questions
90 questions linked to/from How can I check if string input is a number?
5 votes
6 answers
39k views
Python - how to test if a users input is a decimal number [duplicate]
I am writing a program that needs to check if a users input is a decimal (the users input must be a deciamal number),I was wondering how I could test a varible to see if it contains only a decimal ...
3 votes
1 answer
37k views
How do I check if input is a number in Python? [duplicate]
I have a Python script which converts a decimal number into a binary one and this obviously uses their input. I would like to have the script validate that the input is a number and not anything else ...
2 votes
1 answer
16k views
How do I check if an input is an integer or not in python? [duplicate]
So I am trying for my program to print the message "That is not an integer!" if the user inputs something that is not an integer basically, I thought this was how you would do that but apparently isn'...
-2 votes
4 answers
5k views
Preventing alphabetical input [duplicate]
Possible Duplicate: Python - How to check if input is a number (given that input always returns strings) I need to check a input and send a error message if it's not numerical. How would i do this ...
1 vote
1 answer
2k views
IF statement skipping straight to ELSE [duplicate]
Starting off by saying I'm completely new to python, I have to do a school project and I'm stuck with this part of the code. Pretty much, the requirements are being met to go through with the IF ...
0 votes
3 answers
708 views
how to determine the raw input is an integer or not in python? [duplicate]
I have the following piece of code: choice = raw_input("> ") if "0" in choice or "1" in choice: how_much = int(choice) else: dead("Man, learn to type a number.") It seems ...
0 votes
1 answer
558 views
I want to make python identify if `num1` and `num2` were numbers or not in this calculator so that python can notify you're not typing in valid things [duplicate]
I want to make python identify if num1 and num2 were numbers or not in this calculator so that python can notify you're not typing in valid things. Maybe using if statements? num1 = float(input("...
1 vote
1 answer
645 views
How to validate an integer? [duplicate]
I want to validate an input to see whether it is a number (integer) or not. This is my code: temp = input("Today's temperature: ") if int(temp): temperature = int(temp) if ...
-2 votes
2 answers
234 views
How to create a program that terminate when numbers are inputted? [duplicate]
q = [] num = ["1","2","3","4","5","6","7","8","9","0"] while True: dat = float(input("Enter ...
-2 votes
1 answer
420 views
Checking user input? [duplicate]
i want to check whether the user input is a number if it is continues the code if its not it re-asks until they enter a number # This progam will simulate a dice with 4, 6 or 12 sides. import ...
2 votes
2 answers
172 views
Checking that user input is an int (python) [duplicate]
Have been stuck on this for about an hour. Currently trying to teach myself Programming using Python. I am using a textbook for the programming stuff which walks me through pseudocode and then I ...
1 vote
1 answer
321 views
Python - How to check if an variable is an number [duplicate]
I am trying to build an ATM code , but I have another piece of code that is again proving troublesome. Here is the error: How Much Funds Do You Wish To Input Into Your Account? : £1565 Not A Vaild ...
0 votes
2 answers
223 views
A simple program to accept only numbers [duplicate]
I'm writing a simple program to accept only numbers. but the program is accepting both letters and numbers I'm using python 3.. I used the int data type in addition to input statement. #A program to ...
2 votes
2 answers
139 views
Why is != not working to check for an integer in Python [duplicate]
I am trying to write a simple program that checks if a user inputs an integer, but there is a problem with my code. I would like to print out the if statement only if input is not an integer. What is ...
2 votes
2 answers
152 views
ValueError validation loop [duplicate]
I'm starting out with Python after taking a class that taught us pseudocode. How could I make a validation loop to continue the function if a user inputted a decimal rather than a whole number? At its ...