Probleme 1...5

In jedem der folgenden Codes hat es jeweils einen Fehler bzw. ein Problem.

  1. Finde das Problem. Du kannst denn Code auch kopieren und in TigerJython testen, was passiert.
  2. Beschreibe das Problem in eigenen Worten.
  3. Behebe das Problem und teste, ob der Code läuft.
Problem_01.py
input("Gib eine Zahl ein.")
if input >= 0:
    print("Die Zahl ist positiv.")
else:
    print("Die Zahl ist negativ.")


Problem_02.py
eingabe = input("Gib eine Zahl ein.")
if eingabe >= 0:
    print("Zahl ist positiv.")
elif eingabe == 0:
    print("Zahl ist 0")   
else:
    print("Zahl ist negativ.")


Problem_03.py
from gturtle import *
Options.setPlaygroundSize(400, 400)
Michelangelo = Turtle()
 
figur = input("Welche Figur: Quadrat oder Kreis?")
 
if figur == "Kreis":
    Michelangelo.rightArc(50,360)
if figur == "Quadrat":
    repeat 4:
        Michelangelo.forward(50)
        Michelangelo.right(90)
else:
    print("Gib entweder 'Quadrat' oder 'Kreis' ein")


Problem_04.py
from gturtle import *
Options.setPlaygroundSize(400, 400)
Michelangelo = Turtle()
 
figur = input("Welche Figur: Quadrat oder Kreis?")
 
if figur == Kreis:
    Michelangelo.rightArc(50,360)
elif figur == Quadrat:
    repeat 4:
        Michelangelo.forward(50)
        Michelangelo.right(90)
else:
    print("Fehler!")


Problem_05.py
# Wo liegt das Problem?
from gturtle import *
Options.setPlaygroundSize(400, 400)
Michelangelo = Turtle()
 
figur = input("Welche Figur: Quadrat oder Kreis?")
Kreis = Michelangelo.rightArc(50,360)
 
if figur == "Kreis":
    Kreis
else:
    print("Fehler!")
  • gf_informatik/programmieren_ii/problems.1670925930.txt.gz
  • Zuletzt geändert: 2022-12-13 10:05
  • von gra