Benutzer-Werkzeuge

Webseiten-Werkzeuge


kicoku:kicokusommer2023

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
kicoku:kicokusommer2023 [2023/08/14 09:59] – [Zahlen Variablen] newokicoku:kicokusommer2023 [2023/11/24 19:42] (aktuell) – [KiCoKu Sommer 2023] newo
Zeile 1: Zeile 1:
- ====== KiCoKu Sommer 2023 ====== +====== KiCoKu Sommer 2023 ====== 
-===== Python =====+ 
 +Dieser Bereich basiert auf dem Buch "Teach your kids to code" from Bryson Pane und dem folgenden Udemy Kurs  
 +https://www.udemy.com/course/teach-your-kids-to-code\\ 
 +Dieser Kurs ist zwar auf Englisch, aber sehr leicht zu verstehen. 
 + 
 +Dauer: Mo. 28.8 bis Fr. 1.9 
 +Von 9:00 bis 13:00 
 + 
 +Teilnehmer: Felix G, Markus, Paul, Felix E  
 +===== Python Abschnitt 1 - Installation und Test =====
  
 Installation: [[https://www.python.org/downloads/windows/|Python für Windows]] Installation: [[https://www.python.org/downloads/windows/|Python für Windows]]
Zeile 52: Zeile 61:
 </code> </code>
  
 +===== Python Abschnitt 2 - Zeichnen =====
 ==== Erstes Ziel Sechs Eckige Spirale ==== ==== Erstes Ziel Sechs Eckige Spirale ====
 Unser erstes Ziel, eine sechseckige Spirale zeichnen lassen. Unser erstes Ziel, eine sechseckige Spirale zeichnen lassen.
Zeile 313: Zeile 323:
 </code> </code>
 {{:kicoku:spiralmyname.png?200|}} {{:kicoku:spiralmyname.png?200|}}
-==== Text zeichnen ====+==== Taschenrechner ==== 
 +<code> 
 +print("MathHomework.py")
  
 +# Ask the user to enter a math problem
 +problem = input("Enter a math problem, or 'q' to quit: ")
 +
 +# Keep going until the user enters 'q' to quit
 +while (problem != "q"):
 +    
 +    # Show the problem, and the answer using eval()
 +    print("The answer to ", problem, "is:", eval(problem) )
 +    
 +    # Ask for another math problem
 +    problem = input("Enter another math problem, or 'q' to quit: ")
 +    
 +    # This while loop will keep going until you enter 'q' to quit 
 +</code>
 +Bildschirmausgabe
 +<code>
 +MathHomework.py
 +Enter a math problem, or 'q' to quit: 5 + 2
 +The answer to  5 + 2 is: 7
 +Enter another math problem, or 'q' to quit: 5 / 2
 +The answer to  5 / 2 is: 2.5
 +Enter another math problem, or 'q' to quit: 5 // 2
 +The answer to  5 // 2 is: 2
 +Enter another math problem, or 'q' to quit: 5 % 2
 +The answer to  5 % 2 is: 1
 +Enter another math problem, or 'q' to quit: (4 + 2) * (2 + 2)
 +The answer to  (4 + 2) * (2 + 2) is: 24
 +Enter another math problem, or 'q' to quit: q
 +</code>
 +==== Eingabe für die färbige Spirale ====
 +<code>
 +# ColorSpiralInput.py
 +import turtle
 +t = turtle.Pen()
 +t.speed(0)
 +turtle.bgcolor("black")
 +# Set up a list of any 8 valid Python color names
 +colors = ["red", "yellow", "blue", "green",
 +          "orange", "purple", "white", "gray"]
 +# Ask the user for the number of sides
 +sides = int( turtle.numinput("Number of sides",
 +                             "How many sides do you want (1-8)?", 4, 1, 8))
 +# Draw a colorful spiral with the user-specified number of sides
 +for x in range(360):
 +    t.pencolor( colors[x % sides] )
 +    t.forward( x * 3 / sides + x)
 +    t.left(360 / sides + 1)
 +    t.width(x * sides / 200)
 +</code>
 +{{:kicoku:inputcolorspiral.png?200|}}
kicoku/kicokusommer2023.1691999956.txt.gz · Zuletzt geändert: 2023/08/14 09:59 von newo