Giter Club home page Giter Club logo

programming101's Introduction

Python Resources

Whirlwind Tour
Non-Programmer's Tutorial

Exercises

Basic

  • Write a program that prints "Hello World" to the screen.
  • Write a program that asks the user for their name and greets them with their name "Hello username".
  • Do some easy calculations (+,-,*,/,%,**,square root).
  • Write a program that asks the user for a number n and prints the sum of the numbers 1 to n
  • Modify the previous program such that only multiples of three or five are considered in the sum, e.g. 3, 5, 6, 9, 10, 12, 15 for n=17
  • Write a program that asks the user for a number n and gives them the possibility to choose between computing the sum and computing the product of 1..n.
  • Write a program that prints all prime numbers.
  • Write a guessing game where the user has to guess a secret number. After every guess the program tells the user whether their number was too large or too small. At the end the number of tries needed should be printed.
  • Write a program that prints the next 20 leap years.
  • Write a program the checks if a given bank account number (IBAN) or book number (ISBN) is correct according to their respective checksums.

Intermediate

  • Write a function that returns the largest element in a list.
  • Write function that reverses a list, preferably in place.
  • Write a function that checks whether an element occurs in a list.
  • Write a function that returns the elements on odd positions in a list.
  • Write a function that computes the running total (=prefix sum) of a list.
  • Write a function that tests whether a string is a palindrome.
  • Write three functions that compute the sum of the numbers in a list: using a for-loop, a while-loop and recursion.
  • Print all square numbers [1,4,9,16,25] and all n^n numbers [1,2,27,256,3125] up to a certain number.
  • Write a function that concatenates two lists. [a,b,c], [1,2,3] → [a,b,c,1,2,3]
  • Write a function that combines two lists by alternatingly taking elements, e.g. [a,b,c], [1,2,3] → [a,1,b,2,c,3].
  • Write a function that merges two sorted lists into a new sorted list. [1,4,6],[2,3,5] → [1,2,3,4,5,6]. You can do this quicker than concatenating them followed by a sort.
  • Write a function that rotates a list by k elements. For example [1,2,3,4,5,6] rotated by two becomes [3,4,5,6,1,2].
  • Write a function that computes the list of the first 100 Fibonacci numbers.
  • Write a function that takes a number and returns a list of its digits.
  • Implement the following sorting algorithms: Selection sort, Insertion sort
  • Implement binary search.
  • Write function that translates a text to Pig Latin and back. English is translated to Pig Latin by taking the first letter of every word, moving it to the end of the word and adding ‘ay’. “The quick brown fox” becomes “Hetay uickqay rownbay oxfay”.
  • Write a function that takes a list of strings an prints them, one per line, in a rectangular frame. For example the list ["Hello", "World", "in", "a", "frame"] gets printed as:
*********
* Hello *
* World *
* in    *
* a     *
* frame *
*********
  • Print a christmas tree, given its width. If width=7:
   *
  ***
 *****
*******
   *

Dictionaries

  • Write a program, that takes numbers as words (one, two, ..., nine) and translates them to german words (eins, zwei, ..., neun).
  • Given a set of supermarket items ("apple", "banana") and their prices in EUR (2.5, 3). Print the sum of a list of items. For example ["apple", "apple", "banana", "apple"] should print 10.50 EUR.

Recursion

  • n! (factorial)
  • n(i+1) = n(i) + n(i-1) (Fibonacci sequence)
  • Binomial Coefficient
  • Reverse a string
  • Merge sort
  • Quick sort
  • Towers of Hanoi
  • Euclidean algorithm
  • List all files of a folder and its subfolders
  • Graph: depth-first search
  • Graph: flood fill
  • Tree: In-order, Pre-order, Post-order traversal

Random

  • Bresenham
  • Runlength Encoding
  • Huffman Encoding
  • Lempel-Ziv-Welch
  • Wagner Fischer Algorithm (Edit Distance)
  • Boyer Moore
  • Knuth Morris Pratt
  • Miller Rabin
  • Scheduling: Johnson's Rule
  • k-d tree
  • Bloom Filters

Sorting

  • Insertion Sort
  • Selection Sort
  • Merge Sort
  • Quick Sort
  • Heap Sort
  • Radix Sort
  • Bucket Sort

Data structures

  • Stack
  • ArrayList
  • LinkedList
  • Binary Search Tree
  • Heap / Priorityqueue
  • AVL Tree
  • B Tree
  • Skiplist
  • Graph (adj. matrix or list)

Graph Algorithms

  • DFS / BFS
  • Dijkstra
  • A*
  • Bellman-Ford
  • Floyd-Warshall
  • Johnson
  • Kruskal / Prim

Some classical NP hard problems

  • Travelling salesman
  • Vertex cover / Independent set
  • Bin packing
  • Knacksack packing
  • Graph coloring

Wikipedia list: link

Other links

programming101's People

Contributors

r0f1 avatar

Watchers

James Cloos avatar

Forkers

nix1947

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.