GCSE COMPUTER SCIENCE Practical Programming using Python

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Procedures and Functions. What are they? They are both blocks of code that can be reused to perform specific task. However there is a difference: Function-
Computer Science & Engineering 2111 Text Functions 1CSE 2111 Lecture-Text Functions.
CSI 101 Spring 2009 Review and Recap of Visual Basic Wednesday, April 29 th.
Noadswood Science,  To understand what strings are and how decisions are made Thursday, September 17, 2015.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Manipulating Text In today’s lesson we will look at: why we might want to pick out parts of text strings some BASIC functions that can be used to chop.
Fundamentals of Python: First Programs
Comments in Java. When you create a New Project in NetBeans, you'll notice that some text is greyed out, with lots of slashes and asterisks:
Lesson 6. Python 3.3 Objectives. In this lesson students will learn how to output data to the screen and request input from the user. Students will also.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 8: Fun with strings.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 4: Writing programs.
Sequencing The most simple type of program uses sequencing, a set of instructions carried out one after another. Start End Display “Computer” Display “Science”
COMPE 111 Introduction to Computer Engineering Programming in Python Atılım University
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 3: Built-in functions.
Make a function This is a starter activity and should take 5 minutes [ slide 1 ] >>> def count(number): n=1 while n
Lesson 4 Accelerometer.
GCSE COMPUTER SCIENCE Practical Programming using Python Lesson 4 - Selection.
Computer Programming Your First Java Program: HelloWorld.java.
GCSE COMPUTER SCIENCE Practical Programming using Python
var variableName:datatype;
GCSE COMPUTER SCIENCE Practical Programming using Python
what is computer programming?
Whatcha doin'? Aims: To start using Python. To understand loops.
String Methods Programming Guides.
COMPSCI 107 Computer Science Fundamentals
Computer Science A-level
Introduction to Programming
GCSE COMPUTER SCIENCE Practical Programming using Python
GCSE COMPUTER SCIENCE Practical Programming using Python
Module 5 Working with Data
Tuples and Lists.
Lesson 1 An Introduction
GCSE COMPUTER SCIENCE Practical Programming using Python
Lesson 07: Strings Topic: Introduction to Programming, Zybook Ch 6, P4E Ch 6. Slides on website.
Engineering Innovation Center
String Manipulation.
Little work is accurate
Input/Output Input/Output operations are performed using input/output functions Common input/output functions are provided as part of C’s standard input/output.
Python Lesson 6 Mr. Kalmes.
Teaching London Computing
Python I/O.
Decision Structures, String Comparison, Nested Structures
Lists in Python.
Javascript Game Assessment
Learning Outcomes –Lesson 4
Manipulating Text In today’s lesson we will look at:
The backslash is used to escape characters that are used in Python
Lesson 4 Accelerometer.
CIS16 Application Development and Programming using Visual Basic.net
Comparing Strings – How to
Task 1 Computer Programming LEVEL 6 PROGRAMMING:
Introduction to Programming
Module 4 Loops.
String and Lists Dr. José M. Reyes Álamo.
Introduction to Programming
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Introduction to Computer Science
Compound Conditionals
Introduction to Computer Science
Introduction to Programming
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Errors.
WJEC GCSE Computer Science
Introduction to Programming
Python 8 Mr. Husch.
Starter Activities GCSE Python.
Class code for pythonroom.com cchsp2cs
COMPUTING.
Computer Science A-level
Presentation transcript:

GCSE COMPUTER SCIENCE Practical Programming using Python Lesson 6 – String Manipulation

Screenshot the result of this code: String Manipulation Python has a lot of built in methods that allow us to easily manipulate (change) strings. The len method counts the number of characters in a string. Try it for yourself. Screenshot the result of this code: Save the program as stringlen.

Write the following Python program and press F5 to run. Activity 1 Write the following Python program and press F5 to run. Explain what this code does: Save the program as string1.

Write the following Python program and press F5 to run. Activity 2 Write the following Python program and press F5 to run. Explain what this code does: Save the program as string2.

Write the following Python program and press F5 to run. Activity 3 Write the following Python program and press F5 to run. Explain what this code does: Save the program as string3.

Write the following Python program and press F5 to run. Activity 4 Write the following Python program and press F5 to run. Explain what this code does: Save the program as string4.

Write the following Python program and press F5 to run. Activity 5 Write the following Python program and press F5 to run. Explain what this code does: Save the program as string5.

Write the following Python program and press F5 to run. Activity 6 Write the following Python program and press F5 to run. Explain what this code does: Save the program as string6.

Write the following Python program and press F5 to run. Activity 7 Write the following Python program and press F5 to run. #returns a True or False value text = (“I love Computer Science”) print(“C” in text) Explain what this code does: Save the program as string7.

Write the following Python program and press F5 to run. Activity 8 Write the following Python program and press F5 to run. #returns the position, only finds first instance text = (“I love coming to school each day”) print(text.find(“m”)) Explain what this code does: Save the program as string8.

String Formatting {:^15} {:<10} {:>20} Example You can use string formatting to get greater control over how strings are displayed on screen. We create placeholders for the string, each placeholder is enclosed inside curly brackets. {:^15} This example creates a placeholder that is 15 characters in length and whatever is placed inside it will be centred. {:<10} 10 characters in length and left aligned. {:>20} 20 characters in length and right aligned. Example

Write the following Python program and press F5 to run. Activity 9 Write the following Python program and press F5 to run. Write a program that outputs your first name and last name under those same headings. It should use 15 characters for each and be centre aligned. Use the example to help you. Place a screenshot of your code here Save the program as string9.

Write the following Python program and press F5 to run. Activity 10 Write the following Python program and press F5 to run. Write a program that outputs your first name and your age under those same headings. It should use 20 characters for each and be left aligned. Place a screenshot of your code here Save the program as string10.

Write the following Python program and press F5 to run. Activity 11 Write the following Python program and press F5 to run. Write a program that outputs the date and the time under those same headings. It should use 10 characters for each and be right aligned. Place a screenshot of your code here Save the program as string11.