Page 1 of 1

Question #1 Write a program that initializes and stores the following resistance values in an Array/List named resistanc

Posted: Tue Jul 12, 2022 8:09 am
by answerhappygod
Question #1
Write a program that initializes and stores the followingresistance values in an Array/List named resistance: 12, 16, 27,39, 56, and 81. Your program should also create two additionalLists named current and power, each capable of storing six floatnumbers. Using a for loop and an input statement, have your programaccept six user-input numbers in the current List when the programis run. Validate the input data and reject any zero or negativevalues. If a zero or a negative value is entered, the programshould ask the user to re-enter the value. Your program shouldstore the values of the power List. To calculate the power, use theformula given below.
π‘π‘œπ‘€π‘’π‘Ÿ=𝐼2 𝑅
For example, power[0] = (current[0]**2) * resistance[0]. Usingloop, your program should then display the following output (fillin the chart). The output should be aligned. Consider exploringPython β€˜format’ statement.
Resistance Current Power
12 ? ?
16 . .
27 . .
39 . .
56 . .
81 . .
Total ? ? ?
Question #2
Describe what are sorting and searching, and why are theyessential in a computer science field. Give two examples whensorting and searching are necessary in designing softwareapplications. Describe three different types of existing sortingalgorithms and two types of searching algorithms. Justify, compareand contrast your choice of sorting and searching algorithms.Include one example of sorting or searching program. You may use aprogram you discover on the Internet as an example. Please makesure to give credits to the author of the program and cite thewebsite where you found it.