How can I check the length of the user’s input?


#1

Question

How can I check the length of the user’s input?

Answer

In the example in the instructions, an empty string is assigned to the empty_string variable, and then the length of that is checked, using the len() method.
In our code, we want to check the user’s input, which we stored in a variable called original, so we’d just have to use len() on that and compare against 0.
If you think you’ve done it correctly but aren’t able to pass, be sure you’ve put a colon : after your if and else, and that you’ve properly indented the code inside of each. The editor should automatically indent your code after you type a colon and press enter, letting you know you’ve done it correctly. Check the indentation of the example in the instructions if you need a reminder of how to do this!


FAQ: Learn Python - Pyglatin - Check Yourself!