-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment3.py
More file actions
66 lines (57 loc) · 1.75 KB
/
Copy pathAssignment3.py
File metadata and controls
66 lines (57 loc) · 1.75 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
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
# QUESTION: 1
x = float(input("x: "))
y = float(input("y: "))
z = float(input("z: "))
if(x == y == z):
print("Your triangle is Equilateral.")
elif(x == y or y == z or x == z):
print("Your triangle is Isoscles.")
elif(x**2 + y**2 == z**2 or y**2 + z**2 == x**2 or x**2 + z**2 == y**2):
print("Your triangle is Right Angled.")
else:
print("Your triangle is Scalene.")
# QUESTION: 2
p = float(input("Principal Amt: "))
r = float(input("Rate: "))
t = float(input("Time: "))
print("Your Simple Interest for the Provided Data = ", ((p*r*t)/1000))
# QUESTION: 3
year = int(input("Enter Year: "))
if(year % 4 == 0):
if(year % 100 == 0):
if(year % 400 == 0):
print("It's a leap year!!!")
else:
print("It's not a leap year!!!")
else:
print("It's a leap year!!!")
else:
print("It's not a leap year!!!")
# QUESTION: 4
print("Type 1 for Addition")
print("Type 2 for Substraction")
print("Type 3 for Multiplication")
print("Type 4 for Division")
print("Type 5 for Modulus")
print("Type 6 to exit.")
while True:
c = int(input("Enter your choice: "))
if(c == 6):
y = input("Want to break the loop?\n")
if(y == "Yes"):
a, b = None, None
break
else:
continue
a = float(input("Enter one number = "))
b = float(input("Enter another number = "))
if(c == 1):
print('Addition of a and b = ', a + b)
elif(c == 2):
print('Substraction of a and b = ', a - b)
elif(c == 3):
print('Multiplication of a and b = ', a * b)
elif(c == 4):
print('Division of a and b = ', a / b)
elif(c == 5):
print('Modulus of a and b = ', a % b)