Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why can I only insert a number and not a name?

Hi I’m new to Python and I’m wondering why I was only able to put numbers and not actual names in this code. When I added name I ran into a SyntaxError.

my_age = 27
half_my_age = 13
greeting = Hi 
name = Max
greeting_with_name = Hi + Max

print("my_age + half_my_age + greeting + name + greeting_with_name")    

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Name is a String (Combination of characters) not a number. To Store a string in a variable you need to use double quotes ("") or Single Quotes (”).

In Your Code I think you need to put you HI or name into String like this "HI" or "name" to run you code without any SyntaxError.

I Hope this will help you in your python journey.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading