-
Notifications
You must be signed in to change notification settings - Fork 20
Exercise Hello World
- Make sure you have
gitinstalled - Make sure you have a github account.
- Make sure you have your ssh keys setup. See here for help
-
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:
[email protected]:username/bootcamp-python.git. Copy that link. -
In your command line, enter this:
git clone [email protected]:username/bootcamp-python.git. This should create abootcamp-pythondirectory on your computer. Typecd bootcamp-python && ls, and you should see anexercise-hellodirectory. Go into that directory.
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!
Open up hello.py and follow the instructions in that file. When you are done, run
python hello.py
to run your program! To make sure your program matches out expected output:
./test.sh
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.pyThe 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:
./script.pyNow 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-
Go to our bootcamp repository page and click
Pull Requestson the right. -
Click the green
New pull requestbutton. -
Click
Edit. Forbase fork:selecthcs/bootcamp-python. Forhead fork:selectusername/bootcamp-pythonand forcompare:, selectmaster. 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!