About the Challenge Projects category

Welcome to the Challenge Projects category and congratulations on completing a project!

This is a safe space for you to ask questions about any sample solution code and share your work with others! Feedback is a vital component in getting better with coding and all ability levels are welcome here, so don’t be shy!

Remember - your solution might not look like ours, and that’s totally okay! There are multiple ways to complete these projects and you should exercise your creative abilities in doing so. Feel free to ask questions about different methods.

This is a supportive and kind community of people learning and developing their skills. All comments here are expected to keep to our community guidelines

Best practices for asking questions about the sample solution

  • Be specific! Reference exact line numbers and syntax so others are able to identify the area of the code you have questions about.

How do I share my own solutions?

  • If you completed the project off-platform, you can upload your project to your own GitHub and share the public link on the relevant project topic.
  • If you completed the project in the Codecademy learning environment, use the share code link at the bottom of your code editor to create a gist, and then share that link here.

In both cases, you’ll need to get set-up on GitHub! This is a great opportunity to get your feet wet using a critical development tool. Not sure how to get started? We’ve got you covered - read this article for the easiest way to get set-up on GitHub.

5 Likes

World Population II Challenge Project for Feedback
https://discuss.codecademy.com/t/about-the-challenge-projects-category/434328/2?u=dev8126513192

1 Like

WORLD POPULATION Challenge Project for peer Feedback:
https://discuss.codecademy.com/t/about-the-challenge-projects-category/434328/4?u=dev8126513192

1 Like

Hi, i have completed the swift challenge project “Make a Mixtape 101”
I would appreciate if you can give feedback :slight_smile:
This is my version of the “side A & B” part of the project. Not sure to post in the right place, sorry if not

1 Like

Hi,

This is regarding ‘’’ Coded Correspondence Project ‘’’ , Please elaborate how exactly the below code is working?

How offset of 10 is performed? : ‘’’ alphabet[(alphabet_value + 10) % 26]’’’ ??

alphabet = 'abcdefghijklmnopqrstuvwxyz'
msg = "xuo jxuhu! jxyi yi qd unqcfbu ev q squiqh syfxuh. muhu oek qrbu je tusetu yj? y xefu ie! iudt cu q cuiiqwu rqsa myjx jxu iqcu evviuj!" 
#msg = ' ? ,'
punctuation = "?'!., "
new_msg = ''

for letter in msg :
    if letter not in punctuation:
        alphabet_value = alphabet.find(letter)
        new_msg += alphabet[(alphabet_value + 10) % 26]
    else:
        new_msg += letter
print(new_msg)

Thanks in advance.

1 Like

Hello:

I’ve already finished the Number Guesser Challenge, but I’d like to do it again to try and find another way to do it. Where is that challenge available?

Thanks

Hi, please add more challenges or projects with much fewer instructions to fully mastered what we just learned. Thank you

1 Like

that sounds good ! :love_you_gesture: :slightly_smiling_face:

1 Like

Hello fellow Coders,

I’m having trouble completing the challenge projects (i.e. Credit Card Checker & Mysterious organisms) without looking at the solution and was wondering if i will actually encounter this level of complexity in an everyday basis at an entry level job? if anybody wants to share their experience I would greatly appreciate it! thanks!

1 Like

Aqui dejo mi hoja de trucos.
La realice explicando la especificidad.
GitHub page: https://monchitog.github.io.git
GitHub repositorie: GitHub - monchitog/monchitog.github.io

2 Likes

Hello. I’m trying to complete the challenge project called " This is Jeopardy!".

I’m stuck in this question:
2. Write a function that filters the dataset for questions that contains all of the words in a list of words. For example, when the list ["King", "England"] was passed to our function, the function returned a DataFrame of 49 rows. Every row had the strings "King" and "England" somewhere in its " Question".Test your function by printing out the column containing the question of each row of the dataset.

My solution is this:

Filtering a dataset by a list of words

words_questions =
def filter_data(data, words):
for i in words:
for j in data[“Question”]:
if i in j:
if j in words_questions:
pass
else:
words_questions.append(j)
result = pd.DataFrame(words_questions, columns = [“Answer”])
return result

Testing the filter function

filtered = filter_data(jeopardy_data, [“King”, “England”])
print(filtered)

