Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions flag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# флаг
RED = '\u001b[41m'
BLUE = '\u001b[44m'
WHITE = '\u001b[47m'
END = '\u001b[0m'
SET_COLOR = "\x1b[48;5;"


print ('#1 Флаг Франции')

height = (6)
length = (30)


def draw_flag_line():
for i in range (height):
print(f'{BLUE}{" " * (length // 3)}',f'{WHITE}{" " * (length // 3)} ',f'{RED}{" " * (length // 3)}{END}')


if __name__ == "__main__":
draw_flag_line()
30 changes: 30 additions & 0 deletions func.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
def plot_function(func, start, end):


spot1 = f'\x1b[48;5;{1}m{" "}\x1b[0m'
spot2 = f'\x1b[48;5;{2}m{" "}\x1b[0m'
AXIS = f'\x1b[48;5;{1}m{" "}\x1b[0m'
GRAPH = f'\x1b[48;5;{2}m{" "}\x1b[0m'


y_values = {}


for x in range(start, end + 1):
y = func(x)
y_values[y] = x

# Определяем максимальное значение y
max_y = max(y_values.keys())

# Строим график
for y in range(max_y, 0, -1):
if y in y_values:
x = y_values[y]
print(y, ' ' * (3 - len(str(y))), spot1 * (x - 1) + spot2)

print(0, ' ', spot2 + spot1 * (end - start), 'x')
print('   ', ' '.join(str(i) for i in range(start, end + 1)))


plot_function(lambda x: x**2, 0, 10)
13 changes: 13 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
RED = '\u001b[41m'
BLUE = '\u001b[44m'
WHITE = '\u001b[47m'
END = '\u001b[0m'
print (RED + ' '*10 + END)
print (f"{BLUE}{' '*10}{END}")


# '''for i in range(6):
# if i < 3:
# print(f'{BLUE}{" " * (2 * i + 2)}{WHITE}{" " * (14 - 2 * i)}{END}')
# else:
# print(f'{BLUE}{" " * (12 - 2 * i)}{RED}{" " * (4 + 2 * i)}{END}')'''
52 changes: 52 additions & 0 deletions test1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import time


SET_COLOR = "\x1b[48;5;"
END = "\x1b[0m"
CLEAR = "\033[H"


def draw_line(offset=0, length=1, color=222):
line = " " * length
print (f"{' ' * offset}{SET_COLOR}{color}m{line}{END}")

def draw_romb():
size = 15
center = size // 2
offset = size // 2

step = 1
length = 1

colors = [222, 157]

while True:
for color in colors:
for line in range (size):
draw_line(offset, length, color)

if line < center:
offset -= step
length += step*2
else :
offset += step
length -= step*2

print(f"\x1b[{size+2}A")
print(f"\x1b[{offset}D")

length = 1
offset = size // 2

time.sleep (2)


# print (size, center, offset)

draw_romb()

# if __name__ == "__main__":
# # for i in range (20):
# # draw_line(length=20, color=47, offset=i)
# # print (f"{CLEAR}")
# # time.sleep(0.5)
20 changes: 20 additions & 0 deletions uzor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SET_COLOR = "\x1b[48;5;"
END = '\u001b[0m'
repeats = 5


def draw_pattern(color1 = 232, color2 = 231):
print(f"{SET_COLOR}{color2}m{' '*6}{SET_COLOR}{color1}m{' '*6}{SET_COLOR}{color2}m{' '*6}{END}")
print(f"{SET_COLOR}{color2}m{' '*6}{SET_COLOR}{color1}m{' '*6}{SET_COLOR}{color2}m{' '*6}{END}")
print(f"{SET_COLOR}{color2}m{' '*6}{SET_COLOR}{color1}m{' '*6}{SET_COLOR}{color2}m{' '*6}{END}")
print(f"{SET_COLOR}{color1}m{' '*6}{SET_COLOR}{color2}m{' '*6}{SET_COLOR}{color1}m{' '*6}{END}")
print(f"{SET_COLOR}{color1}m{' '*6}{SET_COLOR}{color2}m{' '*6}{SET_COLOR}{color1}m{' '*6}{END}")
print(f"{SET_COLOR}{color1}m{' '*6}{SET_COLOR}{color2}m{' '*6}{SET_COLOR}{color1}m{' '*6}{END}")
print(f"{SET_COLOR}{color2}m{' '*6}{SET_COLOR}{color1}m{' '*6}{SET_COLOR}{color2}m{' '*6}{END}")
print(f"{SET_COLOR}{color2}m{' '*6}{SET_COLOR}{color1}m{' '*6}{SET_COLOR}{color2}m{' '*6}{END}")
print(f"{SET_COLOR}{color2}m{' '*6}{SET_COLOR}{color1}m{' '*6}{SET_COLOR}{color2}m{' '*6}{END}")


if __name__ == "__main__":
for i in range(repeats):
draw_pattern()