I’m brand new to coding and have an assignment in class to review and contrast the design of each of the parts of the below code. Can anyone help with the categories I should use to compare and contrast each part? Not asking to do the assignment for me, just help get me started and pointed in the right direction. Thanks!
numbers = [[4, 3], [1,2], [154,233], [555,-444]]
print(str(pair) + '+' + str(pair) + '= ' + str(pair + pair))
for n in numbers:
[show_add_pair(x) for x in numbers]
Hi there @MarkStanczyk. First of all, well done for pointing out to us that this is a class assignment, seems like you have read the forum guidelines well!
Not quite sure if this is what you are looking for, but maybe these points will help you get started.
1. Function Definitions:
- Identify and describe the purpose of each function in the code.
- Compare the function names, arguments, and implementations.
- Note if there are any differences in the function designs, such as input parameters or return values.
2. Function Calls:
- Analyze how each function is called in different parts of the code.
- Compare the arguments passed to each function call.
- Note if there are any differences in the way functions are invoked.
3. Output Generation:
- Examine how output is generated in different parts of the code.
- Compare the format and content of the output.
- Identify if there are any variations in the output generated by different parts of the code.
4. Data Structures:
- Describe the data structure used in the ‘numbers’ variable.
- Compare how elements of the ‘numbers’ list are accessed and used in different parts of the code.
- Consider the efficiency of the code and/or how fast it is and how many lines of code are needed to achieve the task.
Could you also edit your post to add code formatting to the code you’ve provided, to keep it nice and neat?
Thank you for your quick response! This definitely helps to orient my thinking.
How do I edit my post to add code formatting? Not sure where to find the “edit post” icon.
I already edited your post to include code formatting. However, you can edit your post by clicking on the pencil icon.
Code formatting works like this:
So, three backticks + the language name, then the code, then three backticks (and how I got the backticks to show is by using 4 backticks above the 3; don’t normally do that).
Great you found it useful. If my post solved your problem, please mark it as a solution, thanks