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 trialSenay Berhe
7,871 PointsMake a variable named right with a value that's truthy. Then make another variable named wrong with a falsey value.
I did like this but I don't know why it is not working
right = "truthy" wrong = "falsey"
even I tried to append it but it is not working.
right = "True"
wrong = "False"
6 Answers
jcorum
71,830 Points"true" and "false" are Strings, and are not truthy or falsey.
right = 1
wrong = 0
The following are considered false (falsey):
- None
- False
- zero of any numeric type, for example, 0, 0L, 0.0, 0j
- any empty sequence, for example, '', (), []
- any empty mapping, for example, {}
- instances of user-defined classes, if the class defines a nonzero() or len() method, when that method returns the integer zero or bool value False
All other values are considered true.
Ronnie Jimenez
Courses Plus Student 2,345 Pointsright = True
wrong = False
Senay Berhe
7,871 PointsThank you and it works.
Antonio De Rose
20,885 Pointseven the below will work
right = "Anton" wrong = ""
right = 10 wrong = 0
ankita verma
3,088 Pointsright="true" wrong= ""
jonlunsford
15,480 PointsSenay: What you did was add a string to each variable by inlcuding the quotes. A string is different than True / False. Try something like this.
'''python right = True wrong = False '''
jonlunsford
15,480 Pointsignore the '''python ''' > the markdown did not work apparently. Just use
right = True wrong = False
Wilfried Allico
2,495 PointsWilfried Allico
2,495 PointsHello. If possible could you explain why are the variables 1 and 0 are not in between quotes?