Skip to content
  • Categories
  • Recent
  • Groups
  • Users
  • Tags
  • Popular
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Categories
  3. Web Development
  4. my simple Python calculator

my simple Python calculator

Scheduled Pinned Locked Moved Web Development
1 Posts 1 Posters 29 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • danniltrifonovD Offline
    danniltrifonovD Offline
    danniltrifonov
    Coders Русский(Russian) i love cats Classical Pianists Sad Times did the dew Pythons the goat NOCTURNAL Generic BrowseDNS Chat slim shady gang THE LIT GANG Nathaniel follower resource center
    wrote on last edited by
    #1
    type = input("Enter type of calculation: ")
    try:
        x = int(input("Enter first number: "))
        y = int(input("Enter second number: "))
    except ValueError:
        print("Please input correct information.")
    
    def calculate(x, y, type):
        if type == "+":
            return x + y
        elif type == "-":
            return x - y
        elif type == "*":
            return x * y
        elif type == "/":
            return x / y
        else:
            return "Wrong inputs")
    
    result = calculate(x, y, type)
    print(result)
    

    Do not go gentle into that goodnight...

    1 Reply Last reply
    1
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Groups
    • Users
    • Tags
    • Popular