Practice Bank: GitHub & Collaboration
A deeper set of practice problems, organized by topic, for extra reps beyond the main exercises — including scenario-based problems written in the same style you'll meet in real interviews. Standard library only, no installs needed. Since these run in a Python grader (not a real terminal), every problem reasons about or simulates a GitHub collaboration concept as a plain Python function — but the underlying git/GitHub behavior behind each one was verified against a real local bare-repo simulation first.
starter.py below and run
python3 starter.py from inside the same folder. Standard
library only — nothing to install.
Topic 1: Remotes (origin, push/pull/fetch, tracking branches)
1 Look up a remote URL
Find # TODO 1.1. Write remote_url_for(remotes, name).
2 Fast-forward or merge?
Find # TODO 1.2. Write is_fast_forward_pull(local_only_commits, remote_only_commits).
3 Debug the Code
Find # TODO 1.3. This wrongly claims git fetch changes your working directory. Fix it.
4 Has a tracking branch?
Find # TODO 1.4. Write has_tracking_branch(branch_info).
Silent Push Confusion
Find # TODO 1.A. Write needs_dash_u_explanation(used_dash_u_on_first_push).
Fetch-then-pull workflow
Find # TODO 1.B. Write explain_fetch_then_pull_workflow().
Topic 2: Forking vs. Cloning
1 Fork or clone?
Find # TODO 2.1. Write correct_workflow_for(has_write_access).
2 Remotes after forking
Find # TODO 2.2. Write remote_setup_after_fork().
3 Debug the Code
Find # TODO 2.3. This wrongly claims a fork auto-syncs with the original forever. Fix it.
Open Source First Contribution
Find # TODO 2.A. Write first_contribution_steps(has_write_access).
Fork vs. clone
Find # TODO 2.B. Write explain_fork_vs_clone().
Topic 3: Pull Requests (workflow, descriptions, draft PRs)
1 Ready for review?
Find # TODO 3.1. Write is_ready_for_review(is_draft, has_description, tests_passing).
2 PR title quality
Find # TODO 3.2. Write pr_title_quality(title).
3 Debug the Code
Find # TODO 3.3. This has draft-PR logic backwards. Fix it.
Merge Conflict Blocking a PR
Find # TODO 3.A. Write safe_way_to_update_stale_pr(commits_behind_upstream, has_open_pr).
What makes a good PR description
Find # TODO 3.B. Write explain_good_pr_description().
Topic 4: Code Review (what reviewers look for, giving/receiving feedback)
1 Review verdict
Find # TODO 4.1. Write review_verdict(comment_type).
2 Count blocking reviews
Find # TODO 4.2. Write count_blocking_reviews(review_types).
3 Debug the Code
Find # TODO 4.3. This ignores the follow-up-request flag entirely. Fix it.
"LGTM but can you add a test?"
Find # TODO 4.A. Write interpret_lgtm_with_ask(review_type, has_followup_request).
What makes review feedback constructive
Find # TODO 4.B. Write explain_good_code_review_feedback().
Topic 5: Issues & Project Workflow (good issues, labels, linking to PRs)
1 Minimum issue quality
Find # TODO 5.1. Write has_minimum_issue_quality(title, has_repro_steps, has_expected_behavior).
2 Build the right labels
Find # TODO 5.2. Write issue_labels_for(is_bug, is_feature_request, blocks_release).
3 Debug the Code
Find # TODO 5.3. This only checks closing keywords in uppercase. Fix it to be case-insensitive.
Triaging a Vague Bug Report
Find # TODO 5.A. Write triage_action(has_repro_steps, has_expected_behavior).
Good issue vs. bad issue
Find # TODO 5.B. Write explain_good_issue_vs_bad_issue().
Topic 6: Real-World End-to-End Collaboration Scenario
1 Next step in the workflow
Find # TODO 6.1. Write next_step_in_workflow(step).
2 Safe to merge?
Find # TODO 6.2. Write is_safe_to_merge(approved, ci_passing, has_conflicts).
3 Debug the Code
Find # TODO 6.3. This only checks the first step instead of the whole list. Fix it.
End-to-End Contribution
Find # TODO 6.A. Write plan_contribution(has_write_access, issue_number).
The full issue-to-merge loop
Find # TODO 6.B. Write explain_end_to_end_collaboration().
solution.py. Your exact
wording doesn't need to match on the explanation-style tasks
— the goal is that your program runs without errors and does
what each TODO asks. Every non-explanation task's output is exactly
reproducible.