-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathU3_3_Input.py
More file actions
executable file
·25 lines (22 loc) · 845 Bytes
/
Copy pathU3_3_Input.py
File metadata and controls
executable file
·25 lines (22 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
###################################################################
#
# Uebung:
# Lesen Sie eine Zahl ein mit der input-Funktion
# Erstellen Sie eine Bedingung, welche für Zahlen grösser als 50 einen Text
# und für alle anderen Zahlen einen anderen Text schreibt.
#
###################################################################
#### Lösung: ####
# KI-Prompt:
# Erstelle ein Python Script, welches folgende Aufgaben erfüllt:
# - Verwende die Input-Funktion um eine Zahl einzulesen
# - Erstelle eine if-Bedingung, welche prüft, ob die Zahl grösser ist als 50 oder nicht
# - Gib zwei unterschiedliche Text als Resultat aus
# Eingabe einer Zahl
print("Bitte eine Zahl eingeben")
x = input("-> ")
# Auswertung
if int(x) > 50:
print("Die Zahl", x, "ist grösser als 50")
else:
print("Die Zahl", x, "ist nicht grösser als 50")