Python projects
My Python projects
Project 1:
Write a coad to add two numbers
# 1. addition of two numbers--
print("Addition of two numbers")
print("Enter first number")
a = int(input())
print("Enter second number")
b = int(input())
print("the sum the numbers is--")
print(a+b)
# addition of two numbers--
Result for the above code
E:\languages\python codeing>python main1.py
Addition of two numbers
Enter first number
5
Enter second number
56
the sum the numbers is--
61
Project 2:
Create a diictonary and take input from user and return the meaning
print("Dictionary")
print("Enter the word to find in the Dictionary")
d1 = {"WAN":"Wide area network" , "LAN":"Local area network" , "SAN":"Storage area network" ,
"CAN":"Campus area network" , "MAN":"Metropolotic area network" "VPN":"Virtual pravite network"}
w1 = (input())
if(input = str("WAN")):
print(d1["WAN"])
Result for the above code
E:\languages\python codeing>python main1.py
Dictionary
Enter the word to find in the Dictionary
LAN
Local area network
Project 3:
Eligibility to drive a car
# Eligiblity to drive a vehical
_name = input("Enter your name:")
age = input("enter your age\n")
print(_name)
age = int(age)
if(age>18):
print("you can drive a car")
elif(age==18):
print(" Now you can't drive a car but wait until this year complets ")
else:
print("you can't drive a car")
# print(" Now you can't drive a car but wait until this year complets
# Eligiblity to drive a vehical
Result for the above code
E:\languages\python codeing>python main1.py
Enter your name: Eswar
enter your age
15
Eswar
you can't drive a car
project 4
faulty calaculator:
Design a calculator which will correctly solve all the problems except the following ones:
- 45 * 3 = 555
- 56 + 9 = 77
- 56 / 6 = 4
Your program should take operator and the numbers as input from user and return the result.
# 4. project
# Faulty calculator
print("Enter the operator\n \n+ for Addition\n- for Subtraction\n* for Multiplication\n/ for Division\n** for Power\n")
a = input() # input for operator
_num = int(input("Enter the first numeber: "))
_num1 = int(input("Enter the second numeber: "))
print("SOLUTION:")
if _num==45 and _num1==3 and a=='*' :
print(555)
elif _num==56 and _num1==9 and a=="+" :
print(77)
elif _num==56 and _num1==6 and a=="/" :
print(4)
else:
if a== "+" :
print(int(_num + _num1))
elif a== "-" :
print(int(_num - _num1))
elif a== "*" :
print(int(_num * _num1))
elif a== "/" :
print(float(_num / _num1))
elif a== "**":
print(int(_num ** _num1))
# 4. project
Result for the above code
E:\languages\python codeing>python main1.py
Enter the operator
+ for Addition
- for Subtraction
* for Multiplication
/ for Division
** for Power
*
Enter the first numeber: 45
Enter the second numeber: 3
SOLUTION:
555
Comments
Post a Comment