豌图酱
发表于 2017-3-27 22:54:51
加入每日一练习的队伍,交作业
LED1=' - -- ----- '
LED2='| | |_| _||_||_ |_ ||_||_|'
LED3='|_| | |__|| _||_|||_| _|'
fir = ''
sec = ''
thr = ''
while 1:
num = input('请输入要展示为LED的数字:')
if num.isdigit():
break
for each in num:
each = int(each)
fir+=(LED1)
sec+=(LED2)
thr+=(LED3)
print(fir)
print(sec)
print(thr)
elbert
发表于 2017-3-29 13:14:59
m = input("ENTER PLEASE:")
n=["020101121", #0
"000001001", #1
"020021120", #2
"020021021", #3
"000121001", #4
"020120021", #5
"020120121", #6
"020001001", #7
"020121121", #8
"020121021"] #9
k = len(m)
for i in range(3):
for a in range(k):
s = str(n)])
for j in range(3*i,3*(i+1)): #一行一行的打印
if int(s) == 1:
print("|",end="")
elif int(s) == 2:
print("_",end = "")
else:
print(" ",end="")
print("")
BlackMan
发表于 2017-4-30 08:21:59
jerryxjr1220 发表于 2016-11-13 23:05
我的解答
def prt():
print(' _')
print('|_|')
print('|_|')
xiaofa
发表于 2017-5-28 04:39:55
#python小练习(001):把数字转换成LCD显示模式
dict1={'0':[' _ ','| |','|_|'],\
'1':[' ',' | ',' | '],\
'2':[' _ ',' _|','|_ '],\
'3':[' _ ',' _|',' _|'],\
'4':[' ','|_|','|'],\
'5':[' _ ','|_ ',' _|'],\
'6':[' _ ','|_ ','|_|'],\
'7':[' _ ','|','|'],\
'8':[' _ ','|_|','|_|'],\
'9':[' _ ','|_|',' _|']}
get_str=input("输入数字:")
for j in range(3):
for i in get_str:
print(dict1,end=' ')
print("")
xiaocy123
发表于 2018-2-6 23:39:41
lcd = [
[' _ ', ' ', ' _ ', ' _ ', ' ', ' _ ', ' _ ', ' _ ', ' _ ', ' _ '],
['| |', '|', ' _|', ' _|', '|_|', '|_ ', '|_ ', '|', '|_|', '|_|'],
['|_|', '|', '|_ ', ' _|', '|', ' _|', '|_|', '|', '|_|', ' _|'],
]
list1 = []
numbers = input("Input the numbers:")
for each in numbers:
list1.append(int(each))
for i in range(3):
for each in list1:
print(lcd,end='')
print(end='\n')
阿bang
发表于 2018-4-7 23:09:58
def lcd_num(num):
numlist = [
(" _ ", ' ', ' _ ', ' _ ', ' ', ' _ ', " _ ", " _ ", " _ ", " _ "),
("| |", " | ", " _|", " _|", "|_|", "|_ ", "|_ ", "|", "|_|", "|_|"),
("|_|", " | ", "|_ ", " _|", "|", " _|", "|_|", "|", "|_|", " _|")
]
temp = num
lcdnum = int(str(temp))
for i in range(3):
for j in str(num):
print(numlist,end=' ')
print()
print()
if __name__ == '__main__':
lcd_num(1234563432024423)
学习前面大佬的元组思路
昔日少年郎
发表于 2018-4-15 16:41:56
不错,跟着学习
凌九霄
发表于 2018-5-15 15:09:54
lcd = {0: [' _', '| | ', '|_| '],
1: [' ', '| ', '| '],
2: [' _', ' _| ', '|_'],
3: [' _', ' _| ', ' _| '],
4: [' ', '|_| ', '| '],
5: [' _', '|_', ' _| '],
6: [' _', '|_', '|_| '],
7: [' _', '| ', '| '],
8: [' _', '|_| ', '|_| '],
9: [' _', '|_| ', ' _| ']}
def lcdnum(num):
A = ''
B = ''
C = ''
strnum = str(num)
for i in strnum:
inum = int(i)
A += lcd
B += lcd
C += lcd
print(A + '\n' + B + '\n' + C)
lcdnum(1234567890)
古楼吴狗嗨
发表于 2019-1-31 14:42:52
python新手,献丑了a = ' _ __ _____ '
b = '| || _| _||_||_ |_ ||_||_|'
c = '|_|||__|| _||_|||_| _|'
num = input('输入数字')
for i in num:
i = int(i)
print(a,end='')
print()
for i in num:
i = int(i)
print(b,end='')
print()
for i in num:
i = int(i)
print(c,end='')
python_az
发表于 2023-1-25 18:46:34
str0=[
" _ ",
"| |",
"|_|"
]
str1=[
" ",
"|",
"|"
]
str2=[
" _ ",
" _|",
"|_ "
]
str3=[
" _ ",
" _|",
" _|"
]
str4=[
" ",
"|_|",
"|"
]
str5=[
" _ ",
"|_ ",
" _|"
]
str6=[
" _ ",
"|_ ",
"|_|"
]
str7=[
" _ ",
"|",
"|"
]
str8=[
" _ ",
"|_|",
"|_|"
]
str9=[
" _ ",
"|_|",
" _|"
]
print("請輸入數字:")
num = input()
#分割數字
list0 = list(str(num))
print(list0)
list1 = []
list2 = []
list3 = []
for nums in list0:
print(nums)
ss1 = eval("str" + str(nums) + "")
ss2 = eval("str" + str(nums) + "")
ss3 = eval("str" + str(nums) + "")
list1.append(ss1)#ss1 = str4
list2.append(ss2)
list3.append(ss3)
for each in list1:
print(each,end=' ')
print(" ")
for each in list2:
print(each,end=' ')
print(" ")
for each in list3:
print(each,end=' ')
print(" ")