Thursday 25 June 2020

Group A Assignment No 3 Python Program for Matrix Operation like Addition, Substraction, Multiplication and Transpose


Problem Statement: 

Write a python program to compute following computation on matrix: 

a) Addition of two matrices 

b) Subtraction of two matrices 

c) Multiplication of two matrices 

d) Transpose of a matrix 

-------------------------------------------------------------------------------

Now, the first question comes to our mind is how to declare a matrix in python ? how to store elements in python ?

Let's see......

Using List as a data structure  in Python,  we can create matrix in Python.

How ?

 

Output of this code is as Follows:

Matrix Creation and Storing value in it from user is as follows...
Enter number of rows in matrix:3
Enter number of cols in matrix:3
Enter the value for mat[0][0]:: 10
Enter the value for mat[0][1]:: 20
Enter the value for mat[0][2]:: 30
----------------------
Enter the value for mat[1][0]:: 40
Enter the value for mat[1][1]:: 50
Enter the value for mat[1][2]:: 60
----------------------
Enter the value for mat[2][0]:: 70
Enter the value for mat[2][1]:: 80
Enter the value for mat[2][2]:: 90
----------------------
The user entered elements in matrix are as follows...
10 20 30
40 50 60
70 80 90
>>>


data structures and algorithms Web Developer

Thursday 18 June 2020

Group A Python program to store marks scored in subject “Fundamental of Data Structure” by N students in the class.


Problem Statement:  

Write a Python program to store marks scored in subject “Fundamental of Data Structure” by N students in the class. Write functions to compute following: 

a) The average score of class 

b) Highest score and lowest score of class 

c) Count of students who were absent for the test 

d) Display mark with highest frequency 

 

Hardware Requirement:

      Processor: Intel(R) Core(TM)2 Duo CPU  E7500 @ 2.93GHz

      Memory: 2.00 GB

      Operating System: 64-bit Open source


Software Requirement:

     Programming tool like PyCharm with Python 3.X.X Interpreter 

 

 

Source Program:  







Output:

GroupA Assignment No 02
Menu Driven Program For FDS Test of 30 Marks Analysis:
================== ****** ==============================
The Students gets the marks in FDS Test out of 30M are as follows...
['NA', 12, 22, 20, 23, 24, 25, 'AB', 25, 21, 25, 'AB', 22, 'AB', 25, 28]
>>> mainMenu()
1.The average score of class SEA
2.Highest score and lowest score of class
3.Count of Students who were absent for the test
4.Display mark with highest frequency
5.Exit
Enter your choice::1
1.The average score of class SEA:
Total Strength of Class SE A is:: 16
The Average Score of Class is:: 22.666666666666668
---------- ******* --------------------------------

1.The average score of class SEA
2.Highest score and lowest score of class
3.Count of Students who were absent for the test
4.Display mark with highest frequency
5.Exit
Enter your choice::2
2.Highest score and lowest score of class
The Highest Marks in FDS Test is: 28
The Lowest Marks in FDS Test is: 12
---------- ******* --------------------------------

1.The average score of class SEA
2.Highest score and lowest score of class
3.Count of Students who were absent for the test
4.Display mark with highest frequency
5.Exit
Enter your choice::3
3.Count of Students who were absent for the test

The Students gets the marks in FDS Test out of 30M are as follows...
['NA', 12, 22, 20, 23, 24, 25, 'AB', 25, 21, 25, 'AB', 22, 'AB', 25, 28]

Count of Students who were Absent for the FDS Test is: 3
---------- ******* --------------------------------

1.The average score of class SEA
2.Highest score and lowest score of class
3.Count of Students who were absent for the test
4.Display mark with highest frequency
5.Exit
Enter your choice::4
.Display mark with highest frequency
The marks in FDS Test are as Follows...
['NA', 12, 22, 20, 23, 24, 25, 'AB', 25, 21, 25, 'AB', 22, 'AB', 25, 28]
Count of each marks from 0 to 30 are as follows..
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 1, 1, 4, 0, 0, 1, 0, 0]
Highest frequency of is: 4
Marks of highest frequency is: 25
---------- ******* --------------------------------

Note: In Enter your choice 4 if you run this code you will not get the output as above you will get error please correct this error and execute once again.

data structures and algorithms Web Developer

Sunday 14 June 2020

How to design or write an algorithm for a given problem statement.....


How to write an Algorithm for a following Problem Statement:

Problem Statement:

In second year computer engineering class, group A student’s play cricket, group B students play badminton and group C students play football. 

Write a Python program using functions to compute following: -

a) List of students who play both cricket and badminton 

b) List of students who play either cricket or badminton but not both 

