I need a simple one-liner in Python: ask user for choice and then print a message depending on what user chose. Here's my attempt:
python3 -c "ans=input('Y/N?'); if ans == 'Y': print('YES') else: print('NO');"
And errors of course:
File "<string>", line 1
ans=input('Y/N?'); if ans == 'Y': print('YES') else: print('NO');
^^
SyntaxError: invalid syntax
Is it possible to do this in one-liner? It must be one-liner, I can't use a script here. Thanks.