how to make a calculator using idle

def calculate():
    operation = input('''
Please type in the math operation you would like to complete:
+ for addition
- for subtraction
* for multiplication
/ for division
''')

    number_1 = int(input('Please enter the first number: '))
    number_2 = int(input('Please enter the second number: '))

    if operation == '+':
        print('{} + {} = '.format(number_1, number_2))
        print(number_1 + number_2)

    elif operation == '-':
        print('{} - {} = '.format(number_1, number_2))
        print(number_1 - number_2)

    elif operation == '*':
        print('{} * {} = '.format(number_1, number_2))
        print(number_1 * number_2)

    elif operation == '/':
        print('{} / {} = '.format(number_1, number_2))
        print(number_1 / number_2)

    else:
        print('You have not typed a valid operator, please run the program again.')

    # Add again() function to calculate() function
    again()

def again():
    calc_again = input('''
Do you want to calculate again?
Please type Y for YES or N for NO.
''')

    if calc_again.upper() == 'Y':
        calculate()
    elif calc_again.upper() == 'N':
        print('See you later.')
    else:
        again()

calculate()

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
calculator idle calculator evolution idle how to code calculator in python python calculate ? how to build a calculator create basic calculator python how to create a calculator in python calculator program calculation program in python create a calculator app with python how to do calculations with python www.building simple calculator with python video algorithm that reads in 2 integers and simulates multiplication using a loop and addition using python making a full working calculator in pyton make a custom form calculator python 1.Create a calculator which can perform basic arithmetic operations depending upon the user input. make a calculator in python with def python code calculator with steps python programs on calculator simple calculator in python without function calclator python codr code for simple calculator in python without function very basic python calculator Write a program that performs the tasks of a simple calculator. The program should first take an integer as input and then based on that integer perform the task as given below. python program for simple calculator input given from command prompt calculator in python code python calculator program python // on a calculartor python calculator program using main function arithmetic calculator in python how to make a calculator python python calculator project code pdf python for complete calculator write menu based program in python to create a four way calculator building a calculator in python python basic calculator calculator proggram script python how to know the ammount of calculations performed by python program python calculate operation by second making calculator in python how to make a calcultor in python using funtion how to make python calculate how to make a python calculator how to make a addition calculator in python high end calculator in python from scratch calculator in python code for calculator in python calculator app in python how to make a calculator with python making a calculator in python python calculator code calculator python build a calculator in python how to make a calculator in python using functions python calculator python calculator script example python script for a calculator how to make a muliple number calculater in python calculator script in python python 3 course calculator run calculator python make a python calculator how to make calculator in python making simple calculator with python with IDLE how to build a calulator in python create a calculator in python tutorial build a calculator with python python calculators how to build a calculator in python python tutorial how to build a calculator python input calculator with operator python how to make a calculator how to make a calculator app in python how to make a calculator in python simple calculator in python how to make a calculator using idle
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source