Hi, I’ve been following both the course (Complete Python Mastery) and the yt tutorials on Python (for beginners).
One thing I did’t get is an exercise that appears during the yt tutorial (I mean: Python Tutorial - Python for Beginners [Full Course] at minute 17:24).
Here, after explaining the variables, Mosh gives us this little exercise to do:
“We check in a patient named John Smith. He’s 20 years old and he’s a new patient”.
We have to define three variables, one for his name, one for his age and the last one to tell if it’s a new or an existing patient.
The given solution is:
full_name = “John Smith”
age = 20
is_new = True
How would it look if we wanted to run it and see the result?
Because what I wrote is:
name = “John Smith”
age = “20”
length_of_stay = “new patient”
print(name + " is " + age + ". " + "He’s a " + length_of_stay)
I had to use all three as a string because otherwise it would be considered as a mistake.
Can someone explain? Please.