You are on page 1of 56

LESSON:-9

DATA MANIPULATION : PYTHON


Table of Content:
1. Overview
2. Purpose
3. What we will Learn
4. Introduction
5. Importance of Data Manipulation
6. Types of Data Manipulation
7. Project
8. Conclusion
9. Homework
UNVEILING THE LESSON OVERVIEW
• In today's class, we will learn about Data Manipulation in Python.

• In a block-based Python tool like Codely , Data Manipulation helps in


understanding the basic operations like arithmetic operations for numbers.

• It also helps in understanding conditional statements (if-else) to make


decisions based on conditions.
TAKE AN EXAMPLE FOR A BETTER
UNDERSTANDING

Calculating the Average score of a group of Students.


READY FOR A QUESTION…
Question 1:-
Data Manipulation helps in understanding the basic operations like
arithmetic operations for numbers.
A. True
B. False
Ans:-True
Explanation:-With the help of Data Manipulation we perform the basic
operations like arithmetic operations for numbers.
ARE YOU UP FOR A CLOSER
LOOK?
GETTING TO THE CORE PURPOSE OF
THIS LESSON

Let's embark on a digital adventure as we delve into the exciting


purpose of this lesson. In simple terms, this session will help you
understand:
GETTING TO THE CORE PURPOSE OF THIS
LESSON(cont..)
• Data manipulation helps organize information so it's easier to understand
and use.

• It helps make data more useful by arranging it in a way that makes sense
for analysis or presentation.

• Data manipulation helps solve problems by allowing us to extract


important information and draw conclusions.
READY FOR A QUESTION…
Question 2:-
Data Manipulation helps in:-
A. Addition
B. Subtraction
C. Division
D. All of the Above

Ans:-All of the Above

Explanation:- Data Manipulation helps in understanding the basic operations like arithmetic
operations for numbers
TIME TO EXPLORE OUR LEARNING
JOURNEY
We're starting with Data Manipulation in Python with block coding
where we will:-

• Explore the basics of Data Manipulation in python.

• Execute hands- on project on codely platform.

• Explore the advantages of Data Manipulation.


TIME TO EXPLORE OUR LEARNING
JOURNEY(cont…)
• In this lesson we will learn about different types of data like numbers
and text.

• We will understand how to store data using variables, like storing a


name or a number.

• Learn how to perform simple arithmetic operations like addition and


subtraction.
TIME TO EXPLORE OUR LEARNING
JOURNEY(cont…)
• It helps in understand how to make decisions in code using if-else
statements based on conditions.

• It also helps to learn basic techniques to clean up messy data, like


removing duplicates or fixing errors.
READY FOR A QUESTION…
Question 3:-
Is Data Manipulation helps in understand how to make decisions in
code using if-else statements .
A. True
B. False
Ans:-True
Explanation:-It helps in understand how to make decisions in code using
if-else statements based on conditions.
GOT THE IDEA CLEARLY?
Let’s Explore the Introduction
• Data manipulation refers to the process of changing or transforming
data to make it more useful and meaningful.

• Data Manipulation helps to learn what data is - information or facts


that can be collected and stored for use.

• It helps in discovering the different types of data such as numbers (like


5 or 3.14) and words (like "apple" or "banana")
Let’s Explore the Introduction(cont.)
• Data is information. It can be numbers, words, or anything we can
collect or write down.

• We can do things with data, like adding more things to them, taking
things out, or changing the order that is known as Manipulation.

• We can use data to make decisions in Data Manipulation.


READY FOR A QUESTION…
Question 4:-
With the help of Data Manipulation , you can
A. adding more things to them
B. taking things out
C. changing the order
D. All of the above

Ans:-All of the above.

Explanation:-We can do things with data, like adding more things to them,
taking things out, or changing the order that is known as Data Manipulation.
Ready for Breeze?
Activity 1:-
using CODELY Platform

Prompt the user to create a variable.

SOLUTION
Question Time
Ques 5 :-
Set variable block is found under logic block
A. True
B. False

Ans:-True
Explanation:-We can find that under variable block section
Let’s Explore the Introduction(cont.)
Let’s Explore the Introduction(cont.)
• We can learn about basic operations we can do with data, such as
adding numbers together or combining words.

• Understand how we can use data to make decisions, such as choosing


what to wear based on the weather.

• Some real-life examples of data manipulation are organizing a list


Toys.
READY FOR A QUESTION…
Question 6:-
If-else can be found under which block section?
A. Logic
B. Variable
C. Text
D. Loop
Ans:-Logic
Explanation:-We will get the if else block element from the logic block section.
Ready for Breeze?
Activity 2:-
using CODELY Platform

Prompt the user to enter two numbers and add them.

SOLUTION
ARE YOU CATCHING ON?
Types Of Data Manipulation in Python
There are several types of data manipulation in Python that could be
introduced and are focused on fundamental concepts:-

