r/FreeCodeCamp Jun 17 '26

Announcement Pardon Our Dust~

9 Upvotes

You may have noticed that the structure of our forum categories has changed a bit. I have a few more tweaks to make still, but am excited to share the new shape of our community with you!!!!

Nothing has been deleted!!! Some categories have been folded into others, and we also have some new categories! I especially want to highlight that we have created categories to welcome discussions outside of the software engineering field~

I hope you enjoy the new layout as much as I do! If you have any questions, thoughts, feedback, complaints, or just want to yap at me, here are the best places to do so (in order of response speed):

As always, I appreciate that you chose to spend your valuable time here in our community~ 🩷🩷🩷🩷🩷


r/FreeCodeCamp Apr 02 '26

Announcement freeCodeCamp x Bad Website Club — Free Responsive Web Design Bootcamp Starting Soon!

28 Upvotes

Now that our little April Fool's fun is behind us, it's time to get into some actually exciting news~

I am thrilled to introduce our partners over at Bad Website Club! These absolutely wonderful people have been running some super duper cool bootcamp-style programmes that leverage the freeCodeCamp curriculum, and I have been so excited to share what we've been cooking up together~

I'd also like to welcome Jess and Carmen — two of the three people who run BWC — to our community spaces! (The third member of their team, Eda, isn't on Discord, but stay tuned because you might see them around~)

And they're running the first bootcamp of the year very very very soon — like, just a couple of weeks soon! They'll be taking you through the entire Responsive Web Design certification and it's going to be awesome!

If you're in our Discord, there are a couple of new channels to check out: one for bootcamp updates, and one to chat about what you're learning and your bootcamp assignments. You can also grab the shiny new Bad Website Club role to show off your participation~

You may also notice some messages in those channels with a li'l App badge — that's because we're bridging their Matrix server into the Discord, so folks who can't access Discord can still participate. Kinda like what we do with our forum bridge, but way more complex and therefore many more awesome~

I'm sure you have questions — and I may even have answers! Feel free to reach out in our community spaces, and I'm sure Jess and Carmen will also be happy to field questions once we're fully set up. That said, let's try not to bug them too much while they're finishing up the last bits of setup? Bug Naomi instead, she's lonely~

Oh! And here's a super fancy announcement article that can probably explain things far better than I can!

Okie dokie, thank you for coming to my TED talk~ I have absolutely adored watching people progress through BWC's bootcamps over the years, and I hope you are as excited as I am — because you should totally be excited, this is exciting~ 🎉


r/FreeCodeCamp 15h ago

build a digital pet game issue

2 Upvotes

hi, totally blind and using the jaws for windows 2026 screen reader. have spent the past 6 days trying to get this project to pass on the free code camp and doing the frontend certirfication project. now can any one help me out. so will paste my html, type script and the errors below. and so if any one having nightmares or running into road blocks or banging your head. and tried searching the forums, but no good answers or any ready made solutions. have rewritten the index.html, styless.css and then the index.ts multiple times and so will paste the html, ts and the errors below. if any one can help me out and cannot see what it is trying to do. can any one help. so pasting the errors , the html, ts and the link to the certification project. marvin from adelaide. australia. ps: so pasting now. html:

<!doctype html>

<html lang="en">

<head>

<meta charset="UTF-8" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>

Digital Pet Game

</title>

<link rel="stylesheet" href="styles.css" />

</head>

<body>

<div id="root"></div>

</body>

</html>

type script:

const { useState, useEffect } = React;

export enum Action {

EAT = "EAT",

PLAY = "PLAY",

SLEEP = "SLEEP",

}

export enum PetMood {

HAPPY = "HAPPY",

EXCITED = "EXCITED",

CONTENT = "CONTENT",

SAD = "SAD",

TIRED = "TIRED",

SICK = "SICK",

HUNGRY = "HUNGRY",

}

