Skip to content

Instantly share code, notes, and snippets.

# so definiert man eine Funktion
def permutations(numbers):
# wenn die Liste nur eine Zahl enthält,
# können wir sie direkt zurückgeben
if len(numbers) == 1:
return [numbers]
# die leere Liste hier benutzen wir
# um die Ergebnisse zwischenzuspeichern
result = []
prices = [9, 9, 12, 12, 12, 15, 16, 20]
new_prices = []
# The lowest price has to be a reduces price
# Then calculate the original price from that
# remove both from the prices list and do it again
def solve (prices, new_prices):
if len(prices) == 0:
return new_prices
import itertools
import math
items = [10, 3, 4, 10]
steps = 10
def make(a, b):
print(a, b)
result = []
'use strict'
var tags = {
'a': ['b', 'c', 'd'],
'b': ['c', 'd'],
'c': ['d'],
'd': [],
'e': [],
'f': ['a']
}
'use strict'
const tags = {
'1': ['2'],
'2': ['1', '5'],
'3': ['4'],
'4': ['3', '5'],
'5': ['6'],
'6': ['7'],
'7': ['8'],
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Animation</title>
<meta name="description" content="FDSAnimation">
<meta name="author" content="katze">
@danieldiekmeier
danieldiekmeier / M28_040: Python Bee
Last active December 19, 2015 20:29
Die Aufgaben aus der Python Bee aus M28_040
'''
Die Aufgaben aus der Python Bee aus M28_040
Daniel: Eine Funktion, die prüft, ob ein String ein Palindrom ist (Nicht richtig gelöst)
Max: Eine Funktion, die prüft, ob jeder erste Buchstabe eines Wortes in einem String großgeschrieben ist (Nicht richtig gelöst)
'''
def palindrom(s):
l = len(s) / 2
for x in xrange(l):
@danieldiekmeier
danieldiekmeier / gist:6010031
Last active December 19, 2015 19:58
stringshuffle()
from random import shuffle
from re import match
def stringshuffle(s):
'''
Shuffles a string but keeps the first and last letter of every word at their original position.
'''
splitted = s.split()
shuffled = []
for str in splitted:
@danieldiekmeier
danieldiekmeier / gist:5999435
Created July 15, 2013 12:01
Pegelhöhe in Köln
http://www.pegelonline.wsv.de/webservices/rest-api/v2/stations/K%C3%96LN.json?includeTimeseries=true&includeCurrentMeasurement=true
{
"uuid": "a6ee8177-107b-47dd-bcfd-30960ccc6e9c",
"number": "2730010",
"shortname": "KÖLN",
"longname": "KÖLN",
"km": 688.0,
"agency": "WSA DUISBURG-RHEIN",
"longitude": 6.9633224437726255,