与孩子一起学编程02章

来源:互联网 发布:淘宝最牛卖家骂人 编辑:程序博客网 时间:2024/04/29 11:41

基础知识要点:

1.程序的三个基本要素:输入、处理、输出。

2.变量名区分大小写,必须以字母或下划线开头,不能以数字开头。

3.变量名中不能包含空格。

3.尽量使用能够说明用途的名字,可以告诉你变量要用来做什么。

第二章后面的练习题如下:

>>> age = 36>>> age36>>> print age36>>> age = 37>>> age37>>> print age37>>> age = 37 + 2>>> age39>>> print age39>>> name = "apostolos">>> print nameapostolos>>> DaysperWeek = 7>>> HoursPerDayTraceback (most recent call last):  File "<pyshell#12>", line 1, in <module>    HoursPerDayNameError: name 'HoursPerDay' is not defined>>> HoursPerDay = 24>>> MinutesPerHour = 60>>> MinutesPerHour * HoursPerDay * DaysperWeek10080>>> HoursPerDay = 26>>> MinutesPerHour * HoursPerDay * DaysperWeek10920>>> 

越来越有趣了,呵呵,大家一起来学习python吧。