Нужно переделать код для антиплагиата
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()
Python
Помогите пожалуйста переделать код на Питоне
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()
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()
бедный Питон
Похожие вопросы
- Добрый день, помогите, пожалуйста, написать код к задаче на питоне
- Пожалуйста напишите код на питоне для новичка, чтобы разобраться
- Помогите, пожалуйста, с задачей на питоне!
- Помогите пожалуйста решить задачи на питоне:
- Помогите пожалуйста решить задачу на питоне...
- Помогите пожалуйста с задачей по питону
- Помогите пожалуйста с задачей на Питоне
- Помогите пожалуйста написать код
- Python. Помогите пожалуйста с кодом
- Помогите пожалуйста с кодом. Python
File "C:/Users/Legion/Desktop/1.py", line 7, in
x, y, x1, y1 = 170
TypeError: cannot unpack non-iterable int object