python-grundlage/arithmetische-operationen-cli.py
New file @@ -0,0 +1,33 @@ #! /usr/bin/env python # -*-encoding utf-8-*- import sys a = sys.argv[1] b = sys.argv[2] a = float(a) b = float(b) plus = a + b print(f"{a} + {b} = {plus}") minus = a - b print(f"{a} - {b} = {minus}") mul = a * b print(f"{a} * {b} = {mul}") div = a / b print(f"{a} / {b} = {div}") integer_div = a // b print(f"{a} // {b} = {integer_div}") mod = a % b print(f"{a} % {b} = {mod}") exp = a ** b print(f"{a} ** {b} = {exp}") python-grundlage/arithmetische-operationen.py
New file @@ -0,0 +1,32 @@ #! /usr/bin/env python # -*-encoding utf-8-*- a = input("Geben Sie eine Zahl ein! ") b = input("Geben Sie eine weiter Zahl ein! ") a = float(a) b = float(b) plus = a + b print(f"{a} + {b} = {plus}") minus = a - b print(f"{a} - {b} = {minus}") mul = a * b print(f"{a} * {b} = {mul}") div = a / b print(f"{a} / {b} = {div}") integer_div = a // b print(f"{a} // {b} = {integer_div}") mod = a % b print(f"{a} % {b} = {mod}") exp = a ** b print(f"{a} ** {b} = {exp}") python-grundlage/c/size_of_test.c
New file @@ -0,0 +1,15 @@ #include <stdio.h> #include <stdbool.h> int main() { const unsigned int max = 4294967295; const unsigned int max_as_negativ = -1; printf("%d\n", max); // expected output: -1 printf("%u\n", max); bool same = max == max_as_negativ; if(same) { printf("%d and %u are the same in type unsigned int\n", max, max_as_negativ); } return 0; } python-grundlage/check-leapyear.py
New file @@ -0,0 +1,8 @@ #! /usr/bin/env python year = input("Geben Sie das Jahr ein! ") year = int(year) is_leap_year = ((year % 4 == 0) and (year % 100 != 0)) or (year % 400 == 0) print(is_leap_year) python-grundlage/color-spectral.py
New file @@ -0,0 +1,31 @@ #! /usr/bin/env violet = 380 blau = 430 cyan = 485 gruen = 495 gelb = 565 orange = 590 rot = 625 infrarot = 780 wellenlaenge = float(input("Geben Sie die Wellenlänge in nm ein ")) if violet <= wellenlaenge <= infrarot: if wellenlaenge < blau: print("Violet") elif wellenlaenge < cyan: print("Blau") elif wellenlaenge < gruen: print("Cyan") elif wellenlaenge < gelb: print("Grün") elif wellenlaenge < orange: print("Gelb") elif wellenlaenge < rot: print("Orange") elif wellenlaenge < infrarot: print("Rot") else: print("Nicht in sichtbarer Bereich") python-grundlage/easter-calculator.py
New file @@ -0,0 +1,24 @@ #! /usr/bin/env python # -*-encoding utf-8-*- year_input = input("Geben Sie das Jahr ein! (4-Ziffer) ") year = int(year_input) k = year // 100 m = 15 + ((3*k + 3)//4) - ((8*k + 13)//25) s = 2 - (3*k + 3) // 4 a = year % 19 d = (19*a + m) % 30 r = (d + a//11) // 29 og = 21 + d - r sz = 7 - (year + (year//4) + s) % 7 oe = 7 - ((og - sz) % 7) os = og + oe if os <= 31: print(f"Der Ostersonntag ist {os}.ter März") else: os = os % 31 print(f"Der Ostersonntag is {os}.ter April") python-grundlage/package-example/__init__.py
python-grundlage/package-example/experiments/__init__.py
python-grundlage/package-example/experiments/physik.py
New file @@ -0,0 +1,5 @@ from typing import Any def do_something(arg: Any): return arg python-grundlage/package-example/experiments/physik_test.py
New file @@ -0,0 +1,15 @@ import unittest from physik import do_something class MyTestCase(unittest.TestCase): def test_something(self): arg = 123456 result = do_something(arg) self.assertEqual(arg, result) if __name__ == '__main__': unittest.main() python-grundlage/package-example/use_experiment.py
New file @@ -0,0 +1,7 @@ from experiments import physik arg = 123456 result = physik.do_something(arg) print(result) python-grundlage/print-htw.py
New file @@ -0,0 +1,11 @@ htw = ''' HH HH TTTTTTTTTTTT WW WW HH HH TT WW WW HH HH TT WW WW HHhhhhhhhhhHH TT WW WWWW WW HH HH TT WW WW WW WW HH HH TT WW WW WW WW HH HH TT WW WW ''' print(htw) python-grundlage/quadratic-equation.py
New file @@ -0,0 +1,17 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- import cmath print("Programm zur Lösung einer quadratischer Gleichung ax^2 + bx + c = 0") a = float(input("a = ")) b = float(input("b = ")) c = float(input("c = ")) determinant = b**2 - 4*a*c d = cmath.sqrt(determinant) x1 = (-b - d) / (2*a) x2 = (-b + d) / (2*a) print(f"Gleichung: {a}x^2 + {b}x + {c} = 0") print(f"x1 = {x1}") print(f"x2 = {x2}") python-grundlage/weekdays.py
New file @@ -0,0 +1,3 @@ for t in range(0,7): s = (7 - t) % 7 + 1 print(f"{t} → {s}")