0% found this document useful (0 votes)
6 views

Python_Programs_and_Outcomes

The document outlines ten Python programs along with their expected outcomes. Each program addresses a specific task, such as determining leap years, calculating the area of a triangle, checking for prime numbers, and converting temperatures. The expected outcomes provide examples of inputs and the corresponding outputs for each program.
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
6 views

Python_Programs_and_Outcomes

The document outlines ten Python programs along with their expected outcomes. Each program addresses a specific task, such as determining leap years, calculating the area of a triangle, checking for prime numbers, and converting temperatures. The expected outcomes provide examples of inputs and the corresponding outputs for each program.
Copyright
© © All Rights Reserved
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/ 2

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

You might also like