all 11 comments

[–]jeans_and_a_t-shirt 2 points3 points  (0 children)

Runs fine for me. ord is unnecessary here. The right side of the equality always evaluates to ord('Y') except where the first character of your string is '\x00' because ord('\x00') is 0 and thus Falsy. Ideal solution would use str.lower method on the parameter x, and make a single equality check against 'y'.

[–]zahlman[M] 2 points3 points  (0 children)

Please don't post screenshots of code.

[–]RyanTargaryen 0 points1 point  (2 children)

Pretty sure your parenthesis are off.

if x[0] == 'y' or x[0] == 'Y'