Define a function, finish, that prints "finish".
Define a function, proceed, that calls finish once.
Define a function, start, that calls proceed once.
Call start.
Define a function, middle_of_three, that takes three numbers, x, y and z,
and returns the number that is neither the largest nor the smallest (the middle value) .
Write a function, that takes one numbers as argument, and returns True if it is divisible by 3 or 4, False otherwise.
A company is building highways.
One worker can complete 0.5 kilometers per day.
Write a function that takes the total distance in kilometers, km,
and the number of days until the deadline, days,
and prints how many workers are needed to complete the highway on time.
Write a function that takes a string as argument and using a for loop it prints all its letters, one per line.
Write a function that takes an integer as argument and:
- It returns 'positive' if it is positive
- It returns 'negative' if it is negative
- It returns 'neutral' if it is 0
def power(a):
while True:
a = a ** 2
if a > 100:
break
return a
res = power(2)
Given the above script:
| What is the value of res: |
def dosmth(num, string):
for s in string:
num = num + 1
return num
def dosmth2(string):
v = 2
for char in string:
v = v * 2
return v
Given the above script, what are the results of the following expressions:
| dosmth(1, '12345'): | ||
| dosmth2('123'): | ||
| dosmth(0, 'ani') + dosmth2('a'): |
Complete execution flow of the following program
def repeat_acting(): act() print("acting") def act(): print("acting") repeat_acting()
"acting" "acting" >>>
Complete execution flow of the following program
def print_power(): d = 10 d = d ** 2 print(d) def call_function(): print_power() print_power() print_power()
100 >>> call_function() 100 100 >>>