Practice: Write a function called count_magical that returns the number of even numbers in a given list. In the function, if the number of evens is greater than half of the length of the list, print "Magical". Else, print "Not Magical". Write a function called main which tests the count_magical function on at least 3 different lists of integers. Use the main function to test count_magical by calling main().
Practice: Write a function called calculate_total that will take the number of pennies, nickels, dimes, quarters, and discount rate (i.e. 15 for 15% discount). Return the total amount of money after discount. Print what is returned by the function after it is run with 97 pennies, 13 nickels, 18 dimes, 54 quarters, and 20% discount. Print what is returned by the function after it is run with 32 pennies, 19 nickels, 22 dimes, 71 quarters, and 51% discount.
Practice: Write a function called num_mystery that takes in 3 integers. The function should calculate the sum of the 3 integers and the difference between the largest integer and the smallest integer. The function should return the product of these two integers you calculated. Hint: You may find it useful to use the max() and min() functions. Use the num_mystery function on 1, 2, 3 and print the result. Use the num_mystery function on 5, 13, 7 and print the result.
Practice: Write a function called remove_duplicates. The sole parameter of the function should be a list. The function should go through a list, find all duplicate elements, and remove them. Sort the resulting list. YOU MAY NOT USE the set() function in Python. Use [1, 1, 2, 5, 4, 6, 12, 3, 4, 6] as an example list to input into your function.
Practice: Display the string "Apple" in the following formats:
normally
all uppercase
all lowercase
Display the string "mRoWiE" in the same 3 formats. Ask the user to input a sentence, and display this input in the same 3 formats. Do this in AT MOST 8 lines of code. By the end of the program, 9 lines should have been displayed (3 formats for each of the 3 strings). Example of the 3 formats for one string: AppleAPPLEapple
Practice: Write a function that takes a list of numbers as input and returns the product of all the numbers in the list. Use it to print the products of the following sets of numbers: -1, 5, 3, 2, 82.5, 3, 04, 3, 7, 10