- 博客(26)
- 收藏
- 关注
转载 EX40
1 class Song(object): 2 3 def __init__(self): 4 5 self.lyrics = ["这一路上走走停停,", 6 "顺着少年漂流的痕迹,", 7 "什么也不省心。"] 8 ...
2019-01-13 22:51:00 156
转载 ex39
states = { 'fujian' : 'FJ', 'zhejiang' : 'ZJ', 'jiangsu' :'JS', 'guangdong' : 'GD', 'hunan' : 'HN' } cities = { 'FJ' : '福州', 'ZJ' : '杭州', 'JS'...
2019-01-11 14:49:00 141
转载 ex36
1 def start(): 2 print("我们来复习一下西游记或者水浒传的知识吧。") 3 print("实际上也不是什么难题") 4 print("总之,先写一下你要选哪一本吧。") 5 6 choice = input(">") 7 8 if choice == "西游记":...
2019-01-04 21:25:00 116
转载 ex35
from sys import exit def gold_room(): print("This room is full of gold. How much do you take?") #这个房间装满了金币 你要拿多少? choice = input(">>>") if "0" in choice or "1"...
2019-01-04 16:19:00 121
转载 ex26
修正后 1 print("How old are you?", end=' ') 2 age = input() 3 print("How tall are you?", end=' ') 4 height = input() 5 print("How much do you weigh?", end=' ') 6 weight = input() 7 ...
2018-12-24 00:38:00 114
转载 python习题20 seek()
seek()的三种模式: (1)f.seek(p,0) 移动当文件第p个字节处,绝对位置(2)f.seek(p,1) 移动到相对于当前位置之后的p个字节 (3)f.seek(p,2) 移动到相对文章尾之后的p个字节转载于:https://www.cnblogs.com/shadowyuriya/p/10162761.html...
2018-12-22 22:43:00 186
转载 python习题19
1 def cheese_and_crackers(cheese_count, boxes_of_crackers): 2 print(f"You have {cheese_count} cheese!") 3 print(f"You have {boxes_of_crackers} boxes fo crackers!") 4 print("M...
2018-12-03 22:21:00 155
转载 python习题18
# this one is like your scripts with argvdef print_two(*args): arg1, arg2 = args print(f"arg1: {arg1}, arg2: {arg2}")# ok, that *args is actually pointless, we can just do this...
2018-12-01 18:48:00 115
转载 python习题17
1 from sys import argv 2 from os.path import exists 3 4 script, from_file, to_file = argv 5 6 print(f"Copying from {from_file} to {to_file}") 7 8 # We could do these two on li...
2018-12-01 17:38:00 128
转载 python习题16
1 from sys import argv 2 3 script, filename = argv 4 5 print(f"We're going t o erase {filename}.") 6 print("If you don't want that, hit CTRL-(^C).") 7 print("If you do want that,...
2018-11-21 22:36:00 108
转载 python习题15
1 # 从python的内置模块中引入模组 2 from sys import argv 3 4 # 解包,获取文件名 5 script, filename = argv 6 7 #返回某文件对象 8 txt = open(filename) 9 10 #打印这句话,嵌入文件名11 print(f"Here's your file {fi...
2018-11-21 22:11:00 104
转载 自我反省的碎碎念
很后悔16-18号整整三天,啥都没自学不能坚持下去,怎么当一个好程序员!!我不敢了。加油!转载于:https://www.cnblogs.com/shadowyuriya/p/9983808.html
2018-11-19 16:28:00 110
转载 python习题14
1 #引入特性 2 from sys import argv 3 4 #解包 5 script, user_name = argv 6 #把用户提示符>(字符串)赋值给prompt 7 prompt = '>' 8 9 #把变量user_name、script带入并且打印整句话10 print(f"Hi {user_name}, ...
2018-11-16 00:23:00 195
转载 python习题13
1 from sys import argv2 # read the WYSS section for how to run this3 script,first,second,third = argv4 5 print("The script is called:", script)6 print("Your first variable is:", first...
2018-11-15 23:04:00 165
转载 python习题12
ex121 age = input("How old are you?")2 height = input("How tall are you?")3 weight = input("How much do you weight?")4 5 print(f"So,you're {age} old, {height} tall and {weight} heavy....
2018-11-15 21:03:00 131
转载 python习题11
ex111 print("How old are you?",end=' ')2 age=input()3 print("How tall are you?",end=' ')4 height=input()5 print("How much do you weight?",end=' ')6 weight=input()7 8 print(f"So,...
2018-11-15 20:49:00 89
转载 python习题10
1 tabby_cat = "\tI'm tabbed in." 2 persian_cat = "I'm split\non a line." 3 backslash_cat = "I'm \\ a \\ cat." 4 5 fat_cat=""" 6 I'll do a list: 7 \t* Cat food 8 \t* Fishies 9 ...
2018-11-15 19:44:00 115
转载 python习题9
1 # Here's some new strange stuff,remember type it exactly. 2 3 days = "Mon Tue Wed Thu Fri Sat Sun" 4 # \n:换行符号 5 months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug" 6 7 print("He...
2018-11-15 17:53:00 165
转载 python习题8
1 # 将字符串"{} {} {} {}"赋值给formatter 2 formatter = "{} {} {} {}" 3 4 # 将1,2,3,4分别传递到formatter的四个"{} {} {} {}"中并且打印 5 print(formatter.format(1,2,3,4)) 6 print(formatter.format("one","tw...
2018-11-15 17:39:00 401
转载 python习题7
1.注释 1 #打印Mary had a little lamb. 2 print("Mary had a little lamb.") 3 #在Its fleece was white as后插入字符串snow,并且打印 4 print("Its fleece was white as {}.".format('snow')) 5 #打印And everywhe...
2018-11-15 17:16:00 159
转载 python习题6
1.注释程序 1 # 给变量type_of_people赋值10 2 type_of_people = 10 3 # 在字符串里嵌入变量type_of_people,再赋值给x 4 x = f"There are {type_of_people} types of people." 5 6 # 把字符串"binary赋值给binary 7 binary ...
2018-11-15 16:41:00 87
转载 python习题5
1.修改所有变量名字,把ex5.py的my_去掉,试着使用变量将英镑和寸转换成千克和厘米 1 name = 'Zed A.Shaw' 2 age = 35 #not a lie 3 height = 74 #inches 4 weight = 180 #lbs 5 eyes = 'Blue' 6 teeth = 'White' 7 hair = 'Brow...
2018-11-15 15:45:00 184
转载 python习题4
ex4.py 1 cars = 100 #一百辆车 2 space_in_a_car = 4.0#每辆车可以坐四个人 3 drivers = 30#30个司机 4 passengers = 90#90个乘客 5 cars_not_driven = cars-drivers#没开的车=车辆数-司机数量 6 car_drivern = drivers#已开的车=司...
2018-11-15 15:40:00 253
转载 python习题3
1.每一行上面用#为自己写个注释,说一下这一行作用 1 print("I will now count my chickens:")#打印I will now count my chickens: 2 3 print("Hens",25+30/6)#打印出 hens 和25+30/6结果 4 print("Roosters",100-25*3*4)同上 5 ...
2018-11-15 15:33:00 102
转载 python习题2
巩固练习1.弄清楚“#”字符的作用,并且记住它的名字。注释or临时禁用某行代码。2.检查ex2.py3.1 #A comment,this is so you can read your programe later2 #Anything after the # is igorne by python3 4 print("I could have c...
2018-11-15 15:31:00 66
转载 python习题1
1 print("Hello World!")2 print("Hello again")3 print("I like typing this.")4 print("This is fun.")5 print('Yay!Printing.')6 print("I'd much rather you 'not'.")7 print('I "said" do n...
2018-11-15 15:29:00 65
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人