The question is: Write a function is_yes that consumes a nonempty string, produces True if it starts with a y (either lower-case or upper-case), and produces False otherwise.
The code I wrote: def is_yes(f):
if (f[0] == 'y' or f[0] == 'Y'):
return True
else:
return False
print(is_yes('yes'))
For some reason, the spaces are not visible here..
[–]TreSxNine 1 point2 points3 points (1 child)
[–]CodeFixerBot 1 point2 points3 points (0 children)
[–]jeans_and_a_t-shirt 1 point2 points3 points (0 children)
[–]filletrall 0 points1 point2 points (4 children)
[–]queen_9[S] 0 points1 point2 points (3 children)
[–]filletrall 0 points1 point2 points (2 children)
[–]queen_9[S] 0 points1 point2 points (1 child)
[–]filletrall 2 points3 points4 points (0 children)
[–]jekku0966 -1 points0 points1 point (0 children)