@espenmn Can you tell me which file need to be changed
I mean I was thinking of usinng Python to fetch Gifs from folder and display every gifs at interval of 5 second But I am not getting where to write its python code
You should look over the Mastering Plone training class (see training.plone.org) to understand how to write a browser view, though it's probably not the way I would do it as a newcomer to Plone...I would use an existing add-on that does something like that and inspect how the code is written.
I would activate the Rest-API and do all of this with JavaScript.
Either fetch the list of all images via javascript and do your random slicing in JS, then fetch the image it self.
Or create a BrowserView in python which gives you back a random image and fetch this via JavaScript when ever you want to switch the image.
To create a browser view, you can use the plonecli and the underlaying bobtemplate.plone.
plonecli create addon src/collective.giffyslider
cd src/collective.giffyslider
plonecli add view