'How to get the seven segment output side by side in python?
I have written a code to display the seven segment output. Whereas I need to display the output side by side. Say input: 123 , output should display seven segment side by side as below
# ### ###
# # #
# ### ###
# # #
# ### ###
Here is my logic:
dict = {0:('###','# #','# #','# #','###'),
1:(' #',' #',' #',' #',' #'),
2:('###',' #','###','# ','###'),
3:('###',' #','###',' #','###'),
4:('# ','# ','###',' #',' #'),
5:('###','# ','###',' #','###'),
6:('###','# ','###','# ','###'),
7:('###',' #',' #',' #',' #'),
8:('###','# #','###','# #','###')}
value = input("enter value:")
for i in value:
list1 = dict.get(int(i))
print('\n'.join(list1))
Solution 1:[1]
That's should do
followers_a = account_a.get("follower_count")
followers_b = account_b.get("follower_count")
end_game = False
while not end_game:
print(f"Compare A: {format_data(account_a)}")
print(vs)
print(f"Against B {format_data(account_b)}")
guess = input("Who has more followers? Type 'A' or 'B': ").upper()
current_score = 0
if guess == "A":
if followers_a > followers_b:
current_score += 1
print(f"You are right! Current score: {current_score}")
followers_b = account_b.get("follower_count")
else:
print(f"Sorry, that's wrong, Final score: {current_score}")
end_game = True
elif guess == "B":
if followers_b > followers_a:
print(f"You are right! Current score: {current_score}")
current_score += 1
followers_a = account_a.get("follower_count")
else:
print(f"Sorry, that's wrong, Final score: {current_score}")
end_game = True
elif guess != "A" or guess != "B":
print("invalid entry, type again")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Alik.Koldobsky |