Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Let's do some maths")
- a=int(input("enter number1: "))
- b=int(input("enter number2: "))
- command=input("choose operation: ")
- if command=="+":
- result=a+b
- print(a, "+" ,b, "=",result)
- elif command=="-":
- result=a-b
- print(a, "-" ,b, "=",result)
- elif command=="*":
- result=a*b
- print(a, "*" ,b, "=",result)
- elif command=="/":
- result=a/b
- print(a, "/" ,b, "=",result)
- elif command=="%":
- result=a%b
- print(a, "%" ,b, "=",result)
- else:
- print("Sorry I dont understand what is this kind of operation")
- """
- Here is another problem for computing an area of a triangle(assuming measurements are in cm)
- and shows how much my weekly shopping costs.
- """
- #Area of a triangle
- area=0.5*a*b
- print("Area of triangle is: ",area, "cm sq")
- #Shopping in $
- clothing=int(input("cost for clothes: "))
- stationery=int(input("cost for stationery: "))
- food=int(input("cost for food: "))
- shoes=int(input("cost for shoes: "))
- sum=clothing + stationery + food + shoes
- print("My Weekly Shopping Cost was: $",sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement