Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 1_beginner/chapter4/practice/hours.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Hours
# Write a program that asks the user
# how many hours they spend on the internet
# per day, and return if they’re addicted
# per day, and print if they’re addicted
# or not based on the hours. (5 or more hours
# is addicted, less is not).

Expand Down
2 changes: 1 addition & 1 deletion 1_beginner/chapter4/solutions/hours.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Hours
# Write a program that asks the user
# how many hours they spend on the internet
# per day, and return if they’re addicted
# per day, and print if they’re addicted
# or not based on the hours. (5 or more hours
# is addicted, less is not).

Expand Down
10 changes: 5 additions & 5 deletions 1_beginner/chapter5/practice/TV.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# TV
# Pretend you just got a 37 on your test,
# and you mom says you can’t watch TV until you get above an 84.
# (HINT: comparison operators). You increase
# your test score 6 points per day (iterations).
# Pretend you just got a 50 on your test,
# and you mom says you can’t watch TV until you get
# a score of at least 80. (HINT: comparison operators).
# You increase your test score by 10 points per day.
# Write a program that tells you after
# how many days you'll be able to watch TV
# how many days you'll be able to watch TV. Use a loop.

# write code here
22 changes: 11 additions & 11 deletions 1_beginner/chapter5/solutions/TV.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# TV
# Pretend you just got a 37 on your test,
# and you mom says you can’t watch TV until you get above an 84.
# (HINT: comparison operators). You increase
# your test score 6 points per day (iterations).
# Pretend you just got a 50 on your test,
# and you mom says you can’t watch TV until you get
# a score of at least 80. (HINT: comparison operators).
# You increase your test score by 10 points per day.
# Write a program that tells you after
# how many days you'll be able to watch TV
# how many days you'll be able to watch TV. Use a loop.

x = 37
d = 0
while x < 84:
x += 6
d += 1
print(d)
x = 50
days = 0
while x < 80:
x += 10
days += 1
print("You can watch TV after", days, "days")