Add some examples to functions

This commit is contained in:
2026-08-25 16:13:06 +02:00
parent 4df0cd11d2
commit caeb8808be
2 changed files with 49 additions and 5 deletions

View File

@@ -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})")