

2.2 String Manipulation
Presentation
•
Computers
•
10th Grade
•
Practice Problem
•
Medium
Leah Tomlinson
Used 9+ times
FREE Resource
11 Slides • 4 Questions
1
2.2 String Manipulation
Work through the slides and questions independently, then complete the tasks attached to the assignment in google classroom.

2
Multiple Choice
Which of the following code is a function?
def addition(num1, num2):
total = num1 + num2
print(total)
#main program
addition(3,6)
def addition(num1, num2):
total = num1 + num2
return total
#main total
sum = addition(3,6)
print(sum)
3
Multiple Choice
What is the difference between a procedure and a function?
A function has parameters a procedure does not
A function contains calculations a procedure does not
A function needs to return a value to the main program a procedure does not
4
Sometimes when programming we want to chop and change our strings to meet the needs of the program. For example, you might have an input which asks a user for their first and last name. The program you develop might need that input to be split into two separate variables, Python has string manipulation tools which allow us to do this.
5
Above are the different ways we can manipulate strings to suit our program needs. You may have used some of them before in programming or they could be completely new to you. I have included a link to a website which shows you how to use each of them in python.
6
Complete this task, open the presentation posted in Google Classroom, you need to match the first sets of code to an alternative way of writing it and then match it to the description of what it does.
7
Multiple Choice
When wanting to find the length of a string, which code would you use?
length(string)
length = string.length
length = len(string)
8
Multiple Choice
What would the code 'name.substring(3,5)' return?
5 characters in the string starting from the 3rd
3 characters in the string starting from the 5th
The 3rd to the 5th character in the string
9
Here we have an example of a string "Freda Smith", in the table at the bottom. Here we have first taken a substring starting at position 1 and ending in position 3 resulting in the string "RED". In the second example we are trying to find the location of "S", so the function will search the string find the index and return it. Finally, we use the length function to find how long the string is, in this example "11"
10
Complete the task posted in the assignment, for this task you need to say what the output would be using the string for each line of code/
11
ASCII is an internationally used character set which gives every character its own unique binary code using up to 32 bits. The function ASC("A") would return the decimal number the character represents, in this case 65. The "A" can be substituted for any number. The CHR(66) function will do the opposite, again "66" can be substituted for any number.
12
For this task you need to work through the algorithm to identify what the value of each variable will be when the algorithm has completed.
13
There are 5 tasks which require you to complete string manipulation, some of them just require you to fill in the blanks and others require you to write the full algorithm. These can be written using Python just ensure that all syntax is correct.
14
Final task is some exam style questions on String manipulation, ensure you consider the number of marks available when writing your answer. They are all algorithm questions and so again Syntax will need to be as accurate as possible if writing in Python.
15
The tasks discussed are due in today (Wednesday 20th) you should have also completed and uploaded the tasks from Mondays lesson - subprograms.
2.2 String Manipulation
Work through the slides and questions independently, then complete the tasks attached to the assignment in google classroom.

Show answer
Auto Play
Slide 1 / 15
SLIDE
Similar Resources on Wayground
10 questions
multimedia
Lesson
•
10th Grade
13 questions
An Opinion Essay
Lesson
•
10th Grade
10 questions
Geometry Medians and Altitudes
Lesson
•
9th - 10th Grade
10 questions
KABEL LAN
Lesson
•
10th Grade
11 questions
Inverse Functions
Lesson
•
10th Grade
10 questions
SISTEM KOMPUTER
Lesson
•
8th - 9th Grade
11 questions
Federalist Vs. Anti-Federalist
Lesson
•
10th Grade
11 questions
GLOBALIZATION
Lesson
•
10th Grade
Popular Resources on Wayground
8 questions
Spartan Way - Classroom Responsible
Quiz
•
9th - 12th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
14 questions
Boundaries & Healthy Relationships
Lesson
•
6th - 8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
3 questions
Integrity and Your Health
Lesson
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
9 questions
FOREST Perception
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade