Exercise Hello World
- Make sure you have
- Make sure you have a github account.
- Make sure you have your ssh keys setup. See here for help
Get our code
Go to our bootcamp repository page, and click the
Forkbutton at the top right to make your own fork of our repository.
Once you've forked our repo, there should be a clone URL link on the bottom right of the page of the format:
firstname.lastname@example.org:username/bootcamp-python.git. Copy that link.
In your command line, enter this:
git clone email@example.com:username/bootcamp-python.git. This should create a
bootcamp-pythondirectory on your computer. Type
cd bootcamp-python && ls, and you should see an
exercise-hellodirectory. Go into that directory.
Your first python program
Whenever you learn a programming language for the first time, the first program you ever write is to print out "hello world" to the screen!
hello.py and follow the instructions in that file. When you are done, run
to run your program! To make sure your program matches out expected output:
Your second python program
Make a new file called
script.py. Copy the contents below into that file:
#!/usr/bin/env python print "this is a python script!"
Now give it executable permissions:
chmod +x script.py
The combination of the
#!/usr/bin/env python line in the file and executable permissions allows us to directly run the program without needing to type
python. Now, we can do this to run the program:
Commit your changes and make a pull request
Now to make sure your keep a snapshot of your work in history, run these commands in the shell:
git add hello.py git commit -m "finished hello world example" git add script.py git commit -m "created python script" git push origin master
Make a pull request
Go to our bootcamp repository page and click
Pull Requestson the right.
Click the green
New pull requestbutton.
master. Then hitClick to create a pull request` and hit OK. This will create a pull request with your changes.
Remember the URL that you get redirected to. As you complete exercises later in the bootcamp and push your changes to github, your pull request will automatically be updated with all your work!