How do i get rid of the term none here and what is it?
I’ve created a basic addition statement, i am aware that input is being read as a string but my code prints out "none" before taking an input (see below). How do i take integer as an input??
# code example print("This is a calculator") a = input(print("Enter the first number")) b = input(print("Enter the second number")) print("sum =", a + b)
This is a calculator Enter the first number None5 Enter the second number None6 sum = 56
print() in the first two lines:
a = input("Enter the first number") b = input("Enter the second number")
a = input(print("Enter the first number")) b = input(print("Enter the second number"))
None is the return of the
print() function so since
input() prints what you input to it you are printing the returned
None value. Then the print statement will still print the prompt. However you want to let
input() print the prompt as described above.
Answered By – Eli Harold