python project pdf
python project pdf
PROJECT
Disclaimer:
Question 1
Code:
Output:
Enter the first Integer : 5
Enter the second integer : 5
The two integers are: 5, 5
The sum of two integers are: 10
Question 2
Code:
Output:
Question 3
Code:
Output:
Enter the base of triangle: 30
Enter the height of triangle: 20
Area triangle is: 300
Question 4
Code:
num = 4
square = num ** 2
print(square)
Output:
16
Question 5
Code:
celsius = 25
fahrenheit = (celsius * 9/5) + 32
print(fahrenheit)
Output:
77.0
Question 6
Code:
a, b, c = 5, 10, 8
largest = max(a, b, c)
print(largest)
Output:
10
Question 7
Code:
Output:
Code:
Output:
Enter The principal amount: 200000
Enter the rate of Interest: 2
Enter the time in years: 4
The simple interest is: 16000
Question 9
Code:
num = 5
factorial = 1
for i in range(1, num + 1):
factorial *= i
print(factorial)
Output:
120
Question 10
Code:
num = 7
is_prime = True
for i in range(2, num):
if num % i == 0:
is_prime = False
break
if is_prime:
print('Prime')
else:
print('Not Prime')
Output:
Prime
Question 11
Code:
Question 12
Code:
Output:
Code:
s = 'Python'
print(len(s))
Output:
Question 14
Code:
Output:
Code:
s = input(“Enter a word: ”)
vowels = 'aeiou'
count = 0
for char in s:
if char in vowels:
count += 1
print(“Vowels in the word”,S, “are”, count)
Output:
Code:
output:
Code:
Output:
Question 18
Code:
import math
gcd = math.gcd(12, 8)
print(gcd)
Output:
4
Question 19
Code:
totalTrans, totalsales = 0, 0
count = 1
while count<= 7:
Totaltrans += trans
Totalsales += items
Count += 1
Avgsales = totalsales/totaltrans
Output:
Question 20
Code:
year = 2020
if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
print('Leap Year')
else:
print('Not a Leap Year')
Output:
Leap Year
Question 21
Code:
2, 12 ,10
Question 22
Code:
a, b = 5, 10
a, b = b, a
print(a, b)
Output:
10, 5
Question 23
Code:
import math
radius = 7
area = math.pi * radius ** 2
print(area)
Output:
153.93804002589985
Question 24
Code:
numbers = [1, 2, 3, 4, 5]
print(sum(numbers))
Output:
15
Question 25
Code:
numbers = [1, 2, 3, 4, 5]
average = sum(numbers) / len(numbers)
print(average)
Output:
3.0
Question 26
Code:
numbers = [1, 2, 3, 4, 5]
print(max(numbers))
Output:
5
Question 27
Code:
numbers = [1, 2, 3, 4, 5]
print(min(numbers))
Output:
Question 28
Code:
numbers = [1, 2, 3, 4, 5, 3, 3]
print(numbers.count(3))
Output:
Question 29
Code:
numbers = [1, 2, 3, 4, 5, 3, 3]
unique_numbers = list(set(numbers))
print(unique_numbers)
Output:
[1, 2, 3, 4, 5]
Question 30
Code:
numbers = [5, 2, 9, 1, 5, 6]
numbers.sort()
print(numbers)
Output:
[1, 2, 5, 5, 6, 9]