0% found this document useful (0 votes)
3 views35 pages

Embryology

Uploaded by

chilakamahi9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views35 pages

Embryology

Uploaded by

chilakamahi9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Name: Karthik Allalli Registration Number:23ETCS002

Ramaiah University of Applied Sciences


Name: Karthik
Private University Allalliin Karnataka State by Act No. 15 of 2013
Established Registration

Faculty Engineering & Technology


Programme B. Tech. in Computer Science and Engineering

Year/Semester 1st Year /1st Semester


Name of the Laboratory Introduction to Computer Science and Engineering
Laboratory Code CSF106B

List of Experiments

1. Introduction to Python programming environment


2. Variables, data types, operators and expressions
3. Input output operations
4. Logic operations and decision making
5. Loop statements
6. Character and string operations
7. Functions
8. File handling
9. Data structures

2
Name: Athul Registration

Index Sheet
No Lab Experiment Lab document Viva
.

1 Introduction to Python Lab document


programming environment 10% of Lab CE

2 Variables, data types, operators Lab document


and expressions 10% of Lab CE

3 Input output operations Lab document


10% of Lab CE
4 Logic operations and decision Lab document
making 10% of Lab CE

5 Loop statements Lab document


10% of Lab CE
6 Character and string operations Lab document
10% of Lab CE
7 Functions Lab document
10% of Lab CE
8 File handling Lab document
10% of Lab CE
9 Data structures Lab document
10% of Lab CE
10 Lab Internal Test 10% of Lab CE

3
Name: Athul Registration

S. No Experiments Name Page No


1 Introduction to Python programming environment 5

2 Variables, data types, operators and expressions 6

3 Input output operations 8

4 Logic operations and decision making 10

5 Loop statements 12

6 Character and string operations 14

7 Functions 16

8 File handling 18

9 Data structures 21

4
Name: Athul Registration

Laboratory 1
Title of the Laboratory Exercise: Introduction to Python programming environment

1. Introduction and Purpose of Experiment


Python is a high level, interactive, interpreted, object oriented scripting language. Wing IDE
is an open source integrated development environment for programming in the Python
language. In this laboratory exercise, students get familiar with the program development
tool such as Wing IDE to edit and run Python programs using a set of simple exercises.

2. Aim and Objectives


Aim
 To familiarise IDE and simple Python
programs Objectives
At the end of this lab, the student will be able to
 Explain the features and use of IDE to develop Python programs
 Edit and execute simple Python programs

3. Experimental Procedure
Students are given a set of Python programs. Edit and execute Python programs using
 Python command line
 Using IDE
o Interactive mode
o Script mode

4. Presentation of

Results Interactive mode :

Fig 1.1

Output:

5
Name: Athul Registration

Fig 1.2

Fig 1.3
 Script mode:

Fig 1.4

Fig 1.5

Fig 1.6

Result of script mode :

Fig 1.7

6
Name: Athul Registration

Fig 1.8

Fig 1.9

5. Conclusions

1.Fig 1.1 ,1.2, 1.3 describes the python used in interactive mode

2.Fig 1.4, 1.5, 1.6, are the python progams used in script mode

3. Fig 1.7, 1.8, 1.9, describes the output of fig 1.4 , 1.5, 1.6 , respectively

4. These experiments helped me to learn the basics of python programming and different

methods of execution of python and use of IDE In python

7
Name: Athul Registration

Laboratory 2
Title of the Laboratory Exercise: Variables, data types, operators and expressions
1. Introduction and Purpose of Experiment
Variables are the basic data objects that are manipulated in a program. Every value in
Python has a datatype. Operators specify what is to be done to them. Expressions combine
variables and constants to produce new values. These building blocks are the topics of this
Lab. By solving the given programming problems, the students will be able to apply the
concepts of variables, data types, operators and expressions.
2. Aim and Objectives

Aim
 To develop programs using variables of basic data types and compute simple
expressions involving operators
Objectives
At the end of this lab, the student will be able to
 Use variables of the basic data types
 Apply various operators in expressions
 Create Python programs to solve simple numeric problems
3. Experimental Procedure
i. Analyse the problem statement
ii. Design an algorithm for the given problem statement and develop a
flowchart/pseudo-code
iii. Implement the algorithm in Python language
iv. Execute the Python program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment

4. Questions

