Adding a seed to my program (Word Letter Scramble)
<p>I am having trouble figuring out how to add a seed to my program. It is supposed to be able take a given seed value and return a scrambled sentence. The first and last letters in a words should stay the same as well as ending punctuation. Any punctuation within a word is allowed to be scrambled. </p>

<pre><code>import random
import string

original_text = input("Enter your text: ").split(' ')
seed = int(input("Enter a seed (0 for random): "))
if seed is not 0:
    random.seed(seed)

randomized_list = []

def scramble_word(word):
    alpha = word[0]
    if word[-1] == "," or "." or "!" or "?" or ":" or ";":
        omega = word[-2] 
        middle = word[1:-2]
    else:
        omega = word[-1]
        middle = word[1:-1]
    reorders_text = random.sample(middle, len(middle))
    shuffled_text = "".join(reorders_text)
    new_words = alpha + shuffled_text + omega
    return new_words
for item in original_text:
    if len(item) &lt;= 3:
        randomized_list.append(item)
    else:
        randomized_list.append(scramble_word(item))
new_words = " ".join(randomized_list)
print(new_words)
</code></pre>

<p>To add a seed to the program, with 0 being a random seed, you would need to call <code>random.seed()</code> to your program as so:</p>

<pre><code>seed = int(input("Enter a seed (0 for random): "))
if seed is not 0:  
    random.seed(seed)
</code></pre>

<p>Pretty simple.</p>

<p>See the Python docs for more info: <a href="https://docs.python.org/3.5/library/random.html" rel="nofollow">https://docs.python.org/3.5/library/random.html</a></p>

<p>In the future, it is always worth turning to the documentation before posting here. For basic things like this, the docs will probably answer your question.</p>

python python-3.x