首页 > 代码库 > Python学习日记之练习代码

Python学习日记之练习代码

# -*- coding:utf-8 -*-

number = 23
test=True
while test:
    guess=int(raw_input(‘输入数字‘))
     if guess==number:
        print ‘g=n‘
    elif guess>number:
        print ‘g>n‘
    else:
        print "g<n"

  

# -*- coding:utf-8 -*-

while True:
    s=raw_input(‘输入任意字符‘)
    if s==‘q‘:
        break
    print ‘总长度为‘,len(s)
print ‘结束‘

  

# -*- coding:utf-8 -*-

def test():
    global y,o
    y=o+y
    o=y-o
    y=y-o
y=5
o=7
test()
print y,o

  

Python学习日记之练习代码