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
# -*- coding: utf-8 -*- | |
"""003_static_blit_pretty_template.py""" | |
import pygame | |
import random | |
def make_text(msg="pygame is cool", fontcolor=(255, 0, 255), fontsize=42, font=None): | |
"""returns pygame surface with text. You still need to blit the surface.""" | |
myfont = pygame.font.SysFont(font, fontsize) |
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
def calculate(operator, nr1, nr2): | |
if operator != "/" or operator != "-" or operator != "+" or operator != "*": | |
return "Invalid Operator!" | |
elif operator == "/": | |
try: | |
return str(nr1//nr2) | |
except: | |
return "Error!" | |
elif operator == "-": | |
try: |
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 os | |
def clear(): | |
try: | |
os.system("cls") | |
except: | |
os.system("clear") | |
# You need this module in the same folder and you can simple import it with the "import" command |
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
def swap(a, b): | |
a, b = b, a | |
return a, b | |
swapped_value = swap(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
def reverse(rstr): | |
return rstr[::-1] | |
reversed_string = reverse("Hello") |
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
credits = """ | |
Made by Simon Heppner | |
on 9th of May, 2018 | |
""" | |
print(credits) | |
def addition(int1, int2): | |
return (int1 + int2) | |
def subtraction(int1, int2): |
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
def swap(numbersp): | |
swapped = str(numbersp) | |
a = swapped[0] | |
b = swapped[1] | |
swapped = int(b + a) | |
return swapped | |
swap(12) |
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 | |
import subprocess | |
freunde=("Luka","Eni","Adrian","Caro","Marie","Ella","Boba Fett","Ein Känguru","Merkel", "Pikachu", "Manuel", "Hulk", "Superman", "Batman", "Captain America", "Anakin Skywalker", "Harry Potter", "Luke Skywalker", "Simon Heppner", "Paolo Perfahl", "Pablo Piccaso", "Horst Jens", "Herr Computer", "Spongebob", "Mr. Crabbs", "Maria", "Jesus", "Gott", "Teufel", "Poseidon", "Percy Jackson") | |
verben=("schimpft","schlägt","küsst","isst","verschlingt","hilft","kitzelt","verklagt", "umarmt", "programmiert", "ärgert", "nervt", "erschießt", "zermalmt", "zerdrückt", "erdrosselt", "liebt", "tötet") | |
orte=("am Strand","unter Wasser","im Schiff","über den Wolken","auf dem Spielplatz","in der Schule","in der Klasse","im Parlament", "im UFO", "im Uboot", "im Himmel", "beim Schreibtisch", "in der Schule", "in der Hölle", "auf Courocant", "auf Tatooine", "auf Alderaan", "am Berg", "im Gebirge", "im Raum", "im Kino", "vor dem Kino", "vor dem Computer", "vor der Kirche", "in der Kirche") | |
adj=("leidens |
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 os | |
while True: | |
a = input("Enter the first number and press RETURN >> ") | |
try: | |
num1 = int(a) | |
except: | |
continue | |
break | |
NewerOlder