Elizabeth N. Riley

Krazy with a "K"

2 notes

My Quest to Learn Python: Exercise 1

Exercise 1 of Learn Python the Hard Way complete!

Tools used: Terminal and gedit text editor (to create python file)

What I learned:

  • Python files end in .py
  • To run a python script, type: “python” “[file name]”
  • In python, there are data types called “strings”
  • One of which can be a “print string”
  • To create a print string, you must type “print” before the characters that follow
  • This line must be enclosed with quotes, either “” or ” (haven’t figured out the differences between the two yet, if any)
  • To make your script only print one line of the python file, type “#” before “print” on the lines you want the Terminal to pass over
  • This “#” symbol is also called an octothorpe

Visual:

.py file - example 1

.py file - example 2 (w/octothorpe)

terminal example

  1. aubree-bradley reblogged this from elizabethriley
  2. elizabethriley posted this