Skip to content

Real-McFly/Uebungen_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Übungen Python – Würfel stapeln / Python Exercises – Cube Stacking

Dieses Projekt entstand im Rahmen einer Schulübung (2024). Es geht darum zu berechnen, wie viele Level/Ebenen sich mit einer bestimmten Anzahl an Würfeln stapeln lassen.


🇩🇪 Beschreibung

Es wurden zwei Lösungsansätze implementiert:

  1. Schleifen-Variante: Zählt Level hoch, solange die Würfel reichen.
  2. Formel-Variante: Direkte Berechnung über eine quadratische Gleichung (Mitternachtsformel).

Beide Methoden messen zusätzlich die Ausführungszeit, um Unterschiede zu verdeutlichen.


##EN Description This project was created as part of a school exercise (2024). It calculates how many levels can be stacked with a given number of cubes.

Two approaches were implemented:

  1. Loop approach: Increment levels until cubes are used up.
  2. Formula approach: Direct calculation using a quadratic equation.

Both methods also measure the execution time for comparison.


🛠️ Tech

  • Language: Python 3
  • Modules: math, time

▶️ Usage

python Wuerfel_Level.py
  • Enter the number of cubes when prompted.
  • Choose calculation method in the variable methode_used:
    • 1 = Schleifen-Methode / loop method
    • 2 = Formel-Methode / formula method
    • 3 = beide / both (compare)

📂 Files

  • Wuerfel_Level.py – Hauptdatei mit beiden Methoden

✍️ Author: Sven Lehnert (2024)

About

DE: Schulübung – Würfel stapeln (Schleife & Formel, Zeitvergleich). EN: Cube stacking (loop vs formula, timing).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages