Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make a calcukatir un python

import time
times = 3

for x in range (times):
  def calculate(a, b, formula):
    if formula == '+':
      return a + b
    elif formula == '-':
      return a - b
    elif formula == '*':
      return a * b
    elif formula == '/':
      return a / b
    else:
      print('Just Leave!')
      return 'Closing program...'

  print('Choose a number')
  a = float(input())
  print('Choose a second number')
  b = float(input())
  print('Do you want to * / - or + ?')
  formula = input()
  answer = calculate(a, b, formula)
  print(answer)
sleep(3)
Comment

PREVIOUS NEXT
Code Example
Python :: How to code a simple rock, paper, scissors game on Python 
Python :: how to add one to the index of a list 
Python :: python string operations 
Python :: using slug or .. instead of pk in django 
Python :: how to reduce the image files size in python 
Python :: python boto3 put_object to s3 
Python :: calendar module in python 
Python :: count substring in string python 
Python :: count true in a dataframe 
Python :: how to flatten list of lists in python 
Python :: python frozenset 
Python :: python port forwarding 
Python :: Dependency on app with no migrations: 
Python :: receipt data extraction python 
Python :: TypeError: can only concatenate str (not "method") to str 
Python :: how to access dictionary inside an array python 
Python :: waitkey in python 
Python :: how to find the shortest word in a list python 
Python :: data.head on terminal 
Python :: I**2 python 
Python :: code a gui 
Python :: nested input python 
Python :: pandas Timedelta to postgres 
Python :: arcpy select visible raster 
Python :: Highlighting the shortest path in a Networkx graph 
Shell :: how to check laptop serial number in ubuntu 
Shell :: woeusb ubuntu install 
Shell :: install dateutil 
Shell :: update node version debian 
Shell :: install ext-intl php7.4 ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =