0
Help my code not work
13 Respostas
+ 2
the variable 'text' is not defined.
remove line 11
don't call upper() in the print atatement as its not a global function. Replace each call to upper in the print statement with your up() function
+ 3
https://code.sololearn.com/cc8r3qH3Or1R/?ref=app
Once check this
In ur code you have defined a function called up but you are calling upper in print statement
So modify up to upper in the function name
Second u written text=upper
At there u no need write that line .
Hope this helps you
+ 1
Are you converting all inputs into caps?
0
Faisal Issaka lol yes
0
you could also just take input like so:
name = input("Enter name: ").upper()
0
Slick ok thanks it work
0
print("AI: What is your name?\n ")
name = input("you: ")
print("AI: How old are you?\n ")
age = input("you: ")
print("AI: What is your hobby?\n")
hobby=input("you: ")
def up(text):
return text.upper()
print("a boy named", up(name), "aged", up(age), "and their hobby is", up(hobby))
0
Slick, I wanted to create a shortcut for making text uppercase
0
You just called the function instead and pass the text
And remove the upper = text line
0
Yea ok
0
print("AI: What is your name?\n ")
name = input("you: ")
print("AI: How old are you?\n ")
age = input("you: ")
print("AI: What is your hobby?\n")
hobby=input("you: ")
def up(text):
return text.upper()
print("a boy named", up(name), "aged", up(age), "and their hobby is", up(hobby))
0
You defined function up() and you should call it.
The expression upper=text is wrong, since there is no "text" variable assigned and this expression is not necessary.
0
print("AI: What is your name?\n ")
name = input("you: ")
print("AI: How old are you?\n ")
age = int(input("you: "))
print("AI: What is your hobby?\n")
hobby=input("you: ")
print("a boy named" + str(name) + "aged" + str(age), "and their hobby is", str(hobby))