Fake Calculator
Hey Guys,
Welcome to the coding series and today we will learn to make a calculator, that is a fake calculator that is very fun to make and you can use this to prank your friends. This project was coded using python and was coded in Pycharm. This code is simple and easy to make.
Note (!): This project is for fun purpose and can be edited and used for any purpose. This calculator's intention is not to prank anyone and hurt them.
So, i will be sharing the code and then explain it later step by step.
So here is the code down below:
import random
#create a list for "Addition","Subtraction","Multiplication","Division" to ensure people enter many things and it performs only one operation.
a = ["Add","add","ADD","+","Addition","addition","ADDITION"]
b = ["Diffrence","SUBTRACT","Subtract","-","DIFFRENCE","subtract","diffrence","Subtraction","SUBTRACTION","subtraction"]
c = ["Into","into","x","MULTIPLY","Multiply","X","multiply"]
d = ["Divide","DIVIDE","DIVISION","/","Division","divide","division"]
# Operations to perform
e = ["+","-","x","/"]
# Entering a Operation and entering numbers
A = input("Enter a Operation:")
B = float(input("Enter an Number:"))
C = float(input("Enter an Number:"))
#computer chooses randomly
D = random.choice(e)
#performs the operation chosen by the computer randomly.
if D == "+":
print(B+C)
if D == "-":
print(B-C)
if D == "x":
print(B*C)
if D == "/":
print(B/C)
Here, the first set of code ,
1.we have created a list to make sure that if people enter "Add" or "add" it performs addition and we have done it for every operation.
2.Next create a list for the operations to be performed.
3.Next user input for entering operations and numbers to performed.
4.Making the computer choose the operations randomly.
5.perform the operations chosen randomly instead of the operations entered to fake it.
So this code can be explained in 5 simple steps and try and enjoy this code.
Meet you on the Next Post, Until then Bye!
BY THE BLOG AUTHOR.
2 Comments
Hope you enjoy this Python - made Fake calculator which is very fun.
ReplyDeletePlease share this blog to 15 people to increase my views.
Nice
ReplyDelete