#:white_check_mark: Python/ Exersim Nº3

40 messages · Page 1 of 1 (latest)

hidden mountain
#

I have other problem

 if power_pellet_active is True:
        return touching_ghost is False
    else:
        return touching_ghost is True```
I have that explain to python when pacman lose, and as well explain when don`t lose

this is the error that give me
ashen basin
#

The function first examines the parameter touching_power_pellet:

    if touching_power_pellet is True:
        return True
    else:
        return False

If this parameter is True the function returns True.
If this parameter is False the function returns False.
The function ends either way, without executing anything else.

#

Do you have an idea how to solve this exercise on a conceptual level?
How would you describe the function to a friend, in English?

ashen basin
#

@hidden mountain You still there?

hidden mountain
#

Yes

#

I understand you say me!

ashen basin
#

I still want to help.
How would you describe to a friend when exactly Pac-Man scores?

hidden mountain
#

when it do waka?

#

sorry I needed to do this jsjsjsjsjsjs

#

ok the conditional doesn't make sense because if it is True and I tell it to return True it gives me the same result for me it doesn't make sense, I don't know if I'm wrong?

#

I'm really sorry, I'm sorry, I just realized something, I'm really stupid.

ashen basin
#

when it do waka?
As far as i know Pac-Man makes "waka" when it moves, even if it does not eat a power pellet or a dot.
if it is True and I tell it to return True it gives me the same result
I'm not sure i understand. Let's try it this way:
The comment in the function tells you what the function should do:
"Pac-Man has scored when a power pellet or dot has been eaten."
The parameter touching_power_pellet tells you whether Pac-Man has just eaten a power-pellet,
the parameter touching_dot tells you whether Pac-Man has just eaten a dot.
Now you need to return True if any of those things is true.
So you need to translate "when a power pellet or dot has been eaten" to Python.

hidden mountain
#

So should I tell python that Pacman scores regardless of whether touching_power_pellet or touching_dot?

hidden mountain
hidden mountain
ashen basin
#

yes it is. some programmers prefer if statements over long and complicated expressions.
so choose what you like more.

hidden mountain
#

But is that within good practice when writing in the language?

ashen basin
#

those are good questions for a code review. after you've submitted a solution you can request one and get a mentoring session with (ideally) more experienced programmer

hidden mountain
#

Now how do I if I have a question with the same exercise, do I edit the post or make a new one?

ashen basin
#

for the same exercise? either way is fine.

hidden mountain
#

ok thanks for you help master!

ashen basin
#

Happy coding, young padawan 🙂

hidden mountain
#

rather

#

I don`t understand what was I writte!

lapis epoch
#

Is there something specific you want help with?

hidden mountain
#

wait!

lapis epoch
#

I've been waiting all week!! I need to wait more?

hidden mountain
#

I was working, sorry! It didn't give me a chance to study anything.

lapis epoch
#

Oh? Am I still supposed to wait? Did you have a question?

hidden mountain
hidden mountain
devout juncoBOT
#

If everything is resolved, we ask that the person who posted the request react to the top/original post with a :white_check_mark: (:white_check_mark:). This indicates to others that this issue has been resolved and locks the thread.
If all the tests pass and you want to further improve your solution, we encourage you to use the "Request a Code Review" feature on the website!

hidden mountain
#

:white_check_mark Python/ Exersim Nº3

#

:white_check_mark: Python/ Exersim Nº3

runic lagoon
#

react to it, not changing the name

lapis epoch
hidden mountain
#

Ahhh ok