I got this code from the internet.

``````import random

#create a sequence of words to choose from
name = ("stephen","bob", "robert","craig")

# pick one word randomly from the sequence
word = random.choice(name)

#create a variabe to use later to see if the guess is correct
correct = word

# create hints for all the jumbled words
hint0 = ("\nbegins with s")
hint1 =("\nbegins with b")
hint2 = ("\nbegins with r")
hint3 = ("\nbegins with c")

# 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 the word Jumble!

Unsramble the letters to make a word.

(Press the enter key at prompt to quit.)

"""
)

print("\nThe jumble word is: ",jumble)

guess = input("\nTake a guess: ")

guess = guess.lower()

score = 0

while guess != correct and guess !="":
hint_prompt = input("\nWould you like a hint? YES/NO: ")
hint_prompt = hint_prompt.lower()
if hint_prompt == "yes" and correct == name:
print(hint0)
elif hint_prompt == "yes" and correct == name:
print(hint1)
elif hint_prompt == "yes" and correct == name:
print(hint2)
elif hint_prompt == "yes" and correct == name:
print(hint3)
elif hint_prompt == "no":
score += 50

guess = input("\nTake another guess: ")
guess = guess.lower()

if guess == correct and hint_prompt == "no":
print("\nBecause you never asked for a hint you get ",score," points.")

print("\nWell done, thanks for playing.")
input("\nPress the enter key to exit.")
``````

Can someone please explain what this bit of code means in relation to the program.

``````hint_prompt = hint_prompt.lower()
``````

hint_prompt = hint_prompt.lower()

the string is converted to all lower case

## All 2 Replies

hint_prompt = hint_prompt.lower()

the string is converted to all lower case

Thanks very much, now you have mentioned it, it is obvious lol.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.