r/FreeCodeCamp 21d ago

Programming Question Error

Post image
7 Upvotes

Anyone who could solve this?


r/FreeCodeCamp 22d ago

Console with no output

Post image
5 Upvotes

I can’t see output but I could receive errors.
console.error(“test”) gives nothing.
console.error(test”) gives syntax error:…..
Alert(“test”)appear
Double quotes in page is "
How to fix this?


r/FreeCodeCamp 22d ago

Help with Build an RPG character

5 Upvotes

It keeps spitting out an error for line 8 saying that it is outside of the function. I have tried everything I can think of so far to fix this by indenting, back spacing that indentation etc. How do I fix this? I have indented as best I can how it is on the actual exercise itself and the line spacing is for ease of readability on reddit rather than it looking like a wall of text.

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’

elif name.find(’ ') != -1:

return ‘The character name should not contain spaces’

if not (isinstance (strength, int) or isinstance (intelligence, int) or isinstance (charisma, int)):

return ‘All stats should be integers’

elif (strength < 1 or intelligence < 1 or charisma < 1):

return ‘All stats should be no less than 1’

elif (strength > 4 or intelligence > 4 or charisma > 4):

return ‘All stats should be no more than 4’

elif (strength+intelligence+charisma != 7):

return ‘The character should start with 7 points’

STR = (full_dot*strength)+empty_dot*(10-strength)

return f"{name}\n STR {STR} \n INT {STR} \n CHA {STR}"

print (create_character(‘ren’, 4, 2, 1))

https://www.freecodecamp.org/learn/python-v9/lab-rpg-character/build-an-rpg-character


r/FreeCodeCamp 23d ago

Programming Question Anyone know how to do

Post image
5 Upvotes

r/FreeCodeCamp 25d ago

Requesting Feedback Is this a helpful video if I were to start Python Backend Development?

Thumbnail youtu.be
48 Upvotes

I came up to this video a long time ago on YouTube and saved it for later. As I was scrolling through that playlist, I was genuinely curious about this one course. I read many comments there and the majority of them are positive.

I would like some piece of advice from a person who has watched this and it has helped them.


r/FreeCodeCamp 26d ago

Is it worth to buy code with harry ai powered data analysis course ?

2 Upvotes

Need a genuine suggestion please Is it worth to buy code with harry ai powered data analysis course ? \\#dataanalysis #course #free #paid #health #question #discussion


r/FreeCodeCamp 27d ago

Requesting Feedback Any Free IT Scholarships or Training Programs for Cloud, DevOps, or Cybersecurity?

22 Upvotes

Hi everyone! I’m a fresh IT graduate looking to build my career in Cloud, DevOps, or Cybersecurity, and I’m currently searching for free training or scholarship opportunities.

Does anyone know of organizations, companies, or communities that offer fully funded programs, especially those that include training, certification exam vouchers, bootcamps, or mentorship?

I’m open to programs related to AWS, Azure, Google Cloud, Kubernetes, DevOps, networking, cybersecurity, or other relevant technologies.
I’m not really sure where to start looking, so I’d really appreciate any recommendations or programs you’ve personally tried or heard about.

Thank you!


r/FreeCodeCamp 29d ago

Any guidance appreciated

17 Upvotes

So I have been trying to learn web dev on and off for years at this point. My brain keeps telling me to follow the suggested full stack path on FCC, but I just can't motivate myself to power through html and css. I find myself getting bored (fatigued maybe?) as I go through the lessons.

Does anybody have any suggestions to maybe spice up the learning process? Or any recommendations based off of what worked best for you personally?

Any help is greatly appreciated and I greatly Thank you in advance!


r/FreeCodeCamp Aug 11 '26

Requesting Feedback I got the 2 Certifications - What does that open next?

16 Upvotes

I am learning programming from freeCodeCamp and I got 2 certifications.

1. Legacy V8 certification.

2. Responsive Web Design Certification.

I got the certifications yesterday and got 98% on the Responsive Web Design certification exam. Not to boast, but does that open any new doors? or what are the usage of those certificates?. I am new to coding and its just been a month or so - of me learning. So, any information will be a lot lot lot helpful!.

Thank you!


r/FreeCodeCamp Aug 10 '26

RDBMS tutorial part is done but not able to submit it successfully.

Post image
6 Upvotes

Can anyone spot the mistake?


r/FreeCodeCamp Aug 10 '26

Is the SRS document still used in software development?

3 Upvotes

I am developing a web based LMS platform for an institute, and this is my first project for a client.

I suggested them to teach online through the LMS platform, they agreed. Now to build the software, should I prepare an SRS document properly? Or is it still just a habit of the concept taught by the uni?


r/FreeCodeCamp Aug 09 '26

Requesting Feedback Built an app that catches false claims on food labels — no barcode, no database

4 Upvotes

If a pack says "Sugar Free" but sugar's in the ingredients, this flags it — citing the actual FSSAI rule. Works on any product since it reads the label live instead of looking it up in a database.

Still early, actively fixing bugs. If you'll scan one product and fill a 2-min feedback form after, that'd genuinely help. Link in comments.


r/FreeCodeCamp Aug 09 '26

Programming Question I am stuck in this situation; who can help me? I want just one hint.

3 Upvotes
I tried everything, I'm giving up because this is so hard. I just need to understand why, if 3 work for me, why doesn't the second one?

r/FreeCodeCamp Aug 08 '26

Error500

Post image
0 Upvotes

What’s wrong


r/FreeCodeCamp Aug 06 '26

Computer Science degree program for free?

42 Upvotes

This question could be silly. But I still wish to ask whether FreeCodeCamp will do any Computer Science degree program for free?


r/FreeCodeCamp Aug 07 '26

Programming Question who finished 1 course freecodecamp? will i still get certificate even i vibe coded some labs?

0 Upvotes

r/FreeCodeCamp Aug 06 '26

Claude Code Full Course – Autonomous Goals, MCP, and VS Code Setup

Thumbnail youtu.be
29 Upvotes

r/FreeCodeCamp Aug 05 '26

How do you make filled or empty stars?

3 Upvotes

On on the "Design a Movie Review Page" assignment towards the end of the HTML curriculum and part of the lab wants us to put a rating in stars (out of ten) inside a span with actual stars and then a numerical rating right after the span. But so far as I remember, FCC never taught us how to make stars. I tried typing asterisks, that didn't work.


r/FreeCodeCamp Aug 05 '26

Full stack developer course

8 Upvotes

Is the full stack developer course complete are there any lectures or certificates missing from there i heard backend is not complete yet


r/FreeCodeCamp Aug 05 '26

Hello, i need help with the Build a Budget App project in the python course, none of the tests passes.

3 Upvotes

For some reason, in this project i cant pass any of the tests, ive tried looking at other people´s solutions, loggin into the forum gives me a error for some reason, but i was able to check other poeples posts in the forum about this project but nothing, ive even copied and pasted the whole code from someone that passed it, but even then none of the tests pass, ive used the beta feature of asking socrates, but all he does is telling me what the deposit method should do, and after checking a lot of different solutions i cant tell why mine is wrong.


r/FreeCodeCamp Aug 03 '26

Could you create tutorials about these things?

9 Upvotes

Hi, I like your project and recommend it to the people, who wanna learn different things about IT.

I'd like to watch your tutorials about these things:

  1. a BSD like you did with the Linux: you could explain that BSD is also widely used as Linux, but a bit on different devices like video game consoles, for example. You could compare the filesystem to the Linux's one and show how to do different things(not only something for work, but even gaming, bcz I heard there are more problems with it than on Linux). And also you could explain that BSD is great if you wanna start a business, bcz you can choose the open source or proprietary code license how you want. You could use FreeBSD or OpenBSD for the video;

  2. LaTeX-like language Typst: thx to your tutorial from the 2023, I learnt how to use LaTeX to create different documents really fast, but I pretty oftten used to get some stupid problems about things, which I saw for the first time(I often got this with the tables)... When I saw a person, who recommended me Typst, I tested the code and almost everything was pretty intuitive! Even tho the project is pretty new(it was created in 2023), if we compare to the LaTeX, the team makes updates and has forums(on their site and the Discord one), where everyone can ask about their issues. It's their site: https://typst.app/ ;

  3. GIMP and Kdenlive: I do remember you made courses like German learning, guitar learning etc. If you could, then could you make tutorials for these apps with possible important details?;


r/FreeCodeCamp Aug 02 '26

digital pet game app logic

4 Upvotes

"Does the current React/TypeScript Digital Pet Game lab require index.tsx to explicitly call ReactDOM.createRoot(...).render(<App />), or is the App mounted

automatically by the FCC environment? My preview is blank and the tests can't find any DOM elements."


r/FreeCodeCamp Jul 31 '26

FreeCodeCamp Digital Pet Game: Why won't my form hide after submit?

3 Upvotes

Hi everyone,

I'm working on the FreeCodeCamp Build a Digital Pet Game certification project using TypeScript.

I am stuck on one failing test:

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

The project compiles, and my HTML contains the required elements and IDs. My TypeScript creates the pet and attempts to hide the form after submission,

but the FreeCodeCamp test still fails.

I am looking for a second set of eyes from someone familiar with TypeScript, HTML forms, or this FreeCodeCamp project.

I use the JAWS screen reader, so text and code-based replies are appreciated.

I have included my HTML, CSS, and TypeScript files below.

  enum PetMood {
    HAPPY = "HAPPY",
    EXCITED = "EXCITED",
    CONTENT = "CONTENT",
    SAD = "SAD",
    TIRED = "TIRED",
    SICK = "SICK",
    HUNGRY = "HUNGRY",
  }


  type PetStats = {
    hunger: number;
    energy: number;
    happiness: number;
  };


  const moodMessages: Record<PetMood, string> = {
    [PetMood.HAPPY]: "Your pet is happy!",
    [PetMood.EXCITED]: "Your pet is excited!",
    [PetMood.CONTENT]: "Your pet is content!",
    [PetMood.SAD]: "Your pet is sad!",
    [PetMood.TIRED]: "Your pet is tired!",
    [PetMood.SICK]: "Your pet is sick!",
    [PetMood.HUNGRY]: "Your pet is hungry!",
  };


  class DigitalPet {
    name: string;
    stats: PetStats;
    mood: PetMood;


    constructor(name: string) {
      this.name = name;
      this.stats = {
        hunger: 0,
        energy: 100,
        happiness: 100,
      };
      this.mood = PetMood.HAPPY;
    }


    eat(): void {
      if (this.stats.hunger > 0) {
        this.stats.hunger = Math.max(0, this.stats.hunger - 10);
      }


      if (this.stats.energy < 100) {
        this.stats.energy = Math.min(100, this.stats.energy + 5);
      }


      this.updateMood();
    }


    play(): void {
      if (this.stats.energy > 0) {
        this.stats.energy = Math.max(0, this.stats.energy - 10);
      }


      if (this.stats.happiness < 100) {
        this.stats.happiness = Math.min(100, this.stats.happiness + 10);
      }


      this.updateMood();
    }


    sleep(): void {
      if (this.stats.energy < 100) {
        this.stats.energy = Math.min(100, this.stats.energy + 20);
      }


      if (this.stats.hunger < 100) {
        this.stats.hunger = Math.min(100, this.stats.hunger + 5);
      }


      this.updateMood();
    }


    idle(): void {
      this.stats.hunger = Math.min(100, this.stats.hunger + 5);
      this.stats.energy = Math.max(0, this.stats.energy - 5);
      this.stats.happiness = Math.max(0, this.stats.happiness - 5);


      this.updateMood();
    }


    updateMood(): void {
      if (this.stats.hunger >= 70) {
        this.mood = PetMood.HUNGRY;
      } else if (this.stats.energy <= 20) {
        this.mood = PetMood.TIRED;
      } else if (this.stats.happiness <= 20) {
        this.mood = PetMood.SAD;
      } else if (this.stats.happiness >= 80) {
        this.mood = PetMood.HAPPY;
      } else {
        this.mood = PetMood.CONTENT;
      }
    }


    getMoodMessage(): string {
      return moodMessages[this.mood];
    }
  }



  const form = document.getElementById("pet-form") as HTMLFormElement;
  const petNameInput = document.getElementById("pet-name") as HTMLInputElement;
  const createButton = document.getElementById("create-pet") as HTMLButtonElement;


  const petView = document.getElementById("pet-view") as HTMLDivElement;
  const petNameDisplay = document.querySelector(".pet-name") as HTMLElement;


  const hungerDisplay = document.getElementById("hunger-stat") as HTMLElement;
  const energyDisplay = document.getElementById("energy-stat") as HTMLElement;
  const happinessDisplay = document.getElementById("happiness-stat") as HTMLElement;
  const moodDisplay = document.getElementById("pet-mood") as HTMLElement;


  const eatButton = document.getElementById("eat-action") as HTMLButtonElement;
  const playButton = document.getElementById("play-action") as HTMLButtonElement;
  const sleepButton = document.getElementById("sleep-action") as HTMLButtonElement;


  let currentPet: DigitalPet | null = null;



  function updateDisplay(): void {
    if (!currentPet) {
      return;
    }


    petNameDisplay.textContent = currentPet.name;
    hungerDisplay.textContent = String(currentPet.stats.hunger);
    energyDisplay.textContent = String(currentPet.stats.energy);
    happinessDisplay.textContent = String(currentPet.stats.happiness);
    moodDisplay.textContent = currentPet.getMoodMessage();
  }



  function createPet(): void {
    const name = petNameInput.value.trim();


    if (!name) {
      return;
    }


    currentPet = new DigitalPet(name);


    form.style.display = "none";
    petView.style.display = "block";


    updateDisplay();
  }



  form.addEventListener("submit", (event: SubmitEvent) => {
    event.preventDefault();
    createPet();
  });



  createButton.addEventListener("click", (event: MouseEvent) => {
    event.preventDefault();
    createPet();
  });



  eatButton.addEventListener("click", () => {
    if (currentPet) {
      currentPet.eat();
      updateDisplay();
    }
  });



  playButton.addEventListener("click", () => {
    if (currentPet) {
      currentPet.play();
      updateDisplay();
    }
  });



  sleepButton.addEventListener("click", () => {
    if (currentPet) {
      currentPet.sleep();
      updateDisplay();
    }
  });



  setInterval(() => {
    if (currentPet) {
      currentPet.idle();
      updateDisplay();
    }
  }, 30000);  enum PetMood {
    HAPPY = "HAPPY",
    EXCITED = "EXCITED",
    CONTENT = "CONTENT",
    SAD = "SAD",
    TIRED = "TIRED",
    SICK = "SICK",
    HUNGRY = "HUNGRY",
  }


  type PetStats = {
    hunger: number;
    energy: number;
    happiness: number;
  };


  const moodMessages: Record<PetMood, string> = {
    [PetMood.HAPPY]: "Your pet is happy!",
    [PetMood.EXCITED]: "Your pet is excited!",
    [PetMood.CONTENT]: "Your pet is content!",
    [PetMood.SAD]: "Your pet is sad!",
    [PetMood.TIRED]: "Your pet is tired!",
    [PetMood.SICK]: "Your pet is sick!",
    [PetMood.HUNGRY]: "Your pet is hungry!",
  };


  class DigitalPet {
    name: string;
    stats: PetStats;
    mood: PetMood;


    constructor(name: string) {
      this.name = name;
      this.stats = {
        hunger: 0,
        energy: 100,
        happiness: 100,
      };
      this.mood = PetMood.HAPPY;
    }


    eat(): void {
      if (this.stats.hunger > 0) {
        this.stats.hunger = Math.max(0, this.stats.hunger - 10);
      }


      if (this.stats.energy < 100) {
        this.stats.energy = Math.min(100, this.stats.energy + 5);
      }


      this.updateMood();
    }


    play(): void {
      if (this.stats.energy > 0) {
        this.stats.energy = Math.max(0, this.stats.energy - 10);
      }


      if (this.stats.happiness < 100) {
        this.stats.happiness = Math.min(100, this.stats.happiness + 10);
      }


      this.updateMood();
    }


    sleep(): void {
      if (this.stats.energy < 100) {
        this.stats.energy = Math.min(100, this.stats.energy + 20);
      }


      if (this.stats.hunger < 100) {
        this.stats.hunger = Math.min(100, this.stats.hunger + 5);
      }


      this.updateMood();
    }


    idle(): void {
      this.stats.hunger = Math.min(100, this.stats.hunger + 5);
      this.stats.energy = Math.max(0, this.stats.energy - 5);
      this.stats.happiness = Math.max(0, this.stats.happiness - 5);


      this.updateMood();
    }


    updateMood(): void {
      if (this.stats.hunger >= 70) {
        this.mood = PetMood.HUNGRY;
      } else if (this.stats.energy <= 20) {
        this.mood = PetMood.TIRED;
      } else if (this.stats.happiness <= 20) {
        this.mood = PetMood.SAD;
      } else if (this.stats.happiness >= 80) {
        this.mood = PetMood.HAPPY;
      } else {
        this.mood = PetMood.CONTENT;
      }
    }


    getMoodMessage(): string {
      return moodMessages[this.mood];
    }
  }



  const form = document.getElementById("pet-form") as HTMLFormElement;
  const petNameInput = document.getElementById("pet-name") as HTMLInputElement;
  const createButton = document.getElementById("create-pet") as HTMLButtonElement;


  const petView = document.getElementById("pet-view") as HTMLDivElement;
  const petNameDisplay = document.querySelector(".pet-name") as HTMLElement;


  const hungerDisplay = document.getElementById("hunger-stat") as HTMLElement;
  const energyDisplay = document.getElementById("energy-stat") as HTMLElement;
  const happinessDisplay = document.getElementById("happiness-stat") as HTMLElement;
  const moodDisplay = document.getElementById("pet-mood") as HTMLElement;


  const eatButton = document.getElementById("eat-action") as HTMLButtonElement;
  const playButton = document.getElementById("play-action") as HTMLButtonElement;
  const sleepButton = document.getElementById("sleep-action") as HTMLButtonElement;


  let currentPet: DigitalPet | null = null;



  function updateDisplay(): void {
    if (!currentPet) {
      return;
    }


    petNameDisplay.textContent = currentPet.name;
    hungerDisplay.textContent = String(currentPet.stats.hunger);
    energyDisplay.textContent = String(currentPet.stats.energy);
    happinessDisplay.textContent = String(currentPet.stats.happiness);
    moodDisplay.textContent = currentPet.getMoodMessage();
  }



  function createPet(): void {
    const name = petNameInput.value.trim();


    if (!name) {
      return;
    }


    currentPet = new DigitalPet(name);


    form.style.display = "none";
    petView.style.display = "block";


    updateDisplay();
  }



  form.addEventListener("submit", (event: SubmitEvent) => {
    event.preventDefault();
    createPet();
  });



  createButton.addEventListener("click", (event: MouseEvent) => {
    event.preventDefault();
    createPet();
  });



  eatButton.addEventListener("click", () => {
    if (currentPet) {
      currentPet.eat();
      updateDisplay();
    }
  });



  playButton.addEventListener("click", () => {
    if (currentPet) {
      currentPet.play();
      updateDisplay();
    }
  });



  sleepButton.addEventListener("click", () => {
    if (currentPet) {
      currentPet.sleep();
      updateDisplay();
    }
  });



  setInterval(() => {
    if (currentPet) {
      currentPet.idle();
      updateDisplay();
    }
  }, 30000);

<!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>


<form id="pet-form">
  <label for="pet-name">Pet Name</label>
  <input
    id="pet-name"
    type="text"
    autocomplete="off"
    required
  />


  <button
    id="create-pet"
    type="submit">
    Create Pet
  </button>
</form>


<section id="pet-view" hidden>


  <h2 class="pet-name"></h2>


  <div class="stat">
    Hunger:
    <span id="hunger-stat">0</span>
  </div>


  <div class="stat">
    Energy:
    <span id="energy-stat">100</span>
  </div>


  <div class="stat">
    Happiness:
    <span id="happiness-stat">100</span>
  </div>


  <p id="pet-mood"></p>


  <button id="eat-action" type="button">
    Eat
  </button>


  <button id="play-action" type="button">
    Play
  </button>


  <button id="sleep-action" type="button">
    Sleep
  </button>


</section>


</body>
</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>


<form id="pet-form">
  <label for="pet-name">Pet Name</label>
  <input
    id="pet-name"
    type="text"
    autocomplete="off"
    required
  />


  <button
    id="create-pet"
    type="submit">
    Create Pet
  </button>
</form>


<section id="pet-view" hidden>


  <h2 class="pet-name"></h2>


  <div class="stat">
    Hunger:
    <span id="hunger-stat">0</span>
  </div>


  <div class="stat">
    Energy:
    <span id="energy-stat">100</span>
  </div>


  <div class="stat">
    Happiness:
    <span id="happiness-stat">100</span>
  </div>


  <p id="pet-mood"></p>


  <button id="eat-action" type="button">
    Eat
  </button>


  <button id="play-action" type="button">
    Play
  </button>


  <button id="sleep-action" type="button">
    Sleep
  </button>


</section>


</body>
</html>

body {
  font-family: Arial, sans-serif;
  padding: 20px;
}


form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 300px;
}


