Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Am Anfang jedes Programmierkurses gibt's ein "Hallo, Welt!"-Programm
- # Copyright 2022, 2023 Roland Richter [Mu: Pygame Zero]
- # Erzeuge ein rechteckiges 600×400 Fenster
- WIDTH = 600
- HEIGHT = 400
- # Im folgenden Code ist (absichtlich) ein Fehler versteckt; du sollst
- # den Code richtig stellen -- aber nur innerhalb der ↓ / ↑ Zeilen!
- # ÄNDERE den Code so, dass das "Hallo, Welt!"-Programm uns alle begrüßt.
- # ↓---------↓---------↓---------↓---------↓---------↓---------↓
- hallo_welt = "Holla, welt?"
- # ↑---------↑---------↑---------↑---------↑---------↑---------↑
- def draw():
- # Setze den Hintergrund auf schwarz
- screen.fill("black")
- # Begrüße alle in der Mitte des Fensters
- screen.draw.text(hallo_welt, (300, 200))
- # HALT! Änderungen unter dieser Zeile sind verboten!
- # ↑---------↑---------↑---------↑---------↑---------↑---------↑
- def fail_string(name, val, exp):
- return "\n " + name + " ist " + str(val) + "\n sollte aber " + str(exp) + " sein"
- assert hallo_welt == "Hallo, Welt!", fail_string("hallo_welt", hallo_welt, "Hallo, Welt!")
- # ----------------------------------------------------------------------
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement