CS 105 Lab 3
The purpose of this lab is to practice the techniques of making choices and looping. Before you begin,
please be sure that you understand the following concepts that we went over in class:
How to use: if, elif, else
The difference between a w
1
CS 105 Lab 2
The purpose of our lab today is to explore Python operations and assignment statements, and then
begin to type in complete programs. Please create a new folder called lab02. Later today you will need
to save Python source files to this dire
Practice our problem-solving strategy
Find a partner for this exercise. Your group will be given one or more of these problems to solve. Please
write a very clear list of steps to solve the problem. You will discuss the solutions in class. Try your best,
CS 105 Lab 4
Today, we will practice with strings and lists. On your USB drive or account, please create a new folder
called lab04, and put all of todays work inside this folder.
First, lets use the shell to experiment with some expressions involving stri
1
CS 105 Lab #1 Binary representation of numbers
Binary numbers are the dough we use to represent all information inside the computer. The
purpose of this lab is to practice with some binary number representations. After finishing
this lab, you should fee
CS 105 Lab 6
In every lab so far, you have been using functions that have been provided to you by the Python system.
Today, you get to write your own functions. Functions are a great way to organize your solution to a
problem. Its also very interesting to
CS 105 Lab 5
There are two objectives to todays lab. First, I want to show you how to perform file I/O. And second,
you will write short Python programs corresponding to the practice problems you recently did in class.
Create a new folder on your USB driv
Answers to review questions.
1. Minimum number of bits
a. 7
b. 9
c. 6
d. 38
e. 14
f. In a 300-room hotel, for example, we would need 9 bits.
2. Converting to binary and octal:
a. Binary = 1011 1110 1110 1111
To convert to octal, we need to regroup the bin
CS 105 - Lab 9
Today's Objectives
Python Review. Today we'll be mastering t y . e c p statements.
r. xet
Implement one-time pads for use in cryptography and their strengths and weaknesses.
Learn about the Enigma machine by using a simulator.
Part 1: Er
CS 105 - Lab 10
Today's Objectives
Prime Number Generation
Implement Diffie-Hellman Key Exchange
Implement RSA Encryption
Part 1: Diffie-Hellman Key Exchange
In class you learned about the Diffie-Hellman-Merkle key exchange protocol, and how it can be
1
CS 105 Review Questions
Most of these questions appeared on past exams.
1. What is the minimum number of bits needed to store a single piece of data
representing:
a. An integer between 0 and 100?
b. An integer between 1600 and 2000?
c. A U.S. state?
d.
1
CS 105 Review Questions #2
In addition to these questions, remember to look over your labs, homework assignments,
readings in the book and your notes.
1. Explain how writing functions inside a Python program can potentially make the program
more concise
CS 105 - Lab 7
Today, you will be doing a lot with files! We will start with the basics of reading and writing and then expand upon the
pixel value work that you did in the previous lab by working on image processing with ASCII art. Let's get to it with t
CS 105 - Lab 8
Today, you will be implementing three different ciphers! There's a very weak Caesar cipher, a similarly weak
Transpositional cipher, and a stronger but not impenetrable Vigenere cipher. Let's get into it.
Part 1: ROT13
The first cipher that
Let's practice the Diffie-Hellman-Merkle key exchange protocol.
In other words, two people will agree on a key without actually sending it.
Alice chooses:
Example:
p = 29
q = 15
prime p =
q=
secret value a =
Alice computes:
a = 21
A = q * a mod p
Substitu
Introduction to Graphical User Interfaces (GUIs)
Up until now, all the programs we have implemented have been sequential in nature: if you look at
the main() function, you can readily see the sequence of actions that the program performs. And
those action