Challenge 2 Megathread

For any and all questions relating to Challenge 2 :point_down: post away!

I believe there must be a mistake in the instructions

Required format: #DOT!

but none of the options will add the extra characters. I was able to solve it because there wasn’t any other way around it, but please verify what the output must be.

3 Likes

If the solution you picked is correct but you’re not sure how to add extra characters to a string, I would recommend looking at each of the functions shown in your choice.

Yeah, I know how to add the extra characters. It’s just that none of the solutions will have that part in the functionality.

2 Likes

I think the ‘+’ operator is implied to be used to add extra characters. It’s included in every option though.

3 Likes

I went overboard and f-string’d it with the concatenated # and ! symbols. I should’ve checked the multiple choice answers first. :sweat_smile:

2 Likes

Of course, the ‘+’ operator is used for concatenating strings together.

Solved it? @Eltrion

1 Like

Hello everyone! I am Kelvin, a data science mentor with Lighthouse labs. I will be moderating this forum for the next 2 hours. Please you can ask any questions and feel free to discuss amongst yourselves without sharing answers.

2 Likes

Hi all, with fear of getting kicked/freezed out from Jupyter Notebook and lose my code (almost happened yesterday), I used another IDE today but forgot to paste my code into the Notebook before submitting my answer. Will that affect my points or chances in any way?

I was very confused about this question; I first went to the articles that were linked under the question but that confused me even more. I would’ve appreciated an example of how to add the extra characters (# and !) because I did not understand how to format those so they would appear.

2 Likes
  • Won’t affect points as points are based on whether they get the correct multiple choice answer
  • In terms of saving the code, if you want to keep it for future reference, you can copy it somewhere else as suggested in the FAQ. Once you complete the challenge, it’ll show the solution version. But what you run in the code/notebook doesn’t affect points
  • The freezing of BinderHub I assume is referring to that 1hr outage yesterday - which shouldn’t happen again

For those stuck on adding multiple methods to a variable string, don’t overthink it - just add another method the same way you added it the first time, example: variable_name.title().strip()

Here’s all the Py String methods for the curious minded: Python String Methods

9 Likes

OMG i did .strip().upper() and it was giving error. Then I switched the order to .upper().strip() and now it worked. That took me more than 1hr to figure out!!!

3 Likes

Where should I go to understand the multiple choice responses of this challenge? I connected strings to get #DOT! to show in the terminal. I think I’m going somewhere?

1 Like

This is badly worded question. They example shown talks about using f’ to make concatenated strings, while in the question, they want you to use:
“string 1” + " when added" + " together" to produce “string 1 when added together”.

4 Likes

How did you concatenate the strings together? Did you use the f’{} method or did you use another way?

They want you guys to use a few string methods to:
-remove all the whitespace
-make all the letters UPPERCASE

Look up “string methods” and I’m sure you’ll find a few. Finally they want you to use a form of string concatenation not shown in the example (are there other ways to concatenate strings without f-string?).
(Once again, Google is your friend)

1 Like

I’m very new to coding (have never done it before) but I believe what I used would not be considered the f’{} string.

The alternatives do not show the answer but the way to get it.

1 Like

In the tutorial section above the challenge it links to a page about python strings. Lots of good information there which explains the options.