-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconditionalstatement.py
More file actions
53 lines (39 loc) · 932 Bytes
/
Copy pathconditionalstatement.py
File metadata and controls
53 lines (39 loc) · 932 Bytes
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
temperature = 32
if temperature < 25:
print("It is cold")
elif temperature > 25:
print("It is hot")
else:
print("Normal Temperature")
# A PROGRAM THAT RETURNS THE LARGEST NUMBER AMONG THREE NUMBERS
first = 56
second = 23
third = 78
if first > second and first > third:
print(first, "the largest number")
elif second > first and second > third:
print(second, "the largest number")
else:
print(third, "the largest number")
# A Python Program to determine whether a number is even or odd
num = 0
if num == 0:
print(num, "is neutral")
elif num % 2 == 0:
print(num, "is even")
else:
print(num, "is odd")
# A Python Program that returns the area of a rectangle
# A=L * W
length = 20
width = 5
area = length * width
print(area)
print("The area is ", area)
# A Python Program that returns the area of a trapezium
a = 30
b = 20
h = 5
area = (a+b*h)/2
print(area)
print("The area is ", area)