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!
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)
WowâŚcorrected and output perfect
Thanks for your prompt response, encouraging.
Screen shot of the code snippet⌠indentation is intact , just confuse what the reason for the error maybeâŚplease help check it outâŚthanks
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.
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
Thanks bigâŚI will try the codes on desktop to see what will happenâŚ