Robotics & Artificial Intelligence
Write a function that returns the sum of multiples of 3 and 5 between 0 and limit (parameter). For example, if the limit is 20, it should return the sum of 3, 5, 6, 9, 10, 12, 15, 18, 20.
Related Questions
Write a function called ice_water that takes a number as input. Perform the following operations:
- If the number is divisible by 3, then it should return "ice".
- If it is divisible by 5, then it should return "water".
- If it is divisible by both 3 and 5, then it should return "icewater".
- Otherwise, it should return the same number.
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 5 km above the speed limit (70), it should give the driver one demerit point. Calculate and print the total number of demerit points at the end. For example, if the speed is 80, it should print: "Demerit Points: 2".
- If the driver gets more than 12 demerit points, the function should print: "License suspended".
What are the various parameter passing techniques?
Describe user-defined functions in Python with the help of an example.