Python

Помогите пожалуйста переделать код на Питоне

Нужно переделать код для антиплагиата
import tkinter

length = int(input())
inkrement = int(input())
sum_length = int(input())

x = y = 170
x1 = y1 = 170
# sin45 and cos45 have same value
angle = (2 ** (1 / 2)) / 2
# declare on which side of square I am
# -1 first pos, when we dont increase length with inkrement
pos = -1
# because I chose 45° angle I dont need different shifts for x axis and y axis
shift = 0

canvas = tkinter.Canvas()
canvas.pack()
if sum_length <= length:
shift = sum_length * angle
x1, y1 = (x1 + shift), (y1 - shift)
canvas.create_line(x, y, x1, y1)
else:
shift = length * angle
x1, y1 = (x1 + shift), (y1 - shift)
canvas.create_line(x, y, x1, y1)
x, y = x1, y1
pos += 1
sum_length -= length
length += inkrement
while pos >= 0:
if pos == 0:
pos += 1
if sum_length <= length:
shift = sum_length * angle
x1, y1 = (x1 - shift), (y1 - shift)
canvas.create_line(x, y, x1, y1)
break
else:
shift = length * angle
x1, y1 = (x1 - shift), (y1 - shift)
canvas.create_line(x, y, x1, y1)
x, y = x1, y1
sum_length -= length
length += inkrement
elif pos == 1:
pos += 1
if sum_length <= length:
shift = sum_length * angle
x1, y1 = (x1 - shift), (y1 + shift)
canvas.create_line(x, y, x1, y1)
break
else:
shift = length * angle
x1, y1 = (x1 - shift), (y1 + shift)
canvas.create_line(x, y, x1, y1)
x, y = x1, y1
sum_length -= length
length += inkrement
elif pos == 2:
pos += 1

if sum_length <= length:
shift = sum_length * angle
x1, y1 = (x1 + shift), (y1 + shift)
canvas.create_line(x, y, x1, y1)
break

else:
shift = length * angle
x1, y1 = (x1 + shift), (y1 + shift)
canvas.create_line(x, y, x1, y1)
x, y = x1, y1
sum_length -= length
length += inkrement
elif pos == 3:
pos = 0
if sum_length <= length:
shift = sum_length * angle
x1, y1 = (x1 + shift), (y1 - shift)
canvas.create_line(x, y, x1, y1)
break
else:
shift = length * angle
x1, y1 = (x1 + shift), (y1 - shift)
canvas.create_line(x, y, x1, y1)
x, y = x1, y1
sum_length -= length
length += inkrement
canvas.mainloop()
import tkinter

increment = int(input())
length = int(input())
sum_of_length = int(input())

x, y, x1, y1 = 170

angle = (2 ** (1 / 2)) / 2

position = -1
shift_for = 0

canvas = tkinter.Canvas()
canvas.pack()

if sum_of_length < = length:
shift_for = sum_of_length * angle
x1, y1 = (x1 + shift_for), (y1 - shift_for)
canvas.create_line(x, y, x1, y1)
else:
shift_for = length * angle
x1, y1 = (x1 + shift_for), (y1 - shift_for)
canvas.create_line(x, y, x1, y1)
x, y = x1, y1
position + = 1
sum_of_length - = length
length + = increment

while position > = 0:
if position == 0:
position + = 1
if sum_of_length < = length:
shift_for = sum_of_length * angle
x1, y1 = (x1 - shift_for), (y1 - shift_for)
canvas.create_line(x, y, x1, y1)
break
elif position == 1:
position + = 1

else:
shift_for = length * angle
x1, y1 = (x1 - shift_for), (y1 - shift_for)
canvas.create_line(x, y, x1, y1)
x, y = x1, y1
sum_of_length - = length
length + = increment

if sum_of_length < = length:
shift_for = sum_of_length * angle
x1, y1 = (x1 - shift_for), (y1 + shift_for)
canvas.create_line(x, y, x1, y1)
break

elif position == 2:
position + = 1

else:
shift_for = length * angle
x1, y1 = (x1 - shift_for), (y1 + shift_for)
canvas.create_line(x, y, x1, y1)
x, y = x1, y1
sum_of_length - = length
length + = increment

if sum_of_length < = length:
shift_for = sum_of_length * angle
x1, y1 = (x1 + shift_for), (y1 + shift_for)
canvas.create_line(x, y, x1, y1)
break

elif position == 3:
position = 0

else:
shift_for = length * angle
x1, y1 = (x1 + shift_for), (y1 + shift_for)
canvas.create_line(x, y, x1, y1)
x, y = x1, y1
sum_of_length - = length
length + = increment
if sum_of_length < = length:
shift_for = sum_of_length * angle
x1, y1 = (x1 + shift_for), (y1 - shift_for)
canvas.create_line(x, y, x1, y1)
break
else:
shift_for = length * angle
x1, y1 = (x1 + shift_for), (y1 - shift_for)
canvas.create_line(x, y, x1, y1)
x, y = x1, y1
sum_of_length - = length
length + = increment
canvas.mainloop()
ВУ
Вилис Ундулис
1 338
Лучший ответ
Искаров Даулет Traceback (most recent call last):
File "C:/Users/Legion/Desktop/1.py", line 7, in
x, y, x1, y1 = 170
TypeError: cannot unpack non-iterable int object
Вилис Ундулис https:// pastebin.com/FyB4DUH5
Вилис Ундулис У меня нет такой ошибки, но у меня не установлено tkinter
бедный Питон