Home  >  Article  >  Backend Development  >  Use Python2 to complete the effect example of LED displaying large numbers

Use Python2 to complete the effect example of LED displaying large numbers

巴扎黑
巴扎黑Original
2017-09-05 11:34:461722browse

This article mainly introduces the LED large digital display effect implemented by Python2, involving simple interaction and list-related usage skills of Python. Friends in need can refer to it

The example of this article tells the LED large digital display implemented by Python2 Digital display effect. Share it with everyone for your reference, the details are as follows:


#filename:bigNumber.py
zero=['*******','*   *','*   *','*   *','*   *','*   *','*******']
one=['   *','   *','   *','   *','   *','   *','   *']
two=['*******','   *','   *','*******','*   ','*   ','*******']
three=['*******','   *','   *','*******','   *','   *','*******']
four=['*   *','*   *','*   *','*******','   *','   *','   *']
five=['*******','*   ','*   ','*******','   *','   *','*******']
six=['*******','*   ','*   ','*******','*   *','*   *','*******']
seven=['*******','   *','   *','   *','   *','   *','   *']
eight=['*******','*   *','*   *','*******','*   *','*   *','*******']
nine=['*******','*   *','*   *','*******','   *','   *','*******']
numArr=[zero,one,two,three,four,five,six,seven,eight,nine]
while True:
  try:
    #input a number
    num = raw_input("Enter a number:")
    for i in range(0,7):
      line=''
      j=0
      while j<len(num):
        n=int(num[j])
        line+=numArr[n][i]+&#39; &#39;
        j+=1
      print line
  except ValueError as err:
    print err

The operation effect is as follows:

The above is the detailed content of Use Python2 to complete the effect example of LED displaying large numbers. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn