Challenge: Add Simple Tests
In this exercise, you will practice writing basic tests to check the correctness of a Python function. Testing is essential for maintaining code quality because it helps you verify that your code works as expected and catches mistakes early. You will be given a function, and your goal is to write a few assert-based tests that confirm the function behaves correctly for different inputs.
Swipe to start coding
Write assert-based tests to verify the reverse_string function works as intended.
- Write at least three assert statements that check the output of
reverse_stringfor different input strings. - Use the following template for your assert messages:
"Expected {expected} but got {actual}". - Place your assert statements after the function definition.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 5.26
Challenge: Add Simple Tests
Свайпніть щоб показати меню
In this exercise, you will practice writing basic tests to check the correctness of a Python function. Testing is essential for maintaining code quality because it helps you verify that your code works as expected and catches mistakes early. You will be given a function, and your goal is to write a few assert-based tests that confirm the function behaves correctly for different inputs.
Swipe to start coding
Write assert-based tests to verify the reverse_string function works as intended.
- Write at least three assert statements that check the output of
reverse_stringfor different input strings. - Use the following template for your assert messages:
"Expected {expected} but got {actual}". - Place your assert statements after the function definition.
Рішення
Дякуємо за ваш відгук!
single