Exercise: A patient named John Smith

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.

Hey @Lux not that i’m a Pro or anything of that kind i happen to be a fellow python course student but i really suggest you store your data a ‘dictionary’ rather than a ‘variable’ that way you can call out your input.

1 Like

I’ll look it up. Thank you!

1 Like

Hi, I’ve seen this exercise in Mosh Youtube video as well.
I would say that the video is only touching on the surface part of coding.
I have bought the Python Mastery a week ago and I am now able to finish this exercise myself based on what I’ve learned from the course.

If you had the opportunity, I would suggest you to go for the course.
You would have finish this exercise by utilizing the first 3 chapters.

If you would like the answers, please message me. :slight_smile:

Hi, its me shanu
sir, Mosh please reply me.
i need your help.
please contect me ASAP its urgent
whatsapp 03037384529

Hi, I’m kindly requesting for the answer. And also, which book did you buy?

The video is great but it seems shallow.

Hey Lux,

Welcome to the community.

I think this link (Python Concatenate String and int) will help you out with some various ways this can be achieved. You should be coming across a few of these in future lessons.

I am not sure why you would need to know about dictionaries at this point, you will come across them in the course. It will all be much easier to digest concepts that are presented in a logical order, rather than skipping to things that are not presented in the lesson you are currently in.

As a suggestion, I would try to finish all the lessons in a module. This is just so you have a more complete overview of the topic. This will help when googling keywords, posting questions here, as well as spotting bad advice that could steer you in a wrong direction.

I wish you the best and hope you have fun learning.