Learning notes P-2, Python

本文介绍了Python初学者如何创建第一个源文件,注意事项包括正确使用缩进和避免中文字符。通过实例展示了运行结果,并详细解析了Python程序的基本格式,包括缩进规则和语句结构。适合编程新手学习Python基础。

This article is the author's original, reproduced also please indicate the source.
This article only represents the author's own views, for reference only. If you have any objection, you are welcome to discuss.
Forrest
 

Catalog

1.The first python source file

2.The points need to be noticed

3.Example running results

4.The second example

5.The basic format of python program


1.The first python source file

        Firstly, we need to enter the IDLE, then choose file -> new file;

        Then a new .py file has been created as no name. Then it needs to be saved with a customized name.
        Below is my example for training.

Figure1: my first python source file 

2.The points need to be noticed

There are fews points need to be noticed:

1. Do not use the blank casually. Because in python syntax, blank indicates "indent", 缩进的意思

2.Do not use the chinese charactor like brackets -> ' ( ', quotations -> ' " ', commas->' , '.

3.Example running results

 Figure2: my first python source file running results

4.The second example

Figure3: my second python source file running results

5.The basic format of python program

        (1). The blank in front of one row, and one Tab(4blanks), intend to decide the level of indentation in a logical way, so it could divide the group of your program.

        (2). The sentence starts from this first character of one row.

Ok, this is the end of our today's lesson learn, please stay tuned on the next episode.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值