[Tutor] Livewires questions
Tonu Mikk
tmikk at umn.edu
Thu Jul 26 20:42:03 CEST 2007
Tiger12506 wrote:
>> Based on your guidance, I figured it out. I need to use a return
>> statement, which I had not encountered before. Now I wrote my
>> definitions in this way:
>>
>> def collided():
>> if player_x == robot_x+0.5 and player_y == robot_y+0.5:
>> return True
>>
>
> This could be simplified more.
> Here's an example as a hint. These two functions are the same.
>
> def f():
> if a == b and c == d:
> return True
>
> def g():
> return (a==b and c == d)
>
>
I got it. I will do it like this:
def collided():
return (player_x == robot_x+0.5 and player_y == robot_y+0.5)
Thank you,
Tonu
--
Tonu Mikk
Educational Technology Consultant
Digital Media Center - dmc.umn.edu
tmikk at umn.edu 612 625-9221
More information about the Tutor
mailing list