Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Social Media Quiz dengan Modul Random python
import sys
from random import randint
count = 0
# Soal dan jawaban
Soal = ["Social Media buatan Mark zuck...? ",
"Social Media yang eksis dengan awake sleep? ",
"Microblogging yang gambar burung apa hayo? ",
"Social Media yang populer dengan photo?",
"Social Media yang logonya hampir sama dengan Path ",
"Social Media buat pekerja itu namanya: ",
"Planet Python di Indonesia itu hanya: "]
Jawab = ["facebook",
"path",
"twitter",
"instagram",
"pinterest",
"linkedin",
"planpin"]
link = ["http://www.facebook.com",
"http://Path.com",
"http://twitter.com",
"http://Instagram.com",
"http://Pinterest.com",
"http://linkedin.com",
"http://planet.python.or.id/"]
# Jawaban benar atau Salah
i = randint(0, 7)
answer = raw_input("Pertanyaan 1 : " + Soal[i])
if answer.lower() == Jawab[i]:
print "Benar"
count = count + 1
else:
print "Salah \nJawaban Benar : " + Jawab[i]
print "Pengen Coba? Kunjungi : " + link[i]
i = randint(0, 7)
answer = raw_input("\nPertanyaan 2 : " + Soal[i])
if answer.lower() == Jawab[i]:
print "Benar"
count = count + 1
else:
print "Salah \nJawaban Benar : " + Jawab[i]
print "Pengen Coba? Kunjungi : " + link[i]
i = randint(0, 7)
answer = raw_input("\nPertanyaan 3 : " + Soal[i])
if answer.lower() == Jawab[i]:
print "Benar"
count = count + 1
else:
print "Salah \nJawaban Benar : " + Jawab[i]
print "Pengen Coba? Kunjungi : " + link[i]
i = randint(0, 7)
answer = raw_input("\nPertanyaan 4 : " + Soal[i])
if answer.lower() == Jawab[i]:
print "Benar"
count = count + 1
else:
print "Salah \nJawaban Benar : " + Jawab[i]
print "Pengen Coba? Kunjungi : " + link[i]
i = randint(0, 7)
answer = raw_input("\nPertanyaan 5 : " + Soal[i])
if answer.lower() == Jawab[i]:
print "Benar"
count = count + 1
else:
print "Salah \nJawaban Benar : " + Jawab[i]
print "Pengen Coba? Kunjungi : " + link[i]
i = randint(0, 7)
answer = raw_input("\nPertanyaan 6 : " + Soal[i])
if answer.lower() == Jawab[i]:
print "Benar"
count = count + 1
else:
print "Salah \nJawaban Benar : " + Jawab[i]
print "Pengen Coba? Kunjungi : " + link[i]
i = randint(0, 7)
answer = raw_input("\nPertanyaan 7 : " + Soal[i])
if answer.lower() == Jawab[i]:
print "Benar"
count = count + 1
else:
print "Salah \nJawaban Benar : " + Jawab[i]
print "Pengen Coba? Kunjungi : " + link[i]
#Nilai
print "\n %d jawaban benar" % (count)
print "\nNilai : %d persen" % (count / float(7) * 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment