This project helped me get comfortable getting values of various types from the
user and using variables while calculating different things. The task was to simulate
the cash register experience at a fictional store.
I'm going to simulate the cash register at Weasleys Wizard Wheezes. For reference,
knuts are the smallest currency; one sickle is worth 29 knuts; one galleon is
worth 17 sickles. I will create a simple menu to ask the user for input on what he is buying,
how is he paying and giving him change in our currency at the end.
Selection statements (if/elif/else combinations) allow us to write code that can execute different statements based on the current values seen in a particular run of the program. I used this to write a program that performs calculations and selectively reports on different properties of the calculated values. I asked the user for names and scores, and then reported back the information sorted on different characteristics (alphabetical, increasing score, decreasing score).
sorry,that was not an option!, and just goes to theGoodbye!printing at the end.
alphabetic order :,
ascending score order:, or
descending score order:. If there were any ties, print out how many tied, but not the names. For instance, you might be printing either
two scores tiedor
three scores tied.
Goodbye!, no matter which outcome occurred.
Loops allow us to run the same code multiple times. I used this to write a program that accepts a number from the user, and then checks interesting properties of that number. The user can use the menu to select which check to perform, when to input a new number and when to exit.
I will ensure the user enters a valid option before continuing. If they type in any other integers, I print, "I didn't understand, please try again." and then re-print the whole menu.
In this project, I have constructed a two-dimensional representation of a
grid containing letters (and blank spaces), and then determined if all the letters are
connected to each other, and if all spelled words are valid words from our 'dictionary'
of words. The idea behind this grid layout of letters is borrowed from games that are
played with the letter tiles from Scrabble, going by names such as "Bananagrams"
or "Take Two". I'm not implementing the entire game!
Functions provide a valuable mechanism: naming a block of code that can be called
upon again and again by name. Even more importantly, though, we can parameterize these
blocks of code to accept fresh values each time they are run, and also give back a
freshly calculated value, each time. Parameterizing code makes it much more reusable;
we find the commonality and write it once. There's certainly an art to figuring out how
to break down a large task into smaller, reusable pieces. I have wrote various functions,
some of which ought to be calling each other to make the task simpler.
I will just list the name of the function that I wrote for this project, I
will not explain because that will take too much space but if you have question about a
particular one just contact me. These were the functions that I wrote
Warmups | Interacting with Lists | 2D Lists | Zipping | Frequencies |
---|---|---|---|---|
|
|
|
|
|
This project allows read/write files in the CSV format. More specifically,
I have write Python code that reads in annual population estimates for 50 states and the
District of Columbia as released by U.S. Census Bureau.
I have created dictionary entries for individual states, reading, combining and
relating data from multiple years, providing brief reports and finally storing data
into another CSV format file. You must define certain functions in you resolution, with
the described behaviors. I have created a simple menu structure for testing purposes.
I have written a program that will read data from a file, it creates dictionaries
with the data and we will creates statistics from them. In the end we will write
these reports in files. Show the menu helps to understand what this program does with
data that has been read by the CSV file.
My goal was to create the infrastructure for a calendar application that
can store events and check if two events would overlap (clash). In order to do this, I
have created classes that represent a moment in time, a span of time, an event
(like "lunch with mom"), and an event planner. Also, I have created an Exception class,
which will handle the exception and other kinds of more basic exceptions as part of the
various methods and functions that I have written.
I will not create the full application, as that would be too large a project but
I could imagine storing the event planner to a text file and creating a small menu to
load the event planner, show it to the user, and give them options for adding/removing
events.
I have specified exactly what the class, method, and function signatures must be.
I have started by creating a couple of the classes and just their init/str/repr methods.
After I was comfortable with the classes and how they worked, I started to implement more and
more of the required methods, until I created a nice set of data types that I
could use in future to make my own PythonCalendar program.