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]
2 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]2 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
Select all that apply.
Leto [7]
You may do all of the given options.
Thank You!
8 0
3 years ago
In what machines, places and apparatus are dimmers used in? Put at least 5 examples
dangina [55]

4 Types Of Dimmers :

1. Incandescent/Halogen

2. Magnetic Low Voltage (MLV)

3. Fluorescent

4. Light Emitting Diode (LED)

These are the different types of switches :

1. A single-pole switch controls lights from a single location. ...

2. A 3-way switch provides two separate control locations and is best used with recessed lights. ...

3. A 4-way switch provides for three or more dimming locations.

4. Switches are wired to the "hot" conductor in a wall box.

<em>I hope that my answer helps!</em>

7 0
3 years ago
Clifford created a table using OpenOffice Writer and entered some information into the table. Later, he needed to add more rows
Minchanka [31]

Right click the cell, click add cells & it should say the options (new row above etc.)

4 0
3 years ago
Read 2 more answers
Answer the question ASAP please
RUDIKE [14]

Answer:

Shows the programming checking if num1 is greater than num2

Explanation:

So num1 and num2 are inputs

for you to code this you would need to put

num1=int(input("What is your first number? ))

and the same for num2 except change num1 for num 2 and first for second

When the input is completed, the computer will check if num 1 is greater than num2

it will do this by using a code something like:

if num1>num2:

    Print("Your first input was greater than your second")

But in this example if it greater it just ends

But if it was less than you would put

if num1>num2:

    Print("Your first input was greater than your second")

elif num1<num2:

    Print("Your first input is less than your second")

So basically this code shows the computer checking if one number is greater than the other or not

3 0
2 years ago
Read 2 more answers
The LList class is (mostly) the same one discussed in lecture, but you must write a sort() function that uses one of the three i
Vladimir79 [104]

Answer:

see explaination

Explanation:

#include <iostream>

#include <string>

using namespace std;

class LinkedList{

class Node{

public :

int data;

Node* next;

Node(int data){

this->data = data;

next = NULL;

}

};

public :

Node *head;

LinkedList(){

this->head = NULL;

}

void insert(int d){

Node* new_node = new Node(d);

new_node->next = head;

head = new_node;

}

// sort the list with selection sort algorithm.

// Pick the smallest element in the unsorted array and place in the first element in the unsorted.

void sort_list(){

if (head == NULL){

return;

}

Node* current = head;

while (current->next != NULL){

Node* min_node = current;

Node* traverse = current->next;

while(traverse != NULL){

if(traverse->data < min_node->data){

min_node = traverse;

}

traverse = traverse->next;

}

int temp = current->data;

current->data = min_node->data;

min_node->data = temp;

current = current->next;

}

}

void print_list(){

Node* current = head;

while(current !=NULL){

cout<<current->data<<" ";

current = current->next;

}

cout<<"\n";

}

};

int main(){

LinkedList ll;

for(int i=0;i<10;i++){

ll.insert(i);

}

ll.print_list();

cout<<"*******************************************\n";

ll.sort_list();

ll.print_list();

cout<<"*******************************************\n";

}

8 0
3 years ago
Other questions:
  • What was the first browser that allowed for graphics to be viewed on the web?
    14·2 answers
  • In Outlook 2016, what are the three format options when sending an email message? Check all that apply.
    7·1 answer
  • Interpretations of the AICPA Code of Professional Conduct are dominated by the concept of: Question 4 options: 1) independence.
    5·1 answer
  • How is the JOptionPaneclass used to display a dialog box that performs a yes/noconfirmation?
    10·1 answer
  • Write the definition of a function printAttitude , which hasan int parameter and returns nothing. The function prints amessage t
    13·1 answer
  • Want to.learn about computers​
    9·1 answer
  • Vannevar Bush imagined a desktop computing machine that would allow people to access data stored in various information centers
    13·1 answer
  • Debug the following program.
    5·1 answer
  • If html is used to specify the content of the webpage, then what do you use css for?.
    12·1 answer
  • Discussion Topic
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!