Course and Reading Material
One Dimensional Lists and Strings in Python
Formating floating point: b=float("{0:.2f}".format(a))
Future Plans
- Wed, Jan 27 - Lab Assignment
- Friday, Jan 29 - Mini Quiz
- Friday, Feb 5 - Exam 1
- Friday, Feb 26 - Exam 2
- Monday, Feb 29 - Game of Life Due Day
- Friday, March 4 - Mini Quiz
Jan 22 Lecture Practice
The Community Center in City A offers a wide range of activities: various group exercise classes, gym, swimming pool, personal
training, etc.
For each activity, the Center publishes the number of calories could burnt during 1 hour for each activity. Write a program
that reads the number of activities person participated during one week. The program creates a list of activity names - list
of strings - user input. The program also randomly generates a list of integers - number of hours spent on each activity per
week. The
program also randomly generates a list of integers - the number of calories that could be burnt for 1 hour for each activity.
The program creates a new list - total_calories. Each entry in the list is the total number of calories burnt per week per
activity. The program also finds the activity with minimal number of calories burnt per week.
See example below:
activity_names=["Yoga", "Tai-Chi", "Swimming", "Running", "Walking"]
calories_per_hour=[154, 240, 400, 600, 340]
hours_per_week=[6, 3, 2, 2, 3]
total_calories=[924, 720, 800, 1200, 1020]
the activity with minimal calories burnt per week - Tai-Chi, with 720 calories burnt per week.
Lecture Practice Wed Feb 3
Two Dimensional Lists
List initialization:
Option 1:
a = [[
0 for i in range(COL)] for j in range(ROW)]
The above line will create a list of ROW rows and COL columns and
assign value 0 to each element
Option 2
Mini Quiz Friday Feb 12
Test 2
Test 2
Lecture and Lab Practice Feb 24- Test Preparation
Program 1
Program 2
Program 3
Program 4
Tuples and Dictionaries in Python
Tuples and Dictionaries in Python
Some Dictionaries Methods
- clear
Clears the contents of a dictionary.
- get
Gets the value associated with a specified key. If the key is not
found, the method does not raise an exception. Instead, it returns
a default value.
- items
Returns all the keys in a dictionary and their associated values as
a sequence of tuples.
- keys
Returns all the keys in a dictionary as a sequence of tuples.
- pop
Returns the value associated with a specified key and removes
that key-value pair from the dictionary. If the key is not found,
the method returns a default value.
- popitem
Returns a randomly selected key-value pair as a tuple from the
dictionary and removes that key-value pair from the dictionary.
- values
Returns all the values in the dictionary as a sequence of tuples
Sorting Dictionaries
Part II of the course: Programming with C
Exam Date: Friday April 1, 2016
Exam 1 Programming in C
mini quiz April 15
mini quiqz april 15
Challenge
problems
Exam 2 C Programming
Exam 2
MINI QUIZ MAY 6
Mini Quiz May 6