The first Python program of the Liaoche Python tutorial

Source: Internet
Author: User
Tags sublime text

one, the distinction between command-line mode and Python interaction mode

Command-line mode:

Python interactive mode

Second, text editor

1. Never use Notepad that comes with Word and Windows . Word does not save plain text files, and Notepad will be smart to add a few special characters (UTF-8 BOM) to the beginning of the file, resulting in an inexplicable error in the program running. Text editor available notepad++, Sublime text, editplus, individual with more than EditPlus

2. print Be careful not to have any spaces in front.

3. Write the Python program in a text editor, and then save the file as a suffix .py (the suffix must be. py) so you can run the program directly with Python. The file name can only be a combination of English letters, numbers, and underscores

What is the difference between 4.Python Interactive mode and direct running .py files?

Direct input python into interactive mode is equivalent to launching the Python interpreter, but waiting for you to enter the source code one line at a line to execute each row.

Running the .py file directly is equivalent to launching the Python interpreter and then .py executing the file's source code at once, and you don't have the opportunity to enter the source in an interactive way.

5. It is possible to run the Py file directly on Mac and Linux, not in Windows

Written code can also be used in the Web version-"Code run assistant run, do not want to install the environment, you can try

inputs, outputs input (), print ()

Print () output, which outputs multiple

Difference: Print out the middle is-"comma or space

1 Print ("hello,world"# Result: Hello,world23print( " Hello "World"# result: Hello world

Input () Inputs:

1 name = input (")2print('hello ', ' , name) 3 4 # The results are as follows: 5 # Please enter your Name:michael "Michael is prompted and later re-entered" 6 # Hello, Michael.

The first Python program of the Liaoche Python tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.