码迷,mamicode.com
首页 > 编程语言 > 详细

Python学习

时间:2015-04-17 22:14:17      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:

在业余时间学习一下跨平台代码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     

 

Python学习

标签:

原文地址:http://www.cnblogs.com/connorzx/p/4436002.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!