c) Number of students who play neither cricket nor badminton 

d) Number of students who play cricket and football but not badminton. 

(Note- While realizing the group, duplicate entries should be avoided, Do not use SET built-in functions) 

 

 

Solution:

First of all we have to analyze the problem statement, we have to find out the following things from the Problem statement.
1. What is given in the Problem statement? [Given]

2. Identify the entity and it's attributes. [Entity]
 
3. Identify the users actual requirements and what are the inputs we are accepting from user.[Input]

4. Identify to store and process the data which data structure is required? [Data Structure]

5. How many functions are there in Problem statement? [Output]


Analysis of Problem Statement by referring above five points: 

1. Given: 

In the above Problem Statement Given/Assume things are: 
a. Class SEA Student Roll numbers. that is whole class strength of SEA
b. Students Plays in Group_A Cricket: Group_B Badminton: and Group_C Football: 

2. Entity:

Here the entity is Class_SE_A and the attribute is Rollno.

3. Input:

As a input we have to accept following things from the user:

3.1 Group_A Cricket: The Rollno of students who plays Cricket from Class_SE_A.
3.2 Group_B Badminton: The Rollno of students who plays Badminton from Class_SE_A.
3.3 Group_C Football: The Rollno of students who plays Football from Class_SE_A.
3.4 Class_SE_A: we have to assume the N number of students in class SE A. 

4. Data Structure:

To Store and Process the data as per user requirement we are using LIST  as a data Structure in Python Programming Language.

5. Output:

As per the user requirement user wants following things as an output when he is going to process the data.
5.1 List of students who play both cricket and badminton.
5.2 List of students who play either cricket or badminton but not both.
5.3 Number of students who play neither cricket nor badminton.
5.4 Number of students who play cricket and football but not badminton.

In this way we are going to analyze each and every problem statement before designing the algorithm that is called as "Requirement Analysis" in Software Development Life Cycle.

So by referring the above analysis,
we comes to know that we have to design Four algorithms for  each and every Output.

Algorithms:

5.1 Algorithm for List of students who play both cricket and badminton.


  
5.2 Algorithm for List of students who play either cricket or badminton but not both.



5.3 Algorithm for Number of students who play neither cricket nor badminton.


 
5.4 Algorithm for Number of students who play cricket and football but not badminton.


data structures and algorithms Web Developer

Saturday 13 June 2020

What is List in Python? What are the operations we can perform on List?


What is List in Python?

Lists are just like dynamic sized arrays.

Why we require List in Python? 

 

Lists need not be stored similar data types of elements always which makes it a most powerful tool in Python. A single list may contain different types of data like Float,Integers, Strings, as well as Objects. 

 

Just Try the following Code from your side and find out the answers of it.

Lists are mutable, and hence, they can be altered even after their creation.

List in Python are ordered and have a definite count. The elements in a list are indexed according to a definite sequence and the indexing of a list is done with 0 being the first index. Each element in the list has its definite place in the list, which allows duplicating of elements in the list, with each element having its own distinct place and credibility.

Note- Lists are a useful tool for preserving a sequence of data and further iterating over it.

More Function in List: 

Note: extend() simple adds the elements in existing list it doesn't make Nested list.

Next Function is insert( ) in Python


 
data structures and algorithms Web Developer

Introduction: From Problem to Data Structure (Problem, Logic, Algorithm, and Data Structure).



Introduction: From Problem to Data Structure (Problem, Logic, Algorithm, and Data Structure).

Here i m going to tell you the story of a boy who don't know how to instruct a computer to do some task (How to find out average of four numbers by computer)?
























data structures and algorithms Web Developer

Sunday 7 June 2020

210247: Data Structures Laboratory Group A: Assignment No:02 SE Students FDS Subject Marks Computaion using pyhton List.


Problem Statement:

Write a Python program to store marks scored in subject “Fundamental of Data Structure” by N students in the class. Write functions to compute following:

a) The average score of class.

b) Highest score and lowest score of class.

c) Count of students who were absent for the test.

d) Display mark with highest frequency.

 

 

Analysis of a Problem Statement: 

1. Given :

  Marks scored in subject Fundamental of Data Structure” by N Students.

2. Entity: 

  Here in the Problem statement Entity is subject FDS and attribute of entity is Marks

3. Input:

 Here we have to accept subject FDS marks of N Students as a input from user. 

4. Data Structure:

To store/organize the marks in memory we required LIST as a data structure. 

5. Output: 

5.1 The average score of class
5.2 Highest Score and Lowest Score of a Class.
5.3 Count of a student who were absent for the Test.
5.4 Display marks with highest frequency.



