Skip to content

Latest commit

 

History

History
30 lines (29 loc) · 1.92 KB

Exercise.md

File metadata and controls

30 lines (29 loc) · 1.92 KB

Answer the following questions in a New Notebook

  1. Write a function to convert celcius to fahrenheit
  2. Write a function that given weight and height returns the BMI of the person.
  3. Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells them the year that they will turn 100 years old.
  4. Write a function that returns the maximum of two numbers.
  5. Write a function called fizz_buzz that takes a number. - If the number is divisible by 3, it should return “Fizz”. - If it is divisible by 5, it should return “Buzz”. - If it is divisible by both 3 and 5, it should return “FizzBuzz”. Otherwise, it should return the same number.
  6. Write a function for checking the speed of drivers. This function should have one parameter: speed. - If speed is less than 70, it should print “Ok”. - Otherwise, for every 5km above the speed limit (70), it should give the driver one demerit point and print the total number of demerit points. For example, if the speed is 80, it should print: “Points: 2”. - If the driver gets more than 12 points, the function should print: “License suspended”
  7. Write a function called showNumbers that takes a parameter called limit. It should print all the numbers between 0 and limit with a label to identify the even and odd numbers. For example, if the limit is 3, it should print: - 0 EVEN - 1 ODD - 2 EVEN - 3 ODD
  8. Write a function that returns the sum of multiples of 3 and 5 between 0 and limit (parameter). For example, if limit is 20, it should return the sum of 3, 5, 6, 9, 10, 12, 15, 18, 20.
  9. Write a function called show_stars(rows). If rows is 5, it should print the following:
        *
        **
        ***
        ****
        *****
  1. Write a function that prints all the prime numbers between 0 and limit where limit is a parameter.