1) Find the largest of three numbers:
a=input('enter the first number: ')
b=input('enter the second number: ')
c=input('enter the third number: ')
if(a>b and a>c):
print('a is the largest')
if(b>c and b>a):
print('b is the largest')
if(c>b and c>a):
print('c is the largest')
2)Calculate the sum of numbers from 1 to 100:
sum = 0
i=1
while i <= 100:
sum += i
i += 1
print(sum)
3) Print if number is positive, negative or zero
num = 0
if num > 0:
print("Positive number")
elif num == 0:
print("Zero")
else:
print("Negative number")
4)Find the sum and avg of numbers entered by user
n = int(input("How many numbers? : "))
sum = 0
for i in range(0, n):
num = float(input("Enter number: "))
sum += num
avg = sum/n
print("Average =", avg)
5)Grade a student based on marks:
marks =int(input(“enter marks”))
if(marks > 90):
print("Excellent")
elif(marks > 70):
print("Very Good")
elif(marks >= 50):
print("Good")
else:
print("Fail")