R23 Python Lab - Unit-1
R23 Python Lab - Unit-1
# The following code finds the Largest of Three Unique Numbers using if-elif-
else
# Condition checking
else:
Output
To print all the prime numbers between the given interval, the user has to follow the
following steps:
if number > 1:
if (number % i) == 0:
break
else:
print (number)
Output:
Please, Enter the Lowest Range Value: 14
Please, Enter the Upper Range Value: 97
The Prime Numbers in the range are:
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
x = 5.4
y = 10.3
# Swap code
x = x + y # x = 15.7, y = 10.3
y = x - y # x = 15.7, y = 5.4
x = x - y # x = 10.3, y = 5.4
print ("After swapping: ")
Output:
Before swapping:
Value of x : 5.4 and y : 10.3
After swapping:
Value of x : 10.3 and y : 5.4
Sample Output:
for a in range(1,11):
print(num,'x',a,'=',num*a)
Output
Multiplication Table of :
7x1=7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70