Programing in Python3???Second Edition???_??????
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Programing in Python3???Second Edition???_??????相关的知识,希望对你有一定的参考价值。
??????????????? ???????????? inpu ?????? += second image ???????????? ??????
Programming in Python3 (Second Edition)??????
- ??????????????????Python?????????????????????????????????Programming in Python3 ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Python??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Chapter One
#bigdigits.py 41072819
import sys
#coding:utf-8
Zero=[???*****???,???* *???,???* *???,???* *???,???* *???,???* *???,???*****???]
One=[??? * ???,??? ** ???,???* * ???,??? * ???,??? * ???,??? * ???,???*****???]
Two=[???*****???,??? *???,??? *???,???*****???,???* ???,???* ???,???*****???]
Three=[???*****???,??? *???,??? *???,???*****???,??? *???,??? *???,???*****???]
Four=[??? * ???,??? ** ???,???* * ???,???*****???,??? * ???,??? * ???,??? * ???]
Five=[???*****???,???* ???,???* ???,???*****???,??? *???,??? *???,???*****???]
Six=[???*****???,???* ???,???* ???,???*****???,???* *???,???* *???,???*****???]
Seven=[???*****???,??? *???,??? *???,??? * ???,??? * ???,??? * ???,???* ???]
Eight=[???*****???,???* *???,???* *???,???*****???,???* *???,???* *???,???*****???]
Nine=[???*****???,???* *???,???* *???,???*****???,??? *???,??? *???,???*****???]
Digits=[Zero,One,Two,Three,Four,Five,Six,Seven,Eight,Nine]#??????????????????
try:
digits=input("please input your number:")#????????????
row=0
while row<7:
line=""
column=0
while column<len(digits):#?????????????????????
number=int(digits[column])#?????????????????????????????????????????????????????????????????????
digit=Digits[number]#????????????????????????Digits??????????????????
line+=digit[row]+" "
"""????????????????????????????????????????????????line ?????????????????????????????????????????????????????????????????????
???????????????line?????????????????????????????????????????????????????????
"""
column+=1
print(line)
row+=1
except ValueError as err:#?????????????????????????????????????????????????????????err
print(err)
#????????????????????????
import random
def get_int(msg,minimum,default):#??????
while True:
try:
line=input(msg)
if not line and default is not None:
return default
i=int(line)
if i<minimum:
print("must be>=",minimum)
else:
return i
except ValueError as err:
print(err)
rows=get_int("rows:",1,None)
columns=get_int("columns:",1,None)
minimum=get_int("minimum(or Enter for 0);",-10000,0)
#????????????????????????1000????????????????????????1000????????????????????????minimum
default=1000
if default<=minimum:
default=2*minimum
maximum=get_int("maximum(or Enter for "+str(default)+"):",minimum,default)
#????????????????????????????????????
row=0
while row<rows:
line=""
column=0
while column<columns:
i=random.randint(minimum,maximum)
s=str(i)
s+=" "
line+=s
column+=1
print(line)
row+=1
2018/8/10 13:27:27
以上是关于Programing in Python3???Second Edition???_??????的主要内容,如果未能解决你的问题,请参考以下文章
Learning OSG programing---osgShape
MEF学习总结---Attribute Model Programing