Python Tutorials

Nested Loops in Python 0

Nested Loops in Python

Program 1 # n=int(input(“Enter the limit”)) # for i in range(1,n+1,1): # print(i*i) # n=int(input(“Enter a number”)) # for i in range(1,11,1): # print(n*i) # Nested loop # for i in range (1,6,1): #...

Python if else and if elif Loop 0

Python if else and if elif Loop

Program 1 # print word of number # n=int(input(“Enter a number”)) # if(n==1): # print(“One”) # if(n==2): # print(“Two”) # if(n==3): # print(“Three”) # if(n==4): # print(“Four”) # if(n==5): # print(“Five”) # if(n>5 or...

Python Program on Loops 0

Python Program on Loops

Program 1 # 1 4 9 16 25 ……. n # n=int(input(“Enter the limit”)) # i=1 #intilization # while(i<=n): # print(i*i,end=” “) # i=i+1 # WAP to print table of number # n=int(input(“Enter a...

How to Open Multiple Software Using Python OS Module 0

How to Open Multiple Software Using Python OS Module

Program 1 import os choice=0 while(choice!=8): print(“——————–Menu——————–“) print(“1.NotePad\n2.Calculator\n3.MS Word\n4.MS Excel\n5.MS Paint\n6.Power Point\n7.Notepad++\n8.Exit”) print(“———————————————“) choice=int(input(“Enter your choice”)) if(choice==1): os.system(“notepad”) elif (choice==2): os.system(“calc”) elif (choice==3): os.system(“start winword.exe”) elif (choice==4): os.system(“start excel.exe”) elif(choice==5): os.system(“mspaint”) elif (choice==6): os.system(“start...

How to Create a Notepad in Python Part – 2 0

How to Create a Notepad in Python Part – 2

Program 1 from tkinter import * import tkinter.messagebox as msgbox import tkinter.filedialog as fd def menuclick(choice): textbox = Text(myroot, width=1200, height=500, font=(‘Arial’, 15, ‘bold’),wrap=WORD) if(choice==’new’): textbox.pack() elif(choice==’newwindow’): filename = fd.askopenfilename(parent=myroot, title=’open file window’,filetypes=((“Text File”,...

Enterprise Application Development using ORM Architecture in Python Part – 3 0

Enterprise Application Development using ORM Architecture in Python Part – 3

Program 1 import myconnection as mcon import model class EmployeeDAO: def __init__(self): self.con = mcon.MyConnection.getConnection() self.cur = self.con.cursor() # print(“Connection sucess”) def insertEmployee(self,E): try: sql=”insert into employee values(‘%d’,’%s’,’%s’,’%d’)” value=(E.getid(),E.getname(),E.getdept(),E.getsalary()) self.cur.execute(sql % value) self.con.commit() except...

Application Development using ORM Architecture in Python Part – 2 0

Application Development using ORM Architecture in Python Part – 2

Program 1 import MySQLdb class MyConnection: @staticmethod def getConnection(): con=MySQLdb.Connect(host=”localhost”,user=”root”,password=”root”,database=”dataflair”) return con Program 2 import tkinter.messagebox import tkinter.simpledialog from tkinter import * import tkinter.messagebox import model import employeedao as empd import model def buttonClick(value):...

Enterprise Application Development using ORM Architecture in Python Part-1 2

Enterprise Application Development using ORM Architecture in Python Part-1

Program 1 class Employee: def setid(self,empid): self.empid=empid def getid(self): return self.empid def setname(self,empname): self.empname=empname def getname(self): return self.empname def setdept(self,empdept): self.empdept=empdept def getdept(self): return self.empdept def setsalary(self,empsalary): self.empsalary=empsalary def getsalary(self): return self.empsalary  

How to Create GUI Application with Database Operations in Python Part – 2 0

How to Create GUI Application with Database Operations in Python Part – 2

Program 1 import tkinter.messagebox import tkinter.simpledialog from tkinter import * import tkinter.messagebox import model import employeedao as empd import model def buttonClick(value): if(value==’save’): ed=empd.EmployeeDAO() E=model.Employee() E.setid(empid.get()) E.setname(empname.get()) E.setdept(empdept.get()) E.setsalary(empsal.get()) choice = tkinter.messagebox.askyesno(“save window”, “Are...