A problem i need help on! thanx

a,b,c = map(int, input().split('-'))
a += 20
b = ('%2d'%(b))
c = ('%2d'%(c))
print(a,b,c, sep='-')

how to make the program add 0s and not spaces before the b and c help quick thanks !!


a,b,c = map(int, input().split("-"))
a += 20
b = ("%2d"%(b))
c = ("%2d"%(c))
print("-0".join(map(lambda x: str(x), [a, b, c])))

i think i figured it out by adding zeros before the 2dā€™ so
a,b,c = map(int, input().split(ā€˜-ā€™))
a += 20
b = (ā€˜%02dā€™%(b))
c = (ā€˜%02dā€™%(c))
print(a,b,c, sep=ā€˜-ā€™)
but good try thanks

Oh, ok, sorry to bother you about it; I just thought Iā€™d give a swing at it :stuck_out_tongue:

1 Like

It was close, but it had an extra space in between the 0 and the secondary dates.
like if you inputed 1980-6-5
it would output 2000-0 6-0 5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.