0

What’s this error

File "./Playground/file0.py", line 1 >>>"""Customer: Good morning.\nOwner: Good morning, Sir. Welcome to the National Cheese Emporium.""" ^ SyntaxError: invalid syntax

27th Apr 2020, 1:37 AM
Siraj Thalassery
Siraj Thalassery - avatar
2 RĂ©ponses
+ 3
Just do this: print(type your code written above here) Expected output: Customer: Good morning. Owner: Good morning, Sir. Welcome to the National Cheese Emporium.
27th Apr 2020, 2:17 AM
Prabhat Ranjan
Prabhat Ranjan - avatar
+ 2
The ">>>" has never to be typed (unless you want explicitly to type it inside a string, obviously) That's not a valid python operator, that's just the "prompt" sign show to the user in the Python interactive shell (it's like internaly there was an input(">>>")). When you encouter it in examples/tutos, it means you could type what's next after it in a shell (or sligthly have to adapt to let it work in a script execution context, as suggested by Prabhat Ranjan: in a shell, just typing a variable name or a literal value then pressing enter would log its value -- implicit print -- but in a running script, to log them, you need to explicitly call the print function ;)) Ho! Obviously, code running in code playground are like saved script file that you run in an OS shell (terminal) ^^
27th Apr 2020, 4:32 AM
visph
visph - avatar