JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Gallery
Solution Debug 5.4. Birthday Boolean
Share
Explore
Gallery
Solution Debug 5.4. Birthday Boolean
Solution Debug 5.4. Birthday Boolean
Solution
The Task
Python Starter Code
Code Clips
Solution
Solution
solution
# print out a blank line
print
(
'\n'
)
# ask the user if today is their birthday (true or flase) answer
birthday
=
bool
(
int
(
input
(
'Is today your birthday, 1-True or 0-False? '
)
)
)
# print out a blank line
print
(
'\n'
)
# checks the user response
# if it is true it will display Happy Birthday.
# otherwise display good wishes message.
if
birthday
==
True
:
print
(
"Happy Birthday!"
)
print
(
"Hope you have the best day."
)
else
:
print
(
"Have a great day when it comes."
)
# print out a blank line
print
(
'\n'
)
original
# print out a blank line
print
(
'\n'
)
# ask the user if today is their birthday (true or flase) answer
birthday
=
bool
(
int
(
input
(
'Is today your birthday, 1-True or 0-False? '
)
)
)
# print out a blank line
print
(
'\n'
)
# checks the user response
# if it is true it will display Happy Birthday.
# otherwise display good wishes message.
if
birthday
=
False
:
print
(
"Happy Birthday!"
)
print
(
"Hope you have the best day"
)
else
:
print
(
"Have a great day when it comes."
)
# print out a blank line
print
(
'\n'
)
Gallery
Share
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.