day1

课上例子
print
('hello world!') x = 10 y = 10 SCHOOL = '安徽工程大学' print(id(x)) print(id(y)) name = 'tank' print(type(x)) print(type(name)) print(x == y) print(x is y) name = input('input your name:') pwd = input('请输入密码:') print(name, pwd) print(type(name), type(pwd)) number = 100 # int(100) number2 = int(100) print(number) print(number2) sal = 15.0 # float(15.0) sal2 = float(15.0) print(sal) print(sal2) name = 'tank' name2 = "tank" content = ''' 1r1r1r 21r12r1 r12r 12r1r21 r12r1r2 12r1r print(name, name2, content) print('tank ' * 5) print('tank' + 'jam') print('tank', 'jam') list1 = ['张曼曼', 'tank', '涂懿磊', 11, 1.0, ['jason', 200]] print(list1[0]) print(list1[5][0]) dict1 = {'name': "tank", "age": 18} # {name="tank", "age"=18} print(dict1["name"]) True or False print(10 == 10) # True print(10 == 11) # False str1 = 'my name is xxx, my age is 18。' print(str1[3]) print(str1[3:7]) # 3 - (7-1) print(str1[3:10:2]) print(len(str1)) print('x' in str1) # True print('T' in str1) # False print(str1) print(str1.strip()) list2 = str2.split(' ') print(list2) str4 = ' my name is xxx, my age is 18。' str5 = 'my name is xxx, my age is 18。 ' print(str4.lstrip()) print(str5.rstrip()) str4 = '***my name is xxx, my age is 18。' str5 = 'my name is xxx, my age is 18。***' print(str4.lstrip('*')) print(str5.rstrip('*')) str6 = 'my name is Tank' print(str6.lower()) print(str6.upper()) print(str6.startswith("my")) # True print(str6.startswith("MY")) # False print(str6.endswith("Tank")) # True print(str6.endswith("tank")) # False str7 = 'my name is {}, my age is {}!' str7 = str7.format('tank', 18, 111) print(str7) str7 = 'my name is {0}, my age is {1}!' str7 = str7.format('tank', 18, 111) print(str7) str7 = 'my name is {name}, my age is {age}!' str7 = str7.format(age=18, name='tank') print(str7) list1 = ['tank', 18, 'male', 3.0, 9] print(list1[4]) # 9 print(list1[-2]) print(list1[1:5]) print(list1[1:5:2]) print(len(list1)) print('tank' in list1) # True print('tank' not in list1) # False list1.append('张全蛋') list1.append('赵铁柱') print(list1) print(list1.pop()) # print(list1.pop(0)) # tank level = list1.pop() # print(level) print(list1) # ['tank', 18, 'male', 3.0] name = list1.remove('tank') print(name) print(list1) # [18, 'male', 3.0] for line in list1: print(line) print('hello world!') x = 10 y = 10 SCHOOL = '安徽工程大学' print(id(x)) print(id(y)) name = 'tank' print(type(x)) print(type(name)) print(x == y) print(x is y) name = input('input your name:') pwd = input('请输入密码:') print(name, pwd) print(type(name), type(pwd)) number = 100 # int(100) number2 = int(100) print(number) print(number2) sal = 15.0 # float(15.0) sal2 = float(15.0) print(sal) print(sal2) name = 'tank' name2 = "tank" content = ''' 1r1r1r 21r12r1 r12r 12r1r21 r12r1r2 12r1r print(name, name2, content) print('tank ' * 5) print('tank' + 'jam') print('tank', 'jam') list1 = ['张曼曼', 'tank', '涂懿磊', 11, 1.0, ['jason', 200]] print(list1[0]) print(list1[5][0]) dict1 = {'name': "tank", "age": 18} # {name="tank", "age"=18} print(dict1["name"]) True or False print(10 == 10) # True print(10 == 11) # False str1 = 'my name is xxx, my age is 18。' print(str1[3]) print(str1[3:7]) # 3 - (7-1) print(str1[3:10:2]) print(len(str1)) print('x' in str1) # True print('T' in str1) # False print(str1) print(str1.strip()) list2 = str2.split(' ') print(list2) str4 = ' my name is xxx, my age is 18。' str5 = 'my name is xxx, my age is 18。 ' print(str4.lstrip()) print(str5.rstrip()) str4 = '***my name is xxx, my age is 18。' str5 = 'my name is xxx, my age is 18。***' print(str4.lstrip('*')) print(str5.rstrip('*')) str6 = 'my name is Tank' print(str6.lower()) print(str6.upper()) print(str6.startswith("my")) # True print(str6.startswith("MY")) # False print(str6.endswith("Tank")) # True print(str6.endswith("tank")) # False str7 = 'my name is {}, my age is {}!' str7 = str7.format('tank', 18, 111) print(str7) str7 = 'my name is {0}, my age is {1}!' str7 = str7.format('tank', 18, 111) print(str7) str7 = 'my name is {name}, my age is {age}!' str7 = str7.format(age=18, name='tank') print(str7) list1 = ['tank', 18, 'male', 3.0, 9] print(list1[4]) # 9 print(list1[-2]) print(list1[1:5]) print(list1[1:5:2]) print(len(list1)) print('tank' in list1) # True print('tank' not in list1) # False list1.append('张全蛋') list1.append('赵铁柱') print(list1) print(list1.pop()) # print(list1.pop(0)) # tank level = list1.pop() # print(level) print(list1) # ['tank', 18, 'male', 3.0] name = list1.remove('tank') print(name) print(list1) # [18, 'male', 3.0] for line in list1: print(line) 课下作业
name
= ' aleX' print(name.strip()) print(name.startswith("al")) print(name.endswith("X")) print(name.replace('l','p')) print(name.split('l')) print(name.upper()) print(name.lower()) print(name[1]) print(name[:3]) print(name[3:]) print(name.find('e')) new_name=name[:-1] print(new_name)

 

转载于:https://www.cnblogs.com/djunblog/p/11006745.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值