# Dance-Off please help \[python\]

**URL:** <https://discourse.codecombat.com/t/dance-off-please-help-python/10764>\
**Category:** Level Help\
**Created:** [March 1, 2017, 12:26pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764 "2017-03-01T12:26:29Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![George\_Huchins\_Hun](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@George\_Huchins\_Hun](https://discourse.codecombat.com/u/George_Huchins_Hun)\
**Post date:** [March 1, 2017, 12:26pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/1 "2017-03-01T12:26:29Z")

</div>

```python
friend = self.findNearest(self.findFriends())
loop:
    friendpos = friend.pos
    fx = friendpos.x
    fy = friendpos.y
    if self.now() < 6:
        self.move({'x': fx, 'y': 42})
    if self.now() < 14 and self.now() > 6:
        self.move({'x': fx, 'y': fy + 6})
    if self.now() > 14 and self.now() < 17:
        self.move({'x': fx, 'y': fy + 6})

```

i can seem to get this right can someone please help me? my hero stops right before the end

---

<div class="post-metadata">

**Author:** ![Luke10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/luke10/32/19892_2.png) [@Luke10](https://discourse.codecombat.com/u/Luke10)\
**Post date:** [March 1, 2017, 1:36pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/2 "2017-03-01T13:36:13Z")

</div>

I think you need to line up your code more. What is it saying when you run your code? Basically what error is it producing?

---

<div class="post-metadata">

**Author:** ![George\_Huchins\_Hun](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@George\_Huchins\_Hun](https://discourse.codecombat.com/u/George_Huchins_Hun)\
**Post date:** [March 1, 2017, 1:38pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/3 "2017-03-01T13:38:02Z")

</div>

this is what happens from bottom to top

 ![](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/2/22fb6a8ea3df9c5b6b89ad8fa13a681669890c7b.png)  
 ![](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/6/6ef21ff1235ef500aeed197360c1ad872cf78e61.png) ![](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/c/c5d65c3015297c4d45952035c5a6f78464ed5bdb.png) ![](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/9/9c400a3b2e35e4f4ccee032cfae5a03a71ca6d9c.png) ![](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/b/bd886a18419dbaaa12075a1be8fcb0279a51881d.png) ![](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/2/298b75c39e8d55fa99343239555c78bd7615c6d3.png) ![](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/8/811ed89abc3bd7bc865e1ed317ee67008293ce30.png) ![](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/e/eaeed0c5d2e947f1314c6336acf4483093004d71.png)

---

<div class="post-metadata">

**Author:** ![Luke10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/luke10/32/19892_2.png) [@Luke10](https://discourse.codecombat.com/u/Luke10)\
**Post date:** [March 1, 2017, 1:45pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/4 "2017-03-01T13:45:38Z")

</div>

I’m not sure about this. Ask @Bryukh

---

<div class="post-metadata">

**Author:** ![George\_Huchins\_Hun](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@George\_Huchins\_Hun](https://discourse.codecombat.com/u/George_Huchins_Hun)\
**Post date:** [March 1, 2017, 2:06pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/5 "2017-03-01T14:06:43Z")

</div>

ok i will do that  
thank you

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [March 1, 2017, 2:31pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/6 "2017-03-01T14:31:06Z")

</div>

Have you read hints for this level? You are trying to use time as an argument. The logic should time independent. Watch for the nearest friend position only.

---

<div class="post-metadata">

**Author:** ![juraj\_pechac](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/juraj_pechac/32/4987_2.png) [@juraj\_pechac](https://discourse.codecombat.com/u/juraj_pechac)\
**Post date:** [March 1, 2017, 2:36pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/7 "2017-03-01T14:36:51Z")

</div>

![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex016/uploads/codecombat/original/2X/c/c90ea3cb115714f73278994bc11402eaad48f75f.png)

---

<div class="post-metadata">

**Author:** ![George\_Huchins\_Hun](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@George\_Huchins\_Hun](https://discourse.codecombat.com/u/George_Huchins_Hun)\
**Post date:** [March 1, 2017, 2:52pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/8 "2017-03-01T14:52:13Z")

</div>

@Bryukh i read the hints and i can’t seem to figure out the level do you know what im doing wrong?

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [March 1, 2017, 5:48pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/9 "2017-03-01T17:48:23Z")

</div>

> [@George\_Huchins\_Hun](#):
>
> do you know what im doing wrong?

All. Only `while` is correct 🙂 Find the offset from the nearest friend by x and y. Then use move to that friend position with those offsets.

---

<div class="post-metadata">

**Author:** ![George\_Huchins\_Hun](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@George\_Huchins\_Hun](https://discourse.codecombat.com/u/George_Huchins_Hun)\
**Post date:** [March 1, 2017, 8:33pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/10 "2017-03-01T20:33:56Z")

</div>

was i supposed to beat it with a simple move code?

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [March 2, 2017, 5:43am UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/11 "2017-03-02T05:43:42Z")

</div>

You can solve it many ways, however “move tactic” is the simplest one. You can solve it just with one line in while-loop.

---

<div class="post-metadata">

**Author:** ![George\_Huchins\_Hun](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@George\_Huchins\_Hun](https://discourse.codecombat.com/u/George_Huchins_Hun)\
**Post date:** [March 2, 2017, 11:38am UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/12 "2017-03-02T11:38:02Z")

</div>

yes that is exactly what i did then i created a javascript account

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [October 30, 2019, 3:15pm UTC](https://discourse.codecombat.com/t/dance-off-please-help-python/10764/14 "2019-10-30T15:15:45Z")

</div>

Well done for completing the level, but please could you not post working code. It ruins it for others.  
So could you delete it (edit your post and delete the part with the code) and thank you for giving the advice, you can keep that part. It’s just that it’s better to help people understand without telling them the answer.  
Thanks  
Danny
