Please Subscribe My YouTube Channel

Showing posts with label Python program. Show all posts
Showing posts with label Python program. Show all posts

Tuesday, February 06, 2024

Reverse Number in Python with Slicing #Howto #Youtube #ITCIComputerHardo...

Reverse Number in Python

Wednesday, November 01, 2023

How To Create A Text Editor Such as Notepad with Python

How To Create A Text Editor Such as Notepad with Python

import tkinter

import os

from tkinter import *

from tkinter.messagebox import *

from tkinter.filedialog import *         




class Notepad:

    __root = Tk()


    # default window width and height

    __thisWidth = 500

    __thisHeight = 500

    __thisTextArea = Text(__root)

    __thisMenuBar = Menu(__root)

    __thisFileMenu = Menu(__thisMenuBar, tearoff=0)

    __thisEditMenu = Menu(__thisMenuBar, tearoff=0)

    __thisHelpMenu = Menu(__thisMenuBar, tearoff=0)


    # To add scrollbar

    __thisScrollBar = Scrollbar(__thisTextArea)

    __file = None


    def __init__(self, **kwargs):


        # Set icon

        try:

            self.__root.wm_iconbitmap("Notepad.ico")

        except:

            pass


        # Set window size (the default is 300x300)


        try:

            self.__thisWidth = kwargs['width']

        except KeyError:

            pass


        try:

            self.__thisHeight = kwargs['height']

        except KeyError:

            pass


        # Set the window text

        self.__root.title("Untitled - Notepad")


        # Center the window

        screenWidth = self.__root.winfo_screenwidth()

        screenHeight = self.__root.winfo_screenheight()


        # For left-alling

        left = (screenWidth / 2) - (self.__thisWidth / 2)


        # For right-allign

        top = (screenHeight / 2) - (self.__thisHeight / 2)


        # For top and bottom

        self.__root.geometry('%dx%d+%d+%d' % (self.__thisWidth,

                                              self.__thisHeight,

                                              left, top))


        # To make the textarea auto resizable

        self.__root.grid_rowconfigure(0, weight=1)

        self.__root.grid_columnconfigure(0, weight=1)


        # Add controls (widget)

        self.__thisTextArea.grid(sticky=N + E + S + W)


        # To open new file

        self.__thisFileMenu.add_command(label="New",

                                        command=self.__newFile)


        # To open a already existing file

        self.__thisFileMenu.add_command(label="Open",

                                        command=self.__openFile)


        # To save current file

        self.__thisFileMenu.add_command(label="Save",

                                        command=self.__saveFile)


        # To create a line in the dialog

        self.__thisFileMenu.add_separator()

        self.__thisFileMenu.add_command(label="Exit",

                                        command=self.__quitApplication)

        self.__thisMenuBar.add_cascade(label="File",

                                       menu=self.__thisFileMenu)


        # To give a feature of cut

        self.__thisEditMenu.add_command(label="Cut",

                                        command=self.__cut)


        # to give a feature of copy

        self.__thisEditMenu.add_command(label="Copy",

                                        command=self.__copy)


        # To give a feature of paste

        self.__thisEditMenu.add_command(label="Paste",

                                        command=self.__paste)


        # To give a feature of editing

        self.__thisMenuBar.add_cascade(label="Edit",

                                       menu=self.__thisEditMenu)


        # To create a feature of description of the notepad

        self.__thisHelpMenu.add_command(label="About Notepad",

                                        command=self.__showAbout)

        self.__thisMenuBar.add_cascade(label="Help",

                                       menu=self.__thisHelpMenu)


        self.__root.config(menu=self.__thisMenuBar)


        self.__thisScrollBar.pack(side=RIGHT, fill=Y)


        # Scrollbar will adjust automatically according to the content

        self.__thisScrollBar.config(command=self.__thisTextArea.yview)

        self.__thisTextArea.config(yscrollcommand=self.__thisScrollBar.set)


    def __quitApplication(self):

        self.__root.destroy()

        # exit()


    def __showAbout(self):

        showinfo("Notepad", "This is a simple Notepad editor created with Python with Tkinter. This editor can create new file, edit file ,cut,copy and paste features will be available ")


    def __openFile(self):


        self.__file = askopenfilename(defaultextension=".txt",

                                      filetypes=[("All Files", "*.*"),

                                                 ("Text Documents", "*.txt")])


        if self.__file == "":


            # no file to open

            self.__file = None

        else:


            # Try to open the file

            # set the window title

            self.__root.title(os.path.basename(self.__file) + " - Notepad")

            self.__thisTextArea.delete(1.0, END)


            file = open(self.__file, "r")


            self.__thisTextArea.insert(1.0, file.read())


            file.close()


    def __newFile(self):

        self.__root.title("Untitled - Notepad")

        self.__file = None

        self.__thisTextArea.delete(1.0, END)


    def __saveFile(self):


        if self.__file == None:

            # Save as new file

            self.__file = asksaveasfilename(initialfile='Untitled.txt',

                                            defaultextension=".txt",

                                            filetypes=[("All Files", "*.*"),

                                                       ("Text Documents", "*.txt")])


            if self.__file == "":

                self.__file = None

            else:


                # Try to save the file

                file = open(self.__file, "w")

                file.write(self.__thisTextArea.get(1.0, END))

                file.close()


                # Change the window title

                self.__root.title(os.path.basename(self.__file) + " - Notepad")



        else:

            file = open(self.__file, "w")

            file.write(self.__thisTextArea.get(1.0, END))

            file.close()


    def __cut(self):

        self.__thisTextArea.event_generate("<<Cut>>")


    def __copy(self):

        self.__thisTextArea.event_generate("<<Copy>>")


    def __paste(self):

        self.__thisTextArea.event_generate("<<Paste>>")


    def run(self):


        # Run main application

        self.__root.mainloop()


notepad = Notepad(width=800,height=500)

notepad.run()

Saturday, April 22, 2023

Calculation in Python (Add, Sub, Multi, Division, Square, and Module) IT...

Python Program No 1:-  
Calculation in Python(Add, Sub, Multi, Division, Square, & Module)





Thursday, March 16, 2023

Python Program : List Method

Python Program : List Method

#list is a collection of diffrent types of data.
#enclosed with square brackets
#list elements seperated by comma
#It may be empty
#for creating a list we use list construtor or method
#list is mutable or changable (we can change / add/ remove / access list items)


# create an empty list
list1= []
print(list1)

#list with mixed data types
#with int string and float, tuple, list and set value.      

list2 = [1, "Hello", 3.4, (1,2,4), [1,3,4], {1,2,3}] 
print(list2)

#creating list with list constructor
tl= list(("apple", "banana", "cat"))
print(tl) #['apple', 'banana', 'cat']

#Acess list items
plang = ["Python", "Swift", "C++","Kotlin","C","C#"]

# access item at index 0
print(plang[0])# result:- Python

# access item at index 2
print(plang[2])   # C++
# access item at index 5
print(plang[5])   # C#

# access item at negative index -1
print(plang[-1])   # C#
# access item at negative index -2
print(plang[-2])   # C#

#access nested list element
list1=[5,3.2,'ram',6,8,9,[8,5,6]]

print(list1[6][1]) #5

#List slicing in Python

my_list = ['I','T','C','I',' ','H','A','R','D','O','I']

#items from index 2 to index 4
print(my_list[0:4]) #result- ['I','T','C','I']

# items from index 5 to end
print(my_list[5:]) #result:- ['H','A','R','D','O','I']
# result items beginning to end
print(my_list)
print(my_list[:])
print(my_list[:11])
print(my_list[-11:])


# Add element using append method in list
numbers= [21, 34, 54, 12]
print("Before Append:", numbers)
# after using append method
numbers.append(32) #it takes exactly one argument in one time
print("After Append:", numbers)

#with extend method you can add a list element in another list (join two lists)
#using extend method here you can also add any iterable object (tuples, sets, dictionaries etc.).
num1 = [2, 3, 5]
print("List1:", num1)
num2 = [4, 6, 8]
print("List2:", num2)
num2.extend(num1)
print("List after extend:", num2)

#or
fr_list = ["apple", "banana", "cherry"]
other_list = list(fr_list)
print(other_list)

#or using + concatenate operator
list1 = ["a", "b", "c"]
list2 = [1, 2, 3]
list3 = list1 + list2
print(list3)

#Creating nested list
list1 = [1, 2, 3, 4, 5]
print(list1)
list2 = [12, 13, 23]
print(list2)
list3 = [10, 20, 30]
print(list3)
NestedList = [list1, list2, list3, list4, list5]
print("The list of lists or Nested list is:")
print(NestedList)

#copy list items in another empty list
g= ["apple", "baby", "ambuj"]
a = g.copy()
print(a)

#or you can copy
g= ["anand", "vartika", "chaya"]
a = list(g)
print(a)



#insert an item in list without removing existing element
thislist = ["apple", "banana", "cow"]
thislist.insert(2, "water") 
print(thislist) # here result will be ["apple", "banana", "water","cow"]

# changing list item:(it's mutable so we can change list items.
color= ['pink', 'red', 'gray']

# changing the third item to 'C'
color[2] = 'green'

print(color)  # ['pink', 'red', 'green']

# changing the list items acc to range(change range)
th = ["apple", "blue", "cool", "orange", "kiwi", "mango"]
print(th) #["apple", "blue", "cool", "orange", "kiwi", "mango"]
th[1:3] = ["black", "bag"]
print(th) #["apple", "black", "bag", "orange", "kiwi", "mango"]

#pop method for using last element from list or remove item acor to index value
t = ["apple", "banana", "cherry"]
t.pop()
print(t) #["apple", "banana"]

t1=["ajay", "vijay", "chetan"]
t1.pop(2)
print(t1)

#remove method for remove any specific element
prog = ['Python', 'Swift', 'C++', 'C', 'Java', 'Ruby', 'php']
prog.remove('Java')
print(prog)

#remove list items using del keyword
prog = ['Python', 'Swift', 'C++', 'C', 'Java', 'Ruby', 'php']

# deleting the second item
del prog[1]
print(prog) # ['Python', 'C++', 'C', 'Java', 'Ruby', 'php']

# deleting the last item
del prog[-1]
print(prog) # ['Python', 'C++', 'C', 'Java', 'Ruby']

# delete first two items
del prog[0 : 2]  # ['C', 'Java', 'Ruby']
print(prog)


# del all list in one time with del and clear
prog = ['Python', 'Swift', 'C++', 'C', 'Java', 'Ruby', 'php']
del prog

prog1= ['Python', 'Swift', 'C++', 'C']
prog1.clear()
print(prog1) #return empty list

#creating a list with for loop
for i in range(6):
         print(i)
#print all items from list by using loop method
z=['a','b','c','d']
for i in (z):
    print(i)
#append item from one list to another list using loop
fruits = ["apple", "banana", "cherry", "kiwi", "mango"]
newlist = []

for x in fruits:
  if "a" in x:
    newlist.append(x)

print(newlist) #the result will be ["apple", "banana", "mango"] bcz a is found in all items

#sort the list items
fruit = ["orange", "mango", "kiwi", "pineapple", "banana"]
fruit.sort()
print(fruit) #['banana', 'kiwi', 'mango', 'orange', 'pineapple']

num= [100, 50, 65, 82, 23]
num.sort()
print(num)

#sort list in descending order
num= [100, 50, 65, 82, 23]
num.sort(reverse = True)
print(num)

#count the items from list

fruits = ["apple", "banana", "cherry","cherry"]

x = fruits.count("cherry")

print(x) #result:- 2

#find index value from list items
fruits = ['apple', 'banana', 'cherry']

x = fruits.index("banana")

print(x) #index value is 1






















































Tuesday, March 14, 2023

Quiz Program With Python Programming

Create a Quiz Program With Python:-


print("Welcome To ITCI")

print("\n")
score=0
user=input("Do you want play the quiz ?  ")
if (user=='y' or user=='Y'):#user can press y or Y
    print("\nLets play!!\n")
else:
    print("See you Next Time")#if user press No then this msg display
    exit()#and program will stop
Q1=input('Q1. What is the full form of C.P.U ?\nA. Centeral Process Unit.\nB. Central Processing Unit.\nYour Answer:-')
if(Q1=='b' or Q1=='B'):
    print("Correct\n")
    score+=1
else:
    print("you are wrong\n")
Q2=input("Q1. What is the full form of A.L.U ?\nA. Airthmatic Logic Unit.\nB. Airclock Logic Unit.\nYour Answer:- ")
if(Q2=='a' or Q2=='A'):
    print("Correct\n")
    score+=1
else:
    print("you are wrong\n")
Q2=input("Q1. How many hours in a day ?\nA. 24 hours.\nB. 23 hours.\nYour Answer:- ")
if(Q2=='a' or Q2=='A'):
    print("Correct\n")
    score+=1
else:
    print("you are wrong\n")
q3=input("a for:-\nA.apple\nB.egg\nYour answer:- ")
if (q3=='a' or q3=='A'):
    print("correct")
    score+=1
else:
    print("wrong")
    
print("Your Score is",score,"out of 4.\nThanks!!")
exit()

How to Draw Square with Python.

How to Draw Square with Python :-

import turtle #first we import turtle lib
tur=turtle.Turtle() #create a storage to store turtle lib
tur.color("red")
tur.pensize(5)
tur.hideturtle() #turtle will be hide when square is drawing
'''now we create a square you can use fd or forward to move
the turtle to forward side and rt or right
for move turtle to right side.'''
tur.fd(200)
tur.rt(90)
tur.fd(200)
tur.rt(90)
tur.fd(200)
tur.rt(90)
tur.fd(200)
tur.rt(90)
turtle.done() #tell to compiler that program is done

#note: - Using for loop

import turtle #first we import turtle lib
tur=turtle.Turtle() #create a storage to store turtle lib
tur.color("red")
tur.pensize(5)
tur.hideturtle() #turtle will be hide when square is drawing
'''now we create a square you can use fd or forward to move
the turtle to forward side and rt or right
for move turtle to right side.'''
for i in range(4):
    tur.fd(200)
    tur.rt(90)
turtle.done() #tell to compiler that program is done


How To Make Vote Age Calculator with Python

How To Make Vote Age Calculator with Python


print("Hi!\nWelcome To Voting Pannel")
age=int(input("Enter your age:- "))
if age >=18:
    print("you Are Eligible For Vote")
else:
    print("you Are Not Eligible For Vote")



Watch full video about this blog.


Sunday, March 12, 2023

How to draw Batsman with Python Programming:-

How to draw Batsman with Python Programming:-


import turtle

#initialize method

bat = turtle.Turtle()

#size of pointer and pen
bat.turtlesize(1, 1, 1)
bat.pensize(3)

#screen info
wn = turtle.Screen()
wn.bgcolor("red")
wn.title("BATMAN")

#colour
bat.color("yellow", "black")


#begin filling color
bat.begin_fill()

#turn1
bat.left(90)   # turn pointer direction to left of 90'
bat.circle(50, 85) #draw circle of radius = 50 and 85'
bat.circle(15, 110)
bat.right(180)

#turn 2
bat.circle(30, 150)
bat.right(5)
bat.forward(10) #draw forward line of 10 units

#turn 3
bat.right(90)
bat.circle(-70, 140)
bat.forward(40)
bat.right(110)

#turn 4
bat.circle(100, 30)
bat.circle(30, 100)
bat.left(50)
bat.forward(50)
bat.right(145)

#turn5
bat.forward(30)
bat.left(55)
bat.forward(10)

#reverse

#turn 5
bat.forward(10)
bat.left(55)
bat.forward(30)

#turn 4

bat.right(145)
bat.forward(50)
bat.left(50)
bat.circle(30, 100)
bat.circle(100, 30)

#turn 3
bat.right(90)
bat.right(20)
bat.forward(40)
bat.circle(-70, 140)

#turn 2
bat.right(90)
bat.forward(10)
bat.right(5)
bat.circle(30, 150)

#turn 1
bat.left(180)
bat.circle(15, 110)
bat.circle(50, 85)

#end color filling
bat.end_fill()

#end the turtle method
turtle.done()

How to Draw Doraemon Picture with Python Programming

How to Draw Doraemon Picture with Python Programming


from turtle import *                                 



# Doraemon with Python Turtle
def ankle(x, y):
    penup()
    goto(x, y)
    pendown()


def eyes():
    fillcolor("#ffffff")
    begin_fill()

    tracer(False)
    a = 2.5
    for i in range(120):
        if 0 <= i < 30 or 60 <= i < 90:
            a -= 0.05
            lt(3)
            fd(a)
        else:
            a += 0.05
            lt(3)
            fd(a)
    tracer(True)
    end_fill()


def daari():
    ankle(-32, 135)
    seth(165)
    fd(60)

    ankle(-32, 125)
    seth(180)
    fd(60)

    ankle(-32, 115)
    seth(193)
    fd(60)

    ankle(37, 135)
    seth(15)
    fd(60)

    ankle(37, 125)
    seth(0)
    fd(60)

    ankle(37, 115)
    seth(-13)
    fd(60)


def mukh():
    ankle(5, 148)
    seth(270)
    fd(100)
    seth(0)
    circle(120, 50)
    seth(230)
    circle(-120, 100)


def scarf():
    fillcolor('#e70010')
    begin_fill()
    seth(0)
    fd(200)
    circle(-5, 90)
    fd(10)
    circle(-5, 90)
    fd(207)
    circle(-5, 90)
    fd(10)
    circle(-5, 90)
    end_fill()


def nose():
    ankle(-10, 158)
    seth(315)
    fillcolor('#e70010')
    begin_fill()
    circle(20)
    end_fill()


def black_eyes():
    seth(0)
    ankle(-20, 195)
    fillcolor('#000000')
    begin_fill()
    circle(13)
    end_fill()

    pensize(6)
    ankle(20, 205)
    seth(75)
    circle(-10, 150)
    pensize(3)

    ankle(-17, 200)
    seth(0)
    fillcolor('#ffffff')
    begin_fill()
    circle(5)
    end_fill()
    ankle(0, 0)


def face():
    fd(183)
    lt(45)
    fillcolor('#ffffff')
    begin_fill()
    circle(120, 100)
    seth(180)
    # print(pos())
    fd(121)
    pendown()
    seth(215)
    circle(120, 100)
    end_fill()
    ankle(63.56, 218.24)
    seth(90)
    eyes()
    seth(180)
    penup()
    fd(60)
    pendown()
    seth(90)
    eyes()
    penup()
    seth(180)
    fd(64)


def taauko():
    penup()
    circle(150, 40)
    pendown()
    fillcolor('#00a0de')
    begin_fill()
    circle(150, 280)
    end_fill()


def Doraemon():
    taauko()

    scarf()

    face()

    nose()

    mukh()

    daari()

    ankle(0, 0)

    seth(0)
    penup()
    circle(150, 50)
    pendown()
    seth(30)
    fd(40)
    seth(70)
    circle(-30, 270)

    fillcolor('#00a0de')
    begin_fill()

    seth(230)
    fd(80)
    seth(90)
    circle(1000, 1)
    seth(-89)
    circle(-1000, 10)

    # print(pos())

    seth(180)
    fd(70)
    seth(90)
    circle(30, 180)
    seth(180)
    fd(70)

    # print(pos())
    seth(100)
    circle(-1000, 9)

    seth(-86)
    circle(1000, 2)
    seth(230)
    fd(40)

    # print(pos())

    circle(-30, 230)
    seth(45)
    fd(81)
    seth(0)
    fd(203)
    circle(5, 90)
    fd(10)
    circle(5, 90)
    fd(7)
    seth(40)
    circle(150, 10)
    seth(30)
    fd(40)
    end_fill()

    seth(70)
    fillcolor('#ffffff')
    begin_fill()
    circle(-30)
    end_fill()

    ankle(103.74, -182.59)
    seth(0)
    fillcolor('#ffffff')
    begin_fill()
    fd(15)
    circle(-15, 180)
    fd(90)
    circle(-15, 180)
    fd(10)
    end_fill()

    ankle(-96.26, -182.59)
    seth(180)
    fillcolor('#ffffff')
    begin_fill()
    fd(15)
    circle(15, 180)
    fd(90)
    circle(15, 180)
    fd(10)
    end_fill()

    ankle(-133.97, -91.81)
    seth(50)
    fillcolor('#ffffff')
    begin_fill()
    circle(30)
    end_fill()
    # Doraemon with Python Turtle

    ankle(-103.42, 15.09)
    seth(0)
    fd(38)
    seth(230)
    begin_fill()
    circle(90, 260)
    end_fill()

    ankle(5, -40)
    seth(0)
    fd(70)
    seth(-90)
    circle(-70, 180)
    seth(0)
    fd(70)

    ankle(-103.42, 15.09)
    fd(90)
    seth(70)
    fillcolor('#ffd200')
    # print(pos())
    begin_fill()
    circle(-20)
    end_fill()
    seth(170)
    fillcolor('#ffd200')
    begin_fill()
    circle(-2, 180)
    seth(10)
    circle(-100, 22)
    circle(-2, 180)
    seth(180 - 10)
    circle(100, 22)
    end_fill()
    goto(-13.42, 15.09)
    seth(250)
    circle(20, 110)
    seth(90)
    fd(15)
    dot(10)
    ankle(0, -150)

    black_eyes()


if __name__ == '__main__':
    screensize(800, 600, "#f0f0f0")
    pensize(3)
    speed(9)
    Doraemon()
    ankle(100, -300)
    mainloop()

Aadhar No Validation Program In python (Chech Aadhar No Is Valid or Not.)

Aadhar  No Validation Program In python (Chech Aadhar No Is Valid or Not.)



# Number should be 12 chars
# Number should not start with 0 or 1
# It should not contain alphabets

num = input("Please enter a 12 digit mobile number: ")

# Check if number length is greater or less then 12
if len(num) > 12 or len(num) < 12:
    print("Aadhar number is not valid (Enter a 12 digit number)")
