Posts

Showing posts from 2022

Lalita_YouTube_Downloader v1.0

  import pytube print ( "******** Welcome to e-lalita Youtube Downloader ********" ) def youtube_downloder ():         link = input ( "Enter any youtube link : " )         res = input ( "Choose any one resolution from 144p, 360p, 720p & 1080p: " )         ytube = pytube . YouTube ( link )         print ( "Title:" , ytube . title )         print ( "Author:" , ytube . author )         print ( "Published date:" , ytube . publish_date . strftime ( "%Y-%m- %d " ))         print ( "Number of views:" , ytube . views )         print ( "Length of video:" , ytube . length , "seconds" )         ytube . streams . get_by_resolution ( res ). download ()         print ( " \n Video successfullly downloaded from" , link ) while True :     try :         youtube_downloder ()     except :         print ( " \n Oho! Download failed." )         print ( "Something is wrong with

elalita NewsApp

import io import webbrowser import requests from tkinter import * from urllib.request import urlopen from PIL import ImageTk,Image class NewsApp:     def init(self):         # fetch data         self.data = requests.get('https://newsapi.org/v2/top-headlines?country=in&apiKey=07ce6431517e45c5b04b589c36e5bed6').json()         # initial GUI load         self.load_gui()         # load the 1st news item         self.load_news_item(0)     def load_gui(self):         self.root = Tk()         self.root.geometry('350x600')         self.root.resizable(0,0)         self.root.title('e-lalita News App')         self.root.configure(background='black')     def clear(self):         for i in self.root.pack_slaves():             i.destroy()     def load_news_item(self,index):         # clear the screen for the new news item         self.clear()         # image         try:             img_url = self.data['articles'][index]['urlToImage']             raw

search any element in Dictionary

      j = int ( input ( "Any element to find in dictionary " ))       d ={ 1 : 2 , 3 : 4 , 5 :{ 11 : 12 }, 7 : 8 } l = list ( d . values ()) k =[] for i in l :         if isinstance ( i , int ):                 k . append ( i )         if isinstance ( i , dict ):                 l = k . append ( list ( i . values ())[ 0 ])     if j in k :         print ( "It is present" )   else :         print ( "It is not present" )                

Identify the numbers within the string input

  ######print only number from given any string################ def extract_store_sort ( string ):     k =[]     for a in string :         if a .isalpha()== True :             k . append ( " " )         if a .isnumeric() == True or a == "." :             k . append ( a )             s = "" . join ( k )     k1 = s . split ()     lst = list ( map ( eval , k1 ))     print ( sorted ( lst )) string = "AC*wv12n/:#e123we2.45oin  (fwoi6n#a98nfwb+owi" extract_store_sort ( string )    
def check_prime ( x ):     lst =[]     for i in range ( 1 , x + 1 ):         if x % i == 0 :             lst . append ( i )     if len ( lst )== 2 :         print ( p , "is a prime number" )     else :         print ( p , "is not prime number" ) p = int ( input ( "Enter any number to check whether it is prime or not  = " ))     check_prime ( p )