Date -year format | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Date -year format

The United Nations organization released an official document regarding the most important events from the beginning of the time lik DD-MM-YY format find the total number of events described in the document input:string containing the description of the document

17th Oct 2020, 5:36 PM
Varsha Dustakar
Varsha Dustakar - avatar
1 Answer
+ 1
import re x=input("Enter your Input : ") r=re.findall(r"[\d]{2}-[\d]{2}-[\d]{4}",x) dist_year=[] for i in r: if i.split("-")[2] not in dist_year: dist_year.append(i.split("-")[2]) print(len(dist_year))
19th Sep 2022, 1:58 PM
Pranav Nalawade
Pranav Nalawade - avatar