This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to test this , create a file called poem.txt in the same folder as this python file | |
# make sure there are a lot of "more" in the poem.txt like | |
poem = """there is more to the world | |
than Demi Moore and Roger Mooore | |
It is a good Morning, but more so | |
a good day to every moron out there, | |
gimme more, more, moreofit""" | |
# i assume you are using python3.2 here | |
# open file as fileoobject f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Struktur der Firma: { Name: ( Name erster Unterling, Name nächster Kollege), .. } | |
# oder: [ (Name, Name erster Unterling, Namer nächster Kollege), .. ] | |
firma = { "A":("B","-"), "B":("-","C"), "C":("E","D"), "D":("G","-"), | |
"E":("-","F"), "F":("-","-"), "G":("-","-") } | |
# Problem in 2 Teilprobleme zerlegen. 1.) wie viele direkte Untergebene | |
# hat Mitarbeiter m ? | |
def mitarbeiterzaehler(m): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python3 | |
# hi dennis. first, let us define parts that repeat themself a lot | |
# programmers hate typing the same thing over and over and prefer | |
#to define (def) function and call them over and over ... it's less typing | |
# let's define a function that simply prints the different possibilitys for the user | |
# ask the user for an answer, checks the answer (ask again if answer was invalid) | |
# and return the correct answer. (0,1,2 or 3). Note that those answers are strings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.3 | |
# -*- coding: utf-8 -*- | |
"""A Hangman Demo for Python3 form yipyip. Guess some python3 keywords ! | |
see https://gist.github.com/yipyip/6038584 for original code | |
""" | |
#### | |
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 + 1 | |
100 – 1 | |
100 / 7 | |
100 / 7.0 | |
100 % 7 | |
100 * 4 | |
100 ** 2 | |
100 ** 0.5 | |
(100+1) * 2 | |
100 + 1 * 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Name: goblindice001.py | |
Purpose: combat sim of one goblin against a test dummy | |
edit code: https://gist.github.com/horstjens/11267180#file-goblindice001-py | |
edit website: https://github.com/horstjens/ThePythonGameBook/tree/gh-pages | |
main project: http://ThePythonGameBook.com | |
Author: Horst JENS, [email protected] | |
Licence: gpl, see http://www.gnu.org/licenses/gpl.html | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pyhton3 example to teach python coding to young students | |
import random | |
friends = ["Anne","Bettina","Clara","Daniela"] | |
verbs = ["kissing","beating", "taunting","scaring","cooking","cleaning","eating","feeding"] | |
things = ["frog","airplane","castle","wizard","spaceship","elephant"] | |
adjectives = ["growing","impatient","hungry","angry","happy","sad", "unruly","nervous"] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import turtle as t | |
p1 = t.Turtle() | |
p1.left(70) | |
p1.speed=9 | |
p1.dx = math.cos(p1.heading()*math.pi/180)*p1.speed | |
p1.dy = math.sin(p1.heading()*math.pi/180)*p1.speed | |
for step in range(100): | |
x = p1.xcor() | |
y = p1.ycor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#include<time.h> | |
int z = 0; | |
int level; | |
/* int gen(); | |
int spiel(); */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python3 example to play with turtle graphic |
OlderNewer