Saturday, December 25, 2021

date time in python

 # ========================================================================

# date time using python

# ========================================================================


#uncomment to import library 

import pandas as pd 

import datetime as dt


#converting string into datetime 

df1 = pd.DataFrame(

     {

      "DateTime": pd.to_datetime(["2021-11-13 13:45:33",

                                  '2021-11-14 14:13:25',

                                  "2021-11-15 14:39:25", 

                                  "2021-11-16 15:16:43", 

                                  "2021-11-17 16:51:19"]),

     }

)


#split datetime into individual date and time df column

df1['Dates'] = pd.to_datetime(df1['DateTime']).dt.date

df1['Time'] = pd.to_datetime(df1['DateTime']).dt.time


#join date and time columns into a datetime column 

df1['DateTime_join'] = pd.DataFrame(

    pd.to_datetime(df1['Dates'].astype(str) + ' ' + df1['Time'].astype(str)), 

    columns=['Datetime_join']) 

print(df1)



# ========================================================================

# date time format change

# ========================================================================

import pandas as pd

dt = "02-11-2021"

dt1 = pd.to_datetime(dt)

dt1

#output# Timestamp('2021-02-11 00:00:00')

dt2 = pd.to_datetime(dt, format = "%d-%m-%Y")

dt2

#output# Timestamp('2021-11-02 00:00:00')



# ========================================================================

# date time format

# ========================================================================


import pandas as pd

dt = pd.to_datetime("02-11-2021")

dt3 = dt.strftime('%b/%d/%Y')

dt3

#output# 'Feb/11/2021'



Monday, December 13, 2021

Top 4 interview questions of python

 Write a program  on decorator?


def decor1(func):

    def wrapper():

        print("this is beauty function")

        func()

        

    return wrapper

    

  

def func1():

    print("this is the normal function")

    


func1 = decor1(func1)

func1()


#2. Write a code for fibonacci series upto 1000

a,b=0,1


while b<1000:

    print(b,end=',')

    a,b=b,a+b


output:

1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987


#3.Write a code for show the list indexes with list values?

list1=[1,2,3,4,5]    

for index,value in enumerate(list1):

    print("index-"+str(index)+" value-"+str(value))

output:

index-0 value-1

index-1 value-2

index-2 value-3

index-3 value-4

index-4 value-5



a = 99311278

list1=[]


def sort1(x):

    list1.append(b)

    list1.sort()

     

for i in range(1,9):

         b=a%10

         a =int(a/10)

         #print(a)

         #print(b)

         sort1(b)


print(list1)






    

Thursday, December 9, 2021

python interview questions of inventech solutions

 1.difference between list and tuple?

2.is string is mutable or not?

3.how to remove duplicates from the list

4.what is set in python?

5.what is the lambda function

6.numpy: how to fetch the 5 columns randomly from CSV files

7.How to Copy "A" table with 1 lakh column into empty table "B"

8.query for fetching highest salary employee details from employee table?



Answers:

 1.difference between list and tuple?

ans:



2.is string is mutable or not?

ans: string are immutable. we can't add anything at runtime

3.what is the lambda function

ans:What is Lambda Function in Python? Lambda Function, also referred to as 'Anonymous function' is same as a regular python function but can be defined without a name. While normal functions are defined using the def keyword, anonymous functions are defined using the lambda keyword.

4.how to remove duplicates from the list?


5.what is set in python?

6.numpy: how to fetch the 5 columns randomly from CSV files

7.How to Copy "A" table with 1 lakh column into empty table "B"

8.query for fetching highest salary employee details from employee table?

Wednesday, December 8, 2021

Polymorphism in python

 polymorphism means one function with multiple forms. one function can act like multiple functions.

Example:

#polymorphism


print(len("hello"))


print(len([10,20,30]))



output:

5

3



#your defined  polymorphism


def poly_test(a,b,c=0):

    print(a+b+c)

    

poly_test(10,20)

poly_test(10,20, c=30)


output :

30

60

python classes

 class anil_test2:

    a = 10

    

    def ani_test():

        print(" This class inside function")

        

        

        

print(anil_test2)


python functions test1

 


def anil():

    print("testing the values")

    

anil()


def anil_test():

    print("testing is working")

    

    

anil_test()

Tuesday, May 18, 2021

python interview questions with SOC

 Q1:what are difference between list and tuple?

Q2:what is decorator? what is the use of that?

Q3:what is the dictionary?

Q4:  how to achieve dictionary values with single key?

Q5: how to get ip address in linux ?

Thursday, April 15, 2021

Python online training contents

for python online classes. please contact 8897520530

or whatsup--8897520530

skype-durgam.anil1@gmail.com


for contents please click on below link

Thursday, April 8, 2021

MM32F MCUs delay in ms(milli seconds) and us(microseconds)

static u8 fac_us = 0;
 static u16 fac_ms = 0;
 extern u32 SystemCoreClock;
 void delay_init() 
 SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
 fac_us = SystemCoreClock / 8000000;
 fac_ms = (u16)fac_us * 1000; } void delay_us(u32 nus) { u32 temp; SysTick->LOAD = nus * fac_us; SysTick->VAL = 0x00; SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk ; do { temp = SysTick->CTRL; } while((temp & 0x01) && !(temp & (1 << 16))); SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; SysTick->VAL = 0X00; } void delay_ms(u16 nms) { u32 temp; SysTick->LOAD = (u32)nms * fac_ms; SysTick->VAL = 0x00; SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk ; do { temp = SysTick->CTRL; } while((temp & 0x01) && !(temp & (1 << 16))); SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; SysTick->VAL = 0X00; }

