null
null
0.0.1 Write a program to calculate the hypotenuse of right angled triangle given the
lengths of its two sides. Use good programming practices in solving the problem
h = m.pow(length_1,2) + m.pow(length_2,2)
hypotenus = m.sqrt(h)
print("The hypotenus of a right angled triangle: ", hypotenus)
(ii) a triange
(iii) a circle
1
Enter the lenght of the square: 4
Area of square is: 16.0
area = (1/2)*(base*height)
print("Area of a triangle is: ", area)
[5]: # C = (32F-32)*5/9
[7]: ## This code is calculating the scale in celsius if you are ask to write the␣
,→code to convert degree celsius to
## fahrenheit
celsius = int(input("Enter the value for celsius: "))
2
print("Hello, ", name,",", " the time of the day is ", time,",", " you are␣
,→highly welcome to CSC201 class")
print("Hello i'm ", name, "with Reg number ", Reg_no,",", " am a student of ",␣
,→department, " with CGPA ", cgpa)
0.2 write a program that can ouput the even number between 1 to 40
[13]: ## using for loop
for i in range(2,40,2):
print(i)
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
3
[14]: ## with while loop
i = 2
while i<40:
print(i)
i = i+2
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
0.3 write a function that can print addition of the following numbers
0.4 (a) two numbers
0.5 (b) three numbers
0.6 (c) four numbers
[21]: def sum_of_two_num(a,b):
total = a+b
print(total)
sum_of_two_num(4,5)
17
4
[23]: def sum_of_four_num(a,b,c,d):
total = a+b+c+d
print(total)
sum_of_four_num(4,5,8,7)
24
0.7 Write a program to check the multiple of two and three between 1 to 50
using Aba and yomi and if none output Abayomi. The multiple of 2 will
output Aba and the multiple of 3 will output yomi
[24]: for i in range(1,50,1):
if i%2==0:
print("Aba")
elif i%3==0:
print("yomi")
else:
print("Abayomi")
Abayomi
Aba
yomi
Aba
Abayomi
Aba
Abayomi
Aba
yomi
Aba
Abayomi
Aba
Abayomi
Aba
yomi
Aba
Abayomi
Aba
Abayomi
Aba
yomi
Aba
Abayomi
Aba
Abayomi
Aba
yomi
Aba
Abayomi
5
Aba
Abayomi
Aba
yomi
Aba
Abayomi
Aba
Abayomi
Aba
yomi
Aba
Abayomi
Aba
Abayomi
Aba
yomi
Aba
Abayomi
Aba
Abayomi
[ ]: