-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompetetiveEating.py
More file actions
12 lines (8 loc) · 947 Bytes
/
Copy pathcompetetiveEating.py
File metadata and controls
12 lines (8 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
# The World Wide Competitive Eating tournament is going to be held in your town, and you're the one who is responsible for keeping track of time. For the great finale, a large billboard of the given width will be installed on the main square, where the time of possibly new world record will be shown.
# The track of time will be kept by a float number. It will be displayed on the board with the set precision precision with center alignment, and it is guaranteed that it will fit in the screen. Your task is to test the billboard. Given the time t, the width of the screen and the precision with which the time should be displayed, return a string that should be shown on the billboard.
# Example
# For t = 3.1415, width = 10 and precision = 2,
# the output should be
# competitiveEating(t, width, precision) = " 3.14 ".
def competitiveEating(t, width, precision):
return '{:^{width}.{prec}f}'.format(t, width=width, prec=precision)