else:
    # Check if first number is 0 or 1
    if num[0] == '0' or num[0] == '1':
        print("Aadhar number is not valid (Aadhar card number cannot start with 0 or 1)")
    else:
        try:
            num = int(num)
            print("Aadhar number is valid") #this block try if no error
        except: #this block print when try block or statement have an error
            print('Aadhar number is not valid (Aadhar number should not contain any characters)')





Friday, February 10, 2023

For access list items/values using for loop and while loop.


For access list items/values using for loop and while loop.

Python for Loop

In this blog we'll learn about to use a for loop in Python.
In computer programming, loops are used to repeat a block of code.
For example, if we want to show a message 50 or more  times, then we can use a loop.
There are 2 types of loops in Python: for loop and while loop
Python for Loop
In Python, the for loop is used to run a block of code for a certain number of times. It is used to iterate over any sequences such as list, tuple, string, etc. Loop continues until we reach the last item in the sequence.

Flowchart of Python for Loop

Working of Python for loop 


Example: Loop over Python List
os = ['mac', 'window', 'linux', 'unix']

#Here we can access items value of a list using for loop
for i in os:
    print(i)

#OUTPUT:-
mac
window
linux
unix

Python for Loop with Python range()

A range is a series of values between two numeric intervals.
Here we use a built-in function range() to define a range of values.
For example,
values = range(5)
Here, 5 inside range() defines a range containing values 0, 1, 2, 3 and 4.

In Python, we can use for loop to iterate over a range.
For example:-
# use of range() to define a range of values
values = range(5)

# iterate from i = 0 to i = 4
for i in values:
    print(i)
Result:- 
0
1
2
3
4
In the above example, we have used the for loop to iterate over a range from 0 to 4.
The value of i is set to 0 and it is updated to the next number of the range on each iteration. This process continues until 4 is reached.

Python for loop with else
A for loop can have an optional else block as well. The else part is executed when the loop is finished. 
For example:-
listb = [0, 3, 6]
for i in listb:
    print(i)
else:
    print("Items or value not found in the listb")

#Result:-
0
3
6
Items or value not found in the listb.
Here, the for loop prints all the items of the listb. When the loop finishes, it executes the else block and prints ‘Items or value not found in the listb’.


Python while Loop

Python while loop is used to run a block code until a certain condition is met or finded. A while loop evaluates the condition. If the condition evaluates to True, the code inside the while loop is executed, condition is evaluated again. This process continues until the condition is False, and when condition evaluates to False, the loop will stop.

Flowchart of Python while Loop




Example: Python while Loop
# program to display numbers from 1 to 5

# here we initialize two variable i and n
i = 1
n = 5

# while loop from i = 1 to 5
while i <= n:
    print(i)
    i = i + 1

#Output:-
1
2
3
4
5

Example 2: Python while Loop

# program to calculate the sum of numbers
# until the user enters zero

total = 0

number = int(input('Enter a number: '))

# add numbers until number is zero
while number != 0:
    total += number    # total = total + number
    
    # take integer input again
    number = int(input('Enter a number: '))
    

print("total is =", total)


#output:-
Enter a number: 18
Enter a number: 6
Enter a number: -5
Enter a number: 0
('total is =', 19)

In the above example, the while iterates until the user enters zero. When the user enters zero, the test condition evaluates to False and the loop ends or stop.

Infinite while Loop with else in Python

If the condition of a loop is always True, the loop runs for infinite times (until the memory is full). For example,
age = 30
# the test condition is always True
while age > 18:
    print('You are eligible for vote')
else:
    print('You are not eligible for vote')

#if you change age less than 18 then it will else condition.

In the above example, the condition always evaluates to True. Hence, the loop body will run for infinite times.

Example 2:-
counter = 0

while counter < 3:
    print('we are looping')
    counter = counter + 1
else:
    print('we stop bcz value is >= 3')





Tuesday, February 07, 2023

Python program for to check if year is a leap year or not.


Python program for to check if year is a leap year or not

-------------------------------------Computerwithsatyamsir----------------------------------
# Python program to check if year is a leap year or not

year = 2000

# To get year (integer input) from the user 
Satyam

# year = int(input("Enter a year: "))

# divided by 100 means century year (ending with 00)
# century year divided by 400 is leap year
if (year % 400 == 0) and (year % 100 == 0):
    print("{0} is a leap year".format(year))

# not divided by 100 means not a century year
# year divided by 4 is a leap year
elif (year % 4 ==0) and (year % 100 != 0):
    print("{0} is a leap year".format(year))

# if not divided by both 400 (century year) and 4 (not century year)
# year is not leap year
else:
    print("{0} is not a leap year".format(year))




Python IDLE startup failure problem solve


Python IDLE startup failure problem solve

दोस्तों अगर आप पाइथन यूजर है और याद पाइथन प्रोग्राम को ओपन करते समय Python IDLE startup failure प्रॉब्लम आ रही है तो यह वीडियो आपके लिए बहुत ही जरूरी है। आप वीडियो को पूरा देखें और आप इस समस्या को मिनट में दूर कर सकते हैं, यादी वीडियो ब्लर दिखा तो आप सेटिंग आइकन पर क्लिक करके उसकी क्वालिटी 720p या फिर 1080p चेंज कर दे वीडियो साफ दिखाएगा।




Tuesday, January 31, 2023

IOT (Internet of Things) one linear Important Point

 


    M4R5 IOT (Internet of Things)

www.itcicomputerhardoi.blogspot.com

IOT Important Point

CCC Important points  Cyber Crime, Cyber Security and Virus  Libre Calc point

