Guided project 1

Hi guys:

Can you please help me differ the following two codes. As you can see below one is giving “False” for the last two ones, while the other one is giving “True”. I am little confused. Thanks!

Capture

Capture2

Hi @bhuwan,

The return statement breaks out of your function. So in the first code example, your function is checking the first character and then exiting.

In the second example, the return False statement is only triggered if one character is encountered with ord values above 127. If the for loop reaches the end of the string and no False values are returned, then the final (and unindented) True is returned.

I hope this helps! :slight_smile:

1 Like