Hello World in Python
Print the Python version number and exit. Example output could be:
Running Files with Command Lines
You can ask Python to run it by listing its full filename as the first argument to a python command like the following typed at the system shell prompt.
Type the following statements into a new text file named hellowrold.py:
# A first Python script # hellowrold.py print('hello,世界')
The Interactive Prompt
Assuming the interpreter is installed as an executable program on your system, the most platform- neutral way to start an interactive interpreter session is usually just to type python at your operating system’s prompt, without any arguments. For example:
Python 3.9.1 (default, Oct 15 2021, 22:19:38) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
On Windows, a Ctrl-Z gets you out of this session; on Unix, try Ctrl-D instead.