AP Comp Sci

#1 

This question is based on the project you submitted.

 

Describe one piece of documentation that would be appropriate to include with or in your program. Describe the intended purpose of this documentation by identifying who would use it and what they would do with it.

One piece of documentation that would be good to include with my program is a user guide. This would help people understand how to use the to-do list, like how to add, view, complete, or delete tasks. The guide would be useful for anyone using the program so they don’t get confused about what to type or what each option does.



#2 

Refer to your Personalized Project Reference when answering this question.

(a) Consider the first iteration statement included in the Procedure section of your Personalized Project Reference. Describe the condition(s) that will cause the body of the iteration statement to execute at least once.


In my program, the first iteration is a while loop that runs while the variable done is False. Since done starts off as False, the loop will always run at least once. This loop keeps asking the user what they want to do until they type “exit,” which sets done to True and ends the loop.


—---------------------------------------------------------------------------------------------------------------------


(b) Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Write a call to your procedure with specific argument(s) that you could use for testing this procedure. Describe the program functionality that is related to this call.

Call to my procedure:

manage_tasks(["Buy groceries", "Do homework"])


What it does:


This line of code starts the program with two tasks already in the list. It helps me test if the program can show the tasks correctly and if I can complete or delete them without having to type them in first. It saves time and shows if everything is working.



(c) Consider the list identified in the List section of your Personalized Project Reference. Explain how you would need to adjust this part of your program if the list was not included in your code.

If I didn’t have the list in my program, I wouldn’t be able to save any tasks. The user could type something in, but it wouldn’t be stored anywhere, so the program wouldn’t work right. I would need to add a list like task_list = [] so the program can keep track of what the user wants to do.


—----------------------------------------------------------------------------------------------------------------------------


#3 

This question is based on the project you submitted.

 

Explain how you used or could have used feedback, testing, or reflection in the development of your program.

While I was making my program, I tested it a lot by trying different things, like adding a bunch of tasks or typing in wrong numbers. This helped me find mistakes, like what happens if the user types something that’s not a number. I also asked a friend to try it out and they gave me feedback that the instructions could be more clear, so I added more helpful messages in the program. All of this helped me make the program better and easier to use.



#4


Refer to your Personalized Project Reference when answering this question.

(a) Consider the first conditional statement included in the Procedure section of your Personalized Project Reference. Write an equivalent Boolean expression for this conditional statement.

The first conditional in my procedure is:

if action == "add":


An equivalent Boolean expression for this would be:

(action "add") True


Both do the same thing: they check if the user typed "add" as the action.

—--------------------------------------------------------------------------------------------------------------------------------

(b) Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Identify a strategy, other than using test cases, that you can use to test the correctness of your procedure. Describe how you would use this strategy.


One strategy I could use instead of test cases is manual walkthroughs. That means I go through the code step by step and think about what each part does. I would look at what happens when someone types "add", or "view", or something else, and make sure the program reacts the way it’s supposed to. I’d also follow what happens to the list as things get added or deleted to make sure the changes are correct.



(c) Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Procedures are often used to organize larger problems into subproblems or smaller tasks. Identify the subproblem being solved or the task that is being accomplished by your procedure. Explain how the procedure is used to accomplish the overall functionality of your program.


The subproblem being solved by my procedure, manage_tasks(task_list), is letting the user choose what to do with their tasks, like adding, viewing, completing, or deleting them. This is one part of the whole to-do list program. My procedure is important because it handles all the user choices and updates the task list based on what they type. Without it, the program wouldn’t be able to do anything useful.


—--------------------------------------------------------------------------------------------------------------------------------

#5 

This question is based on the project you submitted.

 

Describe the problem that your program was created to address or the creative expression it pursues.

My program was created to help people keep track of their tasks using a simple to-do list. It solves the problem of forgetting things by letting the user add, view, complete, and delete tasks. This way, everything they need to do is in one place, and they can stay organized. I made it easy to use so anyone could manage their tasks without needing to know how to code.


#6 

Refer to your Personalized Project Reference when answering this question.

(a) Consider the code segment in part (ii) of the List section of your Personalized Project Reference that shows how your list is being used. Explain in detailed steps how this code segment works. Your explanation must be detailed enough for someone else to write the code segment.

The code segment uses a list called task_list to store all the user’s tasks. Here's how it works, step by step:


It first checks if the list is empty by using if len(task_list) == 0:. If it is, it prints “No tasks to show!”


If the list is not empty, it calls the display_tasks(task_list) function. That function prints out each task with a number next to it so the user can see the order of their tasks.


Then, it asks the user to enter the number of the task they want to mark complete using input(). That number gets turned into an integer.


The program checks if the number the user entered is valid (like it’s not too high or less than 1).


If the number is valid, the program uses .pop() to remove that task from the list and saves it in the variable completed_task.


Finally, it prints out a message saying that the task is completed.


This whole segment is what lets the user check off something they’ve finished.

—------------------------------------------------------------------------------------------------------------------------------

(b) Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Passing different values as arguments to a procedure can cause different segments of code to execute. Based on one of your arguments, describe where you could insert output statements in your procedure to test whether a block of code is executed or not.


In the display_tasks(tasks) procedure, I could pass in different task lists to test how the function reacts. For example, if I pass in a list with three tasks, I expect it to print all three. To check if the for loop is actually running, I could insert a print("Loop is running") line right before print(str(index) + "." + task). If I see that message, I know that part of the code is being used. If I don’t, that means the list was empty or something went wrong.



(c) Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Explain how your program could be written differently if one of your parameters was removed from your procedure.


If I removed the tasks parameter from the display_tasks function, the function wouldn’t know which task list to use. I would have to make the list global so the function could still access it. But that would make my program harder to manage and less flexible. It’s better to keep the parameter so I can pass in any task list I want and reuse the function in different parts of the program.