Danke schonmal im Voraus
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
d = "Das ist schön"
print ("Heyho schön dich zu sehen")
meinName = input("Wie ist dein Name? ")
try:
x = int(input("Auf einer Skala von 1 bis 10 - Wie gehts dir " + meinName +"? "))
except ValueError:
# Kommentar: Hier soll das programm nach einer neuen Antwort fragen solange der angegebene Wert kein int wert ist
time.sleep(3)
if (x >= 8 and x < 11):
print (d)
elif (x >= 5 and x < 11):
print ("naja immer noch besser als nichts")
elif (x < 5 and x > 0):
print ("lass dich nicht unterkriegen!")
else:
while x < 1 or x > 10:
try:
x = int(input("von einer skala von 1 bis 10... also nochmal "))
except ValueError:
# Kommentar: Hier das selbe wie oben
time.sleep(3)
if (x >= 8 and x < 11):
print (d)
break
elif (x >= 5 and x < 11):
print ("naja immer noch besser als nichts")
break
elif (x < 5 and x > 0):
print ("lass dich nicht unterkriegen!")
break
pass
time.sleep(10)