Ask Question
20 February, 10:30

Write a program for any element in keysList with a value greater than 50, print the corresponding value in itemsList, followed by a space. Ex: If keysList = {32, 105, 101, 35} and itemsList = {10, 20, 30, 40}, print: 20 30.

+5
Answers (1)
  1. 20 February, 13:42
    0
    The solution code is written in Python:

    keysList = [32, 105, 101, 35] itemsList = [10, 20, 30, 40] output = "" for i in range (len (keysList)) : if (keysList[i] > 50) : output + = str (itemsList[i]) + " " print (output)

    Explanation:

    Firstly, let us use the two sample list, keysList and itemsList in our program (Line 1-2). Then create a output variable to hold the output string (Line 4).

    Next, we create a for-loop and use it to traverse through the elements in the keysList. If any keysList element is bigger than 50 then we use the same index i to get the corresponding item from itemsList and join that value to the output string (Line 7-8).

    Lastly, we print the output (Line 10).
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a program for any element in keysList with a value greater than 50, print the corresponding value in itemsList, followed by a space. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers