MP1
In this assignment you had to create a password authentication program that prompts the user to enter a password. The program should compare the entered password with a predefined correct password and provide feedback on whether the entered password is correct or incorrect. The program should allow the user to try again a limited number of times before locking them out. Something that I learned while doing this assignment is how to do while loops.
In this assignment you are to program a robot to create a picture using what we learned so far about loops and functions. The picture should express your creativity and understanding of how to use programming tools we have learned so far. Something that I learned in this assignment is how to do loops so I don't have to say the same code over and over again. Something else that I learned is how to set position for Tracy to be at.
Simple Calculator
In this assignment you have to create a simple calculator program that allows users to perform basic arithmetic operations (addition, subtraction, multiplication, and division) with error handling for invalid inputs. Something that I learned while doing this assignment is how to use if , elif, and else coding.
In this assignment you have to ask questions to the person if they have fever or any symptoms during the COVID pandemic. Something that I learned during this assignment is how to use yes or no answer and respond to them. Something that I could do better in this assignment is to finish it and not have errors.
MP2
In this assignment you have to make a game called The Game of Pig. It is a classic game played with a 6 sided die. In the game a player rolls the die. If they roll a 2 through 6, they add that score to their round score, but if they roll a 1, their round is over and their round score resets to zero. At any point, the player can choose to bank their round score. When they do that, the points are added to their overall score and their round score resets back to zero. Once the player’s overall score reaches 100, they win. While the die roll is random, there is a little strategy when deciding whether to bank or continue in the round. If you try to be a pig and get more points, you may lose everything and have to start over! Something that I learned in this assignment is how to make while loop and to make it stop after you complete something.
In this assignment you have to create a Black History Month Quiz Game that tests users' knowledge about significant events and figures in Black history. Something that I learned in the assignment is that you have to make question and add a if statement to have the write answer. Something that I could have done better is to finish this assignment and add more code.
MP3
NameHat is a class designed to simulate a container for names, akin to a hat where names can be inserted and drawn randomly. This class encompasses the following functionalities:
- Initialization (__init__): Constructs an empty NameHat.
- Representation (__repr__): Specifies how the NameHat should be displayed, showing the names contained within.
- Insertion of Names (insert_name): Adds a name to the NameHat if it's not already present.
- Drawing a Name (draw_name): Removes and returns a randomly chosen name from the NameHat. This is achieved by utilizing the random.choice function after importing the random module.
To evaluate the functionality of the NameHat class, an instance of the class can be created for testing purposes. Names can be added to the NameHat using the insert_name method, ensuring that duplicate names are handled appropriately. Lastly, the contents of the NameHat can be printed both before and after selecting a name using draw_name.
Develop a program that interacts with the user by prompting them to input their name and a message. The program then proceeds to append this input data to a file named "guest_book.txt", adhering to a specific format: each entry is structured as "Name: [name], Message: [message]".
For instance, if a user inputs:
```
Enter your name: John
Enter your message: Hello, I enjoyed your website!
```
The program will append this input to the end of "guest_book.txt" as:
```
Name: John, Message: Hello, I enjoyed your website!
```
Subsequently, upon successful entry, the program provides feedback to the user, informing them that their input has been duly recorded.
MP4
The Construction class is already implemented, though it's recommended to review it for understanding its usage.
Following that, in the main method, prompt the user to input the sales tax rate in decimal form, as well as the quantities of boards and windows required.
Instantiate a Construction object to calculate the cost of lumber and windows, using $8 for lumber and $11 for windows.
Display the total cost, then utilize the method to compute the tax and print the overall total including tax.
Design a class named Salutations tailored to produce diverse greetings and salutations.
This class should feature a single instance variable, a String named "name," indicating the individual to whom the salutations are directed.
Within the class, include the following methods:
A constructor accepting a String to initialize the "name" variable.
addressLetter(): This method prints "Dear name", with "name" substituted by the value of the instance variable "name".
signLetter(): Prints the signature "Sincerely," followed by the "name" variable.
addressMemo(): Prints "To whom it may concern".
signMemo(): Prints "Best," followed by the "name" variable.