aboutsummaryrefslogtreecommitdiff
path: root/Python/Beginner training/003 Hotel.py
blob: 0e2ed2aed8724990e7c9955254d2a171ced37c3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sys
import os
import math

n_nights = int(input('Type number of nights: '))
room_type = input('Type the type of room: ')

price = 0.0
if room_type == 'apartment':
    price = n_nights * 70
else:
    price = n_nights * 125

#code doesn't account for writing mistakes
if n_nights < 10:
    if room_type == 'apartment':
        price *= 0.7
    else:
        price *= 0.9
elif n_nights > 15:
    if room_type == 'apartment':
        price *= 0.5
    else:
        price *= 0.8
else:
    if room_type == 'apartment':
        price *= 0.65
    else:
        price *= 0.85

print('Total price: {}'.format(round(price, 2)))