|
|
练习题:选择下面哪个变量名是合法的?(单选) 2hello world-this Hello False |
Python2和Python3的差异
练习:选择题89.3 // 5 = ?(单选) 17.86 17.0 17 |
Python2和Python3的差异
练习:填空>>> a = [3, 4, 6, 7, 8, 9] >>> a[:] == [4, 6, 7] True |
练习:填空for num in [3, 4, 6, 7, 8, 9]: if num == : break if num == 3: print(num) 最后输出为: 4 6 想不明白运行过程?去可视化观看运行过程 |
课后练习:填空compute_profit(price_yuan, price_fen, cost_yuan=12, cost_fen=0): ''' 计算利润, 以分为单位 ''' diff_yuan = price_yuan - cost_yuan diff_fen = price_fen - cost_fen diff_yuan * 100 + diff_fen compute_profit(15, 37) == # 正确 |
课后练习:填空目录结构如下 server.py models.py deps---------tools.py | -----__init__.py | -----adapter--------__init__.py | -----xml.py | -----json.py (class JsonAdapter) server.py中要使用到JsonAdapter, 那么导入的语句应该是: from import JsonAdapter |
课后练习:填空(3) = (3, ) # 表达式是正确的,值为True a = {"a": 12, "c": 99} a[] == 99 # 表达式值为True |
Python3和Python2的区别
课后练习:填空题class Dog: def (self): pass def bark(self, text): print(text) jack = Dog() ("I Love Python") |
Python3和Python2的区别
课后练习:填空open("a.txt", 'w') f: f.write("some text") |
课后练习:填空try: int("error input") ValueError e: print(e.message) |