I just started on python and since I started a new calculator project, pyCharm spits out none after everything. I'm not sure what's causing this error, I would appreciate it if I could get some help here. (This is just the main function that I'm showing) Here's the code:
def main():
run = True
while run == True:
if run == False:
break
try:
operation = input(print("Would you like to *, -, + or /?"))
if operation != "+" and operation != "-" and operation != "/" and operation != "*":
print("invalid input.")
go = input(print("Would you like to continue, yes or no?"))
if go == "no":
run = False
else:
continue
else:
num1 = int(input(print("What's your first number?")))
num2 = int(input(print("What's your second number?")))
if operation == "*":
print(multi(num1, num2))
if operation == "-":
print(sub(num1, num2))
if operation == "+":
print(add(num1, num2))
if operation == "/":
print(div(num1, num2))
go = input(print("Would you like to make another calculation, yes or no?"))
if go == "no":
run = False
else:
continue
except:
print("invalid input.")
go = input(print("Would you like to continue, yes or no?"))
if go == "no":
run = False
else:
continue
An example of what happens:
Would you like to *, -, + or /?
None/
What's your first number?
None3
What's your second number?
None4
0.75
Would you like to make another calculation, yes or no?
Noneno
Process finished with exit code 0
printfunctions in yourinputstatements returnNone, and that's why you seeNonebefore the user input. Remove the calls toprint(),inputwill print the text anyway.