Skip to content

Chapter 03 simple conditions exam problems #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Oct 9, 2018
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/01.Transport-price-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/01.Transport-price-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/01.Transport-price-06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/02.Pipes-in-pool-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/02.Pipes-in-pool-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/02.Pipes-in-pool-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/04.Harvest-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/04.Harvest-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/04.Harvest-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/04.Harvest-04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/05.Firm-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/05.Firm-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/05.Firm-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/chapter-3-2-images/original/05.Firm-01.png
Binary file added assets/chapter-3-2-images/original/05.Firm-03.png
1 change: 1 addition & 0 deletions assets/chapter-3-2-images/original/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Put your images here.
168 changes: 79 additions & 89 deletions chapter-03-simple-conditions-exam-problems.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
distance = int(input())
day_or_night = input()

price = 0.00
taxi_rate = 0.00

if day_or_night == 'day':
taxi_rate = 0.79
else:
taxi_rate = 0.90

if distance < 20:
price = 0.70 + distance * taxi_rate
elif distance < 100:
price = distance * 0.09
else:
price = distance * 0.06

print(price)

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import math

volume = int(input())
pipe_1 = int(input())
pipe_2 = int(input())
hours = float(input())

water = (pipe_1 + pipe_2) * hours

if water <= volume:
print('The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.' . format(
math.trunc(water/volume * 100),
math.trunc(pipe_1 * hours / water * 100),
math.trunc(pipe_2 * hours / water * 100)
))
else:
print('For {0} hours the pool overflows with {1} liters.' . format(
hours,
water - volume
))
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import math

holidays = int(input())

working_days = 365 - holidays
total_play_minutes = working_days * 63 + holidays * 127
difference = math.fabs(total_play_minutes - 30000)
hours = int(difference // 60)
minutes = int(difference % 60)

if total_play_minutes > 30000:
print('Tom will run away')
print(f'{hours} hours and {minutes} minutes more for play')
else:
print('Tom sleeps well')
print(f'{hours} hours and {minutes} minutes less for play')



Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import math

vineyard_area = int(input())
grape_per_square = float(input())
needed_liters = int(input())
workers = int(input())

harvest_per_vine = (vineyard_area * grape_per_square) * 0.4
vine = harvest_per_vine / 2.5

if vine >= needed_liters:
vine_left = vine - needed_liters
print('Good harvest this year! Total wine: {0} liters.' . format(
math.floor(vine)))
print('{0} liters left -> {1} liters per person.' . format(
math.ceil(vine_left), math.ceil(vine_left / workers)))
else:
print('It will be a tough winter! More {0} liters wine needed.'.format(
math.floor(needed_liters - vine)))

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import math

project_hours = int(input())
available_days = int(input())
overtime_workers = int(input())

work_days = available_days * 0.90
overtime_hours = work_days * 2 * overtime_workers
work_hours = work_days * 8 * overtime_workers
total_hours = math.floor(work_hours + overtime_hours)

if project_hours <= total_hours:
print('Yes!{0} hours left.' . format(
total_hours - project_hours))
else:
print('Not enough time!{0} hours needed.' . format(
project_hours - total_hours))