This project contains a collection of Python projects taken from https://emkc.org/challenges/
Each file includes a description of the task in the comments along with several sample inputs and outputs you can use to test your code.
Each file also indicates where you should place your code to solve the problem.
Use print()
statements to print your results.
-
If you want each
print()
statement to go to the next line useprint("Hello world!")
. -
If you want to print and stay on the same line use
print("Hello world!", end="")
.
Check your code by:
- Open a terminal window
- Use
cd
to go into the correct folder - Once in the right folder enter
iPython
- Run your code with
run <file-name> <sample-input1> <sample-input2> ...
and compare your output with the instructions.
IMPORTANT NOTE: For the Count Frequency challenge you MAY NOT use the mode function from the statistics library. statistics.mode does not support multiple modes so it will fail on some of the tests!!
Useful built-in Python functions
-
int(string)
: Converts a string number to an integer.int("42")
returns 42 -
str(number)
: Converts a number to a string.str(42)
returns "42"
This is a little function that checks to make sure you are calling your programs with the correct number of parameters.