|
||||||
| Python Discussion forum for Python, a high-level language with simple syntax, but yet powerful. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hey I think you might be able to see what I am trying to do here, here is the code I have came up with
import random print "hello this is the decypher\n" persons_word = raw_input("Enter your word: ") print persons_word.random.randrange() raw_input("Press the enter key to quit") I am pretty sure the random.randrange is where I am going wrong What I am trying to do is get a word from the user and jumble it up so if they typed something like this: "galaxy" python will return several words what "galaxy" can make for instance "galayx" "algyxa" if you see what I am trying to do and know how to help please respond! |
| Sponsored Links |
|
|
|
|||||
|
You're on the right track. The function you're looking for is not random.randrange, but random.shuffle. It'll do the job for you.
Code:
import random
word = list(raw_input("Enter a word: "))
random.shuffle(word)
word = ''.join(word)
print "The jumbled word: %s" % word
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum C/C++ resources - C/C++ frequently asked questions Python resources - Python frequently asked questions I'm always up for a chat, so feel free to contact me... |
|
|||||
|
Quote:
Quote:
Code:
print "Integer: %d" % one_parameter print "Integers: %d and %d" % (one_parameter, two_parameters) Code:
print "Integer: " + one_parameter print "Integers: " + one_parameter + " and " + two_parameters
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum C/C++ resources - C/C++ frequently asked questions Python resources - Python frequently asked questions I'm always up for a chat, so feel free to contact me... |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [C++] Validating user input | Xochiquetzal | C and C++ | 2 | 07-08-2007 05:18 PM |
| PHP: Log Out Users | Ronin | PHP Forum | 3 | 04-26-2007 09:42 AM |
| Please Help With A C Program!! | siren | C and C++ | 7 | 04-17-2007 08:45 AM |
| Interacting with the Mic input | FlyByWire128 | General Programming | 2 | 02-23-2007 01:21 PM |
| Java:Tutorial - User Input | John | Java Tutorials | 0 | 12-09-2006 07:25 PM |
Goal: 100,000 Posts
Complete: 68%