PYTHON PROGRAMMING - Procedure1
PYTHON PROGRAMMING - Procedure1
Aim: The program appends, deletes and displays elements of a list using class.
Procedure:
A class called check is created and the __init__() method is used to initialize values of
that class.
Methods for adding, removing and displaying elements of the list have been defined.
The menu is printed and the choice is taken from the user.
An object for the class is created.
Using the object, the respective method is called according to the choice taken from the
user.
The final list is printed.
Procedure:
Procedure:
Start the program
Read the number named num.
Check the given number is greater than 1
Then, use loop – range i from 1 to num.
If num mod i=0 then
Set f=0 and break else f=1
If f=0, print the given number is not prime
Else, print the given number is prime.
Ex- 2: a3) Program to find whether the given year is leap or not
Aim: Python program to check whether the given year is leap or not.
Procedure:
Step 1: Start the program
Step 2: Read the year named year.
Step 3: Check if mod of the given year with 100 is 0, else go to Step 6
Step 4: Then, mod the given year with 400 is 0, print Leap year
Step 5: Otherwise, print not leap year
Step 6: Check if mod of the given year with 4 is 0, print leap year
Step 7: Otherwise, print not leap year
Ex- 2: b1) Python program to find the given number is palindrome or not.
Procedure:
Ex- 2: b2) Python program to add two matrices using nested loop.
Procedure:
Procedure:
Procedure:
Start the program
Enter a password as input
using regular expression search() method to validate the password
First, check whether the password have minimum 8 characters or not.
Then check whether the alphabets must be between [a-z].
Having at least alphabet should be of Upper Case [A-Z].
Having at least one number or digit between [0-9].
Having at least one special character from [_ or @ or $].
Check any white space is in the input.
Procedure:
Start the program
Importing the calendar module
The menu is printed and the choice is taken from the user.
If choice is 1, read the year as input
Then the calendar function calendar.prcal() – display the calendar
If choice is 2, read the year and month as input
Use the calendar.month() function – display the month of the year.
Stop the program.
Procedure:
Importing the module – tkinter
Create the main window (container)
Create two three box for input and output
Create two button for implement the simple calculation
Stop the program