I need to create a seven segment display, printing the results side by side, the results I get are printed with a n after each number.
# ### ###
# # #
# ### ###
# # #
# ### ###
I’ve tried print(“x”,sep=” “) without success, this is my code:
nums = {
'0': "###n" + "# #n" * 3 + "###",
'1': "#n" * 5,
'2': "###n" + " #n" + "###n" + "# n" + "###",
'3': "###n" + " #n" + "###n" + " #n" + "###",
'4': "# #n" * 2 + "###n" + " #n" * 2,
'5': "###n" + "# n" + "###n" + " #n" + "###",
'6': "###n" + "# n" + "###n" + "# #n" + "###",
'7': "###n" + " #n" * 4,
'8': "###n" + "# #n" + "###n" + "# #n" + "###",
'9': "###n" + "# #n" + "###n" + " #n" + " #"
}
def res(num_list):
num_list = list(str(num_list))
try:
for i in num_list:
print(nums[i], sep=" ")
except:
print("Invalid numbers")
res(12)
Result:
#
#
#
#
#
###
#
###
#
###
Any pointers are greatly appreciated.