-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpypython.py
More file actions
executable file
·40 lines (40 loc) · 1.4 KB
/
pypython.py
File metadata and controls
executable file
·40 lines (40 loc) · 1.4 KB
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
import os
import sys
import time
pypythonver = 0.1
pypython = str("PyPython interpreter- Python interpreter built with python")
print(pypython)
def e_x_i_t():
print("Next time, use sys.exit()!")
exit()
customcommands = {
"exit":"e_x_i_t()",
"quit":"e_x_i_t()",
"pypfo":"print(pypython)",
"pypver":"print(pypythonver)",
"clear":"os.system('clear')",
"print(inputtedcommand)":"print('This is an interpreter-required variable. Please do not tamper with it')",
"print(customcommands)":"print('This is an interpreter-required variable. Please do not tamper with it')",
"print(i_t_e_m)":"print('This is an interpreter-required variable. Please do not tamper with it')",
"ls":"print('You are in the python shell.')"
}
def commandie():
global inputtedcommand
inputtedcommand = str(input(">>> "))
if inputtedcommand == "": return;
for i_t_e_m in customcommands:
if inputtedcommand == i_t_e_m:
eval(customcommands[i_t_e_m])
return;
eval(inputtedcommand);
while True:
try:
commandie()
except NameError as e:
print(f"{inputtedcommand}is not a command, mathematical equation, function, or a valid syntax for the command you just tried to use. ({e})")
except EOFError:
print("\nUse sys.exit() next time!")
sys.exit()
except KeyboardInterrupt:
print("\nUse sys.exit() next time!")
sys.exit()