I have a string I am formatting and printing using f-string and I need to eliminate some spaces. Here is my code:
if len(probably) > 0 and len(might) > 0:
print(f'{name}:',f'Might({might})', f'Probably({probably})')
elif len(probably) == 0 and len(might) > 0:
print(f'{name}:',f'Might({might})')
elif len(probably) > 0 and len(might) == 0:
print(f'{name}:',f'Probably({probably})')
elif len(probably) == 0 and len(might) == 0:
print(f'{name}:')
and here is what it looks like currently:
1: Might(4, 6, 7) Probably(11)
2: Might(5, 8, 10) Probably(9)
3: Might(4, 5, 6, 7, 8, 12)
4: Might(1, 3, 6, 11, 12)
5: Might(2, 3, 8, 10) Probably(9)
6: Might(1, 3, 4, 7, 11)
7: Might(1, 3, 6)
8: Might(2, 3, 5, 9, 10)
9: Might(8, 10) Probably(2, 5)
10: Might(2, 5, 8, 9)
11: Might(4, 6) Probably(1)
12: Might(3, 4)
13:
and here is what I need it to look like
1:Might(4,6,7) Probably(11)
2:Might(5,8,10) Probably(9)
3:Might(4,5,6,7,8,12)
4:Might(1,3,6,11,12)
5:Might(2,3,8,10) Probably(9)
6:Might(1,3,4,7,11)
7:Might(1,3,6)
8:Might(2,3,5,9,10)
9:Might(8,10) Probably(2,5)
10:Might(2,5,8,9)
11:Might(4,6) Probably(1)
12:Might(3,4)
13:
See Question&Answers more detail:
os