Menu
CoddyTech

Recap: Eligibility Rules

Lesson 11 of 48 in Coddy's Python for C# Developers course.

challenge icon

Challenge

Beginner

Read a display name, age token, and credit token. Empty names become Guest. Age is missing or an integer in [0, 120]; credit is missing or an integer in [-20, 20]. The scaffold parses optional numbers. Output the name, then the first applicable decision: incomplete if either number is None; underage if age < 18; debt if credit < 0; eligible otherwise. A zero credit is valid.

C# transfer checkpoint

An optional age needs a missing-value check, not a zero check. Python is None tests identity, not a C# type pattern.

C# reference excerpt: executable statements assume using System; type-only excerpts illustrate the declared contract.

int? age = null;
Console.WriteLine(age == null);

Python pattern

age = None
print(age is None)

Editable implementation files: main.py. The locked driver.py is the supplied launcher or input/output harness and must remain unchanged.

Use the supplied input contract without prompts. Print only the required lines, each ending in a newline.

Try it yourself

# Starts the program in main.py. Edit main.py to solve the challenge.
from runpy import run_module

run_module("main", run_name="__main__")

All lessons in Python for C# Developers

Practice on your own: Online Python compiler