There really is no hope of making this code even half-way decent without
spending the time to rewrite them all properly. Don't want to do any of
that
This commit is contained in:
2025-11-03 17:08:35 +01:00
parent 21a17e33fa
commit ede0ee318b
48 changed files with 1219 additions and 582 deletions

View File

@@ -1,10 +1,11 @@
#Library import
# Library import
import math
#Startup
# Startup
out = 0
print("""
print(
"""
,--------. ,--. ,--.
'--. .--',--,--. ,---. ,---.| ,---. ,---. ,--,--, ,--.--. ,---. ,---.| ,---. ,--,--, ,---. ,--.--.
@@ -17,17 +18,18 @@ print("""
Build 1
28.05.21
""")
"""
)
#Userinput
# Userinput
i = input("Rechung eingeben: ")
#Separation
# Separation
l = i.split()
x1 = l.pop(0)
x = int(x1)
#Calculation
# Calculation
if len(l) == 1:
print("Wrong entry, retry, use spaces in between numbers and operands.")
else:
@@ -45,22 +47,22 @@ else:
elif "/" or ":" in l:
out = x / y
elif "^" or "**" in l:
out = x ** y
out = x**y
elif "<>" in l:
math.sqrt(x)
else:
print("unkown operand, retry")
if len(l) != 0:
operand = l.pop(0)
x = out
else:
print("The result is:")
#Output
print(out)
# Output
print(out)

View File

@@ -11,8 +11,8 @@ go = 1
while go == 1:
zahl = random.randint(1,2)
zahl = random.randint(1, 2)
if st1 == st2:
if st2a == st3:
go = 0
@@ -26,7 +26,7 @@ while go == 1:
print("K")
else:
print("N")
else:
anzahl += 1
st3 = st2
@@ -37,4 +37,4 @@ while go == 1:
print("K")
else:
print("N")
print("Took", anzahl, "tries")
print("Took", anzahl, "tries")

View File

@@ -5,17 +5,14 @@ system = int(input("Zahlensystem: "))
if system == 2:
y = bin(eingabe)
print("Resultat:", y)
elif system == 16:
y = hex(eingabe)
print("Resultat:", y)
elif system == 8:
y = oct(eingabe)
print("Resultat:", y)
else:
print("wrong")

View File

@@ -1,26 +1,28 @@
#FRANKENGEWINNSPIEL
#-------------------------------------------------
# FRANKENGEWINNSPIEL
# -------------------------------------------------
#Import of Modules and setup variables
#import turtle
# Import of Modules and setup variables
# import turtle
#Definition of Turtle instances
# Definition of Turtle instances
#Preparations, so setup of the game output window and choice of diffrent gamemodes
# Preparations, so setup of the game output window and choice of diffrent gamemodes
programchoice = 200
while (programchoice < 1) or (programchoice > 99):
programchoice = programchoice = int(input("Welcher Modus? 1 = Normales Spiel, 2 = Liste aller Gewinne mit angabe des Höchsten, 3 = angabe des höchsten Gewinnes, 4 = andgabe des höchsten erreichbaren Feldes: "))
programchoice = programchoice = int(
input(
"Welcher Modus? 1 = Normales Spiel, 2 = Liste aller Gewinne mit angabe des Höchsten, 3 = angabe des höchsten Gewinnes, 4 = andgabe des höchsten erreichbaren Feldes: "
)
)
if (programchoice < 1) or (programchoice > 99):
print("Number not within designated range. Try again")
print("Willkommen")
#MAINGAME
#-----------------------
# MAINGAME
# -----------------------
def playgame(field):
global winning
winning = 0
@@ -32,10 +34,11 @@ def playgame(field):
else:
next = field / 2
winning += next
field = next
#GAMEMODE 1
#-------------------------
field = next
# GAMEMODE 1
# -------------------------
def gamemode1():
s = 200
while (s < 1) or (s > 99):
@@ -49,17 +52,18 @@ def gamemode1():
print("Your winnings:", winning)
#GAMEMODE 2
#--------------------------
# GAMEMODE 2
# --------------------------
def gamemode2():
fieldascending = 1
for i in range(99):
playgame(fieldascending)
print("You win",winning,"with startpoint",fieldascending)
print("You win", winning, "with startpoint", fieldascending)
fieldascending += 1
#GAMEMODE 3
#--------------------------
# GAMEMODE 3
# --------------------------
def gamemode3():
fieldascending = 1
global winning
@@ -71,10 +75,11 @@ def gamemode3():
currentwinning = winning
currentfield = fieldascending
fieldascending += 1
print("Biggest possible winning is", currentwinning,"on field", currentfield)
#GAMEMODE 4
#-----------------------------
print("Biggest possible winning is", currentwinning, "on field", currentfield)
# GAMEMODE 4
# -----------------------------
def gamemode4():
fieldascending = 1
global winning
@@ -94,18 +99,19 @@ def gamemode4():
next = field / 2
field = next
fieldascending += 1
print("Biggest possible field is", biggestfield,"on startfield", currentfield)
print("Biggest possible field is", biggestfield, "on startfield", currentfield)
#RUN
#-------------------------
# RUN
# -------------------------
if programchoice == 1:
gamemode1()
elif programchoice == 2:
gamemode2()
elif programchoice == 3:
gamemode3()
else:
gamemode4()

View File

@@ -1,7 +1,7 @@
#Idioms
# Idioms
import random
#Check user input
# Check user input
s = 200
while (s < 1) or (s > 99):
@@ -12,28 +12,28 @@ while (s < 1) or (s > 99):
print("Ok")
#Find biggest number
# Find biggest number
output = 0
for i in range(100):
n = random.randint(1, 1000)
if n > output:
output = n
print(output)
#Summ up
summ = 0
# Sum up
sum = 0
for i in range(100):
n = random.randint(1, 1000)
summ += n
print(summ)
sum += n
print(sum)
#even or uneven?
# even or uneven?
z = random.randint(1, 1000)
if (z % 2) == 1:
print("odd")
else:
print("even")
print("even")

View File

@@ -1,13 +1,9 @@
import math
#Eingabe
# Eingabe
s = int(input("Seitenlänge: "))
#Verarbeitung
# Verarbeitung
for i in range(s):
print(s * "* ")

View File

@@ -8,8 +8,8 @@ stelle = 1
while y > 0:
y = y // system
outadd = y % system
out += (outadd * stelle)
out += outadd * stelle
stelle *= 10
print(out)
print(out)

View File

@@ -1,3 +1,3 @@
c = (1.4962375e8 / 2.99792458e5)/60
c = (1.4962375e8 / 2.99792458e5) / 60
print(c)
print(c)

View File

@@ -6,5 +6,5 @@ m = 32
x = int(time.time()) % m
for i in range(10):
x = (a*x + c) % m
print(x)
x = (a * x + c) % m
print(x)