Skip to content

athenian-computational-thinking/add-n-numbers-assignment-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Add n numbers

Problem Description

The goal of this exercise is to write a function that adds all of the numbers up to a given number.

Example 1

Value of n: 4
>>> 10      # 1 + 2 + 3 + 4 = 10

Example 2

Value of n: 3
>>> 6       # 1 + 2 + 3 = 6

Suggested Approach

  1. Use a loop that repeats n times
  2. Use a counter and add its value to the total each time
  3. return the total
  4. Test your function with the print statement provided
  5. If desired, modify the code in 'main' to allow the user to input a number.
  6. Test with pytest

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages