The document contains multiple Python programs that perform various tasks: calculating total marks and percentage for five subjects, converting currency between rupees and dollars, checking if a number is even or odd, determining if a number is prime, and calculating student grades based on marks. Each program includes user input and appropriate conditional statements to execute the required functionality. The code snippets are straightforward and demonstrate basic programming concepts.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
15 views6 pages
Project
The document contains multiple Python programs that perform various tasks: calculating total marks and percentage for five subjects, converting currency between rupees and dollars, checking if a number is even or odd, determining if a number is prime, and calculating student grades based on marks. Each program includes user input and appropriate conditional statements to execute the required functionality. The code snippets are straightforward and demonstrate basic programming concepts.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6
Question
1. Program to calculate the total marks and percent of five subjects
Code subject1 = float(input("Enter marks for Subject 1: ")) subject2 = float(input("Enter marks for Subject 2: ")) subject3 = float(input("Enter marks for Subject 3: ")) subject4 = float(input("Enter marks for Subject 4: ")) subject5 = float(input("Enter marks for Subject 5: ")) total = subject1 + subject2 + subject3 + subject4 + subject5 percentage = (total / 500) * 100 print("Total Marks:",total) print("Percentage:",percentage,"%") Question 2. Program to convert the currency from Rs. To dollar or vice versa. CODE conversion_rate = 80.0 choice = input("Enter 1 to convert Rs to Dollar, or 2 to convert Dollar to Rs: ") if choice == '1': rupees = float(input("Enter amount in Rs: ")) dollars = rupees / conversion_rate print("Amount in Dollars: $", round(dollars, 2)) elif choice == '2': dollars = float(input("Enter amount in Dollars: ")) rupees = dollars * conversion_rate print("Amount in Rupees: ₹", round(rupees, 2)) else: print("Invalid choice") Question 3. Program to check if entered number is even or odd. CODE number = int(input("Enter a number: ")) is_even = number % 2 == 0 if is_even: print("number is even") else: print("number is odd") Question 4. Program to check if the entered number is prime or not. CODE number = int(input("Enter a number: ")) if number < 2: print("number is not a prime number.") else: for i in range(2, number): if number % i == 0: print("number is not a prime number.") break else: print("number is a prime number.") Question 5.Program to calculate the grade of students : Marks > = 90 A1 >=80 A2 >=70 B1 >=60 B2 >=50 C1 >=40 C2 >=33 D <33 E CODE marks = float(input("Enter your marks: ")) if marks >= 90: print("Your grade is: A1") elif marks >= 80: print("Your grade is: A2") elif marks >= 70: print("Your grade is: B1") elif marks >= 60: print("Your grade is: B2") elif marks >= 50: print("Your grade is: C1") elif marks >= 40: print("Your grade is: C2") elif marks >= 33: print("Your grade is: D") else: print("Your grade is: E")