Weight Converter Program"

I am using the Python tutorial and on the part called “Weight Converter Program”.
Having problem with a syntax error.
First it was saying syntax error to the following code

Weight: 240

(L)bs or (K)g:

I was typing the next line in but, on further observations I noticed that Mosh was just pressing enter to get the next line (L)bs or (K)g: to enter itself.

I now get code completed with 0, but not “Your 108.8 Kilos” as show in the tutorial.

Weight: 240 <when you press enter here
Does Charm automatically populate the next line with
(L)bs or (K)g: I Don’t get this line to enter L or K

Sharing your code is always a good starting point. So, share your code so people can see it and provide support.

2 Likes

Ty Doing my best to explain my problem!

Any Ideas on what I’m doing wrong.

Ok figured out I was not completing the instructions to create the project,
this is the code now that I followed up and got this error?
weight = int(input ('Weight: ‘)
unit = input(’(L)bs or (K)g: ')
if unit.upper() == “L”:
converted = weight * 0.45
print(f”You are {converted} kilos
else:
converted = weight / 0.45
print(f”You are{converted} Pounds

Syntax error s:
File “C:\Users\bella\PycharmProjects\Hello World 2\main.py”, line 2
unit = input(’(L)bs or (K)g: ')
^
SyntaxError: invalid syntax

Hope you can see what I’m doing wrong and tY

1 Like

Missing closing")" in line 1?

Got it ! TY Sam!

Now I’m getting;
if unit.upper() == “L”:
^
SyntaxError: invalid character ‘“’ (U+201C)

Solved by retyping quotes not copy and pasting them