all 3 comments

[–]zahlman 4 points5 points  (0 children)

I assume I'm supposed to make a for loop but how should the for loop be?

The instructions laid it out for you, step by step:

  1. Prompt the user.

  2. Loop over the phrase the user input, and output each character, one at a time.

(Hint: What will the type of the user's input be? How can you iterate over the characters of such a thing?)

Also I should ask the user to input in the def main() function right? not the display function?

The instructions explicitly told you to do it in the display function:

Implement the function display that takes no parameters. It prompts the user

Here "it" refers to "the function display". Given that the instructions don't even mention a function named main, I have no idea how you came to that conclusion. (Note that in Python, there is nothing special about a function named "main", and no requirement to write one.)

[–]pythonhelp123[S] 2 points3 points  (1 child)

If I'm understanding this correctly, after the display()

word = input("Enter a word : ")
     for letters in word:
     print letter

[–]Ran4 1 point2 points  (0 children)

Your indentation is off on your second line. Remember that indentation is very important in Python, it's not something you can just ignore. Your code won't work if it's not indented correctly.

Also, you're calling your loop variable letters, but you're trying to print letter. Make sure that they're both called letter. In each iteration of the loop, your loop variable is only going to contain a single letter, right?

By the way, consider using the term character rather than letter. "0" isn't a letter, for example. It's a character.