Advanced Topics in Python “Review”

In this assignment, we created codes that helped us review older topics including lists, dictionaries and lambda, as well as slicing . This assignment is very helpful because the final is coming soon and this is a way of studying. Overall this assignment helped me understand some of the older topics better.

review-15 review-16 review-17 review-18

A Day at the Supermarket

For this assignment, we had to use our knowledge of dictionaries and lists in order to complete the assignment. We also used loops and conditionals as well in order to complete the assignment. This assignment taught me how to use dictionaries and how to add to it them using either more dictionaries or loops.

supermarket1 supermarket2 supermarket3 supermarket4 supermarket5 supermarket6 supermarket7 supermarket8 supermarket9 supermarket10 supermarket11 supermarket12 supermarket13

Battleship

This assignment taught me how to create a functioning game Battleship using python. This program heavily used loops in order to work. I created the board using the for loop and made it have 5 iterations. I also used the randint in order for battleships to be randomly be placed on the board. I also used the raw_input command in order to select the spots where I thought the ships would be. Using more loops, the game would end after 3 turns of guessing incorrectly, or correctly guessing the location of the ship. These loops would also tell me if I was outside the board, and if I had already called the location earlier.

battleship10 battleship11 battleship12 battleship13 battleship14 battleship15 battleship16 battleship17 battleship18

Date and Time

This assignment taught me how to show the current date and time using python. I learned about a new module, datetime. In order to complete this assignment, I had to use what we learned about strings and apply it to the program. The assignment was basically just replacing symbols and words in order for the program to work properly.

 

datetime1 datetime2 datetime3 datetime4 datetime5 datetime6