Question
Code questions 1. how to write a program to find all numbers between 0 and 5,000 (inclusive) that are multiples of 7 and also
Code questions
1. how to write a program to find all numbers between 0 and 5,000 (inclusive) that are multiples of 7 and also divisible by 17. Use a list to hold the numbers you find, and either print the list at the end, or use a for loop to iterate over the list and print each number on a new line (if you want it to look neater).
2. how to write a program to print this pattern using nested for loops: * * * * * * * * * * * * * * * * * * * * * * * * *
3. How to write a program that defines a function named find_odd taking one parameter called input_list, to locate and print all the odd numbers in a given list. You will need to iterate over the list. Paste the following line into the start of your program before you define your function, and call the function at the end of your program with this variable as an argument: test_list = [18, 17, 15, 10, 10, 2, 3, 86, 79, 4, 5, 4, 8, 21, 30, 41, 72, 83, 106, 24]
4. How to write a program that defines a function called mean_compare that takes two arguments list_1 and list_2, both lists of floats. It takes the average of the contents of each list, and compares the two averages.
It should return a string. The following are the possible string outputs it should have, with "m1" and "m2" standing in for the actual means (averages) you calculated. List 1 (mean value: m1) has a greater mean than list 2 (mean value: m2). List 2 (mean value: m2) has a greater mean than list 1 (mean value: m1).
The means of both lists are equal to: m1 or m2 [it doesn't matter which variable you insert here since they are the same in this case.] Do not use the built-in sum() or averaging functions for this.
Use loops, conditionals, and comparison operators to solve the problem. Here are the two test lists you should use, although it is recommended to try it on other lists of floats to make sure it works on all appropriate lists. data_1 = [1.5, 2.0, 3.5, 4, 6.6, 7.8, 1.0, 1.9, 3.8, 3.7, 4.3] data_2 = [2.3, 6.4, 10.9, 0.8, 0.5, 2.7, 3.4, 9.0, 4.0, 3.5, 8.2] Don't forget to call the function in a print statement at the end, since it does not print the output string, but RETURNS it.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started