-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecsn Contrl.txt
75 lines (67 loc) · 3.3 KB
/
decsn Contrl.txt
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Q.1- Take an input year from user and decide whether it is a leap year or not.--
a=int(input("Enter year in XXXX format"))
if(a%4==0):
print("leap")
else:
print("not leap")
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Q.2- Take length and breadth input from user and check whether the dimensions are of square or rectangle.
l=int(input("enter length"))
b=int(input("enter breadth"))
if(l==b):
print("square")
else:
print("rectangle")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Q.3- Take the input age of 3 people and determine oldest and youngest among them.
a=int(input("enter age"))
b=int(input("enter age"))
c=int(input("enter age"))
if(a>b and a>c):
print("a is oldest")
if(b>c):
print("c is youngest")
else:
print(" b is youngest")
elif(b>c and b>a):
print("b is oldest")
if(a>c):
print("a is youngest")
else:
print(" c is youngest")
else:
print("c is oldest")
if(a>b):
print("b is youngest")
else:
print(" a is youngest")
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Q.4- Write an if statement that lets a competitor know which of these prizes they won based on the number of points they scored, which is stored in the integer variable points(your input). points can only take on positive integer values up to 200.
If they've won a prize, the message should state "Congratulations! You won a [prize name]!" with the prize name. If there's no prize, the message should state "Sorry! No prize this time."
Points Prize
1-50 No Prize
51-150 Wooden Dog
151-180 Book
181-200 Chocolates
point=int(input("Enter points u scored"))
if(point>=1 and point<=50):
print("no prize")
elif(point>50 and point<=150):
print("Congratulations! You won a wooden dog")
elif(point>150 and point<=180):
print("Congratulations! You won a book")
elif(point>180 and point<=200):
print("Congratulations! You won chocolates")
else:
print("wrong input!!! point should be les than 200")
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
**Q.5- A shop will give discount of 10% if the cost of purchased quantity is more than 1000.Ask user for quantity Suppose, one unit will cost 100. Judge and print total cost for user.
qua=int(input("Enter quantity:"))
if(qua>1000):
print("you will get 10% discount")
cost=qua*100
cost=cost-cost*0.1
print("you have to pay %f"%(cost))
else:
cost=qua*100
print("cost %d"%(cost))