Z.Banger
Z.Banger

Reputation: 11

Python %s not working when printing another veriable

Me and my friend are working on a program that keeps track of swimmers times and all the times totaled is there aggregate. We also ask that the swimmers name which is equal to Name. We are able to print out...

print('Swimmer had a total time of',aggregates[Name])

but the %Name stop the program from running properly, any suggestions to what we could use instead or maybe what we're doing wrong would be very helpful. Thanks!

print('''%s had a total aggregate time of
''',aggregates[Name] %Name)

Upvotes: 0

Views: 652

Answers (1)

Bobby
Bobby

Reputation: 21

Formatting print should be done like print("%s had a t..." % Name, aggregates[Name])

Upvotes: 2

Related Questions