Testpage: Unterschied zwischen den Versionen
Aus Unterrichtsmaterial
Andyg (Diskussion | Beiträge) |
Andyg (Diskussion | Beiträge) |
||
Zeile 5: | Zeile 5: | ||
exclude=browse | exclude=browse | ||
</tagcloud> | </tagcloud> | ||
+ | |||
Version vom 5. März 2020, 11:51 Uhr
Arbeitsblatt Bereit für die Praxis Bücher Datenbewusstsein Definition Didaktik Glossar Idee Informatik an Grundschulen Lehrinhalt Module Praxiserprobt Primarstufe ProDaBi Seiten mit defekten Dateilinks Seiten mit ignorierten Anzeigetiteln Sekundarstufe I Sekundarstufe II Theoretischer Hintergrund Verlaufsplan Überblick
1 # Import the modules
2 import sys
3 import random
4
5 ans = True
6
7 while ans:
8 question = raw_input("Ask the magic 8 ball a question: (press enter to quit) ")
9
10 answers = random.randint(1,8)
11
12 if question == "":
13 sys.exit()
14
15 elif answers == 1:
16 print "It is certain"
17
18 elif answers == 2:
19 print "Outlook good"
20
21 elif answers == 3:
22 print "You may rely on it"
23
24 elif answers == 4:
25 print "Ask again later"
26
27 elif answers == 5:
28 print "Concentrate and ask again"
29
30 elif answers == 6:
31 print "Reply hazy, try again"
32
33 elif answers == 7:
34 print "My reply is no"
35
36 elif answers == 8:
37 print "My sources say no"