Python核心编程2第一章课后练习

1-1

在windows下的安装方法
在网上下载python2.7直接安装到C盘
1)在系统变量中找到path。

2)编辑path值,添加你安装的python路径,C:\Python27。

3)检验python是否安装配置成功,打开cmd,输入python,如果出现以下界面,则说 明你的python安装成功了。

 

1-2

a.三种方法执行python

  1)启动交互式解释器powershell python,每次输入一行python代码

  2)运行python的脚本

  3)集成开发环境图形界面(IDLE)运行python

b.

1-3

3.执行程序在C:python27 标准库在C:/python27/lib

1-4

print 'hello world!'

 

1-5

1-5.py

print 'hello world!'

powershell中运行

 

1-6

1-6.py

name="steve"

age=18

favoritecolor="blue"

interest="coding"

print "my name is %s"%name

print "my age is %d"%age

print "my favorite color is %s"%favoritecolor

print "my interest is %s"%interest

 

posted on 2014-09-24 08:29  Fly9527  阅读(239)  评论(0编辑  收藏  举报

导航