0

Name reader.

Wanted to make a code in python that will print a name that you input. Can someone tell me what I did wrong? input = name1 name1 = float(input("Enter a name”) print(“name1”) Sorry if this is a basic question, just trying to wrap my head around this.

25th Oct 2018, 4:28 PM
Yosharu
Yosharu - avatar
3 Respostas
+ 1
I see two errors, 1° you defined a variable name1 as a float number (line 2), 2° when you write "number" the print statement is set to print a string but not a variable number1 (line 3).
25th Oct 2018, 4:51 PM
Luiz Santos
Luiz Santos - avatar
+ 2
change float to str. Name is mostly represented as string
25th Oct 2018, 4:35 PM
Anya
Anya - avatar
+ 1
Float is for decimal numbers not strings such as names
25th Oct 2018, 5:06 PM
PureLogicality
PureLogicality - avatar