Action unknown: copypageplugin__copy

Probleme 1...5

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

  1. Finde das Problem. Du kannst den 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.")

Lösung


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.")

Lösung


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")

Lösung


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!")

Lösung


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!")

Lösung

  • gf_informatik/programmieren_ii/problems.txt
  • Zuletzt geändert: 2022-12-21 07:29
  • von gra