A printer prints 8 pages per minute. You have 3 printers running at the same time.
Write a function that takes one argument, pages, and returns number of minutes
it takes to print pages. Example:
>>> time_to_print(240)
10.0
>>> time_to_print(300)
12.5
ⓘ
How many miles are there in 10 kilometers?
Hint: there are 1.61 kilometers in a mile.
ⓘ
A concert hall sells three types of tickets:
- Premium: $50
- Standard: $30
- Economy: $20
They sold 120 premium tickets, 200 standard tickets, and 350 economy tickets.
What is the total revenue? Find and print it.
ⓘ
You have to read books, and you want to know for how many days you finish a book.
Write a function that takes two arguments, total_pages and pages_per_day, and returns
number of days you need to finish the book. Example:
>>> calculate(100, 20)
5.0
>>> calculate(150, 20)
7.5
ⓘ
At the art store, you buy 3 sketchbooks at $7.40 each. If there's a "Buy 2, get 1 half off" deal, how much do you pay in total?
ⓘ
In Babrruja, there's a rule for who gets invited to the annual birthday party.
The guest must either be a teenager, between 13 and 19 years old (inclusive),
and enjoy video games, or be someone who loves outdoor activities but is 25 years old or younger.
Write a function that checks if a person gets an invite by taking their age and interest.
Print True if they qualify for an invitation, and False otherwise. Examples:
>>> check_invite(14, "video games") True >>> check_invite(21, "outdoor activities") True >>> check_invite(5, "outdoor activities") True >>> check_invite(15, "hiking") False >>> check_invite(21, "video games") False
ⓘ
Write a function that takes two numbers: the total bill, total,
and the number of people, people.
Calculate and print how much each person should pay. Bill should be split equally
ⓘ
How many seconds are in 42 minutes and 42 seconds?
ⓘ
How many feet are there in 12 meters?
Hint: there are 3.3 feet in a meter.
ⓘ
At Pupci Academy, employees get a bonus if they meet certain conditions.
If an employee has been at the company for more than 3 years and completed more than 5 projects,
or if they've completed at least 2 projects and their performance rating is higher than 4.0, they receive a bonus.
Write a function that has checks eligibility based on years at company (years), projects completed (projects),
and performance rating (rating). Print True if they qualify for the bonus, and False otherwise. Examples:
>>> check_bonus(years=4, projects=6, rating=1.0) True >>> check_bonus(years=1, projects=2, rating=4.1) True >>> check_bonus(years=3, projects=5, rating=4.0) False
ⓘ
Write a function that takes two arguments, x and y, and prints True if at least one of them is negative. It prints False otherwise.
ⓘ
Write a function that takes one integer as argument and prints False if it is 10 or 100, and True otherwise.
ⓘ
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?
def are_equal(a, b): print(a == b) def are_not_equal(a, b): are_equal(a, a) are_not_equal(4, 5)
What is printed if we execute the above program?
Write a function that takes three arguments, x, y and z, and prints True if x is greater than y and z.
ⓘ
def compare(a, b): print(1 + 2) def not_equal(a, b): s = not a == b d = a == b not_equal(True, False) compare(11, 2)
What is printed if we execute the above program?
def do_smth(a): print(a == a) a = True b = False do_smth(b)
What is printed when we execute the above program?
>>> n = 10 >>> x = 10 * n >>> x = x / 2 + n >>>
What is value of x at the end of execution of the above program?
def calculate(x, y): res = x * y res = x + res revert(res, x, y) def revert(a, b, c): res = a - b res = res / c print(res) calculate(2, 3)
Write the printed value after we execute the above program.
def evaluate(a, b, c, d): print(a == b or c == d)
What is printed if we execute evaluate(1, 1, 2, 2)
What is printed if we execute evaluate(True, True, 4, 4.1)
What is printed if we execute evaluate(True, False, False, True)
def print_result(a, b): print(not a > b) a = 10 b = 10 res = a + b print_result(res, a)
What is printed if we execute the above program?
What is value of res at the end of the execution of the above program?
def compare(a, b, c): print(a == b or a < c) x, y, z = 1, 2, 3 d = x == 1 or y == 2 or 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?
def accepted(level, evaluation): print((level == "senior" and evaluation > 8.0) or evaluation > 6.5) def evaluate(level, logic, syntax, communication): evaluation = (logic + syntax + communication) / 3 accepted(level, evaluation) print(evaluation) evaluate("senior", 7.0, 10.0, 1.0)
After the execution of the above program two values are printed. Write those values in the order that they are printed.
1: | |
2: |
def is_greater_or_equal(s1, s2): print(s1 >= s2) res = 10 is_greater_or_equal(res, res) res = False
What is printed after we execute the above program?