From 9c54280f1e0a2af722a01373ec1780af76efb0e4 Mon Sep 17 00:00:00 2001 From: marcv Date: Sat, 22 Aug 2026 15:28:48 +0000 Subject: [PATCH 1/7] Add future_projects.md --- future_projects.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 future_projects.md diff --git a/future_projects.md b/future_projects.md new file mode 100644 index 0000000..9b61633 --- /dev/null +++ b/future_projects.md @@ -0,0 +1,3 @@ +Some ideas for future challenges learning ptyhon: + +- black jack \ No newline at end of file From cb7e872c2242712dcb17faeccb4cecda866bc4d7 Mon Sep 17 00:00:00 2001 From: marcv Date: Mon, 24 Aug 2026 13:38:36 +0200 Subject: [PATCH 2/7] Change from WIP to done --- rock-paper-scissors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rock-paper-scissors.py b/rock-paper-scissors.py index dab8b6b..ab173bb 100644 --- a/rock-paper-scissors.py +++ b/rock-paper-scissors.py @@ -1,6 +1,6 @@ ############################################# # # -# Work in progress!! # +# Done! # # # ############################################# From 3f7029638761fa10748f733c925e71483aba7309 Mon Sep 17 00:00:00 2001 From: marcv Date: Mon, 24 Aug 2026 13:53:55 +0200 Subject: [PATCH 3/7] save in correct format --- rock-paper-scissors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rock-paper-scissors.py b/rock-paper-scissors.py index ab173bb..35018c5 100644 --- a/rock-paper-scissors.py +++ b/rock-paper-scissors.py @@ -137,4 +137,4 @@ wins: {wins}, losses: {losses}, ties: {ties}''') wins: {wins}, losses: {losses}, ties: {ties}''') sys.exit() - \ No newline at end of file + From ddeeb712d8e7e52936c7f08d6b9b8f03cacebae2 Mon Sep 17 00:00:00 2001 From: marcv Date: Mon, 24 Aug 2026 16:40:28 +0200 Subject: [PATCH 4/7] Changes in playground --- playground.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 playground.py diff --git a/playground.py b/playground.py new file mode 100644 index 0000000..6b5f778 --- /dev/null +++ b/playground.py @@ -0,0 +1,40 @@ +# def hello(): +# # Print 3 greetings: +# print("Good morning!") +# print("Good afternoon!") +# print("Good night!") + +# hello() +# hello() +# print('One more time') +# hello() + +# def say_hello(name): +# print(f'Hello {name}') + +# say_hello('Marc') + +import random + +def get_answer(random_number): + if random_number == 1: + return 'It is certain!' + elif random_number == 2: + return 'It is decidedly so.' + elif random_number == 3: + return 'Yes' + elif random_number == 4: + return "Doubtful" + elif random_number ==5: + return 'Not likely' + else: + return "No way in hell" + +print("Ask a yes or no question:\n>") +input() +r = random.randint(1,5) +fortune = get_answer(r) +print(fortune) + + + From 4df0cd11d215fc1f7e1bc902a6db5ea6bded5d85 Mon Sep 17 00:00:00 2001 From: marcv Date: Tue, 25 Aug 2026 10:02:56 +0200 Subject: [PATCH 5/7] Add functions and return codes --- Defining_funtions.py | 5 +++++ Return_codes_Magic_8_ball.py | 31 +++++++++++++++++++++++++++ playground.py | 41 ++++-------------------------------- 3 files changed, 40 insertions(+), 37 deletions(-) create mode 100644 Defining_funtions.py create mode 100644 Return_codes_Magic_8_ball.py diff --git a/Defining_funtions.py b/Defining_funtions.py new file mode 100644 index 0000000..c78639b --- /dev/null +++ b/Defining_funtions.py @@ -0,0 +1,5 @@ +def hello(name): + print(f'Hello {name}! How are you?') + +username = input('What is your name stranger?\n>') +hello(username) \ No newline at end of file diff --git a/Return_codes_Magic_8_ball.py b/Return_codes_Magic_8_ball.py new file mode 100644 index 0000000..9ead7fb --- /dev/null +++ b/Return_codes_Magic_8_ball.py @@ -0,0 +1,31 @@ +import random + +# This input only makes the user think the program reacts to his question! +# In reality it doesn't do anything! + +input("Ask your question. Be sure it can be answered with a YES or NO!\n>") + +# Define function and based on the evaluation define return code: + +def get_answer(random_number): + if random_number == 1: + return 'It is certain!' + elif random_number == 2: + return 'It is decidedly so.' + elif random_number == 3: + return 'Yes' + elif random_number == 4: + return "Doubtful" + elif random_number == 5: + return 'Not likely' + elif random_number == 6: + return 'Mhhh, not sure about that one' + elif random_number == 7: + return "Nope, afraid not" + else: + return "No way in hell" + + +r = random.randint(1,8) +fortune = get_answer(r) +print(fortune) \ No newline at end of file diff --git a/playground.py b/playground.py index 6b5f778..bd7a708 100644 --- a/playground.py +++ b/playground.py @@ -1,40 +1,7 @@ -# def hello(): -# # Print 3 greetings: -# print("Good morning!") -# print("Good afternoon!") -# print("Good night!") - -# hello() -# hello() -# print('One more time') -# hello() - -# def say_hello(name): -# print(f'Hello {name}') - -# say_hello('Marc') - -import random - -def get_answer(random_number): - if random_number == 1: - return 'It is certain!' - elif random_number == 2: - return 'It is decidedly so.' - elif random_number == 3: - return 'Yes' - elif random_number == 4: - return "Doubtful" - elif random_number ==5: - return 'Not likely' - else: - return "No way in hell" - -print("Ask a yes or no question:\n>") -input() -r = random.randint(1,5) -fortune = get_answer(r) -print(fortune) +def hello(name): + print(f'Hello {name}! How are you?') +username = input('What is your name stranger?\n>') +hello(username) From caeb8808beef32fd6230f5d4c7e3813f5a8a28d6 Mon Sep 17 00:00:00 2001 From: marcv Date: Tue, 25 Aug 2026 16:13:06 +0200 Subject: [PATCH 6/7] Add some examples to functions --- Defining_funtions.py | 28 +++++++++++++++++++++++++++- playground.py | 26 ++++++++++++++++++++++---- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/Defining_funtions.py b/Defining_funtions.py index c78639b..354a63c 100644 --- a/Defining_funtions.py +++ b/Defining_funtions.py @@ -2,4 +2,30 @@ def hello(name): print(f'Hello {name}! How are you?') username = input('What is your name stranger?\n>') -hello(username) \ No newline at end of file +hello(username) + +# Another example using functions and return code: + +import random + +# Defining the function: +def get_answer(answer): + if answer <10: + return "The answer is smaller than 10" + elif answer == 10: + return "The answer is 10." + else: + return 'The answer is greater than 10' + +# Generating a random number, using that random number to define a variable by using it as an argument in the funtion, +# and printing the result: +random_number = random.randint(1, 20) +result = get_answer(random_number) +print(result) + +# The 3 lines above can be rewritten to a single line: +print(get_answer(random.randint(1, 20))) + +# And the check to see if the code is working as it should: +print(f"(It is {random_number})") + diff --git a/playground.py b/playground.py index bd7a708..1f01950 100644 --- a/playground.py +++ b/playground.py @@ -1,7 +1,25 @@ -def hello(name): - print(f'Hello {name}! How are you?') +# Again -username = input('What is your name stranger?\n>') -hello(username) +import random + +def get_answer(answer): + if answer <10: + return "The answer is smaller than 10" + elif answer == 10: + return "The answer is 10." + else: + return 'The answer is greater than 10' + +random_number = random.randint(1, 20) + +result = get_answer(random_number) +print(get_answer(random.randint(1, 20))) + +print(result) +print(f"(It is {random_number})") + + + + \ No newline at end of file From 4b987606c212926778cc19ed7b8a9d2c98e5e246 Mon Sep 17 00:00:00 2001 From: marcv Date: Thu, 27 Aug 2026 12:03:25 +0200 Subject: [PATCH 7/7] playground --- playground.py | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/playground.py b/playground.py index 1f01950..5878d68 100644 --- a/playground.py +++ b/playground.py @@ -1,25 +1,11 @@ -# Again - import random - -def get_answer(answer): - if answer <10: - return "The answer is smaller than 10" - elif answer == 10: - return "The answer is 10." +for i in range(100): # Perform 100 coin flips. + if random.randint(0, 1) == 0: + print('H', end=' ') else: - return 'The answer is greater than 10' - -random_number = random.randint(1, 20) - -result = get_answer(random_number) + print('T', end=' ') +print() -print(get_answer(random.randint(1, 20))) - -print(result) -print(f"(It is {random_number})") - - - - \ No newline at end of file +# print('Deze print eindigt met een spatie', end=" ") +# print("Dit staat er naast") \ No newline at end of file