实验目的:

实验内容:

>>> 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)

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

思考题:

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