Tuesday, April 6, 2021

input function in python

# -*- coding: utf-8 -*- """ Created on Tue Apr 6 22:22:06 2021 @author: Onyx1 #input from the user #syntax:input() a=input() b=input() print(a+b) a=int(input("please enter number") ) #string type b=int(input("please enter number ")) #string type print(a,type(a)) print(b,type(b)) print(a+b) a=input("enter your name") print(a, type(a)) a =float(input("please enter floating values")) print(a,type(a)) a= int(input("enter number")) print(a,type(a)) """ #raw_input------python 2.x version input

doc string in python

""" #docstring def basha(): ''' company name:Harish company author:Harish program description: addition , substraction, multiplication functions file date of started:06-04-2021 date modified:08-04-2022 second user: '''''' print("Basha") #__doc__ -------> docstring print(basha.__doc__) ''' def basha1(): """ company_name:Harish company author:Harish program description: addition , substraction, multiplication functions file date of started:06-04-2021 date modified:08-04-2022 second user: """ print("Basha") #__doc__ -------> docstring print(type(basha1)) print(basha1.__doc__) '''

Monday, April 5, 2021

operators in python

""" Created on Mon Apr 5 21:18:07 2021 @author: Onyx1 #class-3-05-04-2021 #addition a=10 b=20 print(a+b) #substraction print(b-a) print(a-b) #multiplication print(a*b) #division print(a/b) #floor division print(a//b) #power print(a**b) #python 2.x print("anl") #operators #arthimatic operation #assignment operators #logical operators #conditional #identify #membership #bitwise #arthimatic operation # +,-,*,/,%,//,**---> operators #assignment operators a=10 b=20 a=a+b b=b-a a=a*b print(a) b=30+50 print("b-",b) a=20 b=10 a=a/b print(a) a=20 b=10 a=a//b print(a) a=20 b=10 a=a**b print(a) #logical operators #& | ! #and a=4#0100 b=2#0010 a = a & b print(a) a=10#1010 b=8#1000 a = a & b print(a) a=4 #0100 b=2 #0010 harish=a|b #0110--6 print(harish) #not....not available a=2 #0010 a!=3 #0011 print(a) #conditional operator a=5 a==5 #5==5 if (a==5): print("this is harish") a>5 #comparison greater than a<4 #comparison less than a<=5 #less than or equal to a>=10 # greater than or equal to a!=10 #not equal to #identify #is #is not #is if two values true then return True same object #is not if two value not True then return False same object x=["rose","lilli"] b=["rose","lilli"] a=x #print(a,x) #print(id(a),id(x)) #print(b,id(b)) print(x is a) #true print(x is b) #False print(x is not b)#True print(x is not a)#false """ #membership #in #not in x=["rose","lilli"] print("rose" in x) #if member exist ---true print("chicken" not in x ) #not exist ---true print("lilli" not in x ) #false

Saturday, April 3, 2021

Operations on numbers in python

