Project
Project
ankita daS
roll no-36
geography department
SubjeCt : python programming : lab aSSignment
date:
INDEX
2
Assignment -1
Problem Statement: Write a program in Python to check whether a
given character is vowel or consonant.
Flowchart:
Code:
char = input("Enter a character: ")
if char in 'aeiouAEIOU':
print(char, "is a vowel.")
else:
print(char, "is a consonant.")
Output:
3
Assignment -2
Problem Statement: Write a Program in Python to swap two numbers.
Flowchart:
Code:
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Before swapping: a =", a, "b =", b)
a, b = b, a
print("After swapping: a =", a, "b =", b)
Output:
4
Assignment -3
Problem Statement: Write a Python program to find smallest number
among three.
Flowchart
Code
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
if a <= b and a <= c:
smallest = a
elif b <= a and b <= c:
smallest = b
else:
smallest = c
print("The smallest number is", smallest)
Output
5
Assignment -4
Problem Statement: Write a program to find whether a person having
fever or not.
Flowchart
Code
temperature = float(input("Enter your body temperature in Celsius: "))
if temperature >= 38.0:
print("You have a fever.")
else:
print("You do not have a fever.")
Output
6
Assignment -5
Problem Statement: Write a Program in Python to convert Fahrenheit
into Celsius
Flowchart
Code
fahrenheit = float(input("Enter the temperature in Fahrenheit: "))
celsius = (fahrenheit - 32) * 5 / 9
print(f"{fahrenheit} Fahrenheit is equal to {celsius:.2f} Celsius")
Output
7
Assignment -6
Problem Statement: Write a Python program to check if a number is
Even or Odd.
Flowchart
Code
number = int(input("Enter a number: "))
if number % 2 == 0:
print(number, "is even.")
else:
print(number, "is odd.")
Output
8
Assignment -7
Problem Statement: Write a program in Python to find your grade according
to the following condition
a. Above 90 - grade Outstanding
b. Above 80- grade A
c. Above 70 - grade B
d. Above 60 -- grade C
e. Otherwise Fail.
Flowchart
Code
score = int(input("Enter your score: "))
if score > 90:
grade = "Outstanding"
elif score > 80:
grade = "A"
elif score > 70:
grade = "B"
elif score > 60:
grade = "C"
else:
grade = "Fail"
print("Your grade is:", grade)
Output
9
Assignment -8
Problem Statement: Write a Python program to print the Summation
of the following series:
2+4+6+8+10+12+14
Flowchart
Code
n = int(input("Enter the value of n: "))
total_sum = 0
for i in range(2, n + 1, 2):
total_sum += i
print(f"The sum of the series is: {total_sum}")
Output
10