a. Write a Python program to exchange the values of two variables using a temporary
variable.
b. Write a Python program to find the area and perimeter of a rectangle.

5. Calculations/Computations/Algorithms.

8
Name: Athul Registration

a.Write a Python program to exchange the values of two variables using a temporary variable.

Step 1 = Start

Step 2 = The variables taken are a,b

Step 3 = Read the variables a,b

Step 4 = a=temp

Step 5 = a=b

Step 6 =

b=temp

Step 7 = swap a and b values

Step 8 = print a and b

Step 9 = End

b.Write a Python program to find the area and perimeter of a rectangle.

Step 1 = Start

Step 2 = The variables taken are l,b

Step 3 = Read the variables l,b

Step 4 = area=l*b

Step 5 = perimeter=2(l+b)

Step 6 = print(“the area of the rectangle is” (area))

Step 7 = print(“the perimeter of the rectangle is” (perimeter)̥ )

Step 7 = End

6. Presentation of

Results a.code:

9
Name: Athul Registration

1
Name: Athul Registration

Fig2.1

Output:

Fig 2.3

b.code:

Fig 2.2

Output:

Fig 2.4

7. Conclusions

Figure 2.1 describes the python program for swapping of two numbers
Figure 2.3 describes the out put of fig 2.1 in which we can clearly see how by using python
we can clearly change the values or swap the values easily

1
Name: Athul Registration

Fig 2.2 helps us to find the area and perimeter of a rectangle use python easily
Fig 2.4 gives us the result or output of area and perimeter of a rectangle

8. Comments

1. Limitations of Experiments

a.For swapping two variables with temporary variable.

The limitation of above experiment is simple and common technique that may not be best when
handling the huge datasets, and the problem assumes the variables are of compatible types for
swapping.

b.Calculating the area and perimeter of a rectangle.

The limitation lies in its specificity to rectangles. If there is a need for different shape, Then the
code will require some modification.

2. Limitations of Results

a. For swapping two variables with temporary variable.

The result is independent on the input values or non numeric inputs might lead to unexpected
outcomes. It is important to validate the input to make sure the programme gives the correct
output

b Calculating the area and perimeter of a rectangle.

The precision of the results might be affected by the data type used for calculations. Floating
point arithmetic limitations could result in small errors, especially with very large or very small
dimensions.

3. Learning happened

a. For swapping of two variables with temporary variable.

From the above experiment a basic understanding of variable assignments, and the concept of
temporary storage was implemented.

b . Calculating the area and perimeter of a rectangle.

This program allowed for practical application of geometry concepts, enhancing understanding
in the context of programming.

4. Recommendations

1
Name: Athul Registration

a. For swapping of two variables with temporary variable.

Exploring alternative method such as tuple unpacking or arithmetic operations of swapping


could be considered. This may lead to more concise and more efficient code.

b. calculating the area and perimeter of a rectangle.

Considering the Incorporation of exception handling for invalid inputs or extending the
functionality to handle various shapes could enhance the program’s versatility.

1
Name: Athul Registration

Laboratory 3
Title of the Laboratory Exercise: Input Output operations
1. Introduction and Purpose of Experiment
Python provides the Input-Output facility to interact with the user. Some of the functions
such as input() and print() are widely used for standard input and output operations
respectively. By solving the problems, students will be able to develop programs to read
input from screen and display output to the screen.

2. Aim and Objectives


Aim
 To develop programs involving input output
operations Objectives
At the end of this lab, the student will be able to
 Apply input and output operations

3. Experimental Procedure
i. Analyse the problem statement
ii. Design an algorithm for the given problem statement and develop a
flowchart/pseudo-code
iii. Implement the algorithm in Python language
iv. Execute the Python program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment

4. Questions
a. Write a Python program to accept three numbers from the user (in a single line
separated by spaces) and display their average.
b. Write a Python program to enter an integer number and perform the following
operations (use built in methods) on the integer
 Square, Cube, and Factorial
5. Calculations/Computations/Algorithms

1
Name: Athul Registration

a. Algorithm to accept the three numbers from the user ( in a single line separated by spaces)
and display their average

Step 1: start

Step 2: the variables taken are a b c

Step 3: Read a, b, c separated by spaces

Step 4: sum=a+b+c

Step : Average = (a+b+c) /3 or sum/3

