ADC value
embedded system,Arduino,Raspberry pi,ARM7,MM32,STM32,PIC and Python,Django,Datascience and web development
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 28 07:41:21 2020
day 19
topic : class
@author: anil durgam
class praveen():
pass
praveen()
class praveen():
print("praveen rocks!!!")
p=praveen()
print(p)
class praveen():
print("praveen rocks!!!")
print("praveen rocks!!!")
print("praveen rocks!!!")
print("praveen rocks!!!")
print("praveen rocks!!!")
print("praveen rocks!!!")
print("praveen rocks!!!")
p=praveen()
print(p)
class praveen():
x=10
print(x)
p=praveen()
print(p)
class praveen():
x=10
#print(x)
p=praveen()
#print("printx ",p.x)
a=p.x
print("a",id(a))
z=praveen()
b=z.x
print("b=:",id(b))
class praveen():
x=10
#print(x)
p=praveen()
print("printx ",p.x)
p.x=20
print("printx ",p.x)
class praveen():
x=10
#print(x)
p=praveen()
print("printx ",p.x)
p.x=20
print("printx ",p.x)
p.x=500
print("printx ",p.x)
class student():
name="rakesh"
lastname="daggubati"
a=10
b=20
c=30
p=student()
print(p.name)
print(p.lastname)
print(p.a)
print(p.b)
print(p.c)
class student():
name="rakesh"
lastname="daggubati"
a=10
b=20
c=30
p=student()
print(id(p))
print(id(p.name))
print(id(p.lastname))
print(id(p.a))
print(id(p.b))
print(id(p.c))
class student():
name="rakesh"
lastname="daggubati"
a=10
b=20
c=30
p=student()
print(type(p.name))
print(type(p.a))
class student():
name="rakesh"
lastname="daggubati"
a=10
b=20
c=30
student()
print(student.a)
"""
class student():
def __init__(self):
name="rakesh"
print(name)
student()
print(student)
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 26 07:42:27 2020
topic: files
@author: anil
f = open("file1.txt")
print(f)
f = open("file1.txt")
print(type(f))
f = open("day_17.py",'r')
print(f.read())
import os
f = open("day_17.py",'r')
print(f.read())
f = open("file1.txt", "r")
print(f.read(15))
f = open("file1.txt", "r")
print(f.readline())
f.close()
f = open("file1.txt", "r")
print(f.readline())
f.close()
f = open("file1.txt", "r")
print(f.read())
f = open("file1.txt", "a")
f.write("\nPraveen is thopu!!!!")
f = open("file1.txt", "r")
print(f.read())
f.close()
f = open("file1.txt", "r")
print(f.read())
f = open("file1.txt", "a")
f.write("\nPraveen is thopu!!!!")
f = open("file1.txt", "r")
print(f.read())
f = open("file5.txt", "a")
f.write("\nPraveen is thurum!!!!")
f = open("file5.txt", "a")
f.write("\nPraveen is thopu!!!!")
f = open("file5.txt", "r")
print(f.read())
f.close()
import os
os.remove("file5.txt")
"""
import os
file = "a.mp3"
os.system(file)
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 24 07:39:48 2020
day:17
topic: lambda
@author: anil
def x_fn(a):
print(a+10)
x_fn(25)
x = lambda a : a + 10
print(x(25))
lambda a : a + 10
a=lambda a : 5 + 10
print(a(5))
a=lambda a : a + 10
print(a(5))
a=lambda a : a + 10
print(a(5))
a=lambda a,b : a * b
print(a(5,6))
a=lambda a,b,c : (a * b)+c
print(a(5,6,7))
a=lambda a,b,c : (a * b * c)
print(a(5,6,7))
a=lambda a,b,c,d,e,f,g : a * b * c+d-e/f%g
print(a(5,6,7,5,5,5,5))
a=lambda a,b,c,d,e,f,g : a * b * c+d-e/f%g
print(a(5,6,7))
cars = ["Ford", "Volvo", "BMW"]
print(cars)
print(type(cars))
fruits = ['apple', 'banana', 'cherry']
x = fruits.index("cherry")
print(x)
x = fruits.index("banana")
print(x)
#pass by value
#pass by reference
def BMW_function(a):
print(a)
b=(15*120)
BMW_function(b)
def BMW_function(a):
print(a)
b=10
BMW_function(15*150)
BMW_function(15*150)
BMW_function(15*120)
BMW_function(15*120)
BMW_function(15*120)
BMW_function(15*120)
BMW_function(15*120)
def BMW_function(a):
print(a)
b=10*17*16*6237*73246*167*5454*12
BMW_function(b)
BMW_function(b)
BMW_function(b)
BMW_function(b)
BMW_function(b)
BMW_function(b)
BMW_function(b)
def BMW_function(a):
print("a:",a)
print(a)
if __name__ == '__main__' :
b=10
BMW_function(b)
print(b)
global a
def brother_function(b):
print("a:",a)
def small_brother_function(c):
print("a:",a)
def sister_function(d):
print("a:",a)
if __name__ == '__main__' :
a=10
sister_function(a)
small_brother_function(a)
brother_function(a)
print(a)
"""
global a
def brother_function(b):
print("a:",a)
def small_brother_function(c):
print("a:",a)
def sister_function(d):
print("a:",a)
if __name__ == '__main__' :
a=10
sister_function(a)
small_brother_function(a)
brother_function(a)
print(a)
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 23 07:27:55 2020
day :16
session: functions continue
@author:anil
def father(a):
print("father",a)
def son(a):
b=20
print("son",a,b)
son(a)
#father(b)
father(10)
def father(a):
print("father",a)
def son(a):
b=20
print("son",a,b)
return b
c=son(a)
print("father",c)
#father(b)
return c
a=father(10)
print(type(a),a)
def father(a):
print("father",a)
def son(b):
b=30
print("son",b)
return b
c=son(a)
father.son(20)
def father(a):
print("father",a)
def son(b):
b=30
print("son",b)
return b
c=son(a)
father(3)
def square_root():
print("square root")
def triangle(a):
side_of_triangle= a
def perimeter(side_of_triangle):
perimiter_value=3*side_of_triangle
print("perimeter:",perimiter_value)
def semi_perimeter(side_of_triangle):
semi_peri_value=((3*side_of_triangle))/2
print("semiperimeter:",semi_peri_value)
perimeter(a)
semi_perimeter(a)
triangle(30)
square_root()
"""
def square_root(a):
#num1,num2=equal
#number1 *number2= given value
i=1
num1=i
num2=a
j=1
print(j)
for j in range(i):
j=j+1
print(j)
rem=num2/j
i=i+1
print(i)
if num1==rem:
print("square root",num1)
else:
print("not given")
square_root(100)
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 22 07:28:09 2020
day 15
topic: functions continue 3
@author: anil
def my_funtion(a):
print("inside my function",a)
return "kasjfdklfhasjfhdjakfhjdsfhjakfhjhfjkdsahfjdahdsfjhfdsjhfjkadshfhsafjkhsdf"
a=my_funtion(5)
b='c'
print(type(b))
print("this is my main functions:",a,b)
def my_funtion(a):
print("inside my function",a)
return "bahubali"
a=my_funtion(5)
print(type(a))
b='c'
print(type(b))
print("this is my main functions:",a,b)
def my_funtion(a):
print("inside my function",a)
return a
a=my_funtion(5)
print(type(a))
b='c'
print(type(b))
print("this is my main functions:",a,b)
def my_funtion(*a):
print("inside my function",a)
return a
a=my_funtion(5)
print("this is my main functions:",a)
def my_funtion(*a):
print("inside my function",a)
return "bahubali",a,"praveen",a,a,a,a,a,a,a
a=my_funtion(5)
print("this is my main functions:",a)
def my_funtion(*a):
print("inside my function",a)
return ("bahubali",a,"praveen",a,a,a,a,a,a,a)
a=my_funtion(5)
print("this is my main functions:",a)
def my_funtion(*a):
print("inside my function",a)
return ["bahubali",a,"praveen",a,a,a,a,a,a,a]
a=my_funtion(5)
print(type(a))
print("this is my main functions:",a)
def my_funtion(*a):
print("inside my function",a)
return {"bahubali",a,"praveen",a,a,a,a,a,a,a}
a=my_funtion(5)
print(type(a))
print("this is my main functions:",a)
def my_funtion(**a):
print(type(a))
print("inside my function",a)
return a
a=my_funtion(a=5,b=3,c=4)
print(type(a))
print("this is my main functions:",a)
def my_funtion(d,**a):
print(type(a))
print("inside my function",a,d)
return a
d="king"
a=my_funtion(d,a=5,b=3,c=4)
print(type(a))
print("this is my main functions:",a)
def my_funtion(a,b,c,*d,**f):
print(type(a))
print(type(b))
print(type(c))
print(type(d))
print(type(f))
print("inside my function",a,d)
return a
d="king"
a=my_funtion(2,3,5,d,x=5,y=3,z=4)
c=5
f=0
g=c/f
print(g)
print(type(a))
print("this is my main functions:",a)
def my_funtion(a,b,c,*d,**f):
print("inside my function",a,b,c,d,f)
return a
d="king"
z,x,y=0,1,2
a=my_funtion(2,3,5,d,z=4,x=5,y=3)
print("this is my main functions:",d,z,x,y)
def my_funtion(a,b,c,*d,**f):
print("inside my function",a,b,c,d,f)
return a,b,c,d,f
d="king"
z,x,y=0,1,2
a=my_funtion(2,3,5,d,z=4,x=5,y=3)
print(type(a))
print("this is my main functions:",a[4]['z'])
"""
def outer_funtion():
a=10
print("outer function",a)
def inner_funtion(a,*args):
print("inner function",a+args[0])
inner_funtion(56000000,a)
outer_funtion()
# -*- coding: utf-8 -*-
"""
day 14
topic: functions continue
def function_sec():
print("secundrabad")
def function_erragadda():
print("function_erragadda")
def function_kukatpally():
print("function_kukatpally")
if __name__ == "__main__":
function_sec()
function_kukatpally()
function_erragadda()
function_kukatpally()
function_erragadda()
function_sec()
def funtion_one(i=5):
print("addition:",i+6)
if __name__ == "__main__":
funtion_one(11)
def funtion_one():
print(args)
print(type(args))
i=args[0]
j=args[1]
k=args[2]
l=args[3]
m=args[4]
print("addition:",i+j+k+l+m)
if __name__ == "__main__":
my_list =[2,3,4,5,6]
print(my_list)
funtion_one(my_list)
# passing list
def funtion_one(my_list):
'''print(args)
print(type(args))
i=args[0]
j=args[1]
k=args[2]
l=args[3]
m=args[4]
print("addition:",i+j+k+l+m)'''
for i in range(5):
print(my_list[i])
if __name__ == "__main__":
my_list =[2,3,4,5,6]
#print(my_list)
funtion_one(my_list)
def funtion_one(my_list):
'''print(args)
print(type(args))
i=args[0]
j=args[1]
k=args[2]
l=args[3]
m=args[4]
print("addition:",i+j+k+l+m)'''
print(my_list)
print(type(my_list))
if __name__ == "__main__":
my_list ={2,3,4,5,6}
print(type(my_list))
#print(my_list)
funtion_one(my_list)
def function_math(a,b):
print(a**2+2*a*b+b**2)
if __name__ == "__main__":
a=4
b=3
function_math(a,b)
from my_math_function import a_square_b_square_two_a_b
if __name__ == "__main__":
a=4
b=3
a_square_b_square_two_a_b(a,b)
def function_kodi():
print("this is kodi mundu function")
def function_guddu():
print("This is guddu mundu function")
function_kodi()
if __name__ == "__main__":
function_kodi()
def factorial(x):
'''This is a recursive function
to find the factorial of an integer'''
if x == 1:
return 1
else:
return (x * factorial(x-1))
if __name__ == "__main__":
num = 10
print("The factorial of", num, "is", factorial(num))
def functions_n_arguments(*myargs):
print(myargs)
if __name__ == "__main__":
num = 10
functions_n_arguments(num,112,22,2,2,2,2,2)
"""
def functions_n_arguments(**kwargs):
print(kwargs)
print(type(kwargs))
if __name__ == "__main__":
num = 10
functions_n_arguments(num=10,i=11)
'''
day 13
topic: functions
syntax:
def funtion_name():
statements
def addition():
pass
addition()
def addition():
print("this is basha")
for i in range(100):
addition()
print(i)
def addition():
print("this is basha")
while(1):
addition()
def addition():
print("addition")
print("addition")
print("addition")
print("addition")
print("addition")
addition()
def addition():
for i in range(100):
print("addition",i)
addition()
def addition():
while(1):
print("addition")
addition()
def addition(i,j):
print("addition",i+j)
print("addition",i-j)
print("addition",i*j)
i,j=3,4
addition(i,j)
def addition(j=6,i=5):
print(i)
print("addition",i+j)
print("addition",i-j)
print("addition",i*j)
addition(6,)
'''
def power_fn(x):
result=x*x
#print(result)
return result
a=1
a=power_fn(2)
print(a)
'''day12
topic: set
s1={1,2,3}
print(s1)
print(type(s1))
s1={"apple","banana","oranges"}
print(s1)
print(type(s1))
s1={"apple",1,True,"banana",3,"angira",2}
print(s1)
print(type(s1))
a =True
print(True+True)
print(False+False)
print(True+False)
b1={"vodka","zen","wine"}
print(b1)
b1.add("rum")
print(b1)
b1.add("kf")
print(b1)
b1={"vodka","zen","wine"}
print(b1)
b1.clear()
print(b1)
b1={"vodka","zen","wine"}
print(b1)
b2=b1.copy()
print(b2)
b3=b2.copy()
print(b3)
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
z = x.difference(y)
k = y.difference(x)
print(z)
print(k)
x = {"apple", "banana", "cherry"}
print(x)
y = {"google", "microsoft", "apple"}
x.difference_update(y)
print(x)
fruits = {"apple", "banana", "cherry"}
print(fruits)
fruits.discard("banana")
print(fruits)
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
z = x.intersection(y)
print(z)
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
x.intersection_update(y)
print(x)
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "facebook"}
z = x.isdisjoint(y)
print(z)
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
z = x.isdisjoint(y)
print(z)
x = {"a", "b", "c"}
y = {"f", "e", "d", "c", "b", "a"}
z = x.issubset(y)
print(z)
x = {"f", "e", "d", "c", "b", "a"}
y = {"a", "b", "c"}
z = x.issuperset(y)
print(z)
fruits = {"apple", "banana", "cherry"}
fruits.pop()
print(fruits)
fruits = {"apple", "banana", "cherry"}
fruits.remove("banana")
print(fruits)
x = {"apple", "banana", "cherry","panda"}
y = {"google", "microsoft", "apple","panda"}
z = x.symmetric_difference(y)
print(z)
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
x.symmetric_difference_update(y)
print(x)
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
z = x.union(y)
print(z)
'''
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
x.update(y)
print(x)
'''day11
concept : dictionary
#empty dictionary
d1={}
print(type(d1))
d1={
"key":1,
"key2":2
}
print(d1)
d1={
"key":1,
"key2":2
}
print(d1["key"])
d1={
"key":1,
"key2":2
}
print(d1["key"],d1["key2"])
d1={
"key":1,
"key2":2
}
print(d1["key"])
d2={
"flowers":"rose","flowers1":"rose","flowers2":"rose","flowers3":"rose","flowers4":"rose",
}
print(d2["flowers"])
print(d2["flowers1"])
print(d2["flowers2"])
print(d2["flowers4"])
print(d2["flowers3"])
d2={
"flowers":"rose","flowers":"rose","flowers":"rose","flowers":"rose","flowers":"rose",
}
print(d2["flowers"])
print(d2["flowers"])
print(d2["flowers"])
print(d2["flowers"])
print(d2["flowers"])
d2={
"flowers":"rose",
"flowers":"jasmin",
"flowers":"lilli",
"flowers":"chilli",
"flowers":"lolli",
}
print(d2["flowers"])
print(d2["flowers"])
print(d2["flowers"])
print(d2["flowers"])
print(d2["flowers"])
#nested dictionary
d2={
"flowers":{"fl":"chamanthi"},
"flowers1":"jasmin",
"flowers2":"lilli",
"flowers3":"chilli",
"flowers4":"lolli",
}
print(d2["flowers"]["fl"])
print(d2["flowers1"])
print(d2["flowers2"])
print(d2["flowers3"])
print(d2["flowers4"])
#nested dictionary
d2={
"flowers":{"fl":"chamanthi"},
"flowers1":{"fl":"chamanthi"},
"flowers2":{"fl":"chamanthi"},
"flowers3":{"fl":"chamanthi"},
"flowers4":{"fl":"chamanthi"},
}
print(d2["flowers"]["fl"])
print(d2["flowers1"]["fl"])
print(d2["flowers2"]["fl"])
print(d2["flowers3"]["fl"])
print(d2["flowers4"]["fl"])
d2={
"flowers":{"fl":"chamanthi"},
"flowers1":{"fl":"chamanthi1"},
"flowers2":{"fl":"chamanthi2"},
"flowers3":{"fl":"chamanthi3"},
"flowers4":{"fl":"chamanthi4"},
}
print(d2["flowers"]["fl"])
print(d2["flowers1"]["fl"])
print(d2["flowers2"]["fl"])
print(d2["flowers3"]["fl"])
print(d2["flowers4"]["fl"])
d2={
"flowers":{"fl":{"st1":"praveen"}},
"flowers1":{"fl":"chamanthi1"},
"flowers2":{"fl":"chamanthi2"},
"flowers3":{"fl":"chamanthi3"},
"flowers4":{"fl":"chamanthi4"},
}
print(d2["flowers"]["fl"]["st1"])
print(d2["flowers1"]["fl"])
print(d2["flowers2"]["fl"])
print(d2["flowers3"]["fl"])
print(d2["flowers4"]["fl"])
#list in dictionary
d2={
"flowers":[1,2,3],
"flowers1":{"fl":"chamanthi1"},
"flowers2":{"fl":"chamanthi2"},
"flowers3":{"fl":"chamanthi3"},
"flowers4":{"fl":"chamanthi4"},
}
print(d2["flowers"])
print(type(d2))
print(type(d2["flowers"]))
'''
#tuple in dictionary
d2={
"flowers":{"key3":3},
"flowers1":{"fl":"chamanthi1"},
}
print(d2["flowers"])
print(type(d2))
print(type(d2["flowers"]))
'''day10
tuples
example1:
colors=(1,2,3)
colors
colors=(255,255,255)
print(colors)
colors=(255,255,255)
print(colors[0:2])
colors=(255,255,255,255,244,23434,3435434,23423423)
type(colors)
print(colors[:])
colors=(255,255,255,255,244,23434,3435434,23423423)
type(colors)
print(colors[:5])
colors=(255,255,255,255,244,23434,3435434,23423423)
type(colors)
print(colors[1:5])
colors=(0,2,25,265,244,23434,3435434,23423423)
type(colors)
print(colors[1:5])
tuple1 = ("abc", 34, True, 40, "male")
tuple1 = ("abc", 34, True, 50, "male")
#it will have attributes llike insert, pop , remove
print(len(tuple1))
'''
tuple1 = ("abc", (1,2,2,2,2,2,22), True, 50, "male")
tuple2=tuple1
print(tuple1)
print(tuple2)
print(id(tuple1),id(tuple1))
number_of_stars=10
for i in range(5):
for j in range(number_of_stars):
if i<=j:
print("",end=' ')
for j in range(number_of_stars):
if i>=j:
print("*",end=' ')
print()
for i in range(number_of_stars):
for j in range(number_of_stars):
if i>=j:
print("",end=' ')
for j in range(number_of_stars):
if i<=j:
if i<=4:
print("*",end=' ')
print()
*
* *
* * *
* * * *
* * * * *
* * * * * * * * * *
* * * * * * * * *
* * * * * * * *
* * * * * * *
* * * * * *
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 08:25:54 2020
@author: Onyx1
"""
for i in range(5):
for j in range(5):
if i<=j:
print("",end=' ')
for j in range(5):
if i>=j:
print("*",end=' ')
print()
for i in range(5):
for j in range(5):
if i>=j:
print("",end=' ')
for j in range(5):
if i<=j:
print("*",end=' ')
print()
output:
*
* *
* * *
* * * *
* * * * *
* * * * *
* * * *
* * *
* *
*
'''
day 8 list ,tuples,
#example1:
fruits =[]
print(fruits)
print(type(fruits))
fruits =[1]
print(fruits)
print(type(fruits))
fruits =[1,2,3,3,3,3,3,3,3,3,3,3,3,3]
print(fruits)
print(type(fruits))
fruits =[1,2,3,4,5]
print(fruits[0])
print(fruits[1])
print(fruits[2])
print(fruits[3])
print(fruits[4])
print(type(fruits))
fruits =[1,2,3,4,5]
for i in range(5):
print(fruits[i])
print(type(fruits))
fruits =[1,2,3,4,5]
print(id(fruits[0]))
print(id(fruits[1]))
print(id(fruits[2]))
print(id(fruits[3]))
print(id(fruits[4]))
#print(id(fruits[0]))
fruits =[1,2,3,4,5]
print(fruits[-1])
print(fruits[-2])
print(fruits[-3])
print(fruits[-4])
print(fruits[-5])
fruits=["mango","apple","banana","grapes","orange"]
print(fruits[0])
print(fruits[1])
print(fruits[2])
print(fruits[3])
print(fruits[4])
print(type(fruits))
print(fruits[-1])
print(fruits[-2])
print(fruits[-3])
print(fruits[-4])
print(fruits[-5])
flowers=["rose","lotus","lilli","jasmine","chamanthi"]
print(flowers[0])
print(flowers[1])
print(flowers[2])
print(flowers[3])
print(flowers[4])
fruits=["rose","lotus","lilli","jasmine","chamanthi"]
print(fruits[0])
print(fruits[1])
print(fruits[2])
print(fruits[3])
print(fruits[4])
flowers=["rose","lotus","lilli","jasmine","chamanthi"]
flowers.append("mandara")
flowers.append("chitti gulabi")
print(flowers[0])
print(flowers[1])
print(flowers[2])
print(flowers[3])
print(flowers[4])
print(flowers[5])
print(flowers[6])
flowers=["rose","lotus","lilli","jasmine","chamanthi"]
flowers.insert(0,"gilledu")
print(flowers[0])
print(flowers[1])
print(flowers[2])
print(flowers[3])
print(flowers[4])
print(flowers[5])
flowers=["rose","lotus","lilli","jasmine","chamanthi"]
flowers.insert(3,"gilledu")
print(flowers[0])
print(flowers[1])
print(flowers[2])
print(flowers[3])
print(flowers[4])
print(flowers[5])
flowers=["rose","lotus","lilli","jasmine","chamanthi"]
flowers.remove("chamanthi")
print(flowers[0])
print(flowers[1])
print(flowers[2])
print(flowers[3])
flowers=["rose","lotus","lilli","jasmine","chamanthi"]
flowers.pop(2)
print(flowers[0])
print(flowers[1])
print(flowers[2])
print(flowers[3])
flowers=["rose","lotus","lilli","jasmine","chamanthi"]
flowers.sort()
print(flowers[0])
print(flowers[1])
print(flowers[2])
print(flowers[3])
flowers=["rose","lotus","lilli","jasmine","chamanthi"]
flowers.reverse()
print(flowers[0])
print(flowers[1])
print(flowers[2])
print(flowers[3])
print(flowers[4])
'''
'''
#day 7 for loops
syntax:while condition:
statements
syntax: for variable in range(start,stop,step):
for i in range(5):
print(i)
for i in range(5):
print("*")
for i in range(5):
print("praveen")
k=0
for i in range(5):
for j in range(5):
print("j=",j,end="-")
k=k+1
print("k:",k)
for i in range(5):
for j in range(5):
print("*")
for i in range(5):
for j in range(5):
if i==j:
print(i,j)
'''
for i in range(5):
for j in range(5):
#if i==j:
print("*",end=' ')
print()
i,j=4,6
'''
if i==5:
print("thi is if loop")
elif i==4 and j==5:
print(i,j)
elif i==4 or j==5:
print("elif two:",i,j)
else:
if i==4:
print("this is else loop")
else:
#print("this is else else loop")
if i==3:
print("this is else else if loop")
#break execution:
while(1):
print("this is sams")
break
while(1):
while(1):
print("this is sams")
break
print("this is nag")
break
#range(start,stop,step)
for i in range(-10,100,10):
print(i)
a=0
a=range(1,10,2)
print(a)
'''
#################################################
##########this is program developed by Mr. Praveen
######## developed on :05-12-2020
### this is the simple operators testing
###second time developed by Mr. Anil
########################
a=10
b=20
#c=0
'''
#comments
1.single line comments
#
2.multiline comments
your lines comes here
'''
'''
#addition
c=a+b
print(type(a),type(b),type(c))
print("type c after additon",c)
#substraction
c=a-b
print(c)
c=int(a/b)
print(type(a),type(b))
print("this is after division",type(c),c)
c=b//a
print("this is testing",c,type(c))
if a>=20 and a==20:#a=10<10 10<20
print("if",a)
else:
print("else",a)
'''
#input()======>takes the input user
'''
total_marks=int(input("please enter a number:"))
print(total_marks)
if total_marks >=75:
print("distinction")
'''
while a==10:
total_marks=int(input("please enter a number:"))
print(total_marks)
if total_marks >=75:
print("distinction")
print(a)
elif total_marks>50 and total_marks<75:
print("c grade")
else:
print("your not given any grade")
variable
=====================
1.a,b,c,d------allowed
2. total,subtotal,grandtotal-----allowed
3.total1,key1,key2354 -----allowed
4.grand_total,coaching_center, cinema_theatre,s_s_rajamouli,SSRajamouli,CinemaTheatre---allowed
5.ca$h---not allowed
6._mode---allowed
7._ab_abc_abcd---allowed
sep in print:
===============
print("this is praveen","this is testing",sep="------")
output:
this is praveen------this is testing
format in print
==================
print("My name is {firstname}, I'm {age}".format(firstname = "praveen", age = 36))
print("My name is {0}, I'm {1},totals {2}".format("praveen",36,24.56))
print("My name is {0}, I'm {1},totals {total}".format("praveen",36,total=24.56))
if and else:
========================
condition true if statements prints
condition false then else statement prints
a=0
if a==1:
print("we will go movies")
else :
print("indendation is also working fine")
print("second friend sit in home")
ex2:
a="test"
if a=="test":
print("this is if loop")
print("we will go movies")
print("we will go movies")
print("we will go movies")
else :
print("this is else loop")
print("second friend sit in home")
example3:
a=4
budget=1
alcohal=1
beach=2
if a==4:
if budget==1:
if alcohal==1:
print("we will drink")
if beach==1:
print("beach is empty")
else:
print("beach is very busy")
else:
else:
print("no goa sorry")
else :
print("this is else loop")
print("second friend sit in home")
DATABASES = {
'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(DIR, 'django.sqlite3'), 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', }, 'anil': { # this is our sample db, already created 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(DIR, 'anil_Sqlite.sqlite'), 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', } }
password_check1="Anil@123"
password_check2=[]
#i=password_check1.capitalize()
if len(password_check1)>=8:
if password_check1[0].isupper()==True:
if password_check1.isspace()==False:
lookingfor = "@"
for c in range(0, len(password_check1)):
if password_check1[c] == lookingfor:
pass
#print("given characteris there in",password_check1)
for word in password_check1.split():
if word.isdigit():
password_check2.append(int(word))
print(password_check2)
else:
print("no digits")
else:
print("dnot give spaces")
else :
print("first letter should be capital")
else :
print("password should be min 8 letter")
please click below to download the code.
in this PWM technique used to reduce the LED brighness
please click below link to download the file
https://drive.google.com/file/d/19DJQqx37YO6oVXPzKPpfdEzZ7Q1Vk0ij/view?usp=sharing
create a file on student.py
========================
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def anil_test(i):
print("this is working"+i)
create another file test.py
======================
#from student import anil_test,Person
from student import *
anil_test("anil")
p1 = Person("John", 36)
print(p1.name)
print(p1.age)
Django models test...
======================
.in models.py file
class student(models.Model):
student_sno = models.IntegerField();
student_name = models.CharField(max_length=256);
student_father_name= models.CharField(max_length=256);
class student_class(models.Model):
student = models.ForeignKey(student,on_delete=models.CASCADE)
python manage.py makemigrations your_app
python manage.py sqlmigrate your_app 0001
python manage.py migrate
python .\manage.py shell
in db shell
=====================
from chess2.models import student, student_class
Django html tags display:
========================
By writing html tags you can achieve the output
go into views.py file
def menu(request):
return HttpResponse("<h1>This is working menu</h1>");
django installation process:
=============================
pip install virtualenvwrapper-win
mkvirtualenv test
pip install django
django-admin --version
mkdir yourfolder
cd yourfolder
django-admin startproject yourprojectname
python manage.py runserver
to create virtual environment in vscode:
=======================================
workon "base"
python manage.py startapp yourapp
creating your app:
=======================
create urls.py in your app
urlpatterns=[
path('',views.home,name='home')
]
go into views.py
add :from django.http import HttpResponse
create a function home
def home(request):
return HttpResponse("we are into our own page");
go into urls project:
add below line
path('',include('yourapp.urls'))
AT commands
testing on ESP32-WROOM-32
ESP32-WROOM-32 PINOUT DIAGRAM
ESP32-WROOM-32 -
ESP32-WROOM-32 module soldered to the development board. Optionally
ESP32-WROOM-32D, ESP32-WROOM-32U or ESP32-SOLO-1 module may be soldered instead
of the ESP32-WROOM-32.
USB-UART
Bridge - A single chip USB-UART bridge provides up to
3 Mbps transfers rates.
BOOT button
- Download button: holding down the Boot button and pressing the EN button
initiates the firmware download mode. Then user can download firmware through
the serial port.
EN button
- Reset button: pressing this button resets the system.
Micro
USB Port - USB interface. It functions as the power
supply for the board and the communication interface between PC and the ESP
module.
TX0,
TX2 - transmit pin. GPIO pin
RX0,
RX2 - receive pin. GPIO pin
3V3
(or 3V or 3.3V) - power supply pin (3-3.6V).
GND -
ground pin.
EN -
Chip enable. Keep it on high (3.3V) for normal operation.
Vin -
External power supply 5VDC.
1. Uploading AT firmware/Firmware upgrade
CONNECTIONS :
·
Attach USB cable one side to ESP32-WROOM-32
·
Connect the another end PC/LAPTOP
Shown below
2. Using USB
to TTL converter for AT communication
ESP32-WROOM-32 firmware versions
ESP32-WROOM-32
AT Bin V1.1.1 2018.07.11
ESP32-WROOM-32
AT Bin V1.1 2018.06.13
ESP32-WROOM-32
AT Bin V1.0 2017.11.17
ESP32-WROOM-32
AT Bin V0.10 2017.06.14
1. Do wiring for uploading
AT firmware/firmware update.
2. Download Flash
Download Tools (ESP8266 & ESP32) from espressif.com.
The
ESP32 Flash Download Tool, just like the ESP8266 download tool, is the official
Espressif Download tool that runs on Windows platform. The tool can be used to
modify and generate init BINs, generate consolidated BIN files or program
multiple chips for production runs.
The
tool uses COM port to send BIN files from PC to the ESP32, which then flashes
the data to the primary flash chip.
The
ESP32 Flash Download Tool, just like the ESP8266 download tool, is the official
Espressif Download tool that runs on Windows platform. The tool can be used to
modify and generate init BINs, generate consolidated BIN files or program
multiple chips for production runs.
The tool uses COM port to send BIN files from PC to the ESP32, which then
flashes the data to the primary flash chip.
3. Download and unzip the
latest AT firmware for your module (Check which module you have, for example we
have ESP32-WROOM-32). We used this firmware here: ESP32-WROOM-32 AT Bin V1.1.1 2018.07.11
4. Go to the
folder ESP32-WROOM-32_AT_V1.1.1 and find file named download.config.
AT commands firmware
for memory locations
1. bootloader.bin:0x1000
2. at_customize.bin:0x20000
3. server_cert.bin:0x24000
4. server_key.bin:0x26000
5. server_ca.bin:0x28000
6. client_cert.bin:0x2a000
7. client_key.bin:0x2c000
8. client_ca.bin:0x2e000
9. phy_init_data.bin:0xf000
10. esp-at.bin:0x100000
11. partitions_at.bin:0x8000
Download tool
After flashing the
firmware
To communicate (use AT commands) with ESP32
development board you need USB to TTL converter.
For using this USB to UART Converter you need
a software tool. You can use different software tools: Terminal, USR-TCP232-Test V1.4, AiThinker_Serial_Tool_V1.2.3, coolterm, sscom3.2 , KiTTY, putty,tera term, Access port and so
on. We recommend you to use AiThinker_Serial_Tool_V1.2.3 or sscom3.2,
as you can save your AT commands and it's very easy to use.
Results