Open main menu

CDOT Wiki β

Changes

SBR600 Python Lab

562 bytes removed, 11:27, 3 October 2013
no edit summary
Here is a small Python script:# Login to Matrix #!git clone ~chris.tyler/usrpublic/bin/python import random secret=random.randrange(1,100) guess=int(raw_input("Enter a guess: ")) if guess<secret: print "Too low!" elif guess>secret: print "Too high!" else: print "Correct!" # Save this script, set the permissions correctly, and run it.# Modify the script so that according to the user is given playing instructions before comments at the game starts.top# Make the Blog it! Include your script loop to prompt for input until , the challenges you faced making the correct number is guessed.# Displays the number of guesses the user took to guess the secret (score).# Modify the script so that it does not stop when invalid data is entered (such as a word). Suggestion: use try/except.# Accept only input value from 1 to 100.# Write a blog entry giving modifications, and your impressions of Python.