Quiz - 1¶
Make a program that asks for two integer numbers and prints the sum of those two numbers.
xxxxxxxxxx
def suma(n, m):
Activity: 1 ActiveCode (q1_1_en)
Write a program that reads a value in meters and shows it converted to millimeters.
def metros_a_milimetros(n):
Activity: 2 ActiveCode (q1_2_en)
Write a program that reads the number of days, hours, minutes, and seconds from
the user. Calculate the total number of seconds.
def tiempo_en_segundos(dias, horas, minutos, segundos):
Activity: 3 ActiveCode (q1_3_en)
Make a program that calculates a salary increase. It should request the
salary amount and the percentage of the increase. Display the amount of
the increase and the new salary.
#Return the values in a tuple like: return (increase, new_salary)
Activity: 4 ActiveCode (q1_4_en)
Request the price from a merchant and the percentage of the discount.
Display the discount amount and the final price.
#Return the values in a tuple like: return (discount, final_price)
Activity: 5 ActiveCode (q1_5_en)
Calculate the duration of a car trip. Ask for the distance to be covered
and the expected average speed for the trip.
def duration(distance, speed):
Activity: 6 ActiveCode (q1_6_en)
Convert a temperature written in Celsius to Fahrenheit. F = (9 * C) / 5 + 32
def celsius_to_fahrenheit(c):
Activity: 7 ActiveCode (q1_7_en)
Now do the opposite, from Fahrenheit to Celsius.
def fahrenheit_to_celsius(f):
Activity: 8 ActiveCode (q1_8_en)
Write a program that asks for the number of kilometers traveled
by a rented car, as well as the number of days the car has been rented for.
Calculate the price to be paid, knowing that the car costs R $ 60.00
per day and R $ 0.15 per kilometer traveled.
def price(km, days):
Activity: 9 ActiveCode (q1_9_en)
Write a program to calculate the reduction in the lifespan of a smoker.
Ask for the number of cigarettes smoked per day and how many years the person has smoked.
Consider that a smoker loses 10 minutes of life for each cigarette, calculate
how many days a smoker will lose. Show the total days.
def smoker(cigarettes, years):
Activity: 10 ActiveCode (q1_10_en)
Knowing that str()
converts numerical values to strings,
calculate how many digits there are in 2 raised to a million.
def digits():
Activity: 11 ActiveCode (q1_11_en)