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 trialyahyaalshwaily2
Python Development Techdegree Graduate 20,049 PointsIf and else statements are both true
Hi,
if I input yahya both "is learning python" and "you should definetly learn python" statements appear in the console, could anyone please explain to me where I went wrong?
Code:
First_name = input("Hello, What's your name?")
if First_name == "yahya":
print(First_name, " is learning python")
elif First_name == "gleb":
print (First_name, " is learning python")
else:
print ("you should definetly learn python {}".format(First_name))
print ("have a good day {}".format (First_name))
// thank you!
1 Answer
Steven Parker
231,275 PointsAs suggested by boi, an indentation error could cause your issue.
For us to be able to see the code as it really is, use Markdown formatting when posting to the forum.
yahyaalshwaily2
Python Development Techdegree Graduate 20,049 Pointsit seems that workspace just didn't work, I ran the code again today without modification and it worked :)
boi
14,242 Pointsboi
14,242 PointsIt seems like an indentation issue, make sure your indentation of
else
is proper.