This is a self-guided tutorial to help folks learn how to use GitHub Copilot. In this project you will find:
- a
main.py
file with no contents - a devcontainer that installs CodeTour and GitHub Copilot when the Codespace is created
- a CodeTour to guide the developer through using GitHub Copilot to develop a rock, paper, scissors game.
- Access to GitHub Copilot
The CodeTour prompts developers to write comments and lines of code that trigger GitHub Copilot to generate code to create a rock, paper, scissors game.
- Choose 'Use this template', and 'Open in a codespace'
- Choose the “Explorer Icon” on the left sidebar of your editor.
- Toggle the CodeTour panel
- Press the “Play button” to start the tour.
- Your CodeTour will begin! Follow the CodeTour’s steps to learn how to use GitHub Copilot.
-
Introduction: Hi there! this is a guided tour to help you learn GitHub Copilot. We will build a rock, paper, scissors game with Python.
-
Let's give GitHub Copilot some context about what we're building. Write this comment
# Write a rock, paper, scissors, game
at the top of your main.py file.
Now, let's prompt Copilot to import the random module. Write this comment # import random module
on the next line. Press enter to create a new line and accept Copilot's suggestion.
- Now, let's prompt Copilot to create a main function that handles the logic of the game with a comment that says
# define main function that handles all the logic
. Press enter to create a new line and accept Copilot's suggestion.
- Now, let's prompt Copilot to call the main function. Write this comment
# call main function
on the next line. Press enter to create a new line and accept Copilot's suggestion.
- Try it out! Let's run the code to see if it works. In your terminal, run
python3 main.py
. It should start the rock, paper, scissors game. Mission complete! You've used GitHub Copilot to create a rock, paper, scissors game in Python!