+ All Categories
Home > Education > Python programming lab15

Python programming lab15

Date post: 25-Jul-2015
Category:
Upload: profbnk
View: 255 times
Download: 3 times
Share this document with a friend
70
Python Programming Lab 15
Transcript

Python Programming

Lab 15

from random import randint

# Generates a number from 1 through 10 inclusiverandom_number = randint(1, 10)

guesses_left = 3# Start your game!while guesses_left > 0: guess = int(raw_input("Enter your guess:")) if guess == random_number: print "You win" break guesses_left -= 1 else: print "You lose."


Recommended