Advertisement
Guest User

LeBiB - Correction TP1

a guest
Apr 6th, 2015
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. #-*- coding: utf-8 -*-
  3. from random import randint
  4.  
  5. questions = [
  6.     ['Réponse universelle\n','42'],
  7.     ['Vous avez dis leet\n','1337']
  8. ]
  9. score = 0
  10.  
  11. while True:
  12.     i = randint(0, len(questions)-1)
  13.     question = questions[i]
  14.     answer = input(question[0])
  15.     if answer == "stop":
  16.         print("Score: " + str(score))
  17.         break
  18.     elif answer == question[1]:
  19.         score += 1
  20.         print("Bravo")
  21.     else:
  22.         score -= 1
  23.         print("Mauvaise réponse.")
  24.         print(question[1] + " était la bonne réponse.")
  25.     print("Score: " + str(score))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement