标签:
在业余时间学习一下跨平台代码python。
下面是http://courses.ischool.berkeley.edu/i155/su13/schedule.htm下的例题代码。留作未来参考语法。
1 #hw1_1.py 2 x=input("Input the number of gallons of gasoline:") 3 print "Equivalent number of liters:",x*3.7854 4 print "Number of barrels of oil required to produce it:",x/19.5 5 print "Price in US dollars:$",x*3.56,
1 #hw1_2.py 2 import sys 3 name=raw_input("Enter your name:") 4 n=len(name) 5 print name[n-1].upper(), 6 #No space between the output letter 7 sys.stdout.softspace=0 8 i=n-2 9 while i>=0: 10 print name[i].lower(), 11 sys.stdout.softspace=0 12 i=i-1 13
标签:
原文地址:http://www.cnblogs.com/connorzx/p/4436002.html