dd=3
mm=4
yyyy=2021
print(dd,mm,yyyy,end="",sep="kfdjdskjgshgjhsfdjghdsjfg")
print("03-04-2021")
dd=3
mm=4
yyyy=2021
#print("dd-",dd,"mm-",mm,"yyyy-",yyyy,end="",sep="")
#print("03-04-2021")
#print("dd{}-mm-{}-yyyy-{}".format(mm,dd,yyyy))
#print("%d-%d-%d",dd,mm,yyyy)
#print(dd,mm,yyyy)
#boolean=2values
#True----->1
#False---->0
a=True
print(a)
a=False
print(a)
print(True)
print(False)
#operations on number
#+,_,/,%,**,<,>>=,<=,!,!=
#addition---'+'
a=1054545454545454545454421231545313248432132454
b=206545423132468484543545484843415454564545121324874987524154879848544564654564564654548798798
a=a+b
#print(a)
a=a+a+b+a+a+b+b+a+a+b+b+b+b+a+a+b+b+a+a+b+a+b+b+b
b=a+a+b+a+a+b+b+a+a+b+b+b+b+a+a+b+b+a+a+b+a+b+b+b
#print(a+b)
#subtraction ---'-'
a=20
b=10
c=a-b
print(c)
#multiplication---'*'
a=205454564545454545132132156456451234156456451545456456451341
b=10657484564354846454654845645467484546546546
c=454545454546545453423132545454545465456456454554
print(a*b*c)
print(a*b*c*a*b*c)
#BODMAS
#B-brackets
#O-of
#D-division
#M-multiplication
#A-addition
#s--substraction
print((5*4)+10)
#division---'/' a=10
b=2
#print(type(a),type(b))
c=a/b
print(c)
a=10
b=2
#print(type(a),type(b))
c=a/b
print(c)
#floor division
a=11
b=2
#print(type(a),type(b))
c=a//b
print(c)
a=115465454564564545454545454545
b=2
#print(type(a),type(b))
c=a//b
print(c)
#power **
print(2**5)
print((2**5)**2)
print(10**2)
""" print "jyothi laxmi" #2.0
#integer----int
#string-----str
#float------float
#char--------xxxxxx not available

Wednesday, March 24, 2021

python introduction day1

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> 5+10
15
>>> a=5
>>> print(a)
5
>>> print(type(a))

>>> b=10
>>> print(b)
10
>>> print(type(b))

>>> c=a+b
>>> print(c)
15
>>> print(type(c))

>>> a="saikumar"
>>> print(a)
saikumar
>>> print(type(a))

>>> print(id(a))
23484040
>>> print(id(a))
23484040
>>> print(id(b))
1656382704
>>> a=15
>>> a
15
>>> type(a)

>>> id(a)
1656382784
>>> a=20
>>> id(a)
1656382864
>>>

Tuesday, March 16, 2021

django day6 class html input

https://drive.google.com/file/d/1z8wgE8vx-OeX4j-0ii7LjAHMddpDKMNk/view?usp=sharing

Sunday, March 14, 2021

django day 5 view page logic

View.py ===================== from django.shortcuts import render from django.http import HttpResponse # Create your views here. def home(request): #1+2 #HttpResponse("

this is homepage

") #return HttpResponse("

this is test2 app homepage

") user="ranjith" context={'name':user} if user == "chandu": #context={'name':user} return render(request, "home.html", context) elif user == "ranjith": return render(request, "contact.html", {'price':1000}) else: return render(request, "home.html", context) def contact(request): return HttpResponse("

this is app contactpage

") contact.html =========================

HTML Table

Company Contact price
Alfreds Futterkiste Maria Anders {{price}}
Centro comercial Moctezuma Francisco Chang {{price}}
Ernst Handel Roland Mendel Austria
Island Trading Helen Bennett UK
Laughing Bacchus Winecellars Yoshi Tannamuri Canada
Magazzini Alimentari Riuniti Giovanni Rovelli Italy
urls.py =================================== from django.contrib import admin from django.urls import path,include from . import views urlpatterns = [ path('',views.home,name="home"), path('contact',views.contact,name="contact") ]

Monday, March 8, 2021

django day4 first app running

your app urls.py ===================== from django.contrib import admin from django.urls import path,include from . import views urlpatterns = [ path('',views.home,name="home"), path('contact',views.contact,name="contact") ] your app views.py ====================== from django.shortcuts import render from django.http import HttpResponse # Create your views here. def home(request): #1+2 #HttpResponse("

this is homepage

") #return HttpResponse("

this is test2 app homepage

") return render(request, "home.html", {'name': "the king"}) def contact(request): return HttpResponse("

this is app contactpage

") template--home.html ========================

this is templates page home page{{name}}

this is templates page home page{{name}}

this is templates page home page{{name}}

this is templates page home page{{name}}

this is templates page home page{{name}}

this is templates page home page{{name}}

project urls.py ============================= from django.contrib import admin from django.urls import path,include from . import views urlpatterns = [ path('',include('test2.urls')), path('admin/', admin.site.urls), ]

Sunday, March 7, 2021

django day3

#urls.py from django.contrib import admin from django.urls import path,include from . import views urlpatterns = [ path('',views.home,name="home"), path('contact',views.contact,name="contact"), path('aboutus',views.aboutus,name="aboutus"), path('admin/', admin.site.urls), ] #views.py from django.http import HttpResponse def home(request): #1+2 #HttpResponse("

this is homepage

") return HttpResponse("

this is firstpage

") def contact(request): return HttpResponse("

this is contactpage

") def aboutus(request): return HttpResponse("

about page

")

Friday, March 5, 2021

sep, end in print method in python

""" print(10,20,30,sep='@') print(10,20,end='') print(" ", 30) #print(input("enter number")) #print("you opened django server with IP:http://127.0.0.1:8000\n") def ranjith(): print("ranjith is basha") print("chandu is king") ranjith() def connect(): print("you opened django server with IP:http://127.0.0.1:8000\n") def disconnect(): print("it is disconnected") connect() while(1): print("basha") disconnect() i=0 if(i==0): print("rajinikanth") else: print("ramyakrishna") """

Friday, February 12, 2021

day 35 table widget and text widget