Step : print Average

Step : Stop

b.(i)Algorithm for finding square using build in function ()

Step 1:start

Step 2:the variable taken is a

Step 3:read the variable a

Step 4:square=a*a

Step 5:print square

Step 6 :stop

(ii)Algorithm for finding cube using build in function ()

Step 1:start

Step 2:the variable taken is b

Step 3:read the variable b

Step 4:cube=b*b*b

Step 5:print cube

Step 6:stop

1
Name: Athul Registration

ii.Algorithm for finding factorial using build in function ()

Step 1: start

Step 2: read the number

Step 3: set fact=1,i=1

Step 4: check condition i<=number,if false go to step 7

Step 5: fact=fact*i

Step 6: update i=i+1 go to step 4

Step 7: display fact

Step 8: stop

6. Presentation of Results

3a. code:

Fig 3.1

Output:

Fig 3.3

3b. code:

1
Name: Athul Registration

Fig 3.2

Output:

Fig 3.4

7. Conclusions

Fig 3.1 describes the python program to find the average of 3 numbers
Fig 3.3 Gives the result or output of the average of the three numbers
fig 3.2 and fig 3.4 we can conclude that how easily we can use python to calculate the square
cube and factorial of the given numbers

8. Comments

1. Limitations of Experiments :

This program is specifically designed for calculating the average of three numbers. If we need
to calculate the average of a different number of values, we would need to modify the
program accordingly.

2. Limitations of Results
The second programme is not applicable for other data types like float

1
Name: Athul Registration

3. Learning happened
To find average of 3 numbers and to perform the mathematics operations to calculate the
square cube and factorial of any number using python
4. Recommendations
We can create a programme with more inputs to find average

1
Name: Athul Registration

Laboratory 4
Title of the Laboratory Exercise: Logic operations and decision making
1. Introduction and Purpose of Experiment
Python provides number of control flow instructions/statements to control the flow of
program execution conditionally. By solving the problems, students will be able to apply
conditional control statements to control the program execution.

2. Aim and Objectives


Aim
 To develop programs involving branching using appropriate control statements in
Python
Objectives
At the end of this lab, the student will be able to
 Apply conditional control statements such as if-else and nested if-else to express
decisions
3. Experimental Procedure
i. Analyse the problem statement
ii. Design an algorithm for the given problem statement and develop a
flowchart/pseudo-code
iii. Implement the algorithm in Python language
iv. Execute the Python program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment

4. Questions
a. Write a Python program to check whether the given number is zero, positive or
negative.
b. Write a Python program to display the roots of a quadratic equation.

5. Calculations/Computations/Algorithms

a. Algorithm to check the whether the given number is zero, positive or negative.
Step 1:start
Step 2:the variable taken is a

1
Name: Athul Registration

Step 3:read the variable a


Step 4:if a>0 Then print a given number is positive
Step5: if a<0 then print a given number is negative
Step6:if a=0 then print a given number is equal to zero
Step7:print(a)
Step8:stop

b. Algorithm to display the roots of a quadratic equation.

Step 1: import math

Step 2: start

Step 3: Take variables a, b, and c.

Step 4: assign v ariables a, b, and c to float type.

Step 5: discriminant=(b**2) –(4*a*c).

Step 6: find discriminant.

Step 7: root_1=(-b+math.sqrt(discriminant)) /(2*a).

Step 8: root_2=(-b-math.sqrt(discriminant))/(2*a).

Step 9: print root_1 and root_2.

Step 10: stop.

6. Presentation of Results

4a.code.

Fig 4.1

Output: the result of a positive number

2
Name: Athul Registration

Fig 4.3

Output: the result of a negative number

Fig 4.3

Output: the result of a zero

Fig 4.3

4b.code: Write a Python program to display the roots of a quadratic equation

2
Name: Athul Registration

Fig 4.2

Output:

Fig 4.4

7. Conclusions

Fig 4.1, 4.3 details us that by using python how easily we can determine the value of given
number whether the number is positive negative or zero
Similarly fig 4.2 gives us the code for finding the roots of quadratic equation
Fig 4.4 gives the roots of the given values in the code above

8. Comments

1. Limitations of Experiments

If we enter a non numeric value such as a , b the python code doesn’t work

2.Limitations of Results

It is applicable only for quadratic equations

