Python Project Rahul Agata
Python Project Rahul Agata
This is to certify that Mr. Rahul Agata, Roll No: 638, Registration No: 7373838393, a student of BCA
3rd Semester, Silda Chandrasekhar College under Vidyasagar University, has successfully
completed the Python programming mini project as part of the curriculum during the academic
session.
The project contains basic to intermediate level Python programs developed and executed by the
student.
Acknowledgement
I would like to express my heartfelt gratitude to our faculty and the entire department of Computer
Special thanks to our respected teacher for giving me the opportunity to work on this Python project
3. Simple Calculator
9. Temperature Converter
Aim:
Code:
items = []
while True:
name = input("Enter item name (or 'done' to finish): ")
if name.lower() == 'done':
break
price = float(input("Enter item price: "))
qty = int(input("Enter quantity: "))
items.append((name, price, qty))
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 2: Student Marksheet Generator
Aim:
Code:
name = input("Enter student name: ")
marks = []
for i in range(5):
mark = float(input(f"Enter marks for subject {i+1}: "))
marks.append(mark)
total = sum(marks)
average = total / 5
print("Total:", total)
print("Average:", average)
print("Grade:", "A" if average >= 80 else "B" if average >= 60 else "C")
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 3: Simple Calculator
Aim:
Code:
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
op = input("Enter operation (+, -, *, /): ")
if op == '+':
print("Result:", a + b)
elif op == '-':
print("Result:", a - b)
elif op == '*':
print("Result:", a * b)
elif op == '/':
print("Result:", a / b if b != 0 else "Cannot divide by zero")
else:
print("Invalid operator")
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 4: Simple Interest Calculator
Aim:
Code:
p = float(input("Enter principal amount: "))
r = float(input("Enter rate of interest: "))
t = float(input("Enter time in years: "))
si = (p * r * t) / 100
print("Simple Interest:", si)
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 5: Armstrong Number Checker
Aim:
Code:
num = int(input("Enter a number: "))
power = len(str(num))
total = sum(int(digit)**power for digit in str(num))
print("Armstrong Number" if total == num else "Not an Armstrong Number")
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 6: Palindrome String Checker
Aim:
Code:
s = input("Enter a string: ")
if s == s[::-1]:
print("Palindrome")
else:
print("Not a Palindrome")
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 7: Factorial Using Loop
Aim:
Code:
n = int(input("Enter a number: "))
fact = 1
for i in range(1, n+1):
fact *= i
print("Factorial:", fact)
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 8: Fibonacci Series Generator
Aim:
Code:
n = int(input("Enter number of terms: "))
a, b = 0, 1
print("Fibonacci Series:")
for _ in range(n):
print(a, end=" ")
a, b = b, a + b
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 9: Temperature Converter
Aim:
Code:
temp = float(input("Enter temperature: "))
scale = input("Convert to (C/F): ").upper()
if scale == "F":
print("In Fahrenheit:", (temp * 9/5) + 32)
elif scale == "C":
print("In Celsius:", (temp - 32) * 5/9)
else:
print("Invalid scale")
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 10: Prime Number Checker
Aim:
Code:
num = int(input("Enter a number: "))
if num < 2:
print("Not Prime")
else:
for i in range(2, int(num**0.5)+1):
if num % i == 0:
print("Not Prime")
break
else:
print("Prime")
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 11: Number Guessing Game
Aim:
Code:
import random
num = random.randint(1, 10)
guess = int(input("Guess a number (1-10): "))
if guess == num:
print("Correct!")
else:
print(f"Wrong! The number was {num}")
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 12: Vowel and Consonant Counter
Aim:
Code:
s = input("Enter a string: ").lower()
vowels = 'aeiou'
v = c = 0
for ch in s:
if ch.isalpha():
if ch in vowels:
v += 1
else:
c += 1
print("Vowels:", v, "Consonants:", c)
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 13: Area of Circle and Rectangle
Aim:
Code:
shape = input("Enter shape (circle/rectangle): ").lower()
if shape == "circle":
r = float(input("Enter radius: "))
print("Area of Circle:", 3.1416 * r * r)
elif shape == "rectangle":
l = float(input("Enter length: "))
b = float(input("Enter breadth: "))
print("Area of Rectangle:", l * b)
else:
print("Unknown shape")
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 14: File Handling - Write & Read
Aim:
Code:
with open("testfile.txt", "w") as f:
f.write("Hello, this is a test file.")
with open("testfile.txt", "r") as f:
print("File Content:", f.read())
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Program 15: Login System
Aim:
Code:
username = input("Enter username: ")
password = input("Enter password: ")
if username == "admin" and password == "1234":
print("Login successful")
else:
print("Invalid credentials")
Sample Output:
Output will depend on user input. Run the program in a Python IDE.
Conclusion
This Python project has helped me learn fundamental and intermediate level programming concepts
By completing these programs, I feel more confident in implementing real-world logic using Python.