request101
request101
``` Username=str(input('请输入用户名:')) password=int(input('请输入密码:')) if(Username=='seven'): if(password==123): print("登陆成功!") else: print("登陆失败!") i=2 sum=0 while(i
#2.2.1 标准整型和长整型 ``` a = 0o101 print("a="+str(a)) b=64 print('b='+str(b)) c=-237 print('c='+str(c)) d=0x80 print('d='+str(d)) e=-0x92 print('e='+str(e)) longint=34252456245724572456723 print('longint='+str(longint)) #1.2.2 布尔型和布尔对象 print(bool(1)) print(bool(True)) print(bool('0')) print(bool([])) print(bool((1,))) foo = 42 bar = foo...
#1.通过索引的方法 ``` print("list...") list1=[1,2,3,4,5,6,7,8,9,'du','ao','duaoge'] print(list1[::-1])
``` print("字符串...") str1='du','ao','ge','hello','word',"hello worde!" print("原数据为:",str1) print(str1[1:5]) str2=1,2,3 str1=str2+str1[3:]#将字符串前n个字符替换为指定的字符 print(str1)
``` def printRight(Username,Passwords): Prints the usernames and passwords. The two valuse should be right.''' if(Username=='seven'): if(Passwords==123): print("登陆成功!") else: print("登陆失败!") printRight('seven',123) printRight('seven',1234) print(printRight.__doc__) def printList(i,sum): '''Prints the two numbers. The if...
1.6模块
``` def add(a,b): return a+b def sub(a,b): return a-b def mult(a,b): return a*b def div(a,b): return a/b import zuoye a=12 b=13 print('a+b=',zuoye.add(a,b)) print('a-b=',zuoye.add(a,b)) print('a*b=',zuoye.mult(a,b)) print('a/b=',zuoye.div(a,b))