-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassignment2.2.py
56 lines (39 loc) · 1.44 KB
/
assignment2.2.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*- coding: utf-8 -*-
"""
Created on Wed May 29 00:30:23 2019
@author: Shri
"""
#PF-Assgn-16
def make_amount(rupees_to_make,no_of_five,no_of_one):
five_needed=0
one_needed=0
sum=0
diff=0
for i in range(no_of_five):
diff=rupees_to_make-sum
if(sum <= rupees_to_make and diff>=5):
sum=sum+5
five_needed+=1
else:
break
# if(sum < rupees_to_make):
for i in range(no_of_one):
diff = rupees_to_make-sum
if(sum < rupees_to_make and diff>=0 ):
sum+=1
one_needed+=1
else:
break
if(sum == rupees_to_make):
#return five_needed,one_needed
print("No. of Five needed :", five_needed)
print("No. of One needed :", one_needed)
if(no_of_five >= five_needed and no_of_one == one_needed and sum < rupees_to_make):
print(-1)
#Start writing your code here
#Populate the variables: five_needed and one_needed
# Use the below given print statements to display the output
# Also, do not modify them for verification to work
#(no_of_five == five_needed and no_of_one == one_needed and sum < rupees_to_make)
#Provide different values for rupees_to_make,no_of_five,no_of_one and test your program
make_amount(93,19,2)