Step by Step Learn Python(1)
print "Hello World!"
action = raw_input("please select your action{1, 2, 3, 4, 5, 6, 7, 8, 9, o}: ")
print action
if action == str("1"): #print hello name
name = raw_input("what's your name? ")
print "Hello "+name
elif action == str("2"): #print hu and chongshi
hu =["hu", 25]
chongshi=["chongshi", 32]
database = [hu, chongshi]
print database
elif action == "3":
greeting = "chongshi" #print c
print greeting[0]
elif action == "4":
fourth = raw_input("year:")[3] #year:2013 print 3
print fourth
elif action == "5":
tag = '<a href="http://www.python.org">Python web site</a>'
print tag[9:30]
print tag[32:-4]
elif action == "6":
permissions = "rw"
print "w" in permissions
users = ["hls", "lisi"]
r = raw_input("enter you user name:") in users #return true or false check input value is not at users
print r
elif action == "7":
numbers = [100, 34, 678]
print "max(numbers) "+ str(max(numbers)) #get max value for numbers
print "min(numbers) "+ str(min(numbers)) #get min value for numbers
elif action == "8":
lis = list('chongshi')
x = [1,3,4]
x[1] = 2
print x #update item value
del x[1] #delete a item
print x
x[1:] = list("111v123") #append a list at index 1 of x
print x
print 'there have '+str(x.count("1"))+' "1"' #get contains "1" of list x's value
y = [4,5,6,7,8]
x.extend(y) #extend y to x
print x
print x.index("1") #get index for "1"
x.insert(5, "5.5") #insert a value at index 5 later
print x
x.pop() #delete a last item
print x
x.pop(1) #delete index 1's value
print x
x.remove() #delete a first item
print x
x.reverse() #reverse items
print x
x.sort()
print x
elif action == "9": #tuple
z = 1,2,3
print z
z = tuple("12346abc")
print z
else:
print '''this is a very long string.
It continues here.
and it's not over yet.'''
Step by Step Learn Python(1)的更多相关文章
- [py]python写一个通讯录step by step V3.0
python写一个通讯录step by step V3.0 参考: http://blog.51cto.com/lovelace/1631831 更新功能: 数据库进行数据存入和读取操作 字典配合函数 ...
- Python 调试:step into/step out/step over 的区别
Python 调试:step into/step out/step over 的区别: 首先在PyCharm 程序中设置 “ 断点 ”,后点击右上角的Debug 按钮进入调试程序状态: step in ...
- [IT学习]Learn Python the Hard Way (Using Python 3)笨办法学Python3版本
黑客余弦先生在知道创宇的知道创宇研发技能表v3.1中提到了入门Python的一本好书<Learn Python the Hard Way(英文版链接)>.其中的代码全部是2.7版本. 如果 ...
- Tomcat Clustering - A Step By Step Guide --转载
Tomcat Clustering - A Step By Step Guide Apache Tomcat is a great performer on its own, but if you'r ...
- Code Understanding Step by Step - We Need a Task
Code understanding is a task we are always doing, though we are not even aware that we're doing it ...
- Step by Step 真正从零开始,TensorFlow详细安装入门图文教程!帮你完成那个最难的从0到1
摘要: Step by Step 真正从零开始,TensorFlow详细安装入门图文教程!帮你完成那个最难的从0到1 安装遇到问题请文末留言. 悦动智能公众号:aibbtcom AI这个概念好像突然就 ...
- Devops step by step
接着上次分享的devops历程[Followme Devops实践之路], 大家希望能够出一个step by step手册, 那今天我就来和手把手来一起搭建这么一套环境, 演示整个过程! 实验环境需要 ...
- 课程五(Sequence Models),第一 周(Recurrent Neural Networks) —— 1.Programming assignments:Building a recurrent neural network - step by step
Building your Recurrent Neural Network - Step by Step Welcome to Course 5's first assignment! In thi ...
- 课程四(Convolutional Neural Networks),第一周(Foundations of Convolutional Neural Networks) —— 2.Programming assignments:Convolutional Model: step by step
Convolutional Neural Networks: Step by Step Welcome to Course 4's first assignment! In this assignme ...
- Neural Networks and Deep Learning(week4)Building your Deep Neural Network: Step by Step
Building your Deep Neural Network: Step by Step 你将使用下面函数来构建一个深层神经网络来实现图像分类. 使用像relu这的非线性单元来改进你的模型 构建 ...
随机推荐
- [0day]基础工具学习
事实上非常多工具多少都使用的比較熟悉了. 可是仍有一些点还是比較有趣以及我不知道的.毕竟第一章,查缺补漏的. (话说这个成语在高三冲刺的时候,老师用得最多,当时还非常悲哀的一直补东墙.漏西墙.始终认为 ...
- weblogic清理缓存后重启
清理缓存步骤如下: 1.前置条件:停止服务 2.找到下面3个目录,然后将里面的文件删除即可: ……/user_projects/domains/base_domain/servers/AdminSer ...
- 飞天KEY
RoyCShell.exe -PE -if:"G:\EncryptTool\Finder.exe" -of:"G:\EncryptTool\Finder_enc.exe& ...
- jenkins的docker
参考:https://store.docker.com/images/jenkins?tab=description https://my.oschina.net/jayqqaa12/blog/633 ...
- iOS:集合视图UICollectionView、集合视图控制器UICollectionViewController、集合视图单元格UICollectionViewCell(创建表格的另一种控件)
两种创建表格方式的比较:表格视图.集合视图(二者十分类似) <1>相同点: 表格视图:UITableView(位于storyboard中,通过UIViewController控制器实现 ...
- 使用jQuery通过点击它删除HTML表格行-超简单
jQuery的已成为所有时刻的最常用和最喜爱的JavaScript框架之一.它不仅不会减少在JavaScript编码简单的技术开销,而且也使您的代码的跨浏览器兼容.我已经写了许多关于jQuery教程, ...
- ECharts学习总结(四):echarts的实例方法
echarts的实例方法非常重要,因为在实际运用中我们额图表的数据不可能是死的,而是动态变化的,实例方法为动态改变数据提供了方法.故特意从官网上面把下面实例方法进行记录: 注:下面内容摘自echart ...
- 同一个数据库实例,不同用户下多表创建视图,Hibernate完毕ORM映射,Spring整合,后台实现
1.同一个数据库实例.同用户,多表创建视图 2.同一个数据库实例,不同用户下.多表创建视图 3.同一个数据库,不同数据库实例,多表创建视图 4.不同类型数据库,多表创建视图 1.同一个数据库实例.同用 ...
- gedit如何使用代码片段
gedit的片段插件 1 打开这个插件 2 以HTML为例,我们看到触发器是doctype 3则我在编辑一个HTML文档的时候,先输入doctype,再按Tab键,将会自动提示,我选择即可插入 ...
- PHP封装成应用程序的三个方案
大概有三个解决方案吧. 1 如果你精通PHP,你可以看看这个网站:http://gtk.php.net/ 很明显,这个网站介绍了啥是GTK,你可以构件跨平台的图形化应用程序,当然你要再学一门语言,去掌 ...