Created
April 16, 2013 08:38
-
-
Save davidak/5394375 to your computer and use it in GitHub Desktop.
Erzeugt zufällige Worte aus einer Liste, die nicht gleich sind.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
import random | |
r = random.SystemRandom() # Uses /dev/urandom or Windows CryptGenRandom for better entropy | |
liste = ['Kartoffel', 'Flugscheibe', 'Erdbeben', 'Klospülung', 'Nanoroboter'] | |
x = r.choice(liste) | |
print("x =", x) | |
y = r.choice(liste) | |
print("y =", y) | |
while x == y: | |
print("x = y !\n") | |
x = r.choice(liste) | |
print("x =", x) | |
y = r.choice(liste) | |
print("y =", y) | |
print("ok") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment