diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/01_hello_world/hello_world.py b/01_hello_world/hello_world.py new file mode 100644 index 0000000..5c2e653 --- /dev/null +++ b/01_hello_world/hello_world.py @@ -0,0 +1,9 @@ +# This is a comment. Any line beginning with a # is ignored by the interpreter + +# Write a program that displays "Hello World". + +# You onlyu need one line of code. + +# Hint: print("Goodby ldrow") is a valid line of python that you can start with... + +# Can you make it so this file is executable as "./hello_world.py"? diff --git a/02_functions/functions.py b/02_functions/functions.py new file mode 100644 index 0000000..286f07b --- /dev/null +++ b/02_functions/functions.py @@ -0,0 +1,24 @@ +# Here is an example of a function + +def say_hello(): + print("Hello world") + + +# it doesn't run without being called + +# uncomment the following to test it + +# say_hello() + + +# Here is a funciton that calculates a square: + + +def calcSquare(n): + return 9 + +# Unfortunately it always returns the square of 3, not the given number +# Correct it and uncomment the lines below to test it + +# n=5 +# print(f"The square of {n} is {calcSquare(n)}") diff --git a/README.md b/README.md index aacc17c..8bf0396 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # WAD_python_intro -Introductory exercises for python + +Introductory exercises for python. + +Clone the repository to your machine and try the exercises within.