Problem description :
computer 2000 Year problem , Also called “ Millennium Bug ”,“ Computer Millennium Bug problem ” or “ Millennium crisis ”. Abbreviated as “Y2K”. It refers to intelligent systems that use computer programs in some areas ( Including computer system , Automatic control chip, etc ) in , Because the year is only represented by two decimal digits , So when the system ( Or involving ) Cross century date processing
Timing ( Such as calculation or comparison between multiple dates, etc ), There will be wrong results , Then it leads to a variety of system work
Can disorder or even collapse . So basically, the millennium bug is a program that deals with dates bug( Computer program failure ), Not a virus .
input :
Personnel sequence information :【45,89,1998,00,75,33,1968,37,1958,90】
output :
Output reference :【1933, 1937, 1945, 1958, 1968, 1975, 1989, 1990, 1998, 2000】
thinking : Let's separate the two digits from the four digits , When the number is 00 Time , We add the original value 2000, Equal to its real year , Then leave more than 0 less than 100 Two digits plus 1900, Reuse of list objects sort() method .
a=[45,89,1998,00,75,33,1968,37,1958,90] for index,item in enumerate(a): if(item
==00): item+=2000 a[index]=item elif 0<item<100: item+=1900 a[index]=item else:
item=item a[index]=item for i in a: print(i) a.sort() print(' Ascending sort ',a)
Technology