@DarthVilgot/

Calculator 1

Python

A bad calculator. My first time coding.

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.7256729931089112","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IG1hdGgKCmRlZiBjYWxjdSgpOgogIHggPSAwCiAgeSA9IDAKICBvcGVyYXRvciA9ICIiCiAgeCA9IGludChpbnB1dCgiRW50ZXIgbnVtYmVyOiAiKSkKICBvcGVyYXRvciA9IGlucHV0KHN0cigiRW50ZXIgb3BlcmF0b3I6ICIpKQogIHkgPSBpbnQoaW5wdXQoIkVudGVyIG51bWJlcjogIikpCiAgaWYob3BlcmF0b3IgPT0gIi8iKToKICAgIHByaW50KHggLyB5KQogIGlmKG9wZXJhdG9yID09ICIvLyIpOgogICAgcHJpbnQoeCAvLyB5KQogIGlmKG9wZXJhdG9yID09ICIrIik6CiAgICBwcmludCh4ICsgeSkKICBpZihvcGVyYXRvciA9PSAiLSIpOgogICAgcHJpbnQoeCAtIHkpCiAgaWYob3BlcmF0b3IgPT0gIiUiKToKICAgIHByaW50KG1hdGguZm1vZCh4LCB5KSkKICBpZihvcGVyYXRvciA9PSAiKiIpOgogICAgcHJpbnQoeCAqIHkpCiAgaWYob3BlcmF0b3IgPT0gIioqIik6CiAgICBwcmludCh4ICoqIHkpCgpkZWYgY2FsYygpOgogIHJvb3RhID0gIiIKICByb290YSA9IGlucHV0KHN0cigiUm9vdHM/OiAiKSkKICBpZiByb290YSA9PSAiWWVzIjoKICAgIGIgPSAwCiAgICBjID0gMAogICAgYyA9IGludChpbnB1dCgiV2hpY2ggbnVtYmVyPzogIikpCiAgICBiID0gaW50KGlucHV0KCJUbyB0aGUgeHRoIHJvb3Q6ICIpKQogICAgcHJpbnQoYyAqKiAoMS9iKSkKICBlbHNlOgogICAgeCA9IGludChpbnB1dCgiRW50ZXIgbnVtYmVyOiAiKSkKICAgIG9wZXJhdG9yID0gaW5wdXQoc3RyKCJFbnRlciBvcGVyYXRvcjogIikpCiAgICBpZihvcGVyYXRvciA9PSAiISIpOgogICAgICBwcmludChtYXRoLmZhY3RvcmlhbCh4KSkKCmEgPSAiIgphID0gaW5wdXQoc3RyKCIxIG9yIDIgbnVtYmVyczogIikpCmlmIChhID09ICIyIik6CiAgY2FsY3UoKQppZiAoYSA9PSAiMSIpOgogIGNhbGMoKQ=="},"asBuffer":null},"loaded":true}}
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import math

def calcu():
  x = 0
  y = 0
  operator = ""
  x = int(input("Enter number: "))
  operator = input(str("Enter operator: "))
  y = int(input("Enter number: "))
  if(operator == "/"):
    print(x / y)
  if(operator == "//"):
    print(x // y)
  if(operator == "+"):
    print(x + y)
  if(operator == "-"):
    print(x - y)
  if(operator == "%"):
    print(math.fmod(x, y))
  if(operator == "*"):
    print(x * y)
  if(operator == "**"):
    print(x ** y)

def calc():
  roota = ""
  roota = input(str("Roots?: "))
  if roota == "Yes":
    b = 0
    c = 0
    c = int(input("Which number?: "))
    b = int(input("To the xth root: "))
    print(c ** (1/b))
  else:
    x = int(input("Enter number: "))
    operator = input(str("Enter operator: "))
    if(operator == "!"):
      print(math.factorial(x))

a = ""
a = input(str("1 or 2 numbers: "))
if (a == "2"):
  calcu()
if (a == "1"):
  calc()