+ 2
Find error?(solved)
def your name (n): return welcome, + n input (n) print your name (n)
6 Respuestas
+ 4
Arunesh Kishore, the spaces in between words and the order arrangement of its parts seem like they would cause errors for what this program outline is going for. As far as the predefined terms go, aren't def return input and print the keywords here? Why does this example work with how it is structured and how could the statements in its functions be better grouped so as to be logically improved?
https://code.sololearn.com/cVQLaR3MFCpR/?ref=app
+ 2
Thanks bro
+ 2
boneSpider 🎶🕷 please find error in my code
+ 2
OK
+ 1
Arunesh Kishore review the getName.py code I wrote that is restructured and answers where the errors are - you can't use spaces in identifiers. Python's convention is to use underscores in place of spaces when naming a variable or function, camelCase is also a good legible option for the function yourName.
name is a more descriptive variable name instead of n, when you get input in python it is in the form name = input() not input(name) unless you call your getter function something like getName() that returns a string from an input() inside that function and assigns it as in name = getName()
You have return welcome, +name
so either you can choose to return a couple or more values in a tuple separated by commas, -or- do a string concatenation, but trying to do both with a , and a + like that could result in an error. The print command needs parentheses around the expression that you are printing, in this case the yourName() function so print(yourName(name))
+ 1
Arunesh Kishore also, Google the error messages you get from your python interpreter - stackoverflow usually has advanced/professional examples to resolving errors, but w3schools, geeksforgeeks and other similar tutorial website examples within the first 10 search results should be helpful in looking up how to resolve programming errors