Posts

Core java Selenium Software Testing

import java.io.*; public class Assign1  { public void calc() throws IOException { BufferedReader brr=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter operator"); String o=brr.readLine().trim(); System.out.println("Enter value of a"); // String a=brr.readLine(); int a1=Integer.parseInt(brr.readLine().trim()); System.out.println("Enter value of b"); // String b=brr.readLine(); int b1=Integer.parseInt(brr.readLine().trim()); int res = 0; if(o.equals("+")) { res = a1+b1; } else if(o.equals("-")) { res = a1-b1; } System.out.println(res); } public static void main(String[] args) throws IOException { Assign1 add=new Assign1(); add.calc(); } }

Music Player

import   pygame from   pygame   import   mixer from   tkinter   import  * import   os def   playsong ():      currentsong = playlist . get ( ACTIVE )      print ( currentsong )      mixer . music . load ( currentsong )      songstatus . set ( "Playing" )      mixer . music . play () def   pausesong ():      songstatus . set ( "Paused" )      mixer . music . pause () def   stopsong ():      songstatus . set ( "Stopped" )      mixer . music . stop () def   resumesong ():      songstatus . set ( "Resuming" )      mixer . music . unpause ()     root = Tk () root . title ( 'e-Lalita Music Player' ) mixer . init () songstatus = StringVar () songstatus . set ( "choosing" ) playlist = Listb...

Print string with any combination

  from   itertools   import   permutations   str = "abcdefghijklmnopqrstuvwxyz" y = int ( input ( "Enter range of letters of alphabet =" )) your_str = str [ 0 : y ] print ( "You entered  =" ,  your_str )  m = int ( input ( "How many string do you want? =" )) r = int ( input ( "Enter range of letters Combination =" )) permutation  = [ '' . join ( x )  for   x   in   permutations ( your_str , r )]  x = tuple ( permutation ) print ( ', ' . join ( x [ 0 : m ]))

Jarvis voice

  import  pyttsx3 engine  =  pyttsx3 .init() voices = engine .getProperty( 'voices' ) engine .setProperty( 'voice' ,  voices [ 1 ].id) engine .setProperty( 'rate' ,  125 ) engine .setProperty( 'volume' , 0.2 ) engine .say( "Hello, How are you?" ) engine .save_to_file( 'Hello World' ,  'test.mp3' )  engine .runAndWait()

Notepad using Python

  from  tkinter  import * import  tkinter.messagebox  as  tmsg from  tkinter.filedialog  import  askopenfilename, asksaveasfilename import  os def   newFile ():      global   file     root.title( "Untitled-Notepad" )      file = None     TextArea.delete( 1.0 , END) def   openFile ():      global   file      file =askopenfilename( defaultextension = ".txt" ,  filetypes =[( "All Files" ,  "*.*" ), ( "Text Documents" ,  "*.txt" )])      if   file == "" :          file = None      else :         root.title(os.path.basename( file )+  "- Notepad by Elalita" )         TextArea.delete( 1...

Basic Calc using Python Tkinter

  from  tkinter  import * root=Tk() root.geometry( "300x520" ) root.title( "Calculator by Elalita" ) scvalue=StringVar() scvalue.set( " " ) screen=Entry(root,  textvar =scvalue, font = "lucida 40 bold" ) screen.pack( fill  =X, ipadx = 8 ,  padx = 10 ,  pady = 10 ) def   click ( event ):      global  scvalue     text=event.widget.cget( "text" )      print (text)      if  text== "=" :          if   scvalue.get().isdigit():             vlaue= int (scvalue.get())          else :              try :                 value= eval (screen.get())   ...

Python Slider

  from  tkinter  import * import  tkinter.messagebox  as  tmsg root=Tk() root.title( "My Slider" ) root.geometry( "750x450" ) # myslider=Scale(root, from_=0, to=450) # myslider.pack() def   getdollor ():      print  ( f "We have credit  { myslider2.get() }  $ in your account" )     tmsg.showinfo( "Amount Credited!" ,  f "We have credited  { myslider2.get() }  $ in your account." )      f= open ( "file3.txt" ,  "w" )     a=f.write( f " { myslider2.get() }  $ credited in your account. \n " )      with   open ( "file3.txt" ,  "a" )  as  f:         f.write( f "Thanks for giving rate us >>>   { name_value.get() } "...