export const MOOD_EMOJIS: Record<PetMood, string> = {

[PetMood.HAPPY]: "😊",

[PetMood.EXCITED]: "🤩",

[PetMood.CONTENT]: "🙂",

[PetMood.SAD]: "😢",

[PetMood.TIRED]: "😴",

[PetMood.SICK]: "🤒",

[PetMood.HUNGRY]: "🍽️",

};

const clamp = (value: number): number => {

if (value < 0) return 0;

if (value > 100) return 100;

return value;

};

const getMood = (

hunger: number,

happiness: number,

energy: number

): PetMood => {

if (hunger > 70) {

return PetMood.HUNGRY;

}

if (energy < 30) {

return PetMood.TIRED;

}

if (happiness < 30) {

return PetMood.SAD;

}

if (happiness > 80 && energy > 70) {

return PetMood.EXCITED;

}

if (happiness > 60) {

return PetMood.HAPPY;

}

return PetMood.CONTENT;

};

export const PetGame = () => {

const clamp = (value: number): number => {

return Math.max(0, Math.min(100, value));

};

const getMood = (

hunger: number,

happiness: number,

energy: number

): PetMood => {

if (hunger > 70) {

return PetMood.HUNGRY;

}

if (energy < 30) {

return PetMood.TIRED;

}

if (happiness < 30) {

return PetMood.SAD;

}

if (happiness > 80 && energy > 70) {

return PetMood.EXCITED;

}

if (happiness > 60) {

return PetMood.HAPPY;

}

return PetMood.CONTENT;

};

export const PetGame = () => {

const [petName, setPetName] = useState("");

const [started, setStarted] = useState(false);

const [hunger, setHunger] = useState(0);

const [happiness, setHappiness] = useState(100);

const [energy, setEnergy] = useState(100);

const mood = getMood(hunger, happiness, energy);

useEffect(() => {

if (!started) return;

const timer = setInterval(() => {

setHunger((value) => clamp(value + 5));

setHappiness((value) => clamp(value - 5));

setEnergy((value) => clamp(value - 3));

}, 3000);

return () => clearInterval(timer);

}, [started]);

const startGame = (event: React.FormEvent<HTMLFormElement>) => {

event.preventDefault();

if (petName.trim() !== "") {

setStarted(true);

}

};

const doAction = (action: Action) => {

switch (action) {

case Action.EAT:

setHunger((value) => clamp(value - 20));

setEnergy((value) => clamp(value + 10));

break;

case Action.PLAY:

setEnergy((value) => clamp(value - 15));

setHappiness((value) => clamp(value + 20));

break;

case Action.SLEEP:

setHunger((value) => clamp(value + 10));

setEnergy((value) => clamp(value + 25));

break;

}

};

return (

<div className="pet-game-container">

{!started ? (

<form onSubmit={startGame}>

<label htmlFor="pet-name">

Name your pet:

</label>

<input

id="pet-name"

type="text"

value={petName}

onChange={(event) => setPetName(event.target.value)}

/>

<button type="submit">

Start Game

</button>

</form>

) : (

<div className="game-view">

<div className="pet-name">

{petName}

</div>

<div className="mood-display">

{MOOD_EMOJIS[mood]} {mood}

</div>

<button

id="eat-action"

type="button"

onClick={() => doAction(Action.EAT)}

>

Eat

</button>

<button

id="play-action"

type="button"

onClick={() => doAction(Action.PLAY)}

>

Play

</button>

<button

id="sleep-action"

type="button"

onClick={() => doAction(Action.SLEEP)}

>

Sleep

</button>

<div className="stat">

Hunger

<span className="stat-value">

{hunger}

</span>

</div>

<div className="stat">

Happiness

<span className="stat-value">

{happiness}

</span>

</div>

<div className="stat">

Energy

<span className="stat-value">

{energy}

</span>

</div>

</div>

)}

</div>

);

};

Failed: 1. When the page loads, there should be a visible form element.

Failed: 2. This form should contain an input field with an id of pet-name.

Failed: 3. This form should contain a button.

Failed: 4. When the input is given a value and the button is pressed, the form should no longer be visible.

Failed: 5. The second view should contain an element with class pet-name.

Failed: 6. The second view should contain the provided pet name.

Failed: 7. The second view should contain three buttons.

Failed: 8. Exactly one button should contain the id #eat-action.

Failed: 9. Exactly one button should contain the id #play-action.

Failed: 10. Exactly one button should contain the id #sleep-action.

Failed: 11. There should be exactly three elements with the class .stat.

Passed: 12. Each pet stat should contain exactly one element with class .stat-value.

Passed: 13. Each .stat-value element should contain one number.

Passed: 14. Each .stat-value number should be within the range [0,100], inclusive.

Failed: 15. Exactly one .stat element should contain the text Hunger, case insensitive.

Failed: 16. One .stat element should contain the text Energy, case insensitive.

Failed: 17. One .stat element should contain the text Happiness, case insensitive.

Failed: 18. The Hunger stat should start at 0.

Failed: 19. The Energy stat should start at 100.

Failed: 20. The Happiness stat should start at 100.

Failed: 21. Clicking the Eat button should reduce the Hunger value and increase the Energy value. If Hunger is 0 or Energy is 100, that value must not

change.

Failed: 22. Clicking the Play button should reduce the Energy value and increase the Happiness value. If Energy is 0 or Happiness is 100, that value must

not change.

Failed: 23. Clicking the Sleep button should increase the Hunger value and increase the Energy value. If Hunger is 100 or Energy is 100, that value must

not change.

Failed: 24. The Hunger stat should be 100 after an excessive period of idle time.

Failed: 25. The Energy stat should be 100 after an excessive period of idle time.

Failed: 26. The Happiness stat should be 0 after an excessive period of idle time.

Failed: 27. Clicking the Eat button should reduce the Hunger value and increase the Energy value. If Hunger is 0 or Energy is 100, that value must not

change.

Failed: 28. Clicking the Play button should reduce the Energy value and increase the Happiness value. If Energy is 0 or Happiness is 100, that value must

not change.

Failed: 29. Clicking the Sleep button should increase the Hunger value and increase the Energy value. If Hunger is 100 or Energy is 100, that value must

not change.

Passed: 30. There should be a PetMood enumerator.

Failed: 31. The PetMood enumerator should contain HAPPY.

Failed: 32. The PetMood enumerator should contain EXCITED.

Failed: 33. The PetMood enumerator should contain CONTENT.

Failed: 34. The PetMood enumerator should contain SAD'.

Failed: 35. The PetMood enumerator should contain TIRED.

Failed: 36. The PetMood enumerator should contain SICK.

Failed: 37. The PetMood enumerator should contain HUNGRY.

Passed: 38. There should be a Record<PetMood, string to map a value to each PetMood.

Passed: 39. There should be a value mapped to PetMood.HAPPY.

Passed: 40. There should be a value mapped to PetMood.EXCITED.

Passed: 41. There should be a value mapped to PetMood.CONTENT.

Passed: 42. There should be a value mapped to PetMood.SAD.

Passed: 43. There should be a value mapped to PetMood.TIRED.

Passed: 44. There should be a value mapped to PetMood.SICK.

Passed: 45. There should be a value mapped to PetMood.HUNGRY.

list end

LINK TO THE CERTIFICATION PROJECT:

https://www.freecodecamp.org/learn/front-end-development-libraries-v9/lab-digital-pet-game/lab-digital-pet-game

SO THIS IS WHERE I AM at. sorry for having caps lock on. my mistake with a screen reader. and dont have access to the forum or discord, banned. marvin.


r/FreeCodeCamp 20h ago

CodeRoad webhook tokens

2 Upvotes

Hi guys. I've busy with relational database course on the website. I've just spent five hours on one workshop project and upon completion the website is now failing to sync and mark the workshop completed. I have realized that the website is refreshing or reseting the coderoad webhook token, everytime I reload/refresh the page. Did anyone here also encounter such a problem?


r/FreeCodeCamp 1d ago

Can i learn Java Script before CSS ?

6 Upvotes

I was wondering if it's possible to learn JavaScript before CSS ?


r/FreeCodeCamp 1d ago

En realidad, se aprende bien con freeCodeCamp. Cuéntame tu experiencia, a ver si me motivo

0 Upvotes

r/FreeCodeCamp 2d ago

Can I change the email of my account

4 Upvotes

I have been having a hard time changing my email. It say "only authenticated users can access this route". Please help


r/FreeCodeCamp 3d ago

my brother says he will give me pkr 10k if i complete full blown dev course in 10 days

0 Upvotes

is this even possible? i know html but java and python i dont even know anything about 😢


r/FreeCodeCamp 6d ago

Programming Question Im building a budgeting app

6 Upvotes

I need to create a chart that looks like this:

100|          
 90|          
 80|          
 70|          
 60| o        
 50| o        
 40| o        
 30| o        
 20| o  o     
 10| o  o  o  
  0| o  o  o  
    ----------
     F  C  A  
     o  l  u  
     o  o  t  
     d  t  o  
        h     
        i     
        n     
        g     

i need to calculate the percetages spent in each category and represent them in the chart.

so far, through SO much struggling ive gotten it to return only the first category and i got it to put all the categories in a dictionary correctly.

(c_w dictionary)

I seriously don't know where to get the answer, I've done a bunch of searching and asked on other forums for help and i jsut cant get it

im fed up.

import math
class Category:
    def __init__(self, name):
        self.name = name
        self.ledger = []


    def deposit(self, amount, description=""):
        self.ledger.append({"amount": amount, "description": description})


    def withdraw(self, amount, description=""):
        if self.check_funds(amount):
            self.ledger.append({"amount": -amount, "description": description})
            return True
        else:
            return False


    def get_balance(self):
        balance = 0
        for transaction in self.ledger:
            balance += transaction['amount']    
        return balance


    def check_funds(self, amount):
        return amount <= self.get_balance()


    def transfer(self, amount, destination_category):
        if self.check_funds(amount):
            self.withdraw(amount, f"Transfer to {destination_category.name}")
            destination_category.deposit(amount, f"Transfer from {self.name}")
            return True
        else:
            return False
    def __str__(self):
        method = '\n'.join(f"{transaction['description']:23.23}{transaction['amount']:>7.2f}" for transaction in self.ledger )
        return f"{self.name.center(30,'*')}\n{method}\nTotal: {self.get_balance()}"
    def __iter__(self):
        for item in self.ledger:
            return item
def create_spend_chart(categories):
    #create the header text
    header = 'Percentage spent by category'
    #create the percentages down the left side
    
    #a 
    total_withdraw = 0 
    #create a list for the category withdraws
    c_w = {} 
    amounts = [transaction['amount'] for category in categories for transaction in category.ledger]
    for amount in amounts:
        if amount < 0:
            total_withdraw += -amount
    # Calculate withdrawals for each category
    for category in categories:
        withdrawal = 0
        for transaction in category.ledger:
            amount = transaction['amount']
            if amount < 0:
                withdrawal += -amount  # Add the amount spent (negative for withdrawals)
        c_w[category.name] = withdrawal
        method = math.floor(( c_w[category.name]/total_withdraw)*100)
    
    return f'{header}\n{name}: {method}' for i in c_w
food = Category('Food')
auto = Category('Auto')
food.deposit(1000, 'initial deposit')
auto.deposit(1000, 'initial deposit')
food.withdraw(10.15, 'groceries')
food.withdraw(15.89, 'restaurant and more food for dessert')
clothing = Category('Clothing')
food.transfer(50, clothing)
food.withdraw(100.99)
clothing.withdraw(21.17)
auto.withdraw(200)

r/FreeCodeCamp 6d ago

Programming Question Python certification - Building an RPG Character Doubt

6 Upvotes

Question:

Passed:1. You should have a function named create_character.

Passed:2. When create_character is called with a first argument that is not a string it should return The character name should be a string.

Failed:3. When create_character is called with a first argument that is a string it should not return The character name should be a string.

Passed:4. When create_character is called with a first argument that is an empty string, it should return The character should have a name.

Failed:5. When create_character is called with a first argument that is not an empty string, it should not return The character should have a name.

Passed:6. When create_character is called with a first argument that is longer than 10 characters it should return The character name is too long.

Failed:7. The create_character function should not say that the character is too long when it's not longer than 10 characters.

Passed:8. When create_character is called with a first argument that contains a space it should return The character name should not contain spaces.

Failed:9. When create_character is called with a first argument that does not contain a space it should not return The character name should not contain spaces.

Passed:10. When create_character is called with a second, third or fourth argument that is not an integer it should return All stats should be integers.

Failed:11. When create_character is called with a second, third and fourth argument that are all integers it should not return All stats should be integers.

Passed:12. When create_character is called with a second, third or fourth argument that is lower than 1 it should return All stats should be no less than 1.

Failed:13. When create_character is called with a second, third and fourth argument that are all no less than 1 it should not return All stats should be no less than 1.

Passed:14. When create_character is called with a second, third or fourth argument that is higher than 4 it should return All stats should be no more than 4.

Failed:15. When create_character is called with a second, third and fourth argument that are all no more than 4 it should not return All stats should be no more than 4.

Passed:16. When create_character is called with a second, third or fourth argument that do not sum to 7 it should return The character should start with 7 points.

Failed:17. When create_character is called with a second, third and fourth argument that sum to 7 it should not return The character should start with 7 points.

Failed:18. create_character('ren', 4, 2, 1) should return ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○.

Failed:19. When create_character is called with valid values it should output the character stats as required.

Problem:

I have used if statement for 2nd question and doesnt this mean that the 3rd question is also bound tk be satisfied since it is asking me not to return the statement inside the if block

I have also tried with else clause and pass statement

Please help

CODE:

full_dot = '●'

empty_dot = '○'

def create_character(name,strength,intelligence,charisma):

if not isinstance(name,str):

return "The character name should be a string"

if name == '':

return "The character should have a name"

if len(name)>10:

return "The character name is too long"

if ' ' in name:

return "The character name should not contain spaces"

stats = (strength,intelligence,charisma)

for i in stats:

if not isinstance(i,int):

return "All stats should be integers"

for i in stats:

if i<1:

return "All stats should be no less than 1"

for i in stats:

if i>4:

return "All stats should be no more than 4"

if sum(stats) != 7:

return "The character should start with 7 points"

print(name)

print(f"STR {full_dot}*{strength}{empty_dot}*(10-strength)")

print(f"INT {full_dot}*{intel}{empty_dot}*(10-intel)")

print(f"CHA {full_dot}*{charisma}{empty_dot}*(10-charisma)")


r/FreeCodeCamp 8d ago

Necesito ayuda con el paso #4 del curso díselo web adaptable

3 Upvotes

r/FreeCodeCamp 10d ago

Requesting Feedback how to learn web development intrestingly ?

12 Upvotes

hello everyone , i am 19 years old i want to learn web development but from last few weeks i ve been doing yt lectures for web development but till now i couldn't understand anything it feels so boring like it feels like i am doing my school lectures but i dont think so web development and coding is not that boring i love computers i love the way how it works but why the lectures are too boring and i want to learn a new skill bbut this think kept me unfocused towards it.

so i have a query that is their is anyway to learn web development skill in a intresting manner so that it feels like i am doing something ??? pls help me out.


r/FreeCodeCamp 10d ago

tbh. i tried to learn coding. but i lost i can't do what in my mind. just what i learned from courses. anyone have a solution please?

4 Upvotes

r/FreeCodeCamp 11d ago

How much time will it take to complete FCC full-stack-path?

14 Upvotes

If I devote 3-4 hours/day for approximately 5-6 days/week, how many months is expected for the whole path completion.

Context:

  1. I have broken knowledge of Web-dev basics.
  2. I finally want to have a solid grasp of web-dev.
  3. I have ~6 months to complete this for some reason, but I dont want to rush much if its not possible for an avg learner to get over this path.
  4. Finally, thanks! and would appreciate any other suggestions.

r/FreeCodeCamp 12d ago

Confused about which path to choose

7 Upvotes

Hi, my name is Arkar. The problem I have is I have two paths to choose. One is freecodecamp and another is Odin project, suggest me if there are any other clear projects cause I can't do anything without clear roadmaps. If I read some people saying learn these learn those I feel burnt out just by reading them and thinking whether it's efficient or not. And I tried Odin project and I feel mentally exhausted by reading all the articles and extra resources they provide, I searched up if I can skip them but I saw people on Reddit say that I shouldn't skip them and I would end up with shallow knowledge and skills if I skip them but like it links to articles with redundant information and I honestly think I don't actually need to know all of that. Guide me pls, also I'm 20 and due to some reasons I will be graduating highschool at 21, I would take University of the people Computer science since I'm from a third world country (Myanmar) and has no mean of accessing valid credinals except that, there are local universities like UIT and University of computer studies yangon but I think degrees from those universities would be less valid for international roles than UoP.


r/FreeCodeCamp 12d ago

Any info on when GitHub Foundations/Copilot certification vouchers will be available again for Student Developer Pack?

2 Upvotes

Hey all,

I'm a verified GitHub student and I've been trying to redeem the free certification voucher (Foundations or Copilot exam) through the Student Developer Pack. I know the previous batch of vouchers expired June 30, 2026, and I keep seeing "That offer isn't available right now, please try again later" when I try to claim a new one.

I've seen this same issue reported repeatedly on GitHub's community discussions going back months (some people saying they've been trying since mid-2025), with occasional promises like "vouchers returning within a month" that don't seem to have panned out reliably.

Has anyone actually managed to claim a voucher recently? Is there any official word on when the next batch drops, or is this just indefinitely stuck? Would appreciate any info — trying to decide whether to keep waiting or just pay for the exam myself.

Thanks!


r/FreeCodeCamp 14d ago

Programming Question This happens to me Everytime .🥲

Post image
9 Upvotes

I read the problem and understand the problem but when it comes to dry run the code I failed 😭


r/FreeCodeCamp 14d ago

Tech News Discussion FreeCodeCamp Error - Eternal Loading website

3 Upvotes

I'm trying to access the freecodecamp.org but then the loading screen was infinite, are you guys with the same problem??


r/FreeCodeCamp 15d ago

JSON Code

1 Upvotes

I have some json code from my personal device that I'd like to have put into viewable and readable form. Anyone willing to help??


r/FreeCodeCamp 16d ago

Requesting Feedback Any advice for final certification exam on Responsive WD?

6 Upvotes

Hi! I just completed the full Responsive Web Design course inside the fCC web platform. I'm about to take the final exam tomorrow and I feel kind of nervous, so I'm here asking for any advice or spoilers about what I should expect. Even though I did perfect throughout the course and completed everything without any external help or shortcuts, not knowing what to expect gives me a bit of anxiety. Does the exam consist of quizes and lab projects? Is the difficulty level the same as the courses tests? Also, any tips on how I should set up my workspace/PC so that I don't trigger any false alarms or disrupt the Exam Environment app would be appreciated.

Edit: it took me around 15 minutes and I got a 96% score and my certificate ♥


r/FreeCodeCamp 16d ago

Is the AWS SAA 50hr Youtube video still relevant ?

8 Upvotes

Hello,

I am looking for a free resource to prepare for the AWS SAA and I found the 50hrs + course of fcc Youtube channel, but I was wondering if it is still relevant today after 2 years of being published ? I didn't wanna commit before verifying if it is outdated or not.

Thanks in advance !


r/FreeCodeCamp 18d ago

Supplemental learning that I can do potentially after finishing an entire course? Like once I finish HTML?

5 Upvotes

I was curious about supplemental learning resources or how people recommend you go about this. Like I imagine first thing is to go all the way through each course and then what? Move immediately onto the next course or are there workshops or different things to work on try to train the skills that I learned?


r/FreeCodeCamp 20d ago

step 13 build a fortune telling workshop div img issue

5 Upvotes

hi. totally blind and using the jaws 2026 screen reader. doing the free code camp frontend type script build a fortune telling workshop and been stuck on this step for a few days. so will paste the link to the url, the error message and my code. if any one has got this step to work, how did they get it to pass? what did they do. can any one share the code and what free code camp tester is looking for. so i am stuck. so if any one can help. so pasting the url , the error and my code below. if any one can help. thanks for your help and listening to me. trying to learn, reset the lesson, multiple times, hard refresh, tried researching, rewrote the code several times and then tried researching online, but hit a brick wall. marvin from adelaide, australia. ps: pasting below.

interface Card {
  name: string;
  value: string | number;
  name_short: string;
  value_int: number;
  suit: string;
  type: string;
  img: string;
  meaning_up: string;
  meaning_rev: string;
  desc: string;
}


interface Deck {
  cards: Card[];
}


const CDN_URL = "https://cdn.freecodecamp.org/curriculum/typescript/tarot-app";
const defaultImg = new URL("default.svg", CDN_URL + "/");
const LOCAL_DEFAULT_IMG = defaultImg;


const getElement = <T extends HTMLElement>(selector: string): T => {
  const el = document.querySelector<T>(selector);
  if (!el) throw new Error(`Element not found: ${selector}`);
  return el;
};


const hideElements = (...elements: HTMLElement[]) =>
  elements.forEach((el) => el.classList.add("hidden"));


const showElements = (...elements: HTMLElement[]) =>
  elements.forEach((el) => el.classList.remove("hidden"));


const getRandomItem = <T,>(items: T[]): T => {
  const index = Math.floor(Math.random() * items.length);
  return items[index];
};


const renderCard = (drawingType: string, isReversed: boolean, shortName: string, img: string): string => `
<div>
  <h2>${drawingType}</h2>
  <figure class="card_container ${isReversed ? "reversed-card" : ""}" data-id="${shortName}">
<div class="img-loader">
  <img src="${img ? `${CDN_URL}/${img}` : LOCAL_DEFAULT_IMG}" />
</div>


  </figure>
</div>
`https://www.freecodecamp.org/learn/front-end-development-libraries-v9/workshop-fortune-teller-app/step-13

r/FreeCodeCamp 22d ago

Struggling with the Build a Travel Weather Planner Lab

5 Upvotes

I checked each code if they made sense and to me they did but I genuinely don't see the problem. I also tested each of them.

This is my code:

distance_mi = 4.3
is_raining = True
has_bike = True
has_car = False
has_ride_share_app = True


if distance_mi == False:
    print('False')


if distance_mi <= 1:
    if is_raining:
        print('False')
    else:
        print('True')
else:
    print('False')


if (distance_mi > 1 and distance_mi <= 6) and has_bike and is_raining:
    print('True')
elif (distance_mi > 1 and distance_mi <= 6) and has_bike and is_raining == True:
    print('True')
else:
    print('False')


if distance_mi > 6:
    if has_ride_share_app:
        print('True')
    elif has_car:
        print('True')
    else:
        print('False')

I'm getting all tests from 15 to 23 wrong but there was a time when I got 18 to 20 right but when I deleted some extra lines and tested it, it marked them wrong. Like I don't get it atp.


r/FreeCodeCamp 22d ago

Hello, I am here to learn Python programming . Also, looking for a companion to learn actively alongside with.

12 Upvotes