Question 01: Write a Python program to accept two integers and print their sum. Answer: num1 = int(input("Enter first integer: ")) num2 = int(input("Enter second integer: ")) print(f"{num1} + {num2} = {num1 + num2}")Code execution timed out Question 02: Write a Python program that accepts the radius of a circle and prints its area. Answer: radius = float(input("Enter the radius of the circle: ")) print(f"Area: {3.14 * radius * radius}") Question 03: Write a Python program to accept the length and width of a rectangle and compute its perimeter and area. Answer: length = float(input("Enter the length of the rectangle: ")) width = float(input("Enter the width of the rectangle: ")) perimeter = 2 * (length + width) area = length * width print(f"Perimeter: {perimeter}") print(f"Area: {area}")Code execution timed out Question 04: Write a Python program to compute simple interest for a given principal amount, time, and rate of interest. Answer: amount = float(input("Enter the principal amount: ")) time = float(input("Enter the time in years: ")) rate = float(input("Enter the rate of interest: ")) simple_interest = (amount * time * rate) / 100 print(f"Simple Interest: {simple_interest}") Question 05: Write a Python program to find whether a given number is even or odd. Answer: num = int(input("Enter an integer: ")) if num % 2 == 0: print(f"{num} is even") else: print(f"{num} is odd") Question 06: Write a Python program to find the largest among three numbers. Answer: num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) num3 = float(input("Enter third number: ")) if num1 >= num2 and num1 >= num3: largest = num1 elif num2 >= num1 and num2 >= num3: largest = num2 else: largest = num3 print(f"The largest number is: {largest}") Question 07: Write a Python program to perform arithmetic calculation. The program should accept two operands and an operator, then display the result. Answer: num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) operator = input("Enter operator (+, -, *, /): ") if operator == '+': result = num1 + num2 elif operator == '-': result = num1 - num2 elif operator == '*': result = num1 * num2 elif operator == '/': if num2 != 0: result = num1 / num2 else: result = "Error: Division by zero" else: result = "Error: Invalid operator" print(f"Result: {result}") Question 08: Write a Python program to check whether a given year is a leap year or not. Answer: year = int(input("Enter a year: ")) if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0): print(f"{year} is a leap year") else: print(f"{year} is not a leap year") Question 09: Write a Python program to check if a number is positive, negative, or zero. Answer: num = float(input("Enter a number: ")) if num > 0: print(f"{num} is positive") elif num < 0: print(f"{num} is negative") else: print(f"{num} is zero") Question 11: Write a Python program to accept marks of a student and print the grade according to the given criteria: Answer: num = float(input("Enter a number: ")) if num > 0: print(f"{num} is positive") elif num < 0: print(f"{num} is negative") else: print(f"{num} is zero") Question 11: Write a Python program to check whether a given character is a vowel or consonant. Answer: char = input("Enter a character: ").lower() if char.isalpha() and len(char) == 1: if char in 'aeiou': print(f"{char} is a vowel") else: print(f"{char} is a consonant") else: print("Please enter a valid single alphabet character.") Question 12: Write a Python program to check whether a number is divisible by both 5 and 11. Answer: num = int(input("Enter an integer: ")) if num % 5 == 0 and num % 11 == 0: print(f"{num} is divisible by both 5 and 11") else: print(f"{num} is not divisible by both 5 and 11") Question 13: Write a Python program to find the absolute value of a number. Answer: num = float(input("Enter a number: ")) print(f"The absolute value of {num} is: {abs(num)}") Question 14: Write a Python program to check if a character is an uppercase or lowercase letter. Answer: char = input("Enter a character: ") if char.isalpha() and len(char) == 1: if char.isupper(): print(f"{char} is an uppercase letter") else: print(f"{char} is a lowercase letter") else: print("Please enter a valid single alphabet character.") Question 15: Write a Python program to accept age and check whether the person is eligible to vote (18 or older). Answer: age = int(input("Enter your age: ")) if age >= 18: print("You are eligible to vote.") else: print("You are not eligible to vote.") Question 16: Write a Python program to accept three sides and check whether they form a valid triangle. Answer: side1 = float(input("Enter the length of the first side: ")) side2 = float(input("Enter the length of the second side: ")) side3 = float(input("Enter the length of the third side: ")) if (side1 + side2 > side3) and (side1 + side3 > side2) and (side2 + side3 > side1): print("The sides form a valid triangle.") else: print("The sides do not form a valid triangle.") Question 17: Write a Python program to accept cost price and selling price, then print whether there is profit, loss, or no gain. Answer: cost_price = float(input("Enter the cost price: ")) selling_price = float(input("Enter the selling price: ")) if selling_price > cost_price: profit = selling_price - cost_price print(f"There is a profit of: {profit}") elif selling_price < cost_price: loss = cost_price - selling_price print(f"There is a loss of: {loss}")