0
Help with code
Print out your age and message https://sololearn.com/compiler-playground/cJw59raMdiOw/?ref=app
4 Answers
+ 5
Rain ,
you are right, no re-assignment.
but taking an input for a name twice, makes no sense in this case.
+ 4
Kakooza Tawufiki ,
You forgot to convert the input to int before assigning it to age. Fix this line.
age = input("Enter your age: ")
+ 4
Kakooza Tawufiki ,
the code requires to input the name twice. this is not necessary.
the second input for name uses the same variable as for the first name input, so the content of the variable will be overwritten. we can use the if conditional like:
...
if age == 18:
...
+ 1
Lothar ,
Are you sure? The way I read it, message isn't reassigned, and the prompt includes "again", so it's intentional that the user enters their name twice, the second time not being assigned to an identifier but used immediately in the comparison then discarded.
[Edit. Well, it did contain "again", but he changed the prompt to a single space now. Still no reassignment though.]