+ 4
why cant i do this in python?
why cant i do this: ans = input(name, "whats the answer: ")
7 Respuestas
+ 3
~ swim ~ it prints:
cat whats the answer:
and asks for the answrr
+ 3
I think u can use string formatting
If name is a variable where u store name then u can try this
ans=input("{},whats the answer:".format(name))
+ 3
Run help(input) and help(print) and compare what you get. input() expects one parameter (prompt) which can be None. You can't provide more arguments than the method accepts
+ 3
Format your strings, input only accepts 1 parameter
ans = input(f"{name} whats the answer")
+ 2
~ swim ~ as input also prints a value, it would make sense, that it would output text like print function.
+ 1
The current value of name variable will be stored in placeholder {}
0
name= "mi nombre";
print nombre;