Write a function that takes one argument and prints it 20 times.
ⓘ
You're building a wall. Each brick is 20cm tall.
You want to build a wall of a certain height in meters.
Write a function that takes one argument, the height in meters,
and returns how many bricks you need.
Example:
>>> bricks_needed(1)
5.0
>>> time_to_print(3)
15.0
ⓘ
def print_sum(a, b): print(a + b) result = print_sum(30, 400) print(result)
In the above script:
What is value of result: | |
What is the first printed value: | |
What is the second printed value: |
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 compare(a, b, c): print(a == b and a < c) x, y, z = 1, 2, 3 d = x == 1 and y == 2 and y < z compare(x, y, -1 * z)
What is printed if we execute the above program?
What is value of d at the end of the execution of the above program?
Write a function named calculate that takes two numbers as arguments, a abd b, and returns a to the power of a minus b.
Write a function, perform named that takes two numbers as arguments, x and y, and returns x divided by y times x.
Call perform and assign its return value to m
Call calculate passing m and 5 as arguments
ⓘ
In the city of Babrruja, people who apply for housing loans need to meet specific criteria.
If they have an income greater than $50,000 per year and are between 25 and 40 years old (inclusive),
they qualify for the loan.
Alternatively, if they are over 40 but have a savings account with at least $100,000, they may also be eligible.
Write a function that takes income, age, and savings and prints True if the person qualifies for a loan,
and False otherwise.
>>> check_loan_approval(income=50000, age=30, savings=110000) False >>> check_loan_approval(income=50001, age=30, savings=110000) True >>> check_loan_approval(income=3000, age=40, savings=110000) False >>> check_loan_approval(income=3000, age=41, savings=110000) True
ⓘ
Write a function that takes two integers, n and m, (where n < m) and prints all numbers between n and m (including n and m). You should use while statement.
ⓘ
Write a function which takes two arguments, n and m.
- If both arguments are integers, and n is equal or less than m, it returns a random integer between n and m
- If both arguments are strings, it concatenates them and returns a random character out of the concatenated string
- It prints "not applicable" otherwise.
ⓘ
Write a function that takes two integers, n and m, (where n > m) and prints all numbers between n and m (including n but not m). You should use while statement.
ⓘ