2
Name: Athul Registration

3. Learning happened

We learned to find the roots of quadratic equation using python and determine the
positivity or negativity of a given number

4.Recommendations

Can be done by other method also and we can use float and process the code

2
Name: Athul Registration

Laboratory 5
Title of the Laboratory Exercise: Loop statements

1. Introduction and Purpose of Experiment


Loop statements are used to repeat a statement or set of statements multiple times. By
solving the problems students will be able to apply iterative control statements to control
the program execution.

2. Aim and Objectives


Aim
 To develop programs involving loops using appropriate control statements in
Python Objectives
At the end of this lab, the student will be able to
 Apply loop control statements such as for and while to repeat a block of code

3. Experimental Procedure
i. Analyse the problem statement
ii. Design an algorithm for the given problem statement and develop a
flowchart/pseudo-code
iii. Implement the algorithm in Python language
iv. Execute the Python program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment

4. Questions
a. Write a Python program to accept an integer number and find sum of digits in the
number.
b. Write a program to perform addition and subtraction of two matrices
i. Without using numpy module
ii. Using numpy module

5. Calculations/Computations/Algorithms
a. Write algorithm to accept an integer number and find sum of digits in the number.

2
Name: Athul Registration

Step1: start
Step2: input the number and assign it to n
Step3: take sum is equal to zero
Step4: n is not equal to zero
Step5:take digit equal to remainder of n/10
Step6:take sum is eqal to the sum+digit
Step7:take n I sequal to n/10
Step8:output sum
Step9:go to step 4
Step10:stop
b.Algorithm to perform addition and subtraction of two matrices.
I Without using numpy module.
Step 1: start
Step 2: Define two matrices matrix1 and matrix2.
Step 3: print the elements of matrix1 and matrix2 using nested loops.
Step 4: Define an empty matrix result of the same size has matrix1.
Step 5: perform suitable addition and subtraction operations for elements of matrix1
and matrix2 using nested loops and store the result in the result matrix.
Step 6: print the result matrix.
Step 7: stop
II Using numpy module.
Step 1: start
Step 2: Import numpy has np into the program.
Step 3: Declare matrix 1 and give values.
Step 4: Declare matrix 2 and give values.
Step 5: perform suitable addition and subtraction operations for elements of matrix1
and matrix2.
Step 6: print the
result.
Step 7: stop.
6. Presentation of Results
5a.code:

2
Name: Athul Registration

Fig 5.1
Output:

Fig 5.3
5b.code Without using numpy module

fig 5.2
output

Fig 5.4

2
Name: Athul Registration

5b.code: Using numpy module

Fig 5.2
Output:

Fig 5.4
7. Conclusions
The first programme takes integers as inputs and interprets the the sum of the digits using
the logic and displays result
Second programme has 2 parts in the first we calculate sum of 2 matrices using inbuilt
function And In the second part we use numpy
8. Comments
1. Limitations of Experiments
In second Matrice part 1 matrices can be added or subtracted only they have same number
of rows and columns and the code is also long
And in the second part User should have numpy package download in the device using by him
2.Limitations of Results
The first program is lengthy as it contains more line of codes .we can use numpy instead
The second program is short but it lacks the foundation and logic behind the built in
function which is required for beginners to build their understanding in terms of matrices
3. Learning happened
Code can be done in two ways
4. Recommendations
We can compare both programs and find the code which takes the least time to execute.

2
Name: Athul Registration

Laboratory 6
Title of the Laboratory Exercise: Character and String operations

1. Introduction and Purpose of Experiment


A string is a sequence of characters. Strings can be manipulated using a number of built in
functions. By solving this, students will be able to manipulate string data types.

2. Aim and Objectives


Aim
 To develop programs for manipulating characters and
strings Objectives
At the end of this lab, the student will be able to
 Create programs to perform string operations
 Create programs to manipulate strings using built in functions

3. Experimental Procedure
i. Analyse the problem statement
ii. Design an algorithm for the given problem statement and develop a
flowchart/pseudo-code
iii. Implement the algorithm in Python language
iv. Execute the Python program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment

4. Questions
a. Write a Python program to find duplicate characters in the given string and store
them in a list.
b. Write a Python program to count the numbers of occurrences of characters in the
given string and store them in a dictionary.

