The notations where not matching each other. I’m only on ex 17 and I have trouble with others. I’m glad to find someone who’s on the same subject. I hope to be where you are, I’m having problems as well. I hope I’m doing the right things. All I can do is follow along, but I feel like there’s something missing on my part.
Hi all, I also ran into this problem lately. I had Python 3.5.x.
I found that in 3.6, they changed how the f-string works. To be exact, the way we use it in the exercises was only implemented with 3.6 and not before. https://cito.github.io/blog/f-strings/
In 3.5, i used e.g.
print(“Let’s talk about {}.”.format(my_name))
instead.
Hi @syzh, yes I used Python 3.6 and f-strings because we’re supposed to use the latest Python 3 and that’s the most recent. Also because f-strings a great.
I am using Python 3.6.5 and still getting this error for my code. Could you please advise?.
[******** lpthw]$ python ex5.py
File “ex5.py”, line 10
print(f"Let’s talk about {my_name}.")
^
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}.")
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}.")
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
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.
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
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.
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.