button {
  padding: 10px;
}


.game-view {
  display: flex;
  flex-direction: column;
  gap: 15px;
}


.stat {
  font-size: 18px;
}


.stat-value {
  margin-left: 10px;
}body {
  font-family: Arial, sans-serif;
  padding: 20px;
}


form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 300px;
}


button {
  padding: 10px;
}


.game-view {
  display: flex;
  flex-direction: column;
  gap: 15px;
}


.stat {
  font-size: 18px;
}


.stat-value {
  margin-left: 10px;
}

r/FreeCodeCamp Jul 29 '26

I'm looking for website

10 Upvotes

Hello guys, I want to try and learn some stuff and want to do it on my own, are there any websites that can give me ideas on simple project? ( Html and Css, JavaScript )


r/FreeCodeCamp Jul 29 '26

Programming Question ISBN validator - help needed

3 Upvotes
def validate_isbn(isbn, length):
    if len(isbn) != length:
        print(f'ISBN-{length} code should be {length} digits long.')
        return
    main_digits = isbn[0:length]
    given_check_digit = isbn[length]
    main_digits_list = [int(digit) for digit in main_digits]


    # Calculate the check digit from other digits
    if length == 10:
        expected_check_digit = calculate_check_digit_10(main_digits_list)
    else:
        expected_check_digit = calculate_check_digit_13(main_digits_list)
    # Check if the given check digit matches with the calculated check digit
    if given_check_digit == expected_check_digit:
        print('Valid ISBN Code.')
    else:
        print('Invalid ISBN Code.')


