CMPT 120 Lecture 12 – Unit 2 – Cryptography and Encryption –

Slides:



Advertisements
Similar presentations
ECS 15 if and random. Topic  Testing user input using if statements  Truth and falsehood in Python  Getting random numbers.
Advertisements

Python Magic Select a Lesson: Why Learn to Code? Basic Python Syntax
Lecture 14 Go over midterm results Algorithms Efficiency More on prime numbers.
Computer Science 1620 Programming & Problem Solving.
Computer Security coursework 2 Dr Alexei Vernitski.
Introduction of Engineering (ENGR 10) Guest Lecture March 24, 2014.
Conditions. Objectives  Understanding what altering the flow of control does on programs and being able to apply thee to design code  Look at why indentation.
Chapter 7 Problem Solving with Loops
© The McGraw-Hill Companies, 2006 Chapter 3 Iteration.
Computer Programming 12 Lesson 6 – Loop structure By: Dan Lunney.
PYTHON PROGRAMMING Year 9. Objective and Outcome Teaching Objective Today we will look at conditional statements in order to understand how programs can.
Starter What does the following code do?
Week 1, Day 3 Lazy Coding 29 June 2016.
Topic: Introduction to Computing Science and Programming + Algorithm
3.1 Fundamentals of algorithms
Topic: Recursion – Part 2
Topic: Functions – Part 1
Topic: Iterative Statements – Part 1 -> for loop
Repetition Structures
Software Development Expansion of topics page 28 in Zelle
CMSC201 Computer Science I for Majors Lecture 22 – Searching
CMPT 120 Topic: Searching – Part 1
CMPT 120 Topic:  Case Study.
CMPT 120 Topic: Functions – Part 4
Worked Examples - Incremental Software Development Worked Example
Topic: Functions – Part 2
Introduction to Programmng in Python
While Loops in Python.
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Last Class We Covered Data representation Binary numbers ASCII values
Learning to Program in Python
Learning to Program in Python
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Multiple Selections (ELIF Statements)
Last Class We Covered Dictionaries Hashing Dictionaries vs Lists
Do While (condition is true) … Loop
Coding Concepts (Basics)
Repetition Structures
Problem Solving Skill Area 305.1
Programming We have seen various examples of programming languages
Picture This! Fractions and Wholes.
Flowcharts and Pseudo Code
Computer Science The 6 Programming Steps.
CHAPTER 5: Control Flow Tools (if statement)
POWER CHALLENGES Several Ways To Solve 7 CHALLENGES.
Introduction to Python
Creating Maintainable code
CMPT 120 Lecture 3 - Introduction to Computing Science – Programming language, Variables, Strings, Lists and Modules.
Algorithms For use in Unit 2 Exam.
CMPT 120 Lecture 16 – Unit 3 – Graphics and Animation
While Loops in Python.
Topic: Iterative Statements – Part 2 -> for loop
CMPT 120 Lecture 15 – Unit 3 – Graphics and Animation
CMPT 120 Lecture 10 – Unit 2 – Cryptography and Encryption –
CMPT 120 Lecture 9 – Unit 2 – Cryptography and Encryption –
CMPT 120 Lecture 13 – Unit 2 – Cryptography and Encryption –
Lecture 31 – Practice Exercises 7
CMPT 120 Lecture 19 – Unit 3 – Graphics and Animation
Lecture 17 – Practice Exercises 3
CMPT 120 Lecture 18 – Unit 3 – Graphics and Animation
Lecture 8 – Practice Exam
Lecture 20 – Practice Exercises 4
Creating readable code
Lecture 20 – Practice Exercises 4
Lecture 37 – Practice Exercises 9
Lecture 17 – Practice Exercise 3 SOLUTIONS
Thinking Multiplicatively: From Arrays to the ‘Area Model’
Lecture 37 – Practice Exercises 9
CMPT 120 Lecture 26 – Unit 5 – Internet and Big Data
Presentation transcript:

CMPT 120 Lecture 12 – Unit 2 – Cryptography and Encryption – The realm of secret codes Python – Functions

Today, we shall … Go over the Practice Exam 2 Have a quick word about the Weekly Exercises Complete our Encrypt and Decrypt program (transposition algorithm) Have an activity Use functions in a new version of our Encrypt and Decrypt program

Practice Exam 2 Part 1 – Theory and Understanding If each multiple choice question is worth 1 mark, what is your score (out of 8) for Part 1? Part 2 – Coding How did Part 2 go for you? Did you understand the problem to solve? Was it difficult to come up with an algorithm? Was it challenging to writing the program on paper? If so, why?

Let’s go over Question 10 Problem Statement: Write a Milk Survey Bot that asks the user whether s/he has tried almond, coconut, cow, goat, hemp, oat, rice, and/or soy milk. Your Milk Survey Bot must then print the number of different kinds of milk the user has tried. Here is a sample run:

Remember - Steps we perform when we program (develop software) Design solution (algorithm) Problem statement Implement program Test

Question 10 (cont’d) BONUS Part 1: Write your Python code such that it does not include the actual number 8 in its last print statement print(“Wow! You … (out of 8).”) Instead, your program figures this number by calling a function. This number 8 here!

Question 10 (cont’d) BONUS Part 2: After your Milk Survey Bot has printed the number of different kinds of milk the user has tried, it then prints the names of the milks the user has tried. Hint: This printing must be done after (outside) the loop. Here is a sample run with the BONUS part:

https://repl.it/repls/FoolhardySameMeasurements Last Lecture, we did …

How did we solve the decrypt problem?

Implementing the solution https://repl.it/repls/WarmheartedFavoriteDeletions

Activity -

Let’s now move on to … Functions Let’s see if we can use functions in a new version of our Encrypt and Decrypt program

By the way, what is a Python statement? Next Lecture We shall look at another way of repeating Python statements in our programs while loop By the way, what is a Python statement?