World Jumble , moze objasnjenje ?

poruka: 1
|
čitano: 1.005
|
moderatori: XXX-Man, vincimus
1
+/- sve poruke
ravni prikaz
starije poruke gore
14 godina
odjavljen
offline
World Jumble , moze objasnjenje ?

 

# Word Jumble

#

# The computer picks a random word and then "jumbles" it

# The player has to guess the original word

 

import random

 

# create a sequence of words to choose from

WORDS = ("python", "jumble", "easy", "difficult", "answer", "xylophone")

# pick one word randomly from the sequence

word = random.choice(WORDS)

# create a variable to use later to see if the guess is correct

correct = word

 

# create a jumbled version of the word

jumble =""

while word:

   position = random.randrange(len(word))

   jumble += word[position]

   word = word[:position] + word[(position + 1):]

 

# start the game

print(

"""

      Welcome to Word Jumble!

 

  Unscramble the letters to make a word.

(Press the enter key at the prompt to quit.)

"""

)

print("The jumble is:", jumble)

 

guess = input("\nYour guess: ")

while guess != correct and guess != "":

   print("Sorry, that's not it.")

   guess = input("Your guess: ")

 

if guess == correct:

   print("That's it!  You guessed it!\n")

 

print("Thanks for playing.")

 

input("\n\nPress the enter key to exit.")

 

Moze ko objasniti kako ovaj program napravi da se izmjene slova pls

 

Poruka je uređivana zadnji put pet 6.4.2012 11:06 (Aleksije).
Moj PC  
0 0 hvala 0
1
Nova poruka
E-mail:
Lozinka:
 
vrh stranice