I don’t know why I don’t get the same results of Codeacademy.

muy bien! I’m an English speaker.

I just finished the Gold Medal Metrics project for Java. Here is my solution.

Collecting employee engagement survey tools, using top-notch analytics and quickly taking action on the feedback received may sound super easy, but in reality, each process has hidden hurdles that often go unnoticed. and finally, the strategy is to blame and, at worst, discontinued.

I have completed a Tea Cozy project from the Flexbox chapter, using HTML and CSS. Although it is not yet responsive, I have put forth my best effort to complete it.

My Website Style Guide (shalabyelectronics.github.io)

https://github.com/vldkurov/find-your-hat

2024-03-29T04:00:00Z

I just completed the Challenge Project: Luhn Credit Card Checker in Javascript.

It requires we sort through an array of arrays (credit cards numbers), identify the ones that are invalid numbers, and store them in a separate array of arrays created to hold invalid card numbers. I alo created a second one to hold the “true” or valid credit card numbers though not required.

Though I get the correct results (I think), I have a question about the code.

Credit card numbers are invalid if they contain the wrong number of digits or they do not mass the criteria in the Luhn formula.

I created nested functions, and I found I had to make the same, new array declarations in both functions to achieve the correct results. The code does not work if I delete those same array declarations (let falseCreditCards = let trueCreditCards = ) in either function. I hope that explanation is sufficient.

Like I said, it giuves me the right answers, but I am not sure if it adheres to professional standards.

I even tried passing them from the parent function (findInvalidCards) to the child function (validateCred), but the code still does not solve the need for two separatee array declarions. It works only if I declare them twice.

If any can explain what I have done wrong, and how to correct it, how to improve on the code, I would greatly appreciate the help. Please see the code and Guthub link below:

// All valid credit card numbers const valid1 = [4, 5, 3, 9, 6, 7, 7, 9, 0, 8, 0, 1, 6, 8, 0, 8]; //true const valid2 = [5, 5, 3, 5, 7, 6, 6, 7, 6, 8, 7, 5, 1, 4, 3, 9]; // true const valid3 = [3, 7, 1, 6, 1, 2, 0, 1, 9, 9, 8, 5, 2, 3, 6]; // false = not 16 const valid4 = [6, 0, 1, 1, 1, 4, 4, 3, 4, 0, 6, 8, 2, 9, 0, 5]; // true const valid5 = [4, 5, 3, 9, 4, 0, 4, 9, 6, 7, 8, 6, 9, 6, 6, 6]; // true // All invalid credit card numbers const invalid1 = [4, 5, 3, 2, 7, 7, 8, 7, 7, 1, 0, 9, 1, 7, 9, 5]; // false const invalid2 = [5, 7, 9, 5, 5, 9, 3, 3, 9, 2, 1, 3, 4, 6, 4, 3]; //false const invalid3 = [3, 7, 5, 7, 9, 6, 0, 8, 4, 4, 5, 9, 9, 1, 4]; // false - not 16 const invalid4 = [6, 0, 1, 1, 1, 2, 7, 9, 6, 1, 7, 7, 7, 9, 3, 5]; // false const invalid5 = [5, 3, 8, 2, 0, 1, 9, 7, 7, 2, 8, 8, 3, 8, 5, 4]; // false // Can be either valid or invalid const mystery1 = [3, 4, 4, 8, 0, 1, 9, 6, 8, 3, 0, 5, 4, 1, 4]; //delete - not 16 const mystery2 = [5, 4, 6, 6, 1, 0, 0, 8, 6, 1, 6, 2, 0, 2, 3, 9]; // true const mystery3 = [6, 0, 1, 1, 3, 7, 7, 0, 2, 0, 9, 6, 2, 6, 5, 6, 2, 0, 3]; //delete - not 16 const mystery4 = [4, 9, 2, 9, 8, 7, 7, 1, 6, 9, 2, 1, 7, 0, 9, 3]; // false const mystery5 = [4, 9, 1, 3, 5, 4, 0, 4, 6, 3, 0, 7, 2, 5, 2, 3]; // true // An array of all the arrays above const batch = [ valid1, valid2, valid3, valid4, valid5, invalid1, invalid2, invalid3, invalid4, invalid5, mystery1, mystery2, mystery3, mystery4, mystery5, ]; // Add your functions below: // Cards are invalid for two reasons // 1. The card number is not = 16 // 2. It does not meet the Luhn criteria // performs check on all arrays in nested array const findInvalidCards = (nestedArray) => { let falseCreditCards = []; let trueCreditCards = []; // validates card numbers per luhn criteria const validateCred = (array) => { let falseCreditCards = []; let trueCreditCards = []; let arr = array.map((x) => Number.parseInt(x)); let lastDigit = array.pop(); let total = array.reduceRight( (previousValue, currentValue, index) => index % 2 !== 0 ? previousValue + currentValue : previousValue + ((currentValue *= 2) > 9 ? currentValue - 9 : currentValue), 0 ); let sum = total + lastDigit; let result = sum % 10 == 0 ? true : false; console.log(`Result: ${result}`) result && (array.length == 16) ? trueCreditCards.push(array) : falseCreditCards.push(array); } // stores arrays of <> 16 digits as invalid. nestedArray.forEach(array => { if (array.length !== 16) { falseCreditCards.push(array) } else { validateCred(array); }}); // prints invalid cards console.log() console.log("Invalid Credit Cards:") console.log() falseCreditCards.forEach(card => console.log(card)) console.log() // now id the credit card companies const idInvalidCardCompanies = nestedArray => { nestedArray.forEach(array => { switch (Number(array.slice(0,1))) { case 3: console.log("American Express"); break; case 4: console.log("Visa"); break; case 5: console.log("MasterCard"); break; case 6: console.log("Discover"); break; default: console.log("Company not found.") } })}; idInvalidCardCompanies(falseCreditCards) }; findInvalidCards(batch)

