Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make a calcukatir

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 :: add item to python list 
Python :: pandas add prefix to column names 
Python :: no module named 
Python :: jquery datepicker disable 
Python :: python variable definieren 
Python :: swap case python 
Python :: python return double quotes instead of single 
Python :: list operations in python 
Python :: how to get spotify playlist id in spotipy 
Python :: flatten dict with lists as entries 
Python :: excelwriter python 
Python :: how to transcode a video in python using ffmpeg 
Python :: example exponential distribution python 
Python :: parse receipt python 
Python :: socket for api in django 
Python :: python convert number with a comma and decimal to a float 
Python :: how to add to end of linked list python 
Python :: error aesthetics must be either length 1 or the same as the data (3) fill 
Python :: opencv write video 
Python :: group normalization 
Python :: reciprocal python 
Python :: how to use visualize_runtimes 
Python :: ID number zero python 
Python :: linux pyspark select java version 
Python :: derivative of multivariable function pytorch 
Shell :: kill localhost 3000 ubuntu 
Shell :: rails server already running 
Shell :: debian disable ipv6 
Shell :: git config username and password global 
Shell :: restart redis ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =