Syntax Error message (please help out)

https://app.dataquest.io/m/351/cleaning-and-preparing-data-in-python/5/string-capitalization

HI @olasunkanmiafolabi30. We’d love to be able to help you out, but we need some more information so we know what you’re having trouble with. If you could include what you’ve done and what’s giving you trouble using these guidelines, then hopefully someone in the community can help you out!

1 Like

The link just redirects it to the mission. Without the code you wrote the syntax error message cannot be reproduced. Copy paste the code you wrote.

for row in moma:
gender = row[5]
gender = gender.title()
if not gender:
gender = “Gender Unknown”
row[5] = gender

nationality = row[2]
nationality = nationality.title()
if not nationality:
    nationality = "Nationality Unknown"
row[2] = nationality

Hi @olasunkanmiafolabi30 thanks for providing the code snippet. I’m not seeing a problem in the code (except for indenting, but that may be a problem from copy/paste).

I see from the title that you have a syntax error message, but I don’t know what the error specifically is to help you diagnose the problem. A screenshot of the screen with the error might help me understand what you’re having problems with.

Hi @april.g .
A newbie, after i followed all instructions and checked answer from " Get Help" am still having below error, kindly help to check what is wrong;

variable_1 = 10
variable_2 = 2.5

variable_1 += 6.5
variable_2 *= 2

print(varible_1)
print(varible_2)

NameErrorTraceback (most recent call last)
in ()
5 variable_2 *= 2
6
----> 7 print(varible_1)
8 print(varible_2)

NameError: name ‘varible_1’ is not defined

Note : Have also checked the answer from “Get Help” but couldn’t found what is wrong with the code.

Just a typo, you have variable misspelled in the print command.
variable_1 = 10
print(varible_1)

1 Like

Wow…corrected and output perfect

Thanks for your prompt response, encouraging.

2 Likes

2 posts were split to a new topic: My code is same as the solution, but i am getting an error


Screen shot of the code snippet… indentation is intact , just confuse what the reason for the error maybe…please help check it out…thanks

Hi @olasunkanmiafolabi30 ,

While the platform is completely functional on a device like a smartphone, the web app was designed, first and foremost, with the desktop experience in mind, in order to simulate a real-world DA/DS workflow. This means that there are things that are less than optimal on a smartphone, like the size of the coding window, and having to use the virtual keyboard to code.

Mobile/Tablet keyboards use curly quotes instead of straight quotes. This image shows the difference.

Dumb_quotes_vs_curly_quotes.jpg
The python interpreter doesn’t accept curved quotes for representing string values. So you may get SyntaxError: invalid character in identifier when using a mobile device.

Even though your code may appear to be exact as the solution, there might be an invisible character like zero-width space which could be the cause of this problem. This typically happens when we access the platform using mobile.

Hope this helps! I recommend you to use a desktop/laptop to use our platform.

Best,
Sahil

1 Like

Thanks big…I will try the codes on desktop to see what will happen…

2 Likes

A post was split to a new topic: NameError: name ‘app_data’ is not defined