@DragoniteDL/

Fraction Calculator ish

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import replit as r, fractions
from fractions import Fraction as frac

r.clear()
var11 = int(input('First number, Top number: '))
r.clear()
var12 = int(input('(If whole number, set to 1) First number, Bottom number: '))
r.clear()
var21 = int(input('Second number, Top number: '))
r.clear()
var22 = int(input('(If whole number, set to 1) Second number, Bottom number: '))
r.clear()
print('1 - Multiplication')
print('2 - Division')
print('3 - Addition')
print('4 - Subtraction')
print('')
user = int(input())
if user == 1:
  answer = frac(var11,var12) * frac(var21,var22)
if user == 2:
  answer = frac(var11,var12) / frac(var21,var22)
if user == 3:
  answer = frac(var11,var12) + frac(var21,var22)
if user == 4:
  answer = frac(var11,var12) - frac(var21,var22)

r.clear()
print('Your answer is:',answer)