Python Programme For Class IX Practical
Python Programme For Class IX Practical
Python Programme For Class IX Practical
Ans.
num1 = 1.5
num2 = 6.3
Ans.
Ans.
a=5
b=6
c=7
s = (a + b + c) / 2
Ans.
x=5
y = 10
temp = x
x=y
y = temp
Ans.
num = 8
Ans.
celsius = 37.5
# calculate fahrenheit
Q7. Python Program to find the largest number among the two input
numbers
Ans.
# Python program to find the largest number among the three input
numbers
num1 = 10
num2 = 14
else:
Q8. Python Program to find the largest number among the three input
numbers
Ans.
num1 = 10
num2 = 14
num3 = 12
largest = num1
largest = num2
else:
largest = num3
Ans.
if num > 0:
print("Positive number")
elif num == 0:
print("Zero")
else:
print("Negative number")
Ans.
# Python program to check if the input number is odd or even.
if (num % 2) == 0:
else:
Ans.
i=1
n=5
while i <= n:
print(i)
i=i+1
Q12. Python Program to calculate the sum of numbers until the user
enters zero
Ans.
total = 0
while number != 0:
Ans.
values = range(4)
# iterate from i = 0 to i = 3
for i in values:
print(i)
Ans.
digits = [0, 1, 5]
for i in digits:
print(i)
else:
Ans.
num = 29
flag = False
if num == 1:
print(num, "is not a prime number")
if (num % i) == 0:
flag = True
break
if flag:
else:
Ans.
factorial = 1
if num < 0:
elif num == 0:
else:
factorial = factorial*i
Ans.
print(languages[0]) # Python
Ans.
print(languages[-1]) # C++
print(languages[-3]) # Python
Ans.
for i in range(len(thislist)):
print(thislist[i])
Ans.
#Using While loop
i=0
print(thislist[i])
i=i+1