Gobind Sir File
Gobind Sir File
max_marks = 500
print(f"Percentage: {percentage:.2f}%")
Output:
2. Program to convert the currency from Rs. To dollar or vice versa.
print("Currency Converter")
print("1. Convert INR to USD")
print("2. Convert USD to INR")
if choice == 1:
inr_amount = float(input("Enter amount in INR: "))
usd_amount = inr_amount / conversion_rate
print(f"{inr_amount} INR is equal to {usd_amount:.2f} USD.")
elif choice == 2:
usd_amount = float(input("Enter amount in USD: "))
inr_amount = usd_amount * conversion_rate
print(f"{usd_amount} USD is equal to {inr_amount:.2f} INR.")
else:
print("Invalid choice. Please enter 1 or 2.")
Output:
if number % 2 == 0:
print(number, "is an even number.")
else:
print(number, "is an odd number.")
Output
1) 1
12
123
1234
Sol:
n=4
print()
Output
5) Write a python program to print the Fibonacci series till nth term entered by the user.
Sol:
n = int(input("Enter the number of terms: "))
a, b = 0, 1
for _ in range(n):
Output:
Sol:
if number % i == 0:
break
else:
output:
7. Write a program to calculate the grade of the student on the basis of following criteria:
Marks Grades
> = 90 A1
>=80 A2
>=70 B1
>=60 B2
>=50 C1
>=40 C2
>=33 D
<=33 E
Ans:
marks = float(input("Enter the marks obtained by the student: "))
if marks >= 90:
grade = 'A1'
elif marks >= 80:
grade = 'A2'
elif marks >= 70:
grade = 'B1'
elif marks >= 60:
grade = 'B2'
elif marks >= 50:
grade = 'C1'
elif marks >= 40:
grade = 'C2'
elif marks >= 33:
grade = 'D'
else:
grade = 'E'
print(f"The grade for marks {marks} is: {grade}")
Output:
8) Create a list of following elements :
Soln: