#๐Ÿ”’ Hangman

30 messages ยท Page 1 of 1 (latest)

wet raptorBOT
#

@ebon crystal

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

ebon crystal
#

I have a hangman assignemnt for homework and im unsure how to make the letters display themseleves when they are guessed....

#

here is my code..

#

its not printing "Hi"

fierce glade
#

!e ```py
current_phrase = "this is the current phrase."
print(current_phrase)
current_phrase[0].capitalize()
print(current_phrase)

wet raptorBOT
fierce glade
#

Python strings are immutable so if you want to change it you'll have to assign the new string to the variable name

#

also that just capitalizes the substring located at current_phrase[0]. Do you want to capitalize the entire word?

ebon crystal
#

oh i guess so, cuz i capitalized "letter", im going to change it to upper

#

still doesnt print hi... letter should be in currentPhrase???

ebon crystal
fierce glade
#

What does "doesn't work" mean? print out both of those things and make sure they are the same letter

#

also currentPhrase[0].capitalize() just capitalizes and returns that letter

ebon crystal
#

i switched out the capitalize with upper():

fierce glade
#

you're still operating on the substring located at that index

#

!e ```py
s = "this is a string"
s = s[0].upper()
print(s)

wet raptorBOT
fierce glade
#

I have to step away now.

ebon crystal
#

but its a list not a variable? the index 0 is the whole phrase??

#

ok, thanks anyways

fierce glade
#

no it's the letter at that index

#

you're using currentPhrase not phrases

ebon crystal
#

Ooooooh

#

yeah ur right...

fierce glade
#

๐Ÿ‘

#

someone else might be by, good luck

ebon crystal
#

ty

wet raptorBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.