01.
Sonargaon University Grading System (0-100 marks)
marks = float(input("Enter marks (0-100): "))
if 0 <= marks <= 100:
if marks >= 80:
grade = "A+"
elif marks >= 75:
grade = "A"
elif marks >= 70:
grade = "A-"
elif marks >= 65:
grade = "B+"
elif marks >= 60:
grade = "B"
elif marks >= 55:
grade = "B-"
elif marks >= 50:
grade = "C+"
elif marks >= 45:
grade = "C"
elif marks >= 40:
grade = "D"
else:
grade = "F"
print(f"Marks: {marks}, Grade: {grade}")
else:
print("Invalid input! Please enter marks between 0 and 100.")
02. Fibonacci series using while loop
i=1
a=0
b=1
sum = 1
n = int(input("Enter the range "))
while i<=n:
print(sum, end=" ")
sum = a + b
a=b
b = sum
i = i+1
03. Python program to check if a number is prime or composite
num = int(input("Enter a number: "))
if num > 1:
for i in range(2, num):
if num % i == 0:
print("composite number")
break
else:
print("prime number")
else:
(print("neither composite number or prime"))
[Link] find if a year is leap year or not
Y = int(input("Enter the year: "))
if Y % 4 == 0 and Y % 100 != 0:
print(f"Year {Y} is a leap year")
else:
if Y % 400 == 0:
print(f"Year {Y} is a leap year")
else:
print(f"Year {Y} is not a leap year")
[Link] find number of odd and even number list
#Odd number identify
n = int(input("Enter the range: "))
for i in range(1,n+1,2):
print(i, end=",")
#even number identify
n = int(input("Enter the range: "))
for i in range(2,n+1,2):
print(i, end=",")
[Link] find the number of vowels and consonants in a word using function.
word = input("Enter the range: ")
vowel = "aeioUAEIOU"
vowel_count = 0
consonant_count = 0
for i in word:
if [Link]():
if i in vowel:
vowel_count += 1
else:
consonant_count += 1
print(f'word = {word} \nvowel ={vowel_count} \n consonant = {consonant_count}')