·         IOT का पूरा नाम क्या है – इन्टरनेट ऑफ़ थिंग्स (Internet Of Things)

·         IOT में थिंग्स का क्या मतलब किससे है – बस्तुओं से (वह सभी बस्तुये जो ऑन और ऑफ टेक्निक का प्रयोग करती है.

·         इन्टरनेट को क्लाउड भी कहा जाता है – सत्य

www.itcicomputerhardoi.blogspot.com

·         IOT क्या है – नेटवर्क और सेंसर से जुडी हुई बस्तुये.

·         आई ओ टी की खोज किसने की – केविन आस्थन ने 1999 में

·         IOT उपकरण डेटा को कलेक्ट करने व शेयर करने के लिए किसका उपयोग करते है – इन्टरनेट का

·         IOT में किसका होना अनिवार्य है – माइक्रो कंट्रोलर

·         IOT में किस टेक्नोलॉजी का प्रयोग किया जाता है- वायरलेस तकनीक का

·         क्या इन्टरनेट ऑफ़ थिंग्स पूरी तरह से सेफ है – नहीं

·         IOT के प्लेटफॉर्म कौन से है – AWS, माइक्रोसॉफ्ट अजुरे, सेल्सफ़ोर्स, आदि.

·         IOT के फंडामेंटल कॉम्पोनेन्ट कौन से है – सेंसर, कनेक्टिविटी, डाटा प्रोसेसिंग और यूजर इंटरफ़ेस.

·         IOT में वायरलेस कनेक्शन के लिए किस लेयर का प्रयोग किया जाता है – डाटा link लेयर

·         IOT में पुश बटन क्या है – डिजिटल सेंसर

·         IOT में किस लाइट सेंसर किस प्रकार का सेंसर है – एनालॉग सेंसर

·         भौतिक दुनिया से डाटा को कैप्चर करने के लिए किस प्रकार की डिवाइस का प्रयोग किया जाता है – IOT डिवाइस का

·         Arduino Programming में सिंगल line कमेंट के लिए क्या करते है - //comment//

·         Respberry क्या है – एक प्रकार का कंप्यूटर

·         Respberry कंप्यूटर  में किस टेक्नोलॉजी का प्रयोग किया जाता है- ऑन बोर्ड wifi व ब्लूटूथ जैसी तकनीक का

·         IOT उपकरण में कौन –कौन से सेंसर प्रयोग किये जाते है- स्मोक सेंसर(धुआं सेंसर), प्रेसर या दाब सेंसर, टेम्परेचर या तापमान सेंसर, Motion डिटेक्शन सेंसर, प्रोक्सिमिटी सेंसर,BMP-280,DHT-11 आदि.

·         IOT में PWM क्या है – Pulse Width Modulation.

·         PWM का क्या कार्य है – DC मोटर की स्पीड व डिमिंग लाइट को कण्ट्रोल करना

·         बोट नेट किस प्रकार के अटैक को लांच करता है – DDos

·         Arduino Programming में मोडुलो को कण्ट्रोल करने के लिए किस सिंबल का प्रयोग करते है - % (परसेंट का)

·         Arduino UNO प्रोटोटाइप बोर्ड में किस माइक्रो कंट्रोलर का प्रयोग किया जाता है – ATmega328P

·         ATmega328P में p का क्या मतलब है – pico-power

·         Arduino Programming  का डिफ़ॉल्ट मेथड क्या है - setup() और loop()

·         जब स्केच स्टार्ट होता है तब कौन सा फंक्शन कॉल होता है – setup()

·         वेरिएबल को इनिशियलाइज़ करने के लिए कौन सा फंक्शन है - setup()

·         Arduino board के रिसेट होने या पॉवर अप होने के बाद setup() फंक्शन कितनी बार चलता है – सिर्फ 1 बार

·         Arduino बोर्ड को सक्रिय रूप से नियंत्रित करने के लिए किसका उपयोग करते है । - loop() फंक्शन

 

·         सबसे highest डाटा रेट कम्युनिकेशन किसमें होता है – ऑप्टिकल फाइबर केबल में.

·         Arduino  का डिफ़ॉल्ट बूट लोडर क्या है – Optiboot

·         Arduino IDE प्रोग्राम किस सॉफ्टवेर पर लिखे व अपलोड किये जाते है- स्केच (skech) पर

·         Arduino  में बूट लोडर को re-program करने के लिए किसका प्रयोग करते है – ICSP (In Circuit Serial Programming).

·         ICSP (In Circuit Serial Programming), यह फर्मवेयर प्रोग्राम करने के लिए एक प्रोग्रामिंग विधि है- सत्य

·         Arduino डिजाईन क्या है – एक प्रकार का ओपन सोर्स सॉफ्टवेर, जो एनालॉग और डिजिटल दोनों डाटा को पढ़ सकता है.

·         Arduino डिजाईन सॉफ्टवेर के पास कोई ऑपरेटिंग सिस्टम नही होता है क्योंकि फर्मवेयर सॉफ्टवेर इसमें पहले से प्रोग्राम किया होता है – सत्य

·         LED लाइट को कण्ट्रोल करने के लिए किस मोडूल का प्रयोग किया जाता है – Blootooth Module HC-05 का (जो स्मार्ट फ़ोन पर blootooth सिग्नल सेंड करता है)

·         IOT  प्लेटफॉर्म किससे जुड़ा है- सेंसर और डिवाइस से

·         IOT  प्लेटफॉर्म हार्डवेयर और सॉफ्टवेर को प्रोटोकॉल के द्वारा कण्ट्रोल करता है- सत्य

·         IOT में आउटपुट के लिए किसका प्रयोग किया जाता है – Actuator का

·         किसी भी कार्य को कण्ट्रोल करने के लिए माइक्रोकंट्रोलर और माइक्रो प्रोसेसर का प्रयोग किया जाता है – सत्य

·         अलेक्सा क्या है- एक Voice कंट्रोलर

·         BMP-280, DHT-11, Photoresistor क्या है – सेंसर

·         IOT में Actuator कौन से है – स्टॉपर मोटर,फैन, LED, etc.

·         IOT में Actuator का क्या कार्य है – इलेक्ट्रॉनिक सिग्नल को भौतिक सिग्नल में बदलने के लिए

·         IOT में Actuator को ऑपरेट होने के लिए किस सिग्नल की आवश्यकता होती है- एनालॉग सिग्नल

·         COAP कौन सी लेयर है – सर्विस लेयर

·         Ardunio कितने प्रकार के है – 8 (आठ)

·         I2C क्या है – Inter Integrated Communication (यह एक प्रोटोकॉल है)

·         IOT बेस्ड पहली डिवाइस कौन सी है – ATM

·         SCTP किस लेयर पर कार्य करता है – Transport Layer

·         Port Address, पता होस्ट पर एक प्रक्रिया की पहचान करता है – सत्य

·         ट्रांसपोर्ट लेयर का कार्य क्या है – मल्टीप्लेक्सिंग और डी मल्टीप्लेक्सिंग

·         ट्रांसपोर्ट लेयर किस रूप में डाटा प्राप्त करती है – बाइट स्ट्रीम के रूप में.

·         UDP कनेक्शन लेस प्रोटोकॉल है – सत्य

·         UDP का पूरा नाम क्या है – User Datagram Protocol

·         UDP क्या है – एक प्रोटोकॉल

·         TCP क्या है ?- यह कनेक्शन ओरिएंटेड प्रोटोकॉल है जिसका पूरा नाम ट्रांसमिशन कण्ट्रोल प्रोटोकॉल है.

·         IOT के लिए सबसे बेस्ट IP वर्जन है – IPV6

·         स्मार्ट grid आर्किटेक्चर में क्लाउड की क्या भूमिका है – डाटा को मैनेज करना.

·         पहली नई शब्दावली Arduino प्रोग्राम है जिसे "स्केच" कहा जाता है। - सत्य

·         Arduino प्रोग्राम को तीन मुख्य भागों में विभाजित किया जा सकता है- Structure, Values (variables and constants), and Functions.

·         Arduino में डाटा टाइप कौन से है - void, Boolean, char, Unsigned char, byte, int, Unsigned int, word, long, Unsigned long, short,          float,  double,                array, String-char array, String-object

·         Arduino प्रोग्रामिंग में फंक्शन को डिक्लेअर करने के लिए कौन सा कीवर्ड है – void

·         बूलियन डाटा दो प्रकार के मान रखता है सत्य या असत्य था प्रत्येक बूलियन वेरिएबल के लिए 1 बाइट जगह लेता है – सत्य

Z-wave  क्या है – एक वायरलेस कम्युनिकेशन प्रोटोकॉल जिसका प्रयोग स्मार्ट होम नेटवर्किंग स्मार्ट डिवाइस को कनेक्ट करने में किया जाता है.

Zig-Bee क्या है – एक low power, low डाटा रेट वाला वायरलेस नेटवर्क.

Zig-Bee किस पर आधारित है – इलेक्ट्रिकल और इलेक्ट्रॉनिक्स इंजीनियर्स (IEEE) 802.15.4 मानक पर आधारित

BLE क्या है – Blutooth Low Energy नेटवर्क जो पर्सनल एरिया नेटवर्क के अन्तेर्गत आता है.

Respberry क्या है – एक प्रकार का कंप्यूटर

Respberry कंप्यूटर  में किस टेक्नोलॉजी का प्रयोग किया जाता है- ऑन बोर्ड wifi व ब्लूटूथ जैसी तकनीक का

IOT उपकरण में कौन –कौन से सेंसर प्रयोग किये जाते है- स्मोक सेंसर(धुआं सेंसर), प्रेसर या दाब सेंसर, टेम्परेचर या तापमान सेंसर, Motion डिटेक्शन सेंसर, प्रोक्सिमिटी सेंसर,BMP-280,DHT-11 आदि.

IOT में PWM क्या है – Pulse Width Modulation.

PWM का क्या कार्य है – DC मोटर की स्पीड व डिमिंग लाइट को कण्ट्रोल करना

बोट नेट किस प्रकार के अटैक को लांच करता है – DDos

Arduino Programming में मोडुलो को कण्ट्रोल करने के लिए किस सिंबल का प्रयोग करते है - % (परसेंट का)

Arduino UNO प्रोटोटाइप बोर्ड में किस माइक्रो कंट्रोलर का प्रयोग किया जाता है – ATmega328P

ATmega328P में p का क्या मतलब है – pico-power

Arduino Programming  का डिफ़ॉल्ट मेथड क्या है - setup() और loop()

सबसे highest डाटा रेट कम्युनिकेशन किसमें होता है – ऑप्टिकल फाइबर केबल में.

Arduino  का डिफ़ॉल्ट बूट लोडर क्या है – Optiboot

Arduino IDE प्रोग्राम किस सॉफ्टवेर पर लिखे व अपलोड किये जाते है- स्केच (skech) पर

Arduino  में बूट लोडर को re-program करने के लिए किसका प्रयोग करते है – ICSP (In Circuit Serial Programming).

ICSP (In Circuit Serial Programming), यह फर्मवेयर प्रोग्राम करने के लिए एक प्रोग्रामिंग विधि है- सत्य 

Arduino डिजाईन क्या है – एक प्रकार का ओपन सोर्स सॉफ्टवेर, जो एनालॉग और डिजिटल दोनों डाटा को पढ़ सकता है.

Arduino डिजाईन सॉफ्टवेर के पास कोई ऑपरेटिंग सिस्टम नही होता है क्योंकि फर्मवेयर सॉफ्टवेर इसमें पहले से प्रोग्राम किया होता है – सत्य

LED लाइट को कण्ट्रोल करने के लिए किस मोडूल का प्रयोग किया जाता है – Blootooth Module HC-05 का (जो स्मार्ट फ़ोन पर blootooth सिग्नल सेंड करता है)

IOT  प्लेटफॉर्म किससे जुड़ा है- सेंसर और डिवाइस से

IOT  प्लेटफॉर्म हार्डवेयर और सॉफ्टवेर को प्रोटोकॉल के द्वारा कण्ट्रोल करता है- सत्य

IOT में आउटपुट के लिए किसका प्रयोग किया जाता है – Actuator का

IETF का पूरा नाम क्या है – Internet Engineering Task Force

AMQP क्या है – Advanced Message Queuing Protocol

CoAP का पूरा नाम क्या है –Constrained Application Protocol

LoRaWAN का पूरा नाम:- Long Range Wide Area Network (यह लाखो कम शक्ति वाले उपकरणों के साथ स्मार्ट शहरों के लिए Wan प्रोटोकॉल है.

GS1 क्या है – Global Standards One

O-DF क्या है – Open Data Format

• NFC क्या है – Near Field Communication

एनएफसी में इलेक्ट्रॉनिक उपकरणों के लिए संचार प्रोटोकॉल होते हैं, आमतौर पर एक मोबाइल डिवाइस और एक मानक डिवाइस का प्रयोग करता है।

• RFID क्या है – रेडियो फ्रीक्वेंसी आइडेंटिफिकेशन

RFID तकनीक वस्तुओं से जुड़े टैग को पहचानने और ट्रैक करने के लिए तथा 2-वे रेडियो ट्रांसमीटर-रिसीवर का उपयोग करती है

• Low-Energy Wireless (LEW) - यह तकनीक एक IoT सिस्टम के सबसे अधिक शक्ति वाले पहलू की जगह लेती है। हालांकि सेंसर और अन्य तत्व लंबे समय तक बंद हो सकते हैं।

रेडियो प्रोटोकॉल - ZigBee, Z-Wave, and Thread are radio protocols for creating low-rate private area networks.

Types of Sensor:- accelerometers, temperature sensors, magnetometers, proximity sensors, gyroscopes, image sensors, acoustic sensors, light sensors, pressure sensors, gas RFID sensors, humidity sensors , micro flow sensors

6LoWPAN - यह लो-पावर वायरलेस पर्सनल एरिया नेटवर्क पर IPv6 के लिए है। यह सीमित संसाधनों वाले उपकरणों द्वारा आवश्यक कम डेटा दर वायरलेस का समर्थन करने के लिए संपीड़न तकनीक प्रदान करता है।

RPL-  यह  कम-शक्ति और हानिपूर्ण नेटवर्क) के लिए यह डिस्टेंस वेक्टर आईपीवी 6 प्रोटोकॉल है जो विभिन्न क्षमता वाले उपकरणों के जटिल नेटवर्क में सर्वोत्तम संभव पथ खोजने की अनुमति देता है।

LLNs क्या है -  Low-Power And Lossy Networks

IoT सिस्टम के बिल्डिंग ब्लाक  में क्या आवश्यक है - चार चीजें ( सेंसर, प्रोसेसर, गेटवे, एप्लिकेशन) 

सेंसर:- ये IoT उपकरणों का फ्रंट एंड बनाते हैं। उनका मुख्य उद्देश्य वे रीयल-टाइम डेटा एकत्र करना या इसके आसपास (एक्ट्यूएटर्स) को डेटा देना है।

प्रोसेसर:- यह  IoT सिस्टम का दिमाग हैं, यह डेटा को इंटेलिजेंस देता है। उनका मुख्य कार्य सेंसर द्वारा कैप्चर किए गए डेटा को संसाधित करना ताकि भारी मात्रा में एकत्र किए गए कच्चे डेटा से मूल्यवान डेटा निकाला जा सके। प्रोसेसर ज्यादातर रीयल-टाइम आधार पर काम करते हैं और इन्हें एप्लिकेशन द्वारा आसानी से नियंत्रित किया जा सकता है। ये डेटा को सुरक्षित(एन्क्रिप्शन और डिक्रिप्शन) करने के लिए भी जिम्मेदार हैं.

गेटवे:- गेटवे डेटा के संचार में मदद करता है। यह संसाधित डेटा को रूट करने उचित उपयोग के लिए उचित स्थानों पर भेजने के लिए जिम्मेदार हैं। यह डेटा को नेटवर्क कनेक्टिविटी प्रदान करता है। LAN, WAN, PAN, आदि नेटवर्क गेटवे के उदाहरण हैं।

एप्लिकेशन:- यह IoT सिस्टम का दूसरा एंड बनाते हैं। एकत्र किए गए सभी डेटा के समुचित उपयोग के लिए application आवश्यक हैं। एप्लिकेशन उपयोगकर्ताओं द्वारा नियंत्रित होते, जिसके उदाहरन: होम ऑटोमेशन ऐप, सुरक्षा प्रणाली, औद्योगिक नियंत्रण केंद्र आदि हैं।


Python project and practical   O level web desigining paper point