Skip to content

Instantly share code, notes, and snippets.

@stretchkennedy stretchkennedy/problems.md
Last active Nov 16, 2016

Embed
What would you like to do?

Using python:

  • Find 4096 divided by 4.

  • Write a program that

    • takes a number from the command line and divides it by 4.
    • solves a thing called "FizzBuzz" up to the number 20. (hint: to get the remainder of a division, you need a thing called the modulo operator)
    • takes a number and runs through the steps of the Collatz conjecture.
    • takes a number, or numbers, and applies a formula that's actually useful to them. (if you're stuck for ideas, the quadratic formula could be interesting)
    • takes a list of numbers and adds them together. (hint: first use a for loop, then look at map from https://docs.python.org/2/tutorial/datastructures.html#functional-programming-tools)
    • takes a list of names and outputs something like Hello Ted, John, Alice, and Jane!.
    • opens a file and outputs it to the console. (hint: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files)
    • opens a file, the name of which is given as a command line argument, and outputs it to the console.
    • opens a file, reverses the text within it, and outputs it to the console.
    • opens a file, reverses the text within it, and saves it.
    • opens a file, counts the number of times each character appears, and outputs those counts to the console. (hint: https://docs.python.org/2/tutorial/datastructures.html#dictionaries)
  • Write an HTML page with a heading and some text (hint: you can open a HTML file in a browser)

    • Make the heading red (hint: <element style="color: ...;"></element>
    • Change the page so the text is in one column (hint: google css width)
    • Add a title (hint: google html title tag)
  • Write a program that

  • Follow a tutorial on how git works, at least as far as learning what git init, git add, git checkout, git status, and git commit do.

  • Write a web server that

    • returns "Hello World". (hint: use http://flask.pocoo.org/, and use port 8080 or another port in the thousands)

      • using your git knowledge, initialise a repository then commit your progress thus far.
    • returns "You've visited this page X times", where X is a number that goes up by 1 each time.

      • commit after this, and each additional step.
    • returns the previous thing, but reads and saves the number from a file, so the number is the same if the serve is restarted.

    • returns the HTML file you created earlier.

    • returns "You've visited X times" but written in HTML.

    • returns a page with a form containing two texts inputs and a submit button on it.

      • change it so that you can submit that form, then receive the two numbers multiplied together.
  • Sign up for Heroku (it's free), and follow a tutorial on deploying something written in python.

    • Follow a tutorial on deploying Flask to Heroku.
    • With reference to the previous two steps, deploy your Flask server to Heroku.
  • Using python on a raspberry pi, blink an LED on and off.

    • Write a web server with two routes, /on and /off, that turns the LED on and off when you go to each.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.