-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathif else complex que
More file actions
26 lines (21 loc) · 1.03 KB
/
if else complex que
File metadata and controls
26 lines (21 loc) · 1.03 KB
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
'''Given the weekly rental cost of a book X, the number of days you want to rent the book D, and your status as a staff member S (where S="true" if you are a staff member, otherwise S="false"), calculate the total rental cost based on the following rules:
1. The cost to rent the book for up to 7 days is X.
2. If D exceeds 7 days and you are not staff member, an additional charge of 2 Rs per extra day is applied.
3. If you are staff member, no extra charges apply for exceeding 7 days.
4. The full weekly cost X is charged even if you rent the book for less than 7 days.
Write a program to determine the total cost of renting the book.'''
'''Input
The input consists of three lines:
X: An integer representing the weekly rental cost of a book.
D: An integer representing the number of days the book was rented.
S: A string(either "true" or "false") indicating whether the person is a staff member'''
X = int(input())
D = int(input())
S = input()
if D<=7:
print(X)
elif D>7:
if S=="true":
print(X)
else:
print(X+(2*(D-7)))