reading-notes

Class 6 - Guided Project 1

Lab 6 - Ten Thousand - version 1

Overview

Today you’ll begin working in pairs on a command line version of the dice game Ten Thousand by expanding your understanding of Python standard library.

Feature Tasks and Requirements

Implementation Notes

User Acceptance Tests

Stretch Goals

Code Challenge

Feature Tasks

1. Append

2. Insert Before

3. Insert After

Examples

Append

Initial List Method Args Resulting List
head -> {1} -> {3} -> {2} -> X 5 head -> {1} -> {3} -> {2} -> {5} -> X
head -> X 1 head -> {1} -> X

Insert Before

Initial List Method Args Resulting List
head -> {1} -> {3} -> {2} -> X 3, 5 head -> {1} -> {5} -> {3} -> {2} -> X
head -> {1} -> {3} -> {2} -> X 1, 5 head -> {5} -> {1} -> {3} -> {2} -> X
head -> {1} -> {2} -> {2} -> X 2, 5 head -> {1} -> {5} -> {2} -> {2} -> X
head -> {1} -> {3} -> {2} -> X 4, 5 No change, method exception

Insert After

Initial List Method Args Resulting List
head -> {1} -> {3} -> {2} -> X 3, 5 head -> {1} -> {3} -> {5} -> {2} -> X
head -> {1} -> {3} -> {2} -> X 2, 5 head -> {1} -> {3} -> {2} -> {5} -> X
head -> {1} -> {2} -> {2} -> X 2, 5 head -> {1} -> {2} -> {5} -> {2} -> X
head -> {1} -> {3} -> {2} -> X 4, 5 No change, method exception

Unit Tests

Unit tests must be passing before you submit your final solution code.

Stretch Goal

Once you’ve achieved a working solution, write an additional method to delete a node with the given value from the linked list.

Written Class Notes

code challenge insert node of value of 5

Read 6 - Ten Thousand Game 1

Resources Link/Pages

Bookmark and Review

Answer

Statement on why this topic matter as it relates to what I’m studying in this module:

Random functions introduce variability and unpredictability enhancing simulation of real-world scenarios and generate diverse outcomes. Understanding risk analysis and test coverage ensure robust software development by systematically identifying potential risks, prioritizing them, and validating the effectiveness of test cases to achieve comprehensive code coverage, minimizing the chances of undetected errors.

Reading Questions

  1. How can the random module be utilized in Python to generate random numbers or make selections from a list, and what are some common functions available within the module?

The random module in Python is a powerful tool for generating random numbers and making selections from lists. Here are some key functions available in the random module:

  1. random():

    • Generates random floating-point numbers between 0 and 1.
    • Example: random.random() produces a random value between 0 and 1.
  2. randint():

    • Used to generate random integers within a specified range.
    • takes two argument as input(start of range, end of range)
    • gives an error if first argument is greater than second
    • Example: random.randint(1, 10) generates a random integer between 1 and 10.
  3. choice():

    • Selects a random element from a collection (list, set, tuple, etc.).
    • Example: random.choice(["red", "green", "blue"]) selects a random color from the list.
  4. choices():

    • Selects multiple elements with replacement from a list.
    • Example: random.choices(["red", "green", "blue"], k=3) selects three values with replacement.
  5. shuffle():

    • Shuffles the elements of a list in place.
    • Example: random.shuffle(["red", "green", "blue"]) shuffles the order of elements in the list.
  6. randrange():

    • Generates a randomly selected element from a given range with specified intervals.
    • takes three numbers (start, stop, step)
    • Example: random.randrange(0, 100, 20) selects a value from [0, 20, 40, 60, 80].
  7. In the context of software development, what is risk analysis, and what are the key steps involved in conducting a risk analysis for a software project?

    • Risk analysis in software testing is a crucial process that involves identifying and prioritizing risks in applications or software projects. Highlight potential problem areas at the beginning of a project, Assist developers and managers in mitigating risks, Consider risks in the test plan, along with potential damage and solutions.

    • Certain risks are unavoidable, including:

      • Time allocated for testing.
      • Defect leakage due to complexity or size of the application.
      • Urgency from clients to deliver the project.
      • Incomplete requirements.
      • Tackling Unavoidable Risks:
        • Conduct Risk Assessment review meetings.
        • Allocate maximum resources to work on high-risk areas.
        • Create a Risk Assessment database for future use.
        • Identify and categorize risk magnitude indicators: high, medium, low.
    • Risk Magnitude Indicators:

      • High: Non-tolerable effect, may lead to significant losses.
      • Medium: Tolerable but not desirable, limited risk.
      • Low: Tolerable, little or no external exposure, no significant financial loss.
    • Risk Assessment:

      • Three perspectives of Risk Assessment: Effect, Cause, Likelihood.
        • Effect: Assess risk by determining the impact of conditions, events, or actions.
        • Cause: Assess risk by identifying the probable reason behind a problem.
        • Likelihood: Assess risk by stating the probability of a requirement not being satisfied.
      • Steps to Perform Risk Analysis:
        • Searching for risks.
        • Analyzing the impact of each individual risk.
        • Implementing measures for the identified risks.
  8. What is test coverage and why is it an important (or potentially misleading) metric in software testing?

    • Test coverage, often referred to as code coverage, is a metric in software testing that measures the extent to which the source code of a program has been executed during testing. It helps identify the areas of code that have been tested and those that remain untested. Test coverage is expressed as a percentage, representing the ratio of tested code to the total codebase.

    • Potential Misinterpretations:

      • Test coverage is not a numeric representation of test quality. Merely aiming for a high coverage percentage can lead to misguided efforts, with a focus on quantity rather than the quality of tests.
      • Setting coverage percentages as rigid targets may encourage writing tests for the sake of reaching a number rather than thoughtful and meaningful testing.
  9. What is Big O notation, and how is it used to describe the performance of an algorithm? Give an example of an everyday task (not software related) that demonstrates O(n) time complexity.

    • used to describe the performance or efficiency of an algorithm in terms of its input size, analyze, and compare the efficiency of different algorithms.

    • the example in the video that describes an everyday task that demonstrates O(n) time complexity is mowing a square plot of land. The runtime to mow the grass can be described as O(a) or O(s^2), where ‘a’ represents the amount of area in the plot and ‘s’ represents the length of one side of the square. Both expressions essentially convey the same information about the algorithm’s runtime scaling linearly with the input size.

Things I want to know more about

Learning Journal

Reflection

Write a brief reflection on your learning today, or use the prompt below to get started.

Consider the following quote from the article linked above:

“What motivates adults to find time for their learning in their busy schedule? Mostly intrinsic motivators.”

In other words, adults are motivated by internal forces rather than by external expectations, and your learning journal provides an outlet for considering and noting those internal forces. Which of your internal forces for learning can you concretely identify?