1.Basic Arithmetic Operations: Addition, subtraction, multiplication,


and division of numbers.

2.Conditional Statements: Using if-else statements to make decisions


based on conditions.
Importance of Data Manipulation in
Python
• Data manipulation helps us understand and make sense of the
information we have by organizing it in a way that's easier to work
with.

• It allows us to solve problems by analyzing and manipulating data to


find solutions, like calculating averages or sorting items.
Importance of Data Manipulation in
Python(cont.)
• Data manipulation helps us make decisions by processing and
interpreting data.

• Data manipulation in Python is essential for organizing, analyzing, and


understanding data, which are valuable skills for problem-solving and
decision-making in various situations.
READY FOR A QUESTION…
Question 7:-
Is Data Manipulation helps in decision making ?
A. True
B. False
Ans:-True
Explanation :-Data manipulation helps us make decisions by processing
and interpreting data.
Ready for Breeze?
Activity 3:-
using CODELY Platform

Prompt the user to enter two numbers and multiply them.

SOLUTION
IS THE CONCEPT
ABSORBED?
Let’s Showcase our Skills !!!
• Get set to craft something amazing – our project adventure begins
now!

• It’s time to craft our project using these guided steps...

• Check the value in the variable score and if it is greater than 18 print
Pass otherwise print Fail(using decision making statements).
Step 1: To get started, open our Codely Platform and head to the
Practice Factory.
https://portal.aptcoder.com/dist/python_factory.html
Step-2-
Now, we are working with this input section incorporating various
blocks
• Start with the Run Command and after that, we insert our blocks.
• Toggle button will help u to see the text based coding part.
Step-3
Now, click on variable and create a variable and name it as score
Step-4
Now, click on variable and take set block element under it and using
Math block assign a value 45 to the variable score.
Step-5
Now, click on logic and drag and drop the if block to the input section
under set block element
Step-6
Now, click on logic and drag and drop the if block to the input section
under set block element.
Step-7
• Now, click on logic block from which you will get the comparison
block element with ‘=‘ symbol
• Just drag and drop it on the if for attaching condition.
Step-8
• Now click on the Variable block and take score variable from it attach it on the
left side of ‘=‘ symbol
• Go to Math block and take Zero block element and drop it on the right hand side
of ‘=‘ symbol, change 0 to 18
• Click on the ‘=‘ symbol and change it to ‘>’ symbol
Step-9
• Now click on the text block and take print block element from it and drop it below if(in do).
Then type pass on it.
Step-10
• Click on the settings like symbol on the left side of if then you will get the
following options.
Step-11
• Click on the else and drop it on the bottom of if in the option part itself(note: you
have to attach else on the if block in the option screen that you got while clicking
on the settings, not in the input section) .
• Then else block will appear on the input screen also.
READY FOR A QUESTION…
Ques 8:-
We can’t create else block element under if block element.
A . True
B . False
Ans:-False
Explanation:-Click on the settings like symbol on the left side of if then
you will get the options for else.
Step-12
• Click on text block and take print block element and drop it in else
• Type fail in it.
Ready for Breeze?
Activity 4:-
using CODELY Platform

Prompt the user to enter a value and check if the value is greater than
15 print Good else print Bad.

SOLUTION
Step-13
• If you want to check change the value of score to 10 in set block
element and RUN it again.
READY FOR A QUESTION…
Ques 9:-
For evaluating conditions the comparison operators are available
under which block
A. Math
B. Loop
C. Logic
D. Variable
Ans:-Logic
Explanation:- We will get the comparison operators from the logic
section.
PROJECT LINK

https://portal.aptcoder.com/dist/python_factory.html?1
?shared?b5719fa5-9f4b-4734-aadd-5d17d707a58e
Output Screen looks like:-
ARE YOU FOLLOWING
ALONG ?
MOVING FORWARD, LET’S HEAD TO THE CONCLUSION

• We've learned that data in Python comes in different types, such as


integers (whole numbers), and floats (decimal numbers).

• By using arithmetic operators like addition (+), subtraction (-),


multiplication (*), and division (/), we can perform mathematical
operations on our data.

• We've seen how conditional statements (if, else) and can be used to
control the flow of our programs based on certain conditions.
LET'S WRAP IT UP WITH ONE LAST
QUESTION!
Question 10:-
DID YOU FOLLOW ALONG AND ENJOY OUR AWESOME FIRST PROJECT?
Ready for Breeze?
Activity 5:-
using CODELY Platform

Create a variable and check whether a number is Even.

SOLUTION
ARE YOU CLEAR ON THIS?
HOMEWORK CHALLENGE

Prompt the user to enter two numbers and divide them.


Achievement unlocked!
Solved the problem?
Great!

If you're still on the journey, explore the solution for a hint.

Click here for SOLUTION

You might also like