from tkinter import * import pymysql def create_table(): conn=pymysql.connect(host="localhost",user="root",password="",db="sslabs") mycursor=conn.cursor() print("inside create table") #mycursor.execute("CREATE TABLE hotel (id INT AUTO_INCREMENT PRIMARY KEY, dosa VARCHAR(255), add VARCHAR(255), idle VARCHAR(255) )") #sql = "INSERT INTO hotel (dosa, idle, add) VALUES (%s, %s, %s)" mycursor.execute("CREATE TABLE hotel (id INT AUTO_INCREMENT PRIMARY KEY, dosa VARCHAR(255),idle VARCHAR(255), sum VARCHAR(255))") #1234514532 #sub=e3.get() #val = (dosa1, idle1) #mycursor.execute(sql, val) conn.commit() print(mycursor.rowcount, "record inserted.") def display(): #create_table() conn=pymysql.connect(host="localhost",user="root",password="",db="sslabs") mycursor=conn.cursor() #print("First Name: %s\nstandard:%s\nsubject:%s" % (e1.get(),e2.get(),e3.get())) #query = "SELECT * FROM student" ## getting records from the table #mycursor.execute(query) ## fetching all records from the 'cursor' object #records = mycursor.fetchall() ## Showing the data #for record in records: #print(record) a=e1.get() a=int(a) print(type(a)) b=e2.get() b=int(b) print(type(b)) sql = "INSERT INTO hotel (dosa, idle,sum) VALUES (%s, %s,%s)" c=a+b #sub=e3.get() val = (a,b,c) mycursor.execute(sql, val) Label(praveen , text=a).grid(row=5) conn.commit() praveen=Tk() #root=Tk() praveen.geometry("500x300") #root.geometry("500x300") praveen.title("Hotel management") #root.title("Hostel management") Label(praveen, text="dosa").grid(row=0) Label(praveen , text="idle").grid(row=1) e1=Entry(praveen) name=e1.grid(row=0,column=1) #e3=Entry(root) #name=e3.grid(row=0,column=1) e2=Entry(praveen) standard = e2.grid(row=1,column=1) Button(praveen,text='Quit', command=praveen.quit).grid(row=2,column=0,sticky=W,pady=4) Button(praveen,text='display', command=display).grid(row=2,column=1,sticky=W,pady=4) #Button(praveen,text='Insert', command=create_table).grid(row=2,column=2,sticky=W,pady=4) mainloop() # -*- coding: utf-8 -*- """ Created on Thu Feb 11 22:45:50 2021 @author: Onyx1 """ from tkinter import * import pymysql root = Tk() # specify size of window. root.geometry("250x170") # Create text widget and specify size. T = Text(root, height = 5, width = 52) T.pack() # Create label l = Label(root, text = "Fact of the Day") l.config(font =("Courier", 14)) l.pack() Fact = """A man can be arrested in Italy for wearing a skirt in public.""" # Create button for next text. b1 = Button(root, text = "Next", ) b1.pack() # Create an Exit button. b2 = Button(root, text = "Exit", command = root.destroy) b2.pack() # Inserroot The Fact. #root.insert(root.END, Fact) root.mainloop()

day 36 menu bar using python

#from tkinter import Toplevel, Button, Tk, Menu ,Label from tkinter import * top = Tk() def display_text(): w = Label(top,text="Hello Tkinter") #new_win=Tk() #new_win.geometry("300*400") w.pack() menubar = Menu(top) file = Menu(menubar, tearoff=0) file.add_command(label="New",command=display_text) file.add_command(label="Open") file.add_command(label="Save") file.add_command(label="Save as...") file.add_separator() file.add_command(label="print") file.add_command(label="print preview") file.add_command(label="Close") file.add_command(label="Exit", command=top.quit) menubar.add_cascade(label="File", menu=file) edit = Menu(menubar, tearoff=0) edit.add_command(label="Undo") edit.add_command(label="Cut") edit.add_command(label="Copy") edit.add_command(label="Paste") edit.add_separator() edit.add_command(label="Delete") edit.add_command(label="Select All") menubar.add_cascade(label="Edit", menu=edit) help = Menu(menubar, tearoff=0) help.add_command(label="About") menubar.add_cascade(label="Help", menu=help) view = Menu(menubar, tearoff=0) view.add_command(label="View") menubar.add_cascade(label="View", menu=view) top.config(menu=menubar) top.mainloop()

Thursday, February 11, 2021

pandas table with dictionary

df = pd.DataFrame( { "Name": [ "Braund, Mr. Owen Harris", "Allen, Mr. William Henry", "Bonnell, Miss. Elizabeth", ], "Age": [22, 35, 58], "Sex": ["male", "male", "female"], } ) print(df) output: Name Age Sex 0 Braund, Mr. Owen Harris 22 male 1 Allen, Mr. William Henry 35 male 2 Bonnell, Miss. Elizabeth 58 female

pandas in python

Tuesday, February 9, 2021

python day 34 tkinter with mysql connection


from tkinter import*

import pymysql



def create_table():

    conn=pymysql.connect(host="localhost",user="root",password="",db="sslabs")

    mycursor=conn.cursor()

    mycursor.execute("CREATE TABLE hotel (id INT AUTO_INCREMENT PRIMARY KEY, dosa VARCHAR(255),idle VARCHAR(255))")

    sql = "INSERT INTO hotel (dosa, idle) VALUES (%s, %s)"

   

    #sub=e3.get()

    #val = (dosa1, idle1)

    #mycursor.execute(sql, val)

    conn.commit()

    print(mycursor.rowcount, "record inserted.")


def show_entry_fields():

    #create_table()

    conn=pymysql.connect(host="localhost",user="root",password="",db="sslabs")

    mycursor=conn.cursor()

    #print("First Name: %s\nstandard:%s\nsubject:%s" % (e1.get(),e2.get(),e3.get()))

    #query = "SELECT * FROM student"

    ## getting records from the table

    #mycursor.execute(query)

    ## fetching all records from the 'cursor' object

    #records = mycursor.fetchall()

    ## Showing the data

    #for record in records:

        #print(record)

    a=e1.get()

    print(a)

    b=e2.get()

    print(b)

    sql = "INSERT INTO hotel (dosa, idle) VALUES (%s, %s)"

   

    #sub=e3.get()

    val = (a, b)

    mycursor.execute(sql, val)

    

    conn.commit()

    

    


praveen=Tk()

praveen.geometry("500x300")

praveen.title("Hotel management")



Label(praveen, text="dosa").grid(row=0)

Label(praveen , text="idle").grid(row=1)



e1=Entry(praveen)

name=e1.grid(row=0,column=1)



e2=Entry(praveen)

standard = e2.grid(row=1,column=1)



