1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
GREYUIT [131]
3 years ago
5

Write a python program that takes two lists as input from the user, multiplies the index wise elements of the two lists and adds

it to a new variable. While doing the program you should handle the following exceptions: Return an exception if an element in a list is not a number stating “The list has some non number values”. Return an exception if there is an index out of bound stating “Index out of bound”. ============================= Example 1: Input: list_one = [1, a, 2, 4] list_two =[5, 6, 7, 8] Output: The list has some non number values
Computers and Technology
1 answer:
nevsk [136]3 years ago
3 0

Answer:

list_one=[]

list_two=[]

list_three=[]

str1=input("list_one:")

for i in str1:

   if i.isdigit():

       i=int(i)

       list_one.append(i)

   elif i.isalpha():

       list_one.append(i)

str2=input("list_two:")

for i in str2:

   if i.isdigit():

       i=int(i)

       list_two.append(i)

   elif i.isalpha():

       list_two.append(i)

print(list_one)

print(list_two)

if len(list_one)==len(list_two):

   for i in range(len(list_one)):

       multiply=list_one[i]*list_two[i]

       add=str(multiply)

       list_three.append(add)

else:

   print("Index out of bound")

n=0

for i in list_three:

   if i.isdigit():

           n+=1

   else:

       print("The list has some non number values")

print(list_three)

You might be interested in
The constructor signature is defined as the constructor __________ followed by the __________.
d1i1m1o1n [39]

Answer:

The constructor signature is defined as the constructor name followed by the parameter list.

Explanation:

In object oriented programming, a class constructor is a special method that will run automatically whenever a new object is created from the class. The constructor name is same with the class name. Besides, the class constructor is often used to initialize the attributes with initial values. Those initial values are held by the parameter list of the constructor.

One example of the constructor defined in a Java class is as follows:

// class name

public class BankAccount {

    // attribute names

      private String holder;

      private double amount;

      // constructor name

      public BankAccount(String holder, double amount) // parameter list

     {

               this.holder = holder;

               this.amount = amount

      }

}    

7 0
4 years ago
Web page typically contains _______, which contains the formatting instructions for displaying the web pag
MatroZZZ [7]

The answer in the blank is HTML or also referred to as Hypertext Markup Language as this is always included with the World Wide Web pages for they are always essential and needed. It is because it is a standardized system that would help the resources of the internet that is to be displayed on the page.

6 0
3 years ago
What language do the Vikings speak in the game " For Honor"?
aivan3 [116]
In the game the Vikings speak icelandic
3 0
3 years ago
Read 2 more answers
What is procurement? Multiple Choice The purchasing of goods and services to meet the needs of the supply chain Includes the pro
fomenos

Answer:

The purchasing of goods and services to meet the needs of the supply chain

Explanation:

Procurement is usually associated with the buying of goods required to meet the need of the organisation.

The procurement department of any organizations is charged with the responsibility of purchasing goods and services for the organizations; they fill up whatever void is existing in the goods and services needed by the organisation.

6 0
3 years ago
Read 2 more answers
u arrive at an intersection with traffic lights that are not working because of a power outage. What do you do?
maxonik [38]
Go to o rilles or autozone
5 0
4 years ago
Other questions:
  • Imagine you are writing a personal fitness program that stores the user's age, gender, height (in feet or meters), and weight (t
    10·1 answer
  • What is a tag in an HTML document?
    9·2 answers
  • _______________ is the term for the convergence of real-time and non-real-time communications services such as telephony, instan
    11·1 answer
  • The role of a computer-based instructional system is to deliver messages to learners. Those messages originated from a human tut
    10·1 answer
  • Which of the following is a file on the host computer used for temporary memory storage when a sudden surge in memory requiremen
    9·1 answer
  • How to do this PLEASE HELP 80 points!
    15·1 answer
  • Select the answer that best descibes what an opportunity cost is
    6·1 answer
  • Identify a possible IOT (internet of Things) device in a smart kitchen and write a use case for interacting with the software of
    12·1 answer
  • 1 pts Question 5 Which of the following calculations would evaluate to 12? (36) + 2/2, 3* ((6+2)/2), 3* 6+2/2, (306+ 2)/2​
    14·1 answer
  • Accessing a web site in search of magazine articles about a product before its purchase is an example of what part of the consum
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!