Cannot work out the issue here

can someone please help here ?.

hello
have worked through your code, on each error I change your speech marks(they were not speech marks but looked like them) to " " and now the script runs and outputs as expected. Just work through your code and address each error.

my_name = "Zed A. Shaw"
my_age = 35 # It’s close to my real age
my_height = 74 #inches
my_weight = 180 #lbs
my_eyes = "Blue"
my_teeth = "White"
my_hair = "Brown"

print(f"Let’s talk about {my_name}.")
print(f"He is {my_height} inches tall.")
print(f"He is {my_weight} pounds heavy.")
print("Actually, that’s not too heavy.")
print(f"He’s got {my_eyes} eyes and {my_hair} hair.")
print(f"His teeth are usually {my_teeth} depending on the coffee.")

total = my_age + my_height + my_weight

print(f"If I add {my_age}, {my_height}, and {my_weight} I get {total}.")

also see this link about posting code
https://forum.learncodethehardway.com/t/how-to-post-code-in-forum-other-than-copy-paste-thanks/473

Thanks Jason, Could you please help about… how do I know if there are speech marks? and how to correct them ?

Also, I copied the code you gave and it didn’t work for me, gave this error. There isn’t any ‘\xe2’ in the code.

File “ex5_Corrected_Syntax.py”, line 2
SyntaxError: Non-ASCII character ‘\xe2’ in file ex5_Corrected_Syntax.py on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

from the command line can you type

python --version

let’s just check which version of python is running, also which operating system are you using ?

]$ python --version
Python 2.7.5

I installed the Python 3.5.6 and running from the installation directory of python and the OS is here
uname -a
Linux prdpldspp0028 3.10.0-693.21.1.el7.x86_64 #1 SMP Fri Feb 23 18:54:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Please advise how I can get the latest version to be set up as default python.

what happens if you type

python3.6 --version

an earlier post said “I am using Python 3.6.5 and still getting this error for my code” and your last post says “Python 3.5.6” we need to check which it is

I think @jason helped you but, you say you’re running Python 3.6, but when you run:

python --version

It prints out 2.7. To run Python 3.6 you probably have to run your things like:

python3.6 --version

So that’s"

python 3.6 ex5.py

Thanks Jason and Zed.

The version I installed is Python 3.6.5
My python --version gives 2.7

Did python3.6 --version

I tried python3.6 --version and python 3.6 ex.5 and python3.6 ex.5
All three resulted in command not found

Checking on how to activate the version of Python I want to run. Will keep you all posted about my progress and any help would be really appreciated as I am in the very beginning stage.

Thanks
Surendra

I invoked the python 3.6 by giving the absolute path and it worked. Thanks a lot Jason and Zed. Posting stuff here, reading some content over the web, trying and able to solve this keeps me moving.

Will keep you all posted about my progress. Thank you very much.

lpthw]$ /opt/app/surendra/Python-3.6.5/python ex5_Corrected_Syntax.py
Let’s talk about Zed A. Shaw.
He is 74 inches tall.
He is 180 pounds heavy.
Actually, that’s not too heavy.
He’s got Blue eyes and Brown hair.
His teeth are usually White depending on the coffee.
If I add 35, 74, and 180 I get 289.

What operating system are you on? Linux or a Mac? Try python3, and also try this:

find / -name "python*" | less

That’ll find everything with python in the name.

The OS is RHEL 7 and Python is “Python-3.6.5”.

I am just wondering how could you get this special type format in this website?

@johnbriton
I’m not quite sure what you are asking, do you mean:

special type format in this website

I used these codes to format the text

[ code ] to start and [ /code ] to end the block formatting, without the bracket spaces, you try

I can’t remember where on the site this information is, but if you work through the badges you will come across it

1 Like