-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA+ code.py
More file actions
157 lines (111 loc) · 4.41 KB
/
A+ code.py
File metadata and controls
157 lines (111 loc) · 4.41 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
from colorama import *
import os
import re
# Версия v0.2.1
# Чтобы узнать все функции программы впишите в консоле 'A+ -func'
init()
print('A+ запустилась\n')
all_codes = []
user = ''
errors = 0
# Функция которая очищает консоль
def clear_console():
os.system('cls||clear')
# Функция где программа определяет что ввёл пользователь
def go_command():
if user_set_func == 'A+ -info':
program_version()
elif user_set_func == 'A+ -code edit':
st_print()
elif user_set_func == 'A+ -print':
st_print()
elif user_set_func == '-print':
st_print()
elif user_set_func == 'A+ -func':
all_func()
elif user_set_func == 'A+ -clear console':
clear_console()
set_command()
else:
print(Fore.RED + '\nОшибка: команда "' + user_set_func + '"\nне существует\n')
set_command()
user_set_func = ''
res_input = ''
# Функция где пользователь пишет функцию
def set_command():
global user_set_func
user_set_func = input(Fore.YELLOW)
print()
go_command()
# Функция которая показывает информацию о А+
def program_version():
print(Fore.WHITE + 'A+ version: 0.2.1\nAuthor: Almaz\n')
set_command()
# Функция где описаны все функции А+
def all_func():
print(
Fore.WHITE + 'Все функции A+:\n\nA+ -info: вся информация о A+\nA+ -print: функция которая выводит текст который вы написали\n"print:" : выводит текст который вы написали\nA+ -res() или program -res(): перезапускает функцию\nA+ -exit() или program -exit(): выходит из функции\nA+ -func: выводит все функции A+\nA+ -clear console: полностью очищает консоль\n')
set_command()
# Функция редактора кода
def st_print():
# Старт написанного пользователем кода
def code_start():
global all_codes
global errors
clear_console()
numbers_codes = 0
for i in range(len(all_codes)):
print(all_codes[numbers_codes])
numbers_codes += 1
all_codes = []
print(Fore.WHITE + '\n\nProgram finished error code[' + str(errors) + ']')
errors = 0
comand_input()
# Функция 'ошибка кода'
def error_comand():
global error_name
print(Fore.RED + 'Ошибка: команда "' + error_name + '"\nне существует')
# Функция где пользователь вводит функции после конца кода
def comand_input():
global res_input
res_input = input(Fore.YELLOW)
code_res_o()
# Функция которая проверяет функцию который ввёл пользователь
def code_res_o():
if res_input == 'program -res()':
clear_console()
st_print()
elif res_input == 'A+ -res()':
clear_console()
st_print()
elif res_input == 'program -exit()':
set_command()
elif res_input == 'A+ -exit()':
clear_console()
set_command()
else:
print(Fore.RED + '\nОшибка: команда "' + res_input + '"\nне существует')
comand_input()
clear_console()
print('function print has started\n')
# Функция где пользователь пишет код
def code_se():
global all_codes
user = input(Fore.GREEN)
if user[0:6] == 'print:' and len(user) > 6:
all_codes.append(user[6:-1] + user[-1])
elif user == 'start()':
code_start()
elif user[0:8] == 's.print:' and len(user) >7:
set_nums = input(Fore.WHITE)
set_tx = user
all_codes.append((set_tx[8:-1] + set_tx[-1]) * int(set_nums))
elif user == 'exit()':
clear_console()
all_codes = []
set_command()
else:
errors += 1
code_se()
code_se()
set_command()