Design of Algorithm:

5.1 To find out the average score of a class.



5.2 To find out Highest Score and Lowest Score of a class.

 



 5.3 To find out count of a student who were absent for the Test.

 

 

data structures and algorithms Web Developer

210247: Data Structures Laboratory Group A: Assignment No:01 Set Operation using pyhton List.


Guidelines for Laboratory Conduction 

The instructor is expected to frame the assignments by understanding the prerequisites, technological aspects, utility and recent trends related to the topic. The assignment framing policy need to address the average students and inclusive of an element to attract and promote the intelligent students. The instructor may set multiple sets of assignments and distribute among batches of students. It is appreciated if the assignments are based on real world problems/applications.

Encourage students for appropriate use of Hungarian notation, proper indentation and comments. Use of open source software is to be encouraged. In addition to these, instructor may assign one real life application in the form of a mini-project based on the concepts learned. Instructor may also set one assignment or mini-project that is suitable to respective branch beyond the scope of syllabus.

Set of suggested assignment list is provided in groups- A, B, C, D, and E. Each student must perform at least 13 assignments as at least 3 from group A, 3 from group B, 2 from group C, 2 from group D and 3 from group E. Group A and B assignments should be implemented in python without using built-in methods for major functionality of assignment. Use List data structure of Python as array. Group C, D and E assignments should be implemented in C++ language.

Operating System recommended:- 64-bit Open source Linux or its derivative Programming tools recommended: - Open Source python, Programming tool like Jupyter Notebook, Pycharm, Spyder, G++/GCC,

Examination Scheme:                                   Teaching Scheme: PR: 04 Hours/Week
TW: 25 Marks                                                   Credit 02
PR: 50 Marks


Hardware Requirement:
      Processor: Intel(R) Core(TM)2 Duo CPU  E7500 @ 2.93GHz
      Memory: 2.00 GB
      Operating System: 64-bit Open source

Software Requirement:
     Programming tool like PyCharm with Python 3.X.X Interpreter


Problem Statement:  

In second year computer engineering class, group A student’s play cricket, group B students play badminton and group C students play football. Write a Python program using functions to compute following: - 

a) List of students who play both cricket and badminton 

b) List of students who play either cricket or badminton but not both 

c) Number of students who play neither cricket nor badminton 

d) Number of students who play cricket and football but not badminton. 

(Note- While realizing the group, duplicate entries should be avoided, Do not use SET built-in functions) 

 

 Source Program:   

 




Output:       

Total Students in SE A Class: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Total Students in GoupA plays Cricket: [2, 4, 6, 8]
Total Students in GoupB plays Badminton: [3, 5, 6, 8]
Total Students in GoupC plays football: [1, 7]
>>> mainMenu()
1. List of students who play both cricket and badminton
2. List of students who play either cricket or badminton but not both
3. Number of students who play neither cricket nor badminton
4. Number of students who play cricket and football but not badminton.
5. Exit
Enter your choice:1
List of Stud Who Play both Cricket & Badminton are: [6, 8]
************************ !!!!!!!!!!!!!! ***************************
 
1. List of students who play both cricket and badminton
2. List of students who play either cricket or badminton but not both
3. Number of students who play neither cricket nor badminton
4. Number of students who play cricket and football but not badminton.
5. Exit
Enter your choice:2
The Stud Who Play only Cricket are: [2, 4]
The Stud Who Play only Badminton are: [3, 5]
************************ !!!!!!!!!!!!!! ***************************
 
1. List of students who play both cricket and badminton
2. List of students who play either cricket or badminton but not both
3. Number of students who play neither cricket nor badminton
4. Number of students who play cricket and football but not badminton.
5. Exit
Enter your choice:3
The Student who plays both Cricket and Badminton: [2, 4, 6, 8, 3, 5]
The Stud Who Play neither Cricket nor Badminton are: [1, 7, 9, 10]
************************ !!!!!!!!!!!!!! ***************************
 
1. List of students who play both cricket and badminton
2. List of students who play either cricket or badminton but not both
3. Number of students who play neither cricket nor badminton
4. Number of students who play cricket and football but not badminton.
5. Exit
Enter your choice:4
The Student who plays both Cricket and Football: [2, 4, 6, 8, 1, 7]
The Student who plays both Cricket and Football not badminton: [2, 4, 1, 7]
************************ !!!!!!!!!!!!!! ***************************
 
1. List of students who play both cricket and badminton
2. List of students who play either cricket or badminton but not both
3. Number of students who play neither cricket nor badminton
4. Number of students who play cricket and football but not badminton.
5. Exit
Enter your choice:5
>>>  

data structures and algorithms Web Developer