Skip to content

Sheffield | 26-Java-June | Hassan Osman | Sprint 5 | Prep: Debugging - #79

Open
HassanOHOsman wants to merge 3 commits into
CodeYourFuture:mainfrom
HassanOHOsman:prep/sprint5-debugging
Open

HassanOHOsman wants to merge 3 commits into
CodeYourFuture:mainfrom
HassanOHOsman:prep/sprint5-debugging

Conversation

@HassanOHOsman

Copy link
Copy Markdown

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

In this PR I completed 2 exercises around debugging. After running the code and not getting what I expected, i used the debugger, set breakpoints, stepped into a few code blocks to observe the values I'd get for some variables. This has helped me pinpoint the problematic code and correct it.

@HassanOHOsman HassanOHOsman added 📅 Sprint 5 Assigned during Sprint 5 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 1, 2026

@jacknewman1995 jacknewman1995 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brill!

After placing a breakpoint at the for loop, and stepping into it, I noticed that the loop starts iterating at i = 1.
This means the current number will start at 20, eventually leading to a sum of 90, and average of 22.5.
To solve this we need the loop to start iterating at index 0, so that 10 is no longer skipped. This way, the total
adds up to 100 and the average to 25 respectively.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@HassanOHOsman

Copy link
Copy Markdown
Author

Hi Jack! If there's nothing here you want me to fix, could you kindly mark it as complete? :) Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 5 Assigned during Sprint 5 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants