JUNIOR

ACADEMY

9/3/2016

vimtutor

  • Open your terminal (mod + Enter)
  • Type in vimtutor
  • Continue from where you left off last week
    • If you remember the line number #, use #G to go directly to that line
    • If you remember the lesson name, you can use / and then type in the pattern to find it (like ctrl+f)
      • Press Enter, then if the first result isn't it use n to search forward, and N to search backward

libraries and modules

  • There is a lot of cool stuff you can do in Python, such as plotting scientific data, making games with pygame and scipy and mathplotlib
  • Modules are pre-written, complex, program files that allow us to do something specific
  • Libraries are giant collections of modules that serve a general purpose
  • To use access a library to make your code do cool stuff use import
  • Usually we only want one or two modules from a library, though, so we use the from library import module statement
    • ex. from Random import randint

pip

  • Pip is a Python repository where you can download a lot of Python files, modules, and libraries
  • In the terminal:
    • sudo apt install python3-pip
  • Updating pip for packages
    • pip install --upgrade setuptools
    • pip install --upgrade pip

tfr

Write a function tempConvert() that takes in two parameters, a number and a string. The number is a temperature and the string indicates the temperature system (Fahrenheit or Celsius).

The function converts the inputted temp into the other system and returns the resulting temp.

ex. tempConvert(0, 'C') returns 32

tempConvert(50, 'F') returns 10

Look up the temperature conversion formulas yourselves :)

rock paper scissors

  • For your first project, you must make a rock paper scissors game
  • Requirements:
    • Ask the player if they pick rock, paper, or scissors
    • Have the computer randomly choose its move
    • Compare the choices and decide who wins
      • Print the results
    • Let the player choose to play again
    • Keep a record of the score, and when the player finishes, print the end score
      • ex. Player: 3 / Computer: 6
    • Make the code as clean as possible & easy to read. Use multiple functions (preferably ~3)
Made with Slides.com