Ich habe Python mit Himbeer-Pi 1 Modell b ausprobiert.
raspberry pi 1 model b raspbian 2016_09_23 jessie lite python 2.7.9
# coding: utf-8
import random
zundoko = ["Dung", "Doco"]
n = 0
i = True
while (i):
s = zundoko[random.randint(0, 1)]
print (s)
if (s == "Doco"):
if (n == 4):
print "Kiyoshi!"
i = False
else:
n = 0
else:
n = n + 1
# coding: utf-8
def fizzbuzz(n):
if n % 3 == 0 and n % 5 == 0:
print("fizzbuzz")
return 0
if n % 3 == 0:
print("fizz")
return 1
if n % 5 == 0:
print("buzz")
return 2
print(n)
return 3
for i in range(100):
fizzbuzz(i + 1)
Recommended Posts