I need help if anyone is out there.

I cannot, for the life of me, wrap my head around this project.

Even the solution code leaves me scratching my head. Specifially, the compareDNA function will not work because otherOrg does not exist. I can fgure out how its created, where its created, and how I can pass it to be compared. That is the present sticking point and I would appreciate assistance. How can I pass a second DNA strand into this function when it does not exist?

I was so proud because I did well in the last challenge. I cannot waste more time trying to figure out how otherObj can juust suddenly exist and be passed in compareDNA(). Here is my code, though I find it embarassing:

Here is the error message. I understand what it means, but I don’thow to fic it because otherOrg cannot exist, and it is not evident to me in the instructions or the solution:

/home/ccuser/workspace/mystery-organism/main.js:31
if (arr[idx] === otherOrg.dna[idx]) {
TypeError: Cannot read property ‘dna’ of undefined
at similarities.dna.reduce (/home/ccuser/workspace/mystery-organism/main.js:31:34)

Here is the code. I rarely ask for help, but I really need it.

// Returns a random DNA base const returnRandBase = () => { const dnaBases = ['A', 'T', 'C', 'G'] return dnaBases[Math.floor(Math.random() * 4)] } // Returns a random single stand of DNA containing 15 bases const mockUpStrand = () => { const newStrand = [] for (let i = 0; i < 15; i++) { newStrand.push(returnRandBase()) } return newStrand } const pAequorFactory = (num, dna) => { return { num: num, dna: dna, mutate() { const randIndex = Math.floor(Math.random() * this.dna.length); let newBase = returnRandBase(); while (this.dna[randIndex] === newBase) { newBase = returnRandBase(); } this.dna[randIndex] = newBase; return this.dna; }, compareDNA(otherOrg) { const similarities = this.dna.reduce((acc, curr, idx, arr) => { if (arr[idx] === otherOrg.dna[idx]) { return acc + 1; } else { return acc; } }, 0); const percentOfDNAshared = (similarities / this.dna.length) * 100; const percentageTo2Deci = percentOfDNAshared.toFixed(2); console.log(`${this.specimanNum} and ${otherOrg.specimanNum} have ${percentageTo2Deci}% DNA in common.`); }, } }; const pAequor = pAequorFactory(1, mockUpStrand()) console.log(pAequor) pAequor.mutate() pAequor.compareDNA()

I. Here is a summary of the major issues:

Below, I have described the issue and what I’ve tried to do though it’s been approaching two weeks (?) since I started reaching out. I have dumped everything here as Customer Service suggested:

I need help. I really do. I have been round and round with it for weeks at this point; and they have helped with some of the technical difficulties. But this situation has persisted for weeks and I still don’t have a solution to this problem.

I would much prefer to understand it than to plagarize someone else’s solution code.

I hope you understand.

(I have also been through all the exercises and recommended documents several times at this point).

Specifically it falls apart when I first go to work on the compareDNA function.

It does not recognize the argument otherOrg. I do not see how it’s created, and how I can pass it to be compared.

That is the present sticking point and I would appreciate assistance. How can I pass a second DNA strand into this function when it does not exist? When it is not created anywhere in the code?

I was so proud because I did well in the last challenge. I cannot waste more time trying to figure out how otherObj can just suddenly exist and be passed in compareDNA(). Here is my code, though I find it embarassing:

II. Here is also the error message.

Here is the message telling me OtherOrg has no dna. It is not defined. Yet, I do not understand how it becomes an object with dna and a number to start. I understand what it means, but I don’t how to fix this problem because otherOrg cannot exist, and it is not evident to me in the instructions or the solution.

(Again, I have been over everything several times and it’s been going on two weeks since I first reached out for help).

home/ccuser/workspace/mystery-organism/main.js:32 **if (arr[idx] === otherOrg.dna[idx]) {** ^ TypeError: Cannot read property 'dna' of undefined at similarities.dna.reduce (/home/ccuser/workspace/mystery-organism/main.js:32:34) at Array.reduce (native) at Object.compareDNA (/home/ccuser/workspace/mystery-organism/main.js:31:37) at Object.<anonymous> (/home/ccuser/workspace/mystery-organism/main.js:50:15) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.runMain (module.js:605:10)

III. Here is the code as it stands.

I think I have asked for help once in the past year. And I have been a member for two years.

/ Returns a random DNA base const returnRandBase = () => { const dnaBases = ['A', 'T', 'C', 'G'] return dnaBases[Math.floor(Math.random() * 4)] } // Returns a random single stand of DNA containing 15 bases const mockUpStrand = () => { const newStrand = [] for (let i = 0; i < 15; i++) { newStrand.push(returnRandBase()) } return newStrand } const pAequorFactory = (speciNum, dna) => { return { speciNum, dna, mutate() { const randomBase = Math.floor(Math.random() * this.dna.length); let newBase = returnRandBase(); while (this.dna[randomBase] === newBase) { newBase = returnRandBase(); } this.dna[randomBase] = newBase; return this.dna; }, **compareDNA(otherOrg) {** ** const similarities = this.dna.reduce((acc, curr, idx, arr) => {** ** if (arr[idx] === otherOrg.dna[idx]) {** (The problem starts here. It does not recognize otherOrg as an objective with DNA attached, and thoug return acc + 1; } else { return acc; } }, 0); const percentOfDNAshared = (similarities / this.dna.length) * 100; const percentageTo2Deci = percentOfDNAshared.toFixed(2); console.log(`${this.specimanNum} and ${otherOrg.specimanNum} have ${percentageTo2Deci}% DNA in common.`); }, } }; const pAequorStrand = pAequorFactory(1, mockUpStrand()); pAequorStrand.mutate() pAequorStrand.compareDNA() console.log("Print PAequorFactory") console.log(pAequorStrand) console.log("Print Mutate Strand") console.log(pAequorStrand.mutate()) console.log("Print compareDNA Strand") console.log(pAequorStrand.compareDNA())

**IV. Here is the detailed description of the programming issue as sent to Customer Service last week with links to everything. I don’t have the code on Github yet. **

I need to post because I am stumped on this exercise.

I really need someone to help me understand how the solution code works (see main.js attached) because it confounds me at this point.

In case you cannot see my work, I will post my code (as it stands now) below with the black background. The error message is beneath it. But it does not work as it should. As advised in the assignment, I reviewed the course materials for factory functions several times and watched the Get Unstuck video for the previous Meal Maker exercise, several times. But she does not really address this issue.

How to pass a previously non-existent argument into the method in the factory function when it does not exist?

I’ve looked for examples in outside resources. Though I refuse to steal the work of others, I have reviewed complete project code (Mysterious Organism) produced by others, looking for clues. Sometimes, it works, but I cannot replicate their results. I prefer to submit my own work. I need to learn how to solve the problem, not copy it.

3. The sticking point is the argument “otherOrg” passed to the compareDNA method (see my code below).

That argument (otherOrg) is a HUGE mystery to me. I have been near tears (honestly) because I can make no sense of it, and it makes me feel stupid. (The error message stating it is not defined is below the code I posed below this response). At this point, it’s big mess and I need someone to walk me through it whether online or on the phone.

I do not understand how I can pass an argument not created anywhere in the code to that method and assign it a number and a DNA strand. “otherOrg” exists as an argument passed into in the compareDNA() method (out of thin air) and used inside that method. It is supposed to represent a strand of DNA to “compare” to the existing strand of DNA looking for similarities.

I understand the assignment conceptually. I know what I am supposed to do, but I obviously don’t understand how to assign a new DNA strand to otherOrg that can be compared to the previous one, collecting the similarities at the identical indexes.

As I stated above, I receive an error message stating it is “undefined” below under my code.

I just renewed for a second year in February. I have asked maybe one-two questions in more than than one year.

In all honesty, I don’t like to ask questions because it means waiting. By that, I mean I don’t ask unless I am truly stumped trying to solve the problem and unable to locate outside resources that explain it so that I can understand. So a) the original problem was not being able to post this question to the forum, but b) enough time has been wasted at this point I need direct help with the coding problem too.

