Welcome to challenge 3! Use this thread for any and all questions relating to challenge 3.
Yet another Youtube video guide for the Day 3 Challenge…
Obvious warning that a solution is included and that you should attempt the challenge before watching this video.
For me, this is an opportunity to test my video making skills with predetermined content in attempt to improve. I hope to keep this up for all 21 days of the challenge!
I only noticed today that you’re making videos. Nice work. My main suggestion is: when you’re driving, please focus on driving and record videos after you get to where you’re going.
It’s very interesting, thanks for taking the time! I just wish you used a more novice way to solve the challenges. I was expecting an if statement so you kinda lost me at the end…
Maybe someone has already pointed it out, but shouldn’t the second output in the question be [2,1,2]?
You are right, that should be [2,1,2]!
I love your video. I decided to go the if statement route but I can’t seem to differenciate between each candidates. My code just adds all the votes together in one big mush. Help?
The if statement approach will work, but you are returning that single candidate’s vote total after updating and updated array of votes.
Hello, am I seeing wrong or is the names array wrong? It should have 3 different names, and I am getting an error when I run my code (my code is not in this picture)
I actually got my code running, but I still have that doubt of why the name Sally is there twice
Ok, I passed the challenge by using the provided hint, but I don’t understand why. I’m posting because I imagine other people are having the same problem.
I put in some failing code in order to produce this output:
Why does it seem like the program is passing TWO arrays with each input? The directions say that the code will pass the current vote tally and then the new votes but the function only accepts one name and one array.
I can’t figure out any sensible math that makes the numbers in that image correct either.
Can someone explain to me what is going on here? Again, I passed the challenge but I don’t understand why the code I submitted should work, given what I see here.
The first array is the original vote, second is with the added vote (for Sally it went from 2 to 3, Tim from 4 to 5, Beth from 0 to 1)
make sure you’re using “else if” to go from one if statement to the next. And in the last if statement you just have “else”
This is “testing” and how the problems are evaluated to be correct or incorrect. It’s taking the function you are writing and testing it with values. The second array you are seeing is what it expects as a result.
Yes, but the function only accepts two inputs.
Ok, thanks, I understand now!
WaivedAnswer has the right explanation. Returning updatedVotes vs returning updatedVotes are different things. The first is an array, the second is a number.
This is gonna sound dumb but how do I access challenge 3? I’ve done challenges 1 and 2 but for some reason I can’t find the link for challenge 3. help lol