PYTHON LESSON

Topic 58/63 · Phase 7: Real-World Tools

pip and requirements — Python lesson on EduBard (phase: Real-World Tools)

pip and requirements

Main idea

requirements.txt captures dependency versions for reproducibility.

Tip

Pin versions in production projects.

Watch out

Forgetting to update requirements file.

Read this next

You will study pip and requirements. It belongs to the Real-World Tools phase.

Remember this:
requirements.txt captures dependency versions for reproducibility.

Practice step by step. Do not rush. Each run should show you something new.

Tip:
Pin versions in production projects.

Avoid this:
Forgetting to update requirements file.

Your challenge:
Export requirements and recreate environment.

Go to the challenge lab below. Fix errors until the output looks right. Then press the green button to complete the topic.

Example code

Copy this example if it helps. Change it so it matches pip and requirements.

# Topic: pip and requirements
def main():
    sample = "edit me"
    # TODO: apply pip and requirements concept here
    result = sample
    print("Result:", result)

if __name__ == "__main__":
    main()

Challenge

Export requirements and recreate environment.

Before you can finish: your output should include at least 16 characters; at least 1 non-empty line(s); no crash traceback—fix errors until the program runs cleanly.

Use Run. Read the output. Change your code until the task is done.

Starter reference

# Challenge starter for pip and requirements
def solve():
    # Write your solution here
    pass

print("Update solve() and run")

Your code

The first Run may load Python in your browser (one-time). Later runs are faster.



    
    

Navigation