0

What is wrong with this code and why do i get the error "NameError: name 'arg' is not defined"?

This is probably a noob problem but all help and explanations are greatly appreciated :) https://code.sololearn.com/cduz0iHUqhMi/?ref=app

9th Jun 2017, 7:11 PM
Harry
Harry - avatar
3 Antworten
+ 3
Def should be def. Print should be print. (no caps). Watch out with the indentation too, it's hard to tell what's in the function and what isn't. Python sort of relies on proper indentation. Writing "impure(arg)" to call the function will throw an error since arg isn't defined.
9th Jun 2017, 7:25 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
Also Some_list is not some_list in Python!!! Python is case-sensitive!
9th Jun 2017, 7:30 PM
Amarie
+ 1
Thanks guys :) the reason for the difference in caps was just changed by default on my phone, but thanks anyway for the advice and to James for the correct code :)
9th Jun 2017, 7:34 PM
Harry
Harry - avatar