1. print "Hello World!"
  2.  
  3. action = raw_input("please select your action{1, 2, 3, 4, 5, 6, 7, 8, 9, o}: ")
  4. print action
  5.  
  6. if action == str("1"): #print hello name
  7. name = raw_input("what's your name? ")
  8. print "Hello "+name
  9. elif action == str("2"): #print hu and chongshi
  10. hu =["hu", 25]
  11. chongshi=["chongshi", 32]
  12. database = [hu, chongshi]
  13. print database
  14. elif action == "3":
  15. greeting = "chongshi" #print c
  16. print greeting[0]
  17. elif action == "4":
  18. fourth = raw_input("year:")[3] #year:2013 print 3
  19. print fourth
  20. elif action == "5":
  21. tag = '<a href="http://www.python.org">Python web site</a>'
  22. print tag[9:30]
  23. print tag[32:-4]
  24. elif action == "6":
  25. permissions = "rw"
  26. print "w" in permissions
  27.  
  28. users = ["hls", "lisi"]
  29. r = raw_input("enter you user name:") in users #return true or false check input value is not at users
  30. print r
  31. elif action == "7":
  32. numbers = [100, 34, 678]
  33. print "max(numbers) "+ str(max(numbers)) #get max value for numbers
  34.  
  35. print "min(numbers) "+ str(min(numbers)) #get min value for numbers
  36. elif action == "8":
  37. lis = list('chongshi')
  38.  
  39. x = [1,3,4]
  40. x[1] = 2
  41. print x #update item value
  42.  
  43. del x[1] #delete a item
  44. print x
  45.  
  46. x[1:] = list("111v123") #append a list at index 1 of x
  47. print x
  48.  
  49. print 'there have '+str(x.count("1"))+' "1"' #get contains "1" of list x's value
  50.  
  51. y = [4,5,6,7,8]
  52. x.extend(y) #extend y to x
  53. print x
  54.  
  55. print x.index("1") #get index for "1"
  56.  
  57. x.insert(5, "5.5") #insert a value at index 5 later
  58. print x
  59.  
  60. x.pop() #delete a last item
  61. print x
  62.  
  63. x.pop(1) #delete index 1's value
  64. print x
  65.  
  66. x.remove() #delete a first item
  67. print x
  68.  
  69. x.reverse() #reverse items
  70. print x
  71.  
  72. x.sort()
  73. print x
  74. elif action == "9": #tuple
  75. z = 1,2,3
  76. print z
  77.  
  78. z = tuple("12346abc")
  79. print z
  80.  
  81. else:
  82. print '''this is a very long string.
  83. It continues here.
  84. and it's not over yet.'''

Step by Step Learn Python(1)的更多相关文章

  1. [py]python写一个通讯录step by step V3.0

    python写一个通讯录step by step V3.0 参考: http://blog.51cto.com/lovelace/1631831 更新功能: 数据库进行数据存入和读取操作 字典配合函数 ...

  2. Python 调试:step into/step out/step over 的区别

    Python 调试:step into/step out/step over 的区别: 首先在PyCharm 程序中设置 “ 断点 ”,后点击右上角的Debug 按钮进入调试程序状态: step in ...

  3. [IT学习]Learn Python the Hard Way (Using Python 3)笨办法学Python3版本

    黑客余弦先生在知道创宇的知道创宇研发技能表v3.1中提到了入门Python的一本好书<Learn Python the Hard Way(英文版链接)>.其中的代码全部是2.7版本. 如果 ...

  4. 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 ...

  5. 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 ...

  6. Step by Step 真正从零开始,TensorFlow详细安装入门图文教程!帮你完成那个最难的从0到1

    摘要: Step by Step 真正从零开始,TensorFlow详细安装入门图文教程!帮你完成那个最难的从0到1 安装遇到问题请文末留言. 悦动智能公众号:aibbtcom AI这个概念好像突然就 ...

  7. Devops step by step

    接着上次分享的devops历程[Followme Devops实践之路], 大家希望能够出一个step by step手册, 那今天我就来和手把手来一起搭建这么一套环境, 演示整个过程! 实验环境需要 ...

  8. 课程五(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 ...

  9. 课程四(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 ...

  10. Neural Networks and Deep Learning(week4)Building your Deep Neural Network: Step by Step

    Building your Deep Neural Network: Step by Step 你将使用下面函数来构建一个深层神经网络来实现图像分类. 使用像relu这的非线性单元来改进你的模型 构建 ...

随机推荐

  1. .net程序保护方式大观

    .net软件保护方式大观 最近调试一个运行于.net 2.0下的软件,发现该软件使用的保护方式很具有代表性,基本囊括了现在.net下的所有保护措施.实践证明,这些保护措施就像全真七子,单打独斗功力差了 ...

  2. jQuery:validate表单验证基本使用

    jquery.validate是jquery的一个验证框架,可以迅速验证一些常见的输入,并且可以自己扩充自己的验证方法! 这里先从介绍简单的使用方法:jquery.validate.js下载地址 1. ...

  3. xml布局内容总结(一)--Android

    关于安卓项目中xml的使用非常多.为了达到一些好的UI效果.须要对xml比較熟练.会使用非常多的小技巧,本人准备对这些小技巧进行整理和总结,希望进行分享和交流. 关于weight的使用,因为weigh ...

  4. (转)基于SQL的EAN13、ENA8条形码校验位生成

    USE [DB]GO/****** Object: UserDefinedFunction [dbo].[EAN13] Script Date: 07/04/2017 15:21:51 ******/ ...

  5. poj2186 Popular Cows 题解——S.B.S.

    Popular Cows Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 29642   Accepted: 11996 De ...

  6. SQL PRIMARY KEY,SQL FOREIGN KEY

    A primary key is defined as a column or a group of column that their value are always be unique. Nor ...

  7. SSIS无法在unicode和非unicode 字符串数据类型之间转换

    场景:SSIS从oracle抽到sqlserver,一个表对表到数据仓库ODS层的抽取,没有任何逻辑结果遇到问题: SSIS无法在unicode和非unicode 字符串数据类型之间转换 如下图2个字 ...

  8. 【pyhon】黑客用字典暴力破解Zip文件密码原理性展示

    基本原理:用程序把字典文件里拟定好的密码一个个提取出来,去测试zip能否打开 字典文件pass.txt内容: 1224 2121 asdf abcd1234 dwsdsd dssds 程序代码: # ...

  9. ejs和swig对比问题之二

    上一次用浏览器里面简单的进行了测试,得到的数据是swig是ejs的速度的一倍左右,这次在控制台进行测试,能够得到比较精确的数据,并加入了dot一块儿进行测试. 测试数据是一百万条记录 创建测试数据cr ...

  10. Oracle的操作系统身份认证

    Oracle的操作系统身份认证 oraclelogin数据库远程登录authenticationos sqlnet.authentication_services=(NTS),在$ORACLE_HOM ...