Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views1 page

Import Os

This document contains a Python script for a simple calculator that performs basic arithmetic operations. Users can input two numbers and choose an operation (addition, subtraction, multiplication, or division). The program continues to run until the user decides to stop by entering 'N'.

Uploaded by

aryan.fr7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Import Os

This document contains a Python script for a simple calculator that performs basic arithmetic operations. Users can input two numbers and choose an operation (addition, subtraction, multiplication, or division). The program continues to run until the user decides to stop by entering 'N'.

Uploaded by

aryan.fr7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import os

os.system('cls')

print(' ')
while 1 :
num1 = float(input("Enter first Number : "))
num2 = float(input("Enter Second NUmber : "))
print("...........................")
print( ' press 1 for + \n press 2 for - \n press 3 for * \n press 4 for / ')
choice = int(input("Enter your operetion number "))
print('---------------------------')

if choice == 1 :
print('the answer is : ' , (num1+num2))
elif choice == 2 :
print('the answer is : ' , (num1-num2))
elif choice == 3 :
print('the answer is : ' , (num1*num2))
elif choice == 4 :
if num2 == 0 :
print("Cant devision by 0")
else :
print('the answer is : ' , (num1/num2))
else :
print("invalid operation !")
print(' ')
stop = input("Do you want the calculator again (Y or N) ?")
if stop == 'N' :
break;

You might also like