I don’t even know if that forum is active since it seems like several years since there has been any activity.

If so, there is nothing telling the user, and nowhere else to go for help.

In addition, I also have a serious, legal and permanent disability called [small-fiber sensory neuropathy](Small Fiber Sensory Neuropathy | Johns Hopkins Peripheral Nerve Center, which actually means intense frustration causes panful parathesia (a burning prickly painful sensation). It just complicates my ability to solve the problem. It’s like having extreme, globalized fibromyalgia.

It hurts enough that I need to stop. No kidding.

Thank you in advance for your help.

Sincerely.

Robert Pfaff

My code:

I made some progress with the code. The second object is at least passing through the compareDNA( function and I am getting results on the percentage of shared DNA bases.

// Returns a random DNA base const returnRandBase = () => { const dnaBases = ['A', 'T', 'C', 'G'] return dnaBases[Math.floor(Math.random() * 4)] } // Returns a random single strand of DNA containing 15 bases const mockUpStrand = () => { const newStrand = [] for (let i = 0; i < 15; i++) { newStrand.push(returnRandBase()) } return newStrand } const pAequorFactory = (specimanNum, dna) => { return { specimanNum, dna, mutate() { console.log(paequor_obj1.specimanNum , paequor_obj1.dna) return const randIndex = Math.floor(Math.random() * this.dna.length); let newBase = returnRandBase(); while (this.dna[randIndex] === newBase) { newBase = returnRandBase(); } this.dna[randIndex] = newBase; return this.dna; }, compareDNA(paequor_obj2) { const randIndex = paequor_obj2; const similarities = this.dna.reduce((prev, curr, index, array) => { if (array[index] === paequor_obj2[index]) { return prev + 1; } else { return prev; } }, 0); const percentOfDNAshared = (similarities / this.dna.length) * 100; const percentageTo2Deci = percentOfDNAshared.toFixed(2); paequor_obj2.dna = paequor_obj2; paequor_obj2.specimanNum = specimanNum+1; console.log(`${this.specimanNum} and ${(paequor_obj2.specimanNum)} : ${percentageTo2Deci}% DNA in common.`); }, willLikelySurvive() { const cOrG = this.dna.filter(base => base === "C" || base === "G"); return cOrG.length / this.dna.length >= 0.6; }, }}; // Set speciman number to zero. specimanNum = 0; // Run 30 scanearios. // Run 30 each method 30 times. for (let x=0; x<30; x++) { // Increase speciman number each time. // Create DNA strand paequor_obj1 = pAequorFactory(specimanNum++, mockUpStrand()) paequor_obj1 paequor_obj1.mutate() paequor_obj1.compareDNA(mockUpStrand()) paequor_obj1.willLikelySurvive() }