Skip to content

Khanyi-Codes/loopsTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

Overview

This project has a Python file with a few small functions you need to complete. Each function has a TODO comment telling you what it should do — like counting items, adding numbers, or finding vowels in a string.

Once you finish the functions, you can run tests to check your work.


How to Run

  1. Make sure you have Python 3 installed.
  2. Save your file as test_loops.py in your project folder.
  3. Open your terminal or command prompt.
  4. Run this command to test it:
python -m unittest test_loops.py

What Each Function Should Do

Function What it should return
count_items(items) The number of items in a list
sum_numbers(numbers) The sum of all numbers
find_largest(numbers) The largest number in the list
count_even_numbers(numbers) How many even numbers are in the list
sum_digits(number) The sum of all digits in a number
count_vowels(string) The number of vowels (a, e, i, o, u) in a string
multiply_list_elements(numbers) The product of all numbers in the list

Example Run

python test_loops.py

Example output:

All tests passed!

or

Test failed: find_largest()

Keep fixing the functions until all tests pass.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages