The Final Ascent explainer


#42

This is confusing so can you help me.


#43

Hi @Luke,

Looks like you have an extra if statement inside your else block, as well as an extra element = 'rope' at the top of your for loop. Have a look at @Venkat_Sudheer_Reddy’s screenshot to get an idea of what the solution can look like.

H :slight_smile:


#44

So do I have to add if else statement


#45

I trying to do this lesson. …but It is not successful. …please help me to fix this code


Please show me to what is the wrong of code. …


#46

Hey @KAVEESHA_NIROOSHAN,

Looks like you’ve just got one small issue: an extra line of code at the very top of your for loop block.

The line of code element === 'rope' (before the if statements) isn’t doing anything and is unnecessary code. Try removing it and your solution should work!

H :slight_smile:


What's wrong with my code?
#47

Hi @Grasshopper_Heather,

You might consider adding a suggestion directly in the instructions to tell people which puzzle to look at for concatenation.

–Scott.


#48

Help, pls.


#49

Hey @I_Hate_Java_and_JS (you’ve gotten really far through the app with a name like that :stuck_out_tongue: )

You’ve got the right idea on how to complete this, but you’ve added in too many if statements. You only need one if-else statement; so that the code does one thing if element === rope, and a different thing if element is not equal to rope.

You may want to take a look at @Venkat_Sudheer_Reddy or @NageshJ.C posts on this thread to get an idea of what the code could look like.

H :slight_smile:


#50

Maybe u can use this
Its work


#51

Does that work? If it does, it shouldn’t.


#52


#53

This is my final code :ok_hand:t2:


#54


Took me long enough :joy:


#55

grasshopper


#56

Screenshot_2018-04-15-17-44-51Screenshot_2018-04-15-17-45-12


#57

Hey @Xegoq,

Firstly, well done on getting to the final puzzle in Fundamentals! That’s awesome!!

You have created code with the same output, but not quite solved the puzzle.

Rather than using three if statements, the puzzle is looking for one if-else statement. This will allow you to solve the puzzle with less code.

Inside the test () of the if-else statement, check for the element being equal to 'rope'. Then, inside the first block {} print out a message for when you find a rope. In the else block {} print out a different message letting you know the rope hasn’t been found yet.

If you’d like to reference the element in your print() function, you can use the + symbol to combine the variable and strings together, like print(element + ' is not useful right now').

I hope this helps — but let me know if you’re still having issues!

H :slight_smile:


#58


#59

You have the right idea; however, your current code will always say that A map is not useful right now for every item, map or not, except for rope. You would want to do what Heather said:

to get the desired result. Also, the combining of strings (concatenation) will continue to be a useful feature in most languages and is important to learn early because it’ll make your life easier down the road. :grin:


#60

I am on the level “the final ascent”. And i made this code : Screenshot_20180619-203815
I just want to know why would it not work. Thanks.


#61

Check out this post on the explainer page for this puzzle.

–Frankie