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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply