版本2和3间的区别
于2006-08-31 14:33:35修订的的版本2
大小: 685
编辑: czk
备注:
于2006-08-31 15:44:23修订的的版本3
大小: 1277
编辑: czk
备注:
删除的内容标记成这样。 加入的内容标记成这样。
行号 11: 行号 11:
 * 运行Python解释器,输入一些Python语句并查看运行结果。
 * 下载安装一种Python编辑器,并熟悉它的使用。(SPE - Stani's Python Editor, IDLE, DrPython, Eclipse+PyDev, Boa Constructor,Emacs, VIM等)
 * 运行编辑器,编辑一段Python代码,并运行它。
 * 运行Python解释器,输入一些Python语句并查看运行结果。比如:
{{{
>>> 1+1
>>> 2**10
>>> r = 5
>>> pi = 3.14159
>>> pi*r*r
>>>
>>> "hello world"
>>> print "hello world"
>>> "hello " + "world\n"
>>> print "hello " + "world\n"
>>>
>>> x = 54
>>> y = 36
>>> if x>y:
        print x
    else:
        print y
>>>
>>> while y != 0:
        y, x = x%y, y
>>> print x
>>>
>>> import sys
>>> sys.version
>>> sys.platform
>>>
>>> help()
>>> help(sys)
>>> dir(sys)
>>> (Ctrl+d或者ctrl+z)
}}}
 * 下载安装一种Python编辑器,并熟悉它的使用。(比如SPE - Stani's Python Editor, IDLE, DrPython, Eclipse+PyDev, Boa Constructor,Emacs, VIM等)
 * 运行编辑器,编辑一段Python代码,并运行它。比如
{{{#!python
def GCD(x,y):
    while y != 0:
        y, x = x%y, y
    return x

print GCD(36, 54)

}}}

实验目的:

  • Python运行环境的安装
  • 交互式运行Python
  • Python编辑器安装
  • 编辑、运行Python程序

实验内容:

>>> 1+1
>>> 2**10
>>> r = 5
>>> pi = 3.14159
>>> pi*r*r
>>>
>>> "hello world"
>>> print "hello world"
>>> "hello " + "world\n"
>>> print "hello " + "world\n"
>>> 
>>> x = 54
>>> y = 36
>>> if x>y:
        print x
    else:
        print y
>>>
>>> while y != 0:
        y, x = x%y, y
>>> print x
>>>
>>> import sys
>>> sys.version
>>> sys.platform
>>> 
>>> help()
>>> help(sys)
>>> dir(sys)
>>> (Ctrl+d或者ctrl+z)
  • 下载安装一种Python编辑器,并熟悉它的使用。(比如SPE - Stani's Python Editor, IDLE, DrPython, Eclipse+PyDev, Boa Constructor,Emacs, VIM等)

  • 运行编辑器,编辑一段Python代码,并运行它。比如

   1 def GCD(x,y):
   2     while y != 0:
   3         y, x = x%y, y
   4     return x
   5 
   6 print GCD(36, 54)

思考题:

Python游戏开发基础/实验1 (2008-02-23 15:35:37由localhost编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.