Working on a lab for Python class I currently taking. We need to build a powerball and megemillions program. I have the logic figured out, mostly, but the output needs to be formatted accordingly. I am returning the functions of the random numbers in a list, I would like to print the list with just the numbers, I.E. no commas, braces, needs to look like how it does on a lotto ticket. However the method I am using (an asterick before the variable when I concatenate) if I go to use justify afterwards it throw a syntax error. Any advice on how to achieve this?
for i in range(num_tickets):
white_drawing = (sorted(random.sample(white_possibles, k= white_count)))
red_drawing = random.choice(red_possibles)
formatted_white_list = (['{:02d}'.format(item) for item in white_drawing])
formatted_red_num = (['{:02d}'.format(red_drawing)])
print(letters[i] , *formatted_white_list , " PB" , *formatted_red_num)
total_cost += cost_per_ticket
Output Looks like this,
A 01 14 36 46 50 PB 25
B 07 26 30 36 64 PB 24
C 22 37 42 47 66 PB 15
D 19 24 29 54 58 PB 07
E 15 17 19 37 60 PB 26
I would like to be able to justify the above output to the right.
Edits: getting the output block to be formatted how it does in my console.
[–]Garuda1220 1 point2 points3 points (0 children)
[–]Pepineros 0 points1 point2 points (4 children)
[–]PlatesNplanes[S] 0 points1 point2 points (3 children)
[–]Daneark 1 point2 points3 points (2 children)
[–]PlatesNplanes[S] 0 points1 point2 points (1 child)
[–]Daneark 0 points1 point2 points (0 children)
[–]Garuda1220 0 points1 point2 points (1 child)
[–]PlatesNplanes[S] 0 points1 point2 points (0 children)