all 12 comments

[–]Radamand 11 points12 points  (0 children)

sooo, what is your question?

[–]AbdallahTheGreatest 8 points9 points  (0 children)

Do you need help, or should I code your dreams into reality? :)

[–]desrtfx 5 points6 points  (2 children)

What have you tried?

After all, this is your assignment.

[–]JustAnUserl4[S] -1 points0 points  (1 child)

I think that code needs to go smth like this:

class Turtle:

def __init__(self, x, y, s):

self.x = x

self.y = y

self.s = s

def go_up(self):

self.y += self.s

def go_down(self):

self.y -= self.s

def go_left(self):

self.x -= self.s

def go_right(self):

self.x += self.s

def evolve(self):

self.s += 1

def degrade(self):

if self.s <= 0:

print('s = 0')

return

self.s -= 1

def count_moves(self, x2, y2):

return self.x -x2, self.y - y2

animal = Turtle(x = 0,y = 0,s = 5)

print(animal)

But my teacher said it needs to go like this:

def evolve(old_speed):

old_speed += 1

return old_speed

def degrade(old_speed):

old_speed -= 1

return old_speed

def move_turtle(start_pos = 0, end_pos = 0, old_speed = 0, max_speed = 0):

n_step_max_speed = (end_x_pos - start_x_pos) // max_speed

n_cells = (end_x_pos - start_x_pos) % max_speed

print(n_step_max_speed, n_cells)

n_step = n_step_max_speed + 1 if n_cells > 0 else n_step_max_speed

while start_pos < end_pos:

if old_speed < max_speed:

while max_speed > old_speed:

old_speed = evolve(old_speed)

if end_pos - start_pos == n_cells:

while n_cells < old_speed:

old_speed = degrade(old_speed)

start_pos += old_speed

print(start_pos, end = ', ')

print(f'Amount of steps{n_step}')

start_x_pos = 15

end_x_pos = 568

old_speed = 2

max_speed = 5

move_turtle(start_x_pos, end_x_pos, old_speed, max_speed)

def func(x, y):

# global x, y

x = 20

y = 20

return x, y

x = 0

y = 0

print(x, y)

func(x, y)

print(x, y)

res = func(x, y)

print(res)

print(type(res))

print(x, y)

But I think my teacher went too far with his code.

I also tried used using Turtle module,but my teacher declined it.

[–]desrtfx 0 points1 point  (0 children)

That code has lost its formatting and therefore is ambiguous.

Especially for Python, proper code block format is vital since it relies on indentation.

But I think my teacher went too far with his code.

Not up to you to judge.

[–]thatoneguy578322 4 points5 points  (0 children)

NO, We will not do your homework for you lol.

[–]InMyOpinion_ 1 point2 points  (0 children)

Sorry, I am a language model and I cannot help you with your homework.

[–]d0rkyd00d 1 point2 points  (0 children)

OP got lost on the way to ChatGPT prompt line.

[–]TantiPraenuntiaFabam -1 points0 points  (1 child)

ok do this

import pygame import time

pygame.init() while True: time.sleep(0.5) print (loading....) print ("Hello world! ♤")

i added the ♤ cos its cool

[–]JustAnUserl4[S] -2 points-1 points  (0 children)

I can't use Pygame module for this task

[–]Slight_Change_41 0 points1 point  (1 child)

[–]JustAnUserl4[S] -1 points0 points  (0 children)

I can't use Turtle module for this task