5. Calculations/Computations/Algorithms
a.Write a algorithm find duplicate characters in the given string and store them in a list.

2
Name: Athul Registration

Step1: start
Step2: ask the user to input a string
Step3:store the input string in the variable n
Step4:create an empty list called d
Step5:for each character I in the input string n
Step6:count the number of occurances of I in the input string n using count()method
Step7:if the count of I is greater than 1
Step8:check if I is already present in the list d using the not in operatot
Step9:if I is not in d append I in list d
Step10:print the list d containing duplicate characters
Step11:stop

b.write algorithm to count the numbers of occurrences of characters in the given string and
store them in a dictionary.
Step 1:start
Step 2: input a string
Step 3 : create an empty dictionary called d
Step 4: take character ch in string st
Step 5: count is equal to st.count(ch)
Step 6 : d[ch] is equal to count
Step 7:print the dictionary
step 8: end
6. Presentation of
Results 6a.code:

2
Name: Athul Registration

Output:

6b.code

Output:

3
Name: Athul Registration

7. Conclusions
a).In conclusion, the Python program effectively identifies duplicate characters within a
provided string. By systematically traversing the string and utilizing a list to store duplicates,
it offers a clear representation of the repeated characters present. Such a solution
underscores Python's capabilities in string manipulation and algorithmic problem-solving.
b). In summary, the Python program adeptly analyzes a given string to determine the
frequency of each character. By leveraging a dictionary to map characters to their respective
counts, it offers a concise and organized representation of character occurrences. This
approach exemplifies Python's versatility in data structuring and efficient counting
methodologies.

8. Comments
1. Limitations of Experiments
1. In code 1 to find sum of all items in a list if we have only 1 item the code is not valid
2. to find the code for the largest number all the elements in the given list should be
different in not the code fails
3.the length of a string in python
4. The above code is case sensitive and it cant handle all Unicode characters given in input

2. Limitations of Result
This algorithm is not applicable in other data types except lists.

3. Learning happened
Learned about lists and strings

4.Recommendations
We can implement the same in logic in other data types and check the output.

3
Name: Athul Registration

Laboratory 7
Title of the Laboratory Exercise: Functions

1. Introduction and Purpose of Experiment


A function serves as an abstraction mechanism to view many things as one thing. The
function definition specifies the name of a new function and the sequence of statements
that execute when the function is called. Once a function is defined, it can be called as many
times as required. By solving these problems, students will be able to create user defined
functions.
2. Aim and Objectives
Aim
 To develop programs using user defined functions
Objectives
At the end of this lab, the student will be able to
 Apply user defined functions with proper definition
3. Experimental Procedure
i. Analyse the problem statement
ii. Design an algorithm for the given problem statement and develop a
flowchart/pseudo-code
iii. Implement the algorithm in Python language
iv. Execute the Python program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment

4. Questions
i. Write a Python program to find factorial of a number using recursion.
ii. Write a Python function to reverse a string (without using slicing or built in method).
Use the returned result to check whether the given string is palindrome or not.

5. Calculations/Computations/Algorithms

i. Write algorithm to find factorial of a number using recursion.

3
Name: Athul Registration

6. Presentation of Results

7a.code

Output:

3
Name: Athul Registration

7b.code

Output:

7. Conclusions

a). In conclusion, the Python program elegantly employs recursion to determine the factorial
of a given number. By breaking down the factorial calculation into iterative multiplications of
decreasing values, the program efficiently computes the desired result. This recursive
approach underscores Python's capability to handle complex mathematical operations with
a concise and structured methodology.

3
Name: Athul Registration

b). In summary, the Python function ingeniously reverses a string without relying on built-in
methods or slicing techniques. By comparing the original string with its reversed
counterpart, the function adeptly determines whether the string is a palindrome or not. This
approach exemplifies Python's flexibility in string manipulation and its capacity to tackle
fundamental programming challenges with clarity and efficiency.

8. Comments

1. Limitations of Experiments

The above given code is case sensitive and it may not handle all Unicode characters

2. Limitations of Results

The program returns a list of duplicate characters. Depending on our requirements, we


might want to change the output format or further process the results.

3. Learning happened

Learned about dictionary and string usages in python which makes it very easy for us to
understand

4. Recommendations

The output is only stored in dictionary format which is not useful for accessing in other
functions,

So we can try to store it in other data types.

You might also like