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.
Create your program file as steppy
Import the time module and use the ctime function to create the time stamp.
Create an empty list for the records as the first line of code.
Create a menu as follows:
Forum Comments
: Exit
: Display Comments
: Add Comment
Create a while loop with an ifelifelse construct to implement each of the menu selections.
If the user selects exit the while loop and display a message thanking the user for participating.
If the user selects 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.
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.
If the user selects
Create a time stamp string, using ctime from the time module, eg ts time.ctime
Prompt the user for hisher 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.
Run your program and verify that you are able to add records and that the list of records grows.
If all goes well, congratulations!
Step : points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
