Python challenges
Practice problem statements with input format, output format, constraints and solutions.
Python Introduction challenge
Build a small solution that uses Python Introduction in Python and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
items = ["Python Introduction", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core python introduction pattern before polishing the final output.
Solution
items = ["Python Introduction solution", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Syntax challenge
Build a small solution that uses Syntax in Python and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
items = ["Syntax", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core syntax pattern before polishing the final output.
Solution
items = ["Syntax solution", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Variables challenge
Build a small solution that uses Variables in Python and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
items = ["Variables", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core variables pattern before polishing the final output.
Solution
items = ["Variables solution", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Data Types challenge
Build a small solution that uses Data Types in Python and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
items = ["Data Types", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core data types pattern before polishing the final output.
Solution
items = ["Data Types solution", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Strings challenge
Build a small solution that uses Strings in Python and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
items = ["Strings", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core strings pattern before polishing the final output.
Solution
items = ["Strings solution", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Lists challenge
Build a small solution that uses Lists in Python and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
items = ["Lists", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core lists pattern before polishing the final output.
Solution
items = ["Lists solution", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Tuples challenge
Build a small solution that uses Tuples in Python and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
items = ["Tuples", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core tuples pattern before polishing the final output.
Solution
items = ["Tuples solution", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Sets challenge
Build a small solution that uses Sets in Python and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
items = ["Sets", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core sets pattern before polishing the final output.
Solution
items = ["Sets solution", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Dictionaries challenge
Build a small solution that uses Dictionaries in Python and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
items = ["Dictionaries", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core dictionaries pattern before polishing the final output.
Solution
items = ["Dictionaries solution", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Conditions challenge
Build a small solution that uses Conditions in Python and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
items = ["Conditions", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core conditions pattern before polishing the final output.
Solution
items = ["Conditions solution", "practice", "review"]
for position, item in enumerate(items, start=1):
print(f"{position}. {item}")