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, horst.jens@spielend-programmieren.at | |
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
python3 example to play with turtle graphic |
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
# Caesar Cipher | |
# from Al Sweigarts invent with python book https://inventwithpython.com/chapter14.html | |
MAX_KEY_SIZE = 26 | |
def getMode(): | |
while True: | |
print('Do you wish to encrypt or decrypt a message?') | |
mode = input().lower() | |
if mode in 'encrypt e decrypt d'.split(): |
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 random | |
# legende: # Fels . Boden T Troll ! trap | |
dungeon = """ | |
############################################### | |
#......................bbb.....#.....#........# | |
#.............................................# | |
#.............................................# | |
############################################### | |
""" |
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
#Fantasynamengenerator (python3) | |
"""generates fantasy names""" | |
def namensgenerator(namen): | |
"""im docstring in triple-quotes beschreibt man was die funktion tut""" | |
namensliste = [] | |
output = "" | |
while len(namensliste) < anzahl: | |
neuername = (random.choice(namen[0]))+(random.choice(namen[1])) | |
if neuername not in namensliste: |
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 |
OlderNewer