Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Fixing Syntax Errors | Syntax and Indentation Pitfalls
Common Python Mistakes and How to Fix Them

bookChallenge: Fixing Syntax Errors

In this challenge, you will practice spotting and correcting common Python syntax errors. Syntax errors prevent your code from running and are often caused by missing punctuation, incorrect indentation, or using the wrong keywords. You will be given several short code snippets, each containing a different syntax error. Your task is to fix each snippet so that it runs successfully.

Aufgabe

Swipe to start coding

You are given three short code snippets, each with a different syntax error. For each function, fix the syntax errors so that the code runs without any issues.

  • Complete the function print_greeting so that it prints the greeting message as intended.
  • Complete the function calculate_sum so that it returns the sum of two numbers.
  • Complete the function is_even so that it returns True if the number is even, and False otherwise. Use the provided print statements in the starter code to test your fixes.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 3
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

close

Awesome!

Completion rate improved to 5.26

bookChallenge: Fixing Syntax Errors

Swipe um das Menü anzuzeigen

In this challenge, you will practice spotting and correcting common Python syntax errors. Syntax errors prevent your code from running and are often caused by missing punctuation, incorrect indentation, or using the wrong keywords. You will be given several short code snippets, each containing a different syntax error. Your task is to fix each snippet so that it runs successfully.

Aufgabe

Swipe to start coding

You are given three short code snippets, each with a different syntax error. For each function, fix the syntax errors so that the code runs without any issues.

  • Complete the function print_greeting so that it prints the greeting message as intended.
  • Complete the function calculate_sum so that it returns the sum of two numbers.
  • Complete the function is_even so that it returns True if the number is even, and False otherwise. Use the provided print statements in the starter code to test your fixes.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 3
single

single

some-alt