Skip to content
This repository was archived by the owner on Jul 28, 2024. It is now read-only.

Commit 10d5ada

Browse files
committed
adding feaurures
1 parent 35a9115 commit 10d5ada

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

terminal.py

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ def supercommand():
77
while True:
88
command = input().strip().lower()
99
if command == "":
10-
continue
10+
continue
11+
elif command == "superpmdm":
12+
superpmdmcalc()
1113
elif command == "supertype":
1214
typed_text = input("Type something:")
1315
print(typed_text + typed_text)
@@ -42,9 +44,9 @@ def supercommand():
4244
print("No such command in supermode.")
4345
else:
4446
print("PyTerm error: wrong password.")
45-
47+
# PMDMcalc integrated with PyTerm, and even more powerful version for the supermode, SUPERPMDMcalc!
4648
def pmdmcalc():
47-
operation = input("hint: + - / *. Type the symbol here: ").strip()
49+
operation = input("PMDMcalc is welcomming you! hint: + - / *. Type the symbol here: ").strip()
4850

4951
if operation in ["+", " +"]:
5052
num1 = float(input("Number 1: "))
@@ -68,11 +70,56 @@ def pmdmcalc():
6870

6971
else:
7072
return "Your symbol is not supported in PMDMcalc. Please try again with another symbol."
73+
def superpmdmcalc():
74+
operation = input("SUPERPMDMcalc is welcoming you! hint: + - / * or < = >. Type the symbol here: ").strip()
75+
76+
if operation in ["+", " +"]:
77+
num1 = float(input("Number 1: "))
78+
num2 = float(input("Number 2: "))
79+
num3 = float(input("Number 3: "))
80+
return f"Result: {num1 + num2 + num3}"
81+
82+
elif operation in ["-", " -"]:
83+
num1 = float(input("Number 1: "))
84+
num2 = float(input("Number 2: "))
85+
num3 = float(input("Number 3: "))
86+
return f"Result: {num1 - num2 - num3}"
87+
88+
elif operation in ["/", " /"]:
89+
num1 = float(input("Number 1: "))
90+
num2 = float(input("Number 2: "))
91+
num3 = float(input("Number 3: "))
92+
if num2 == 0 or num3 == 0:
93+
return "Error: Division by zero."
94+
return f"Result: {num1 / num2 / num3}"
95+
96+
elif operation in ["*", " *"]:
97+
num1 = float(input("Number 1: "))
98+
num2 = float(input("Number 2: "))
99+
num3 = float(input("Number 3: "))
100+
return f"Result: {num1 * num2 * num3}"
101+
102+
elif operation in ["<", " <", ">", " >"]:
103+
num1 = float(input("Number 1:"))
104+
num2 = float(input("Number 2:"))
105+
if operation.strip() == "<":
106+
return str(num1 < num2)
107+
elif operation.strip() == ">":
108+
return str(num1 > num2)
109+
110+
elif operation == "=":
111+
num1 = float(input("Number 1:"))
112+
num2 = float(input("Number 2:"))
113+
return str(num1 == num2)
114+
115+
else:
116+
return "Your symbol is not supported in SUPERPMDMcalc. Please try again with another symbol."
71117

118+
# All commands are in this handle_command() tag.
72119
def handle_command(command):
73120
command = command.strip().lower()
74121
if command == "help":
75-
return "Available commands: help, exit, info, pmdm, super"
122+
return "Available commands: help, exit, info, pmdm, super, type. Available Add-ons: -h"
76123
elif command == "exit":
77124
return "Exiting..."
78125
elif command == "info":
@@ -93,6 +140,11 @@ def handle_command(command):
93140
return pmdmcalc()
94141
elif command == "super":
95142
return supercommand()
143+
elif command == "type":
144+
typed_text = input("Type something:")
145+
print(typed_text)
146+
elif command == "type -h":
147+
return "Type is a command that copies the text you've already written. I know, it's unuseful but someone would like it."
96148
elif command == "help -h":
97149
return "Help is a command that let's you see all the commands in PyTerm."
98150
elif command == "exit -h":

0 commit comments

Comments
 (0)