Week 1, Day 1

Videos

  1. Part 1 (no content)
  2. Part 2: Introduction, Machine Setup
  3. Part 3: Background and Hello World
  4. Part 4: Go Commands and Hello World
  5. Part 5: Documentation, Variables
  6. Part 6A: Variables, Constants, Scope, Imports, Whitespace
  7. Part 6B
  8. Part 7: Miles to Kilometers
  9. Part 8: Q & A
  10. Part 9: Types
  11. Part 10: Types, Numbers
  12. Part 11: Types, Strings
  13. Part 12: Control Structures
  14. Part 13: A Deeper Look

Outline

  1. Machine Setup

  2. Hello World

    • Files & Folders
    • Terminal
    • Text Editor
    • Hello World
    • godoc

    Problems

    1. Create a program which prints “Hello World” to the terminal.
    2. What is whitespace?
    3. What is a comment? What are the two ways of writing a comment?
    4. Our program began with package main. What would the files in the fmt package begin with?
    5. We used the Println function defined in the fmt package. If we wanted to use the Exit function from the os package what would we need to do?
    6. Modify the program we wrote so that instead of printing Hello World it prints Hello, my name is followed by your name.
  3. Variables

    • Samples
    • Blank Identifiers
    • Short Variable Declarations
    • Assignment
    • Zero Values
    • Scope
    • Constants

    Problems

    1. Create a program which prints “Hello <NAME>” with <NAME> replaced with your name to the terminal using a variable.
    2. Use fmt.Scanf to read a user’s name and print “Hello <NAME>” with <NAME> replaced with the user’s name to the terminal.
    3. Create a program which converts:
      • Miles to Kilometers
      • Fahrenheit to Celsius
      • Pounds to Kilograms
  4. Types

    • Integers
    • Floating Point Numbers
    • Strings
    • Booleans

    Problems

    1. How are integers stored on a computer?
    2. We know that (in base 10) the largest 1 digit number is 9 and the largest 2 digit number is 99. Given that in binary the largest 2 digit number is 11 (3), the largest 3 digit number is 111 (7) and the largest 4 digit number is 1111 (15) what's the largest 8 digit number? (hint: 101-1 = 9 and 102-1 = 99)
    3. Although overpowered for the task you can use Go as a calculator. Write a program that computes 32132 × 42452 and prints it to the terminal. (Use the * operator for multiplication)
    4. What is a string? How do you find its length?
    5. What's the value of the expression (true && false) || (false && true) || !(false && false)?
  5. A Deeper Look

    1. Memory
    2. Stack vs Heap
  6. Control Structures

    1. For
    2. If
    3. Switch

    Problems

    1. Write a program that prints out all the numbers evenly divisible by 3 between 1 and 100. (3, 6, 9, etc.)
    2. Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".