Foundations Exercises (Modules 1-9)¶
Module 2: First Programs¶
Exercise 1: Input and output¶
Write a script that asks for a user's name and favorite number, then prints a sentence combining both values.
Hint
Use input() twice and an f-string for output.
One possible solution
Module 4: Control Flow¶
Exercise 2: Branching¶
Given an integer, print positive, negative, or zero.
Hint
Use if/elif/else in that order.
One possible solution
Module 8: Testing¶
Exercise 3: Simple pytest test¶
Write a function is_even(n) and test it with pytest.
Hint
Create two assertions: one true case and one false case.