Mar-11-2020, 08:06 AM
Task - a program which is able to simulate the work of a seven-display device
Sample input:
123
Sample output:
(I did read some information on using zip but I suppose there should/could be an easier way to print the lines.)
Any help is appreciated.
Sample input:
123
Sample output:
Output: # ### ###
# # #
# ### ###
# # #
# ### ###
So far....printE = (" \n \n \n \n \n") print0 = ("###\n# #\n# #\n# #\n###\n") print1 = (" #\n"*5) print2 = ("###\n #\n###\n# \n###\n") print3 = ("###\n #\n###\n #\n###\n") print4 = ("# #\n# #\n###\n #\n #\n") print5 = ("###\n# \n###\n #\n###\n") print6 = ("###\n# \n###\n# #\n###\n") print7 = ("###\n #\n #\n #\n #\n") print8 = ("###\n# #\n###\n# #\n###\n") print9 = ("###\n# #\n# #\n #\n###\n") printList = [print0,print1,print2,print3,print4,print5,print6,print7,print8,print9] inputVal = int(input("Enter an integer :")) inputStr = str(inputVal) inputDigits = [int(x) for x in inputStr] # print (len(inputStr)) # print(inputDigits) result = "" for i in inputDigits: result += printList[i] print (result)This outputs
Output:
#
#
#
#
#
###
#
###
#
###
###
#
###
#
###
Is there an easy way to achieve this output printed side-by-side.(I did read some information on using zip but I suppose there should/could be an easier way to print the lines.)
Any help is appreciated.