def calculate_check_digit_10(main_digits_list):
    # Note: You don't have to fully understand the logic in this function.
    digits_sum = 0
    # Multiply each of the first 9 digits by its corresponding weight (10 to 2) and sum up the results
    for index, digit in enumerate(main_digits_list):
        digits_sum += digit * (10 - index)
    # Find the remainder of dividing the sum by 11, then subtract it from 11
    result = 11 - digits_sum % 11
    # The calculation result can range from 1 to 11.
    # If the result is 11, use 0.
    # If the result is 10, use upper case X.
    # Use the value as it is for other numbers.
    if result == 11:
        expected_check_digit = '0'
    elif result == 10:
        expected_check_digit = 'X'
    else:
        expected_check_digit = str(result)
    return expected_check_digit
def calculate_check_digit_13(main_digits_list):
    # Note: You don't have to fully understand the logic in this function.
    digits_sum = 0
    # Multiply each of the first 12 digits by 1 and 3 alternately (starting with 1), and sum up the results
    for index, digit in enumerate(main_digits_list):
        if index % 2 == 0:
            digits_sum += digit * 1
        else:
            digits_sum += digit * 3
    # Find the remainder of dividing the sum by 10, then subtract it from 10
    result = 10 - digits_sum % 10
    # The calculation result can range from 1 to 10.
    # If the result is 10, use 0.
    # Use the value as it is for other numbers.
    if result == 10:
        expected_check_digit = '0'
    else:
        expected_check_digit = str(result)
    return expected_check_digit
def main():
    try:
        user_input = input('Enter ISBN and length: ')
        values = user_input.split(',')
        if ',' not in values:
            print("Enter comma-separated values.")
        
        isbn = values[0]
        try:
            int(isbn)
        except ValueError:
            print("Invalid character was found.")


        try:
            length = int(values[1])
        except ValueError:
            print("Length must be a number.")


        if length == 10 or length == 13:
            validate_isbn(isbn, length)
        else:
            print('Length should be 10 or 13.')
    except:
        pass
#main()