鱼C论坛小甲鱼《零基础入门学习python》课程课后题

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

10.PythonPython(Scriptinglanguage)CC++JavaShell1.IDLEIDLEPythonShellshellWindowscmdLinuxshellIDLEshellPython2.print()print()IDLEshell3.PythonPython*4.print('Ilovefishc.com'*5)print('Ilovefishc.com'+5)Pythonprint('Ilovefishc.com'+5)Ilovefishc.com5.\'Ilovefishc.com'6.Python3Python2Python2Python2Python3PythonXPWIN7PythonPython3Python3Python220.BIFBIFBuilt-inFunctionsPythonprint()input()Python3input()Python2raw_input()BIFPython31.Python3BIFPythonIDLEdir(__builtins__)PythonbuiltinsBIFBIFinput()shellhelp(input)BIF68~T_T2.Python'FishC''fishc'PythonPythonfishcFishCPythonPython3.PythonPythonPython......C......PythonC:IDLE4.======Cif(c==1)if(c=1)PythonPythonififc=1:BUGBUG5.'I'+'Love'+'FishC''ILoveFishC'Python30.hello.py1.name=input()2.print(''+name+'!')1.calc.py11001.temp=input(1100)2.num=int(temp)3.if1=num=100:4.print('^_^')5.else:6.print('T_T')5.1.str=r'C:\ProgramFiles\FishC\Good''\\'40.C1.while'C':2.print('C!')1.C1.i=102.whilei:3.print('C!')4.i=i-12.10cost503.Python34.Python35.PythonandC&&CC++6.short-circuitlogic0.1.2.3.0.CCCCTRL+Cwhile(True)PythonFalseNone0''()[]{}1.while'':2.print('')3.print('')1.whileFalse:2.print('')3.print('')1.while0:2.print('')3.print('')1.C102.10cost50(10cost)and(cost50)3.Python3print('Ilovefishc');print('verymuch!')4.Python31.34and\2.121.(34and2.12)5.CC++PythonandC&&(C\C++VSPython)VS6.short-circuitlogicxandyxy(True)x(False)Falseyshort-circuitlogiclazyevaluationorPythonxx(0)y0.1.importrandom2.times=33.secret=random.randint(1,10)4.print('------------------C------------------')5.#guesssecret6.guess=07.#print()end=print()8.#end=JJ9.print(,end=)10.while(guess!=secret)and(times0):11.temp=input()12.guess=int(temp)13.times=times-1#-114.ifguess==secret:15.print()16.print()17.else:18.ifguesssecret:19.print(~~~)20.else:21.print(~~~)22.iftimes0:23.print(,end=)24.else:25.print(T_T)26.print(^_^)1.1.temp=input(':')2.number=int(temp)3.i=14.whilenumber:5.print(i)6.i=i+17.number=number-12.1.temp=input(':')2.number=int(temp)3.whilenumber:4.i=number-15.whilei:6.print('',end='')7.i=i-18.j=number9.whilej:10.print('*',end='')11.j=j-112.print()13.number=number-13.^_^50.Pythonintboolfloatstr1.(bool)TrueFalse102.int()3.int()4.type()isinstance()5.Python36.0.1.temp=input()2.#type(1)class'int'type(temp)3.whiletype(temp)!=type(1):4.print(,end='')5.temp=input()1.temp=input()2.#notnotTrue==Flase3.whilenotisinstance(temp,int):4.print(,end='')5.temp=input()input()type(temp)class'str'ss.isalnum()TureFalses.isalpha()TureFalses.isdigit()TureFalses.islower()TureFalses.isupper()TureFalses.istitle()TureFalses.isspace()TureFalses='ILOVEFISHC's.isupper()True1.BIF:4100,4002.0.Pythonintboolfloatstrboolfloatstr1.(bool)TrueFalse10CPU0101FalseTrue2.int()5.5653.int()int()5.45int(5.4+0.5)==55.66int(5.6+0.5)==64.type()isinstance()isinstance()type()5.Python3Pyhton3utf-8=''print()6.=33.secret=random.randint(1,10)4.print('------------------C------------------')5.guess=06.print(,end=)7.while(guess!=secret)and(times0):8.temp=input()9.whilenottemp.isdigit():10.temp=input()11.guess=int(temp)12.times=times-1#-113.ifguess==secret:14.print()15.print()16.else:17.ifguesssecret:18.print(~~~)19.else:20.print(~~~)21.iftimes0:22.print(,end=)23.else:24.print(T_T)25.print(^_^)1.1.temp=input('')2.whilenottemp.isdigit():3.temp=input()4.5.year=int(temp)6.ifyear/400==int(year/400):7.print(temp+'')8.else:9.if(year/4==int(year/4))and(year/100!=int(year/100)):10.print(temp+'')11.else:12.print(temp+'')2.3.0.CCCCTRL+Cwhile(True)PythonFalseNone0''()[]{}1.while'':2.print('')3.print('')1.whileFlase:2.print('')3.print('')1.while0:2.print('')3.print('')1.C102.10cost50(10cost)and(cost50)3.Python3print('Ilovefishc');print('verymuch!')4.Python31.34and\2.121.(34and2.12)5.CC++PythonandC&&(C\C++VSPython)VS6.short-circuitlogicxandyxy(True)x(False)Falseyshort-circuitlogiclazyevaluationorPythonxx(0)y0.1.importrandom2.times=33.secret=random.randint(1,10)4.print('------------------C------------------')5.#guesssecret6.guess=07.#print()end=print()8.#end=JJ9.print(,end=)10.while(guess!=secret)and(times0):11.temp=input()12.guess=int(temp)13.times=times-1#-114.ifguess==secret:15.print()16.print()17.else:18.ifguesssecret:19.print(~~~)20.else:21.print(~~~)22.iftimes0:23.print(,end=)24.else:25.print(T_T)26.print(^_^)1.1.temp=input(':')2.number=int(temp)3.i=14.whilenumber:5.print(i)6.i=i+17.number=number-12.1.temp=input(':')2.number=int(temp)3.whilenumber:4.i=number-15.whilei:6.print('',end='')7.i=i-18.j=number9.whilej:10.print('*',end='')11.j=j-112.print()13.number=number-160.Pythonfloor//3.0//2.01.abc2.IDLE5**-23.4.not1or0and1or3and4or5and6or7and8and95.%0.0~1001.Python......2.213254657~~~3.70.Pythonfloor//3.0//2.01.5CPythonfloor1.01.abc(ab)and(bc)2.IDLE5**-20.041/253.2x%2==04.not1or0and1or3and4or5and6or7and8and904notorandnotandor(not1)or(0and1)or(3and4)or(5and6)or(7and8and9)==0or0or4or6or9==443and4==43or4==345.%ifyear/400==int(year/400)0.0~

1 / 390
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功