Friday, December 4, 2020

python day5, comments,if else introduction

 #################################################

##########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")

Thursday, December 3, 2020

python day4,variable types,print formats

 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:
print
else:
print("no goa sorry")

else :
print("this is else loop")

print("second friend sit in home")


Multiple data bases support in SQLITE3

 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': '',
    }
}

Wednesday, November 18, 2020

password checking code in python and django

 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")

MM32F003TW SWDIO as GPIO working code

 

MM32F003TW SWDIO as GPIO working code

please download  by clicking below link


Download

MM32F003TW with PWM working code

 

please click below to download the code.

in this PWM technique used to reduce the LED brighness


Download

Tuesday, November 3, 2020

RFM98w with arudino libraries

 

please click below link to download the file

click here

https://drive.google.com/file/d/19DJQqx37YO6oVXPzKPpfdEzZ7Q1Vk0ij/view?usp=sharing

Wednesday, October 28, 2020

import * working method

 

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

 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

 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

 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'))





python class topic video