8th Apr 2024, 5:37 PM
Kakooza Tawufiki
Kakooza Tawufiki - avatar
4 Respostas
+ 5
Rain , you are right, no re-assignment. but taking an input for a name twice, makes no sense in this case.
10th Apr 2024, 9:07 AM
Lothar
Lothar - avatar
+ 4
Kakooza Tawufiki , You forgot to convert the input to int before assigning it to age. Fix this line. age = input("Enter your age: ")
9th Apr 2024, 1:36 AM
Rain
Rain - avatar
+ 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: ...
9th Apr 2024, 9:30 AM
Lothar
Lothar - avatar
+ 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.]
9th Apr 2024, 3:17 PM
Rain
Rain - avatar