JUNIOR

ACADEMY

8/27/2016

i3 review

  • Dynamic tiling window manager
  • By default, the mod key is Alt
    • Use it with other keys to perform commands
  • Application manager: dmenu
  • Workspaces
  • Configuration file
    • ~/.config/i3/config

vimtutor

  • Open your terminal (mod + Enter)
  • Type in vimtutor
  • Advance through it!

the internet

  • How the internet works
    • Network of interconnected machines
  • IP Address
    • Unique number assigned to each device on the internet
  • Difference between the internet and world wide web
    • WWW is a way of accessing the information over the internet
  • How we connect to the internet
    • Servers, sockets, and ports

server/client

sockets & ports

scp

  • Secure Copy protocol
  • The scp command allows you to remotely copy files from:
    • Your host computer to another computer
    • Another computer to your host
    • Another computer to another computer
  • Copies files between hosts on a network
  • Syntax:
    • scp user@host1:source user@host2:destination
      • user is the user on the host
      • host is the computer; usually the IP address
      • source is the path to the file being copied to the destination

scp example

  • ex. scp ~/Documents/file.txt junior@192.168.0.2:~/Desktop
    • The localhost doesn't need the first part before the colon (user@host:)
    • Find out your IP address by typing ifconfig into your terminal and look at your "inet address" under wlp3s0

scp exercise

  • Use scp to send your partner a file containing a message
    • Place it in their Desktop
  • Remember to use the man command if you forgot how to use SCP

ssh

  • Secure Shell
  • ssh allows you to remotely access a machine by logging in and executing commands
  • Syntax:
    • ssh user@hostname
    • Similarly to scp, you need the password of the remote host
  • You can't ssh from one host into another

python

  • Review
  • Loops
  • Functions

function review

  • Write a function called practice_function() that takes in a number as a parameter. If the number is less than 50, print the value. If the number is greater than 50 but less than 1000, print a message. If the number is any other value, return the number, then print it. Call the function for three different values: 5, 50, and 200.

 

  • Write a function called describeCity() that accepts the name of a city and its country as parameters. The function should return a simple sentence (for example: "Honolulu is in the USA"). Call your function for three different cities, store them in a list, and print the items in the list separately.

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 python-pip
  • Updating pip for packages
    • pip install --upgrade setuptools
    • pip install --upgrade pip

team function review

  • Teams compete to see who can write a function to solve the given problem or complete the given task
  • When finished, the instructors will look over the code
  • However, in order to win, a random member of the team will write the code on the board and the other member will have to explain the code line by line to the class

tfr

Return the number of even integers in the given array. Note: the % "mod" operator computes the remainder, e.g. 5 % 2 is 1.

 

count_evens([2, 1, 2, 3, 4]) → 3

count_evens([2, 2, 0]) → 3

count_evens([1, 3, 5]) → 0​

tfr

Define a function sumOfList() that takes in a list as a parameter and adds up all of the numbers in the list.

Return the sum, or a string saying "The list is empty" if there are no items in the list.

 

Note: Use the len(param) function to return the length of the param

tfr

Write a function that takes in a string and an integer n, and returns a larger string that is n copies of the original string

 

Use a for loop, not the string*int

 

ex. string_times("Hi", 4) == HiHiHiHi

tfr

A Fibonacci Sequence is a series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers:

 

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55

 

 

0 and 1 are the first two Fibonacci numbers, given by default. 

 

Write a function that takes in a number as a parameter, and returns that amount of Fibonacci numbers. 

Jr. DevLeague Academy PM 8/27/16

By jtheadland

Jr. DevLeague Academy PM 8/27/16

  • 635