pirntTable
摘要:输出结果为: apples oranges cherries banana Ali Bob Carol David dogs cats moose goose 要求结果为:
阅读全文
posted @
2017-08-28 11:36
auleon
阅读(156)
推荐(0)
Add_List2Dictionay
摘要:#The addToInventory() function should return a dictionary that represents the updated inventory.
阅读全文
posted @
2017-08-25 23:19
auleon
阅读(124)
推荐(0)
displayInventory
摘要:# Write a function named displayInventory() that would take any possible “inventory” and display it like the following: Inventory:
阅读全文
posted @
2017-08-25 23:16
auleon
阅读(222)
推荐(0)
pinicTable
摘要:def printTable(dic_name,l_length,r_length): print('ITEM TABLE'.center(l_length+r_length,"-")) for k,v in dic_name.items(): print(str(k).ljust(l_length,'.')+str(v).rjust(r_length,' '))...
阅读全文
posted @
2017-08-24 13:18
auleon
阅读(124)
推荐(0)
ticTacToe
摘要:theBoard={'top-L':' ','top-M':' ','top-R':'', 'mid-L':' ','mid-M':' ','mid-R':'', 'low-L':' ','low-M':' ','low-R':''} def printBoard(board): print(board[
阅读全文
posted @
2017-08-23 17:15
auleon
阅读(222)
推荐(0)
List
摘要:1# range()method: range(a1,a2,b):from a1 to a2,including a1,not a2,with b as the interval; range(a): from 0 to a,successive integer,contains a numbers
阅读全文
posted @
2017-08-17 23:27
auleon
阅读(140)
推荐(0)
while循环中的变量
摘要:num2=0在while外和内得到截然不同的运行结果: 当num2=0在while外循环时,num2完成一次循环后值变为8,重新执行num1时,num2<=7不满足,所以不会执行; 当num2=0在while内循环时,num2完成一次循环后值变为8,重新执行num1时,num2被重新赋值。
阅读全文
posted @
2017-08-10 16:39
auleon
阅读(1095)
推荐(0)
module的引用
摘要:method1\ import module_name1,module_name2 way to use function in it: module_name1.function_name() method2\ from import module from module_name import
阅读全文
posted @
2017-08-10 16:32
auleon
阅读(313)
推荐(0)
range函数
摘要:1、range()能返回一系列连续增加的整数,可以生成一个列表对象。 大多出现在for循环中,在for循环中可以作为索引使用。 2、range(2) ——[0,1] range(1,3)——[1,2] range(1,7,2)——[1,3,5] range(6,-2,-2)——[6,4,2,0]
阅读全文
posted @
2017-08-10 10:51
auleon
阅读(1056)
推荐(0)
Python的几种循环
摘要:1\if语句:if condition 是True,执行if clause语句,并跳过后面的elif或else语句;执行一次 2\while语句;只要while condition是True,就会执行while clause语句,执行完后回头再看while condition的判断值; 只要cond
阅读全文
posted @
2017-08-09 22:31
auleon
阅读(2284)
推荐(0)
print函数
摘要:1\直接输出数值和字符串类型: 1 print(2) 2 print('hello world') 2\
阅读全文
posted @
2017-08-09 22:26
auleon
阅读(185)
推荐(0)
FLOW CONTROL
摘要:A\The differences between == and = operators: 1 the == operator(equal to) asks whether two values are the same as each other; 2 the = operator(assignm
阅读全文
posted @
2017-08-09 22:22
auleon
阅读(258)
推荐(0)
DOS下的python
摘要:1、DOS下清屏命令:cls 2、DOS下输入python进入Python交互界面,此时输入的命令在Python中执行,故输入cls报错,应先CTRL+Z退出python界面 3、/除 //整除 %取余 ** 幂运算 4、中括号[]和大括号{}有特殊的意义,在数学运算中都用()来表示 5、input
阅读全文
posted @
2017-08-08 23:36
auleon
阅读(745)
推荐(0)
Python中字符串的表示
摘要:区别于其他语言,python中字符串可以用3中方法表示,且都能被正确编译: 1、'mary' 单引号括起来 2、"it's a great day" 双引号括起来 3、''' nice to meet you, my dear friend. ''' 三引号括起来 区别: a、单引号和双引号没有什么
阅读全文
posted @
2017-08-08 14:09
auleon
阅读(809)
推荐(0)
注释符的区别JAVA vs Python
摘要:JAVA中注释: // 注释一行 /*...*/ 注释若干行 /**...*/ 注释若干行,并写入Javadoc文件 Python注释: # 单行注释符 ''' 三对单引号 ''' 或"""三对双引号""" 是多行注释符
阅读全文
posted @
2017-08-07 23:00
auleon
阅读(247)
推荐(0)
变量的命名规格
摘要:1、由数字、字母和下划线组成; 2、不能由数字开头,不能含有特殊字符和空格; 3、不能以保留字命名; 4、变量的命名应该有意义; 5、尽量不要使用中文; 6、命名方式有驼峰式、下划线分割; 7、Python变量区分大小写;
阅读全文
posted @
2017-08-07 22:40
auleon
阅读(153)
推荐(0)