Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialdakota ferrell
2,336 Pointswhy will the .upper() function not work here
first_name = input ("whats your first name ") print ("hello,", first_name) if first_name == "Dakota": print (first_name, "is learning Python") elif first_name == "billy": print("go away {}!".format(first_name))
else: age = int(input("how old are you? ")) if age <= 6: type = print("Wow youre {}! if your confident with reading already...".format(age)) type = type.upper() print("you should learn python {}!".format(first_name))
print("have a great day {}!".format(first_name))
1 Answer
Maxwell Newberry
7,693 Pointsupper()
should be appended to a string, for example:
string_name = "Maxwell Newberry"
string_name.upper()
print(string_name)
Output:
MAXWELL NEWBERRY
In your code, you set type
's value as a print statement, not a string.
dakota ferrell
2,336 Pointsdakota ferrell
2,336 PointsThanks but it seems like i can only do it like this
else: age = int(input("how old are you? ")) if age <= 6: type = "Wow youre {}! if your confident with reading already...".format(age) type.upper() print (type.upper())
is it because its in a if statement?