Question: In this step, we'll focus on creating the user interface and the data structures. 1 . Create your program file as step _ 1 .

In this step, we'll focus on creating the user interface and the data structures.
1. Create your program file as step_1.py.
2. Import the time module and use the ctime() function to create the time stamp.
3. Create an empty list for the records as the first line of code.
4. Create a menu as follows:
Forum Comments
==============
0: Exit
1: Display Comments
2: Add Comment
5. Create a while loop with an if-elif-else construct to implement each of the menu selections.
6. If the user selects 0, exit the while loop and display a message thanking the user for participating.
7. If the user selects 1, use a for loop to iterate through the elements in the records list. Since each element in the list is a dictionary, the for loop variable will contain a dictionary.
8. Inside the for loop, display the items of the dictionary. The keys are "date", "name" and "comment". The values for the date and the name should be displayed on one line and the comment on another line. Display a separator line after each record, such as "------------------------", to make the output easier to read. If you have problems, add a print statement inside the for loop and print the for loop variable. You should see a dictionary - verify that the keys are what you expect.
9. If the user selects 2,
Create a time stamp string, using ctime() from the time module, e.g. ts = time.ctime().
Prompt the user for his/her name.
Prompt the user for a one line comment.
Create a dictionary with "date", "name" and "comment" keys and assign the applicable values.
Append the dictionary to the records list.
If you have problems with this step, add a print statement to see what's in the list. The list should contain a record for each entry and each record should be a dictionary.
10. Run your program and verify that you are able to add records and that the list of records grows.
11. If all goes well, congratulations!
Step 2: 25 points

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!