Button(praveen,text='Quit', command=praveen.quit).grid(row=2,column=0,sticky=W,pady=4)

Button(praveen,text='Show', command=show_entry_fields).grid(row=2,column=1,sticky=W,pady=4)

#Button(praveen,text='Insert', command=create_table).grid(row=2,column=2,sticky=W,pady=4)



mainloop()

tab widget python tkinter

     



import tkinter as tk  

from tkinter import ttk 



root = tk.Tk() 

root.title("Tab Widget") 

tabControl = ttk.Notebook(root) 


tab1 = ttk.Frame(tabControl) 

tab2 = ttk.Frame(tabControl) 

tab3 = ttk.Frame(tabControl) 


tabControl.add(tab1, text ='Tab 1') 

tabControl.add(tab2, text ='Tab 2') 

tabControl.add(tab3, text ='Tab 3') 

tabControl.pack() 


ttk.Label(tab1,text ="evening class").grid(column = 0, 

row = 0, 

padx = 30, 

pady = 62) 

ttk.Label(tab2, 

text ="praveen is thopu").grid(column = 0, 

row = 0, 

padx = 30, 

pady = 100) 

                                 

ttk.Label(tab3, 

text ="chiranjivi is thopu").grid(column = 0, 

row = 0, 

padx = 30, 

pady = 100) 


root.mainloop() 


Friday, February 5, 2021

python day 31 tkinter entery widget

 


"""

from tkinter import *


root = Tk()

root.title("Basic Entry Widget")



lbl=Label(root, text="This is Label widget", fg='red', font=("Helvetica", 16))

lbl.place(x=60, y=50)

ent = Entry(root)#same like input

ent.pack()#particular window



ent1 = Entry(root)#same like input

ent1.pack()#particular window


ent2 = Entry(root)#same like input

ent2.pack()#particular window



def show_data():

    print(ent.get())

    print(ent1.get())

    print(ent2.get())

    

    

Button(root,text="Show ",command=show_data).pack()


root.mainloop()




#multiple windows


from tkinter import *

root = Tk()

root1 = Tk()


data = "Hotel Management"


w = Label(root1,fg='white', bg='green',text=data,font=("Helvetica", 30))

w.pack()



root.mainloop()



from tkinter import *

root = Tk()



data = "Hotel Management"


w = Label(root,fg='RED', bg='green',text="Hotel Management",font=("calibri", 30))

w.pack()



root.mainloop()

"""






from tkinter import *

root = Tk()

root.title("Radio Button")


Label(root,text="Select True or False",justify=LEFT).pack()



data = BooleanVar()


def data_print():

    print(data.get())


true_button = Radiobutton(root,

                          text = "Ture",

                          variable=data,

                          value= True,

                          padx=20,

                          pady=5,

                          command = data_print

                          )


false_button = Radiobutton(root,

                           text = "False",

                           variable=data,

                           value= False,

                           padx=20,

                           pady=5,

                           command = data_print

                          )

true_button.pack()

false_button.pack()


root.mainloop()


























Wednesday, February 3, 2021

python day 31 tkinter button with command function

 import tkinter

from tkinter import *


def display():

    print("this is praveen")

    print("this is working")

    

def calculate():

    print(5*10)


main_windows=tkinter.Tk()

main_windows.geometry("800x500")

main_windows.title("Hotel management")


name_Label=Label(main_windows , text="Hotel Management", font=("arial", 40))

name_Label.place(x=500,y=10)


btn=Button(main_windows, text="Display", fg='red', command=display)

btn.place(x=20, y=20)



btn=Button(main_windows, text="calculate", fg='red', command=calculate)

btn.place(x=80, y=20)

main_windows.mainloop()

Sunday, January 31, 2021

EC25 Quectel drivers | QUECOPEN

After doing different projects on different micro controller i started working with Quectel EC25 driver( 4g LTE) and mc60 and m66.

 EC25 Quectel Drivers Description:

Quectel EC25 is a series of LTE Cat 4 module optimized specially for M2M and IoT applications. Adopting the 3GPP Rel. 11 LTE technology, it delivers 150Mbps downlink and 50Mbps uplink data rates. Designed in the compact and unified form factor,EC25 is compatible with Quectel UMTS/HSPA+ UC20/UC200T modules and multi-mode LTE EC2x/EG25-G modules, whichallows for flexible migration among them in design and manufacturing.EC25 contains 12 variants: EC25-E, EC25-EU, EC25-EC, EC25-EUX, EC25-A, EC25-V, EC25-AF, EC25-MX, EC25-AU, EC25-AUT,EC25-AUTL and EC25-J.

This makes it backward-compatible with existing EDGE and GSM/GPRS networks, ensuring that it can be connected even in remote areas devoid of 4G or 3G coverage.
EC25 supports Qualcomm® IZat™ location technology Gen8C Lite (GPS, GLONASS, BeiDou, Galileo and QZSS). The integrated GNSS greatly simplifies product design, and provides quicker, more accurate and more dependable positioning.

A rich set of Internet protocols, industry-standard interfaces and abundant functionalities (USB serial drivers for Windows 7/8/8.1/10, Linux, Android/eCall*) extend the applicability of the module to a wide range of M2M and IoT applications such as industrial router, industrial PDA, rugged tablet PC, video surveillance, and digital signage.

EC25 ubuntu os link for virtual machine

download the above link 


EC25 Quectel driver


python day 29 tkinter class1

 # -*- coding: utf-8 -*-

"""

Created on Mon Feb  1 07:09:50 2021


@author: anil



import tkinter


window=tkinter.Tk()

window.geometry("1024x768")

window.mainloop()




import tkinter


window=tkinter.Tk()

window.geometry("1920x1080")

window.mainloop()


import tkinter

#from tkinter import *


window=tkinter.Tk()

window.geometry("1920x1080")

Button(window,text='Quit', command=master.quit)

window.mainloop()

"""



from tkinter import *

import pymysql



def create_table():

    conn=pymysql.connect(host="localhost",user="root",password="",db="sslabs")

    mycursor=conn.cursor()

    #mycursor.execute("CREATE TABLE student2 (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255),standard VARCHAR(255), sub VARCHAR(255) )")

    sql = "INSERT INTO student2 (name, standard,sub) VALUES (%s, %s,%s)"

 

    #print("First Name: %s\nstandard:%s\nsubject:%s" % (e1.get(),e2.get(),e3.get()))

    name=e1.get()

    standard=e2.get()

    sub=e3.get()

    val = (name, standard, sub)

    mycursor.execute(sql, val)

    conn.commit()

    print(mycursor.rowcount, "record inserted.")


def show_entry_fields():

    #print("First Name: %s\nstandard:%s\nsubject:%s" % (e1.get(),e2.get(),e3.get()))

    query = "SELECT * FROM student2"

    ## getting records from the table

    mycursor.execute(query)

    ## fetching all records from the 'cursor' object

    records = mycursor.fetchall()

    ## Showing the data

    for record in records:

        print(record)


master=Tk()

master.geometry("500x300")

master.title("Hotel management")



Label(master , text="dosa").grid(row=0)

Label(master , text="idle").grid(row=1)

Label(master , text="puri").grid(row=2)

Label(master , text="wada").grid(row=3)

Label(master , text="Bonda").grid(row=4)

Label(master , text="Upma").grid(row=5)


e1=Entry(master)

name=e1.grid(row=0,column=1)

e2=Entry(master)

standard = e2.grid(row=1,column=1)

e3=Entry(master)

sub = e3.grid(row=2,column=1)


Button(master,text='Quit', command=master.quit).grid(row=6,column=0,sticky=W,pady=4)

Button(master,text='Show', command=show_entry_fields).grid(row=7,column=1,sticky=W,pady=4)

Button(master,text='Insert', command=create_table).grid(row=8,column=2,sticky=W,pady=4)



mainloop()






python day 28 mysql with python crud operations

 # -*- coding: utf-8 -*-

"""

Created on Sun Jan 31 13:29:32 2021


@author:anil




#try fail condition

try:

   print("i am in try")

   

#error handling

except:

    print("i am in expect block")

   

    


#try fail condition

try:

   print(1/0)

   #failing condition

   

#error handling

except:

    print("i am in except block")



   

#try fail condition

try:

   #print("db conneted")

   print(1/0)

   #db connections

   #failing condition

   

#error handling

except ZeroDivisionError:

    print("this is name ZeroDivisionError: block")


try:

   #print("db conneted")

   print(1/1)

   #db connections

   #failing condition

   

#error handling

except ZeroDivisionError:

    print("this is name ZeroDivisionError: block")

else:

    print("nothing is wrong")

 

  

try:

   #print("db conneted")

    while(1):

        print(1/1)

   #db connections

   #failing condition

   

#error handling

except ZeroDivisionError:

    print("this is name ZeroDivisionError: block")

finally:

    print("finally class")


try:

   #print("db conneted")

   for i in range(10):

       print(1/1)

    

   print(1/0)

   #db connections

   #failing condition

   

#error handling

except ZeroDivisionError:

    print("this is name ZeroDivisionError: block")

finally:

    print("finally class")


    

    

try:

   f = open("mytesfd.txt",'r+b')

   f.write("this is testing")

except:

    raise Exception("sorry file is missing")

finally:

    f.close()

   


try:

   print("this is connected")


finally:

    print("file closed")


    

    

import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor()

ycursor.execute(CREATE TABLE fifth_class_a (id int primary key, name varchar(20),last_name varchar(20)))

mycursor.execute(CREATE TABLE fifth_class_b (id int primary key, name varchar(20)))

mycursor.execute(CREATE TABLE fifth_class_b (id int primary key, name varchar(20)))

conn.commit()

conn.close()


import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor()


mycursor.execute(CREATE TABLE fifth_class_d (id int primary key, name varchar(20),lastname varchar(20),student_id varchar(20)))

conn.commit()

conn.close()



import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor()

#mycursor.execute("INSERT INTO names(id,name) VALUES(1,'praveen');")

#a=mycursor.execute("INSERT INTO names(id,name) VALUES(4,'lavanya');")


#print("->data inserted")


 

mycursor.execute("UPDATE `names` SET `name` = 'lavanya2' WHERE `names`.`id` = 4;")


mycursor.execute("SELECT * FROM names")

row = mycursor.fetchone()

while row is not None:

    print(row)

    row = mycursor.fetchone()


conn.commit()

conn.close()


#CRUD

#C-create

#R-read

#U-update

#D-delete



#update the tables

import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor() 

mycursor.execute("UPDATE `names` SET `name` = 'laxmi' WHERE `names`.`id` = 4;")


conn.commit()

conn.close()




#delete operation

import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor() 

mycursor.execute("DELETE FROM `names`  WHERE `id` = 4;")


conn.commit()

conn.close()




import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor() 

#mycursor.execute("DELETE FROM `names`  WHERE `id` = 4;")

sql_select_Query = "select * from names"

mycursor.execute(sql_select_Query)

records = mycursor.fetchall()


for row in records:

        print("Id = ", row[0], )

        print("Name = ", row[1])

        

        

        

conn.commit()

conn.close()


"""


import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor() 

#mycursor.execute("DELETE FROM `names`  WHERE `id` = 4;")

sql_select_Query = "select * from names"

mycursor.execute(sql_select_Query)

records = mycursor.fetchall()


for row in records:

        print("Name = ", row[1])


conn.commit()

conn.close()





    

    


Thursday, January 28, 2021

python day26

 # -*- coding: utf-8 -*-

"""

Created on Thu Jan 28 21:45:09 2021

day 26

iterators 


@author: anil


flowers=("jasmin","marigold","lilli")

#print(type(flowers))


#iterators

#__iter__()

#iter()

#

'''

print(iter(flowers))

print(flowers[0])

print(flowers[1])

print(flowers[2])

'''


myiter=iter(flowers)

print(myiter)

"""


#flowers=("jasmin","marigold","lilli","malle","rose")

#print(type(flowers))


#iterators

#__iter__()

#iter()

#

'''

print(iter(flowers))

print(flowers[0])

print(flowers[1])

print(flowers[2])



myiter=iter(flowers)

#print(myiter)


print(next(myiter))

print(next(myiter))

print(next(myiter))

print(next(myiter))

print(next(myiter))





flowers=["jasmin","marigold","lilli","malle","rose"]

myiter=iter(flowers)

#print(myiter)


for i in range(5):

    print(next(myiter))



class numbers:

    def __iter__(self):

        self.a=1

        return self

    

    def __next__(self):

        x=self.a

        self.a=self.a+1

        return x

    


my_class=numbers()

myiter=iter(my_class)


print(next(myiter))

print(next(myiter))

print(next(myiter))

print(next(myiter))


#StopIteration(args)

'''



class numbers:

    def __iter__(self):

        self.a=1

        return self

    

    def __next__(self):

        if self.a<=30:

            x=self.a

            self.a=self.a+1

            return x

        else:

            raise StopIteration

    


my_class=numbers()

myiter=iter(my_class)



for i in range(30):

    print(next(myiter))



#StopIteration(args)

Friday, January 22, 2021

python day 25 docstring and variable, scope

 # -*- coding: utf-8 -*-

"""

Created on Sat Jan 23 06:45:14 2021

topic: classes doc string and variables



@author: anil



class father():

    '''This is the father class developed by praveen

    inside addition method is there

    inside sub method is there

    inside mul method is there

    inside div method is there

    '''

    def __init__(self):

        print("this is father class default constructor")

        help(type(self))

  

    

    

father()

print(father.__doc__)

help(father)


b=10


class father():

    '''This is the father class developed by praveen

    inside addition method is there

    inside sub method is there

    inside mul method is there

    inside div method is there

    '''

    global b

    

    def __init__(self):

        a = 10

        

        

        self.name="praveen"

        print(self.name)

        print(a)

        print(b)

    def display():

        

        print(b)

        


#father()

father.display()

#print(a)

"""

b=30

c=10


class father():

    

    global b

    

    def __init__(self):

        a = 10

        self.name="praveen"

        #print(self.name)

        #print(a)

        #print(b)

        b =20

        print(b)

        b=50


    def display():

       

        print(b,c)


father()

print("this is display method inside values")

father.display()

print("a",a)

#print(a)




python day 24 class super function 2

 # -*- coding: utf-8 -*-

"""

Created on Fri Jan 22 21:48:01 2021

day 24:classes


@author: anil durgam



class engine():

    def piston():

        print("piston")


class carbody(engine):

    engine.piston()

    def seats():

        print("seats")

        

       

carbody()





class engine():

    def __init__(self,name,lastname):

        self.name=name

        self.lastname=lastname

        #print(self.name)

        

    def piston(self):

        print(self.name,self.lastname)


class carbody(engine):

    def __init__(self):

        pass

    

    def seats(self):

        print("seats")

        

    

         

#carbody()

s=engine("raju","kumar")

s.piston()



class engine():

    def __init__(self,name,lastname):

        self.name=name

        self.lastname=lastname

        #print(self.name)

        

    def piston(self):

        print(self.name,self.lastname)


class carbody(engine):

    def __init__(self,name,lastname):

        engine.__init__(self,name,lastname)

       

    #def seats(self):

        #print(self.name,self.lastname)

        

    def seatbelt():

        print("This is seatbelt method")

               

class backseat():

    def backseats(self):

        print("back seat method is working")

        

    

         

x=carbody("honda","spender")

x.piston()

"""



class engine():

    def __init__(self,name,lastname):

        self.name=name

        self.lastname=lastname

        #print(self.name)

        

    def piston(self):

        print(self.name,self.lastname)


class carbody(engine):

    def __init__(self,name,lastname):

        super().__init__(name,lastname)

       

    #def seats(self):

        #print(self.name,self.lastname)

        

    def seatbelt():

        print("This is seatbelt method")

               

class backseat():

    def backseats(self):

        print("back seat method is working")

        

    

         

x=carbody("honda","spender")

x.piston()

Thursday, January 21, 2021

python day 23 topic classes with super function

 # -*- coding: utf-8 -*-

"""


 day 23:

topic : classes

@author: 



class employee():

    pass



employee()



class employee():

    #print("this is employee class")

    

    def __init__(self,s_no,name,sal):

        self.s_no = s_no

        self.name = name

        self.sal  = sal

        #print("inside constructor",a,b)

        

    def display(self):

        print("employee info ",self.s_no,self.name, self.sal )

        



s=employee(1,"venky",2000)

s.display()



class person():

    def __init__(self,name,):

        self.name=name

        

    def display(self):

        print("employee info ",self.name )

    

class employee(person):   

    

    def __init__(self,name):

        person.__init__(self,name)

        

    


a=employee("ram")

a.display()


"""


class person():

    def __init__(self,name,):

        self.name=name

        

    def display(self):

        print("employee info ",self.name )

    

class employee(person):   

    

    def __init__(self,name):

       super().__init__(name)

        

a=employee("ram")

a.display()


python day 22 topic classes

 # -*- coding: utf-8 -*-

"""

day 22: 

Topic : classes


@author: anil



class addition():

   def __init__(self,a,b):

       self.a=a

       self.b=b

       #print("self",self.a,self.b)

       

   def add(self):

       c= self.a + self.b

       print("self",self.a,self.b)

       return c

       

if __name__ == "__main__":

    

    a=addition(10,20)

    a.add()


class addition():

   def __init__(self,a,b):

       self.a=a

       self.b=b

       #print("self",self.a,self.b)

       

   def add(self):

       c= self.a + self.b

       print("self",self.a,self.b,c)

       return c

       

if __name__ == "__main__":

    

    a=addition(10,20)

    a.add()

    #print(addition(300,40))



class addition():

   def __init__(self,a,b):

       self.a=a

       self.b=b

       #print("self",self.a,self.b)

       

   def add(self):

       c= self.a + self.b

       print("self",self.a,self.b,c)

       return c

   

    

   def sub(self):

       c= self.a - self.b

       print("self",self.a,self.b,c)

       return c

       

if __name__ == "__main__":

    

    a=addition(10,20)

    a.sub()

    #print(addition(300,40))

  

class addition():

         

   def add(self):

      print("this is add method")

   

    

 

       

if __name__ == "__main__":

    

    a=addition()

    a.add()

    #print(addition(300,40))

   

class engine():

    #print("this is engine")

    def piston():

        print("piston")


class carbody():

    #print("this is carbody")

    def seats():

        print("seats")

         

      

    

engine.piston()

carbody.seats()

 

class engine():

    #print("this is engine")

    def piston():

        print("piston")


class carbody():

    #print("this is carbody")

    def seats():

        print("seats")

        

    engine.piston()

         

carbody.seats()

""" 

class engine():

    def __init__(self):

        print("this is engine")

    def piston():

        print("piston")


class carbody(engine):

    print("this is carbody")

    def seats():

        print("seats")

        

    

         

carbody()


Wednesday, January 20, 2021

python class 21 ...topic classes

 # -*- coding: utf-8 -*-

"""

python topic classes

@author: anil



from substraction import sub


def addition(a,b):

    return a+b


a=sub(10,5)

print(a)



class addition():

   def __init__(self):

       print("praveen is thopu")

    


addition()




class addition():

   def __init__(self):

       print("praveen is thopu")

       print("praveen is thopu")

       print("praveen is thopu")

       print("praveen is thopu")

       print("praveen is thopu")

       print("praveen is thopu")

       print("praveen is thopu")

    


addition()



class addition():

   def __init__(raju):

       print("praveen is thopu")

       print("praveen is thopu")

       print("praveen is thopu")

       print("praveen is thopu")

       print("praveen is thopu")

       print("praveen is thopu")

       print("praveen is thopu")

    


addition()


class addition():

   def __init__(self):

       a=10

       b=20

       c= a+b

       print(c)

    


addition(10,20)


class addition():

   def __init__(self):

       print("this is default constructor")

      

   def addition():

       #c= a+b

       #print(c)

       print("this is addition method")

       

   def sub():

       #c= a+b

       #print(c)

       print("this is sub method")

    


addition()

addition.addition()

addition.sub()

"""

class addition():

   def __init__(self):

       print("this is default constructor")

      

   def add(a,b):

       c= a+b

       print(c)

       #print("this is addition method")

       

   def sub(a,b):

       c= a-b

       print(c)

       #print("this is sub method")

    



addition.add(10,20)

#add(10,20)

python day 20 revision on all topics

 # -*- coding: utf-8 -*-

"""


 python day 20

@author: anil


for i in range(1,100,1):

     print(i)

     


fruits=["dragon","mango","apple"]

print(type(fruits))

print(fruits[0])

print(fruits[1])

print(fruits[2])




pra1={'key1':10,

      'key2':{'key3':23},

      

      }

print(type(pra1))

print(pra1['key2']['key3'])



def basha(a,b):

    #print("rajini is the boss",a+b)

    return a+b



if __name__ == "__main__":

    s=basha(3,4)

    print(s)


    s=basha(300,400)

    print(s)

    

"""

def basha(a,b,*s,**kw):

    return s


s=basha(4,5,7)

print(s)

    





     



python class topic video