Python Programs and Their Outcomes
1. Program to input a year and find if it is a leap year or not
Expected Outcome:
Input: 2024
Output: 2024 is a leap year.
2. WAP to input sides of a triangle and calculate its area using Heron's formula
Expected Outcome:
Input: a = 3, b = 4, c = 5
Output: Area of the triangle = 6.0
3. Write a program to input a number and determine whether it is a prime
number or not
Expected Outcome:
Input: 7
Output: 7 is a prime number.
4. Write a program to input the principal, rate, and time to calculate simple
interest
Expected Outcome:
Input: Principal = 1000, Rate = 5%, Time = 2 years
Output: Simple Interest = 100.0
5. Write a program to input a number and check whether it is even or odd
Expected Outcome:
Input: 4
Output: 4 is an even number.
6. Write a program to convert a temperature from Celsius to Fahrenheit
Expected Outcome:
Input: Celsius = 0
Output: Fahrenheit = 32.0
7. WAP to print all even numbers from 1 to 100
Expected Outcome:
Output: 2, 4, 6, ..., 100
8. Write a program to input a number and check whether it is positive,
negative, or zero
Expected Outcome:
Input: -5
Output: The number is negative.
9. Write a program to input two numbers and swap their values
Expected Outcome:
Input: a = 3, b = 4
Output: a = 4, b = 3
10. Write a program to input a number and display its square
Expected Outcome:
Input: 5
Output: Square of 5 = 25