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
Ray Of Light [21]
3 years ago
9

PYTHON QUESTION

Computers and Technology
1 answer:
zloy xaker [14]3 years ago
7 0

Answer:

num=[]

a=input("Enter the number count")

i=0

for i in range(0,int(a)):

   b=input("Enter the number")

   num.append(b)

def safe_int(num):

   i=0

   for i in range(0,int(a)-1):

       if( num[i].isdigit()):

           num[i]=num[i]

       else:

           num[i]=0

safe_int(num)

print(num)

Explanation:

Above we have entered a list, and then pass it to the function. There we check if each item of list is an integer, and if it is an integer it is left as it is, or else 0 is stored for it in the list.

You might be interested in
Identify the modern-day printmaking process, also known as screenprinting, in which the artist squeegees paint through a mesh sc
aliya0001 [1]
Serigraphy is another word for this!
5 0
3 years ago
Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T
hammer [34]

Answer:

In C++:

#include<iostream>

#include<vector>

using namespace std;

int main() {

int len;

cout<<"Length: ";  cin>>len;

string inpt;

vector<string> vect;

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

   cin>>inpt;

   vect.push_back(inpt); }

char ch;

cout<<"Input char: ";  cin>>ch;  

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

   size_t found = vect.at(i).find(ch);  

       if (found != string::npos){

           cout<<vect.at(i)<<" ";

           i++;

       }

}  

return 0;

}

Explanation:

This declares the length of vector as integer

int len;

This prompts the user for length

cout<<"Length: ";  cin>>len;

This declares input as string

string inpt;

This declares string vector

vector<string> vect;

The following iteration gets input into the vector

<em>for(int i =0;i<len;i++){ </em>

<em>    cin>>inpt; </em>

<em>    vect.push_back(inpt); } </em>

This declares ch as character

char ch;

This prompts the user for character

cout<<"Input char: ";  cin>>ch;  

The following iterates through the vector

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

This checks if vector element contains the character

   size_t found = vect.at(i).find(ch);  

If found:

       if (found != string::npos){

Print out the vector element

           cout<<vect.at(i)<<" ";

And move to the next vector element

           i++;

       }

}  

4 0
3 years ago
When you ____ an exception, you send a message that an error has occurred to another part of the program.
jekas [21]
The correct answer is most definitely B
8 0
3 years ago
Read 2 more answers
Computer-based networks that trigger actions by sensing changes in the real or digital world are known as: global marketing plat
Gennadij [26K]
It known as the smart systems

It make decision by describing and analyzing the available data in a predictive or adaptive manner thereby performing an efficient and smart actions based on that analysis

A lot of smart systems evolved from micro systems
8 0
3 years ago
DEFINE WHAT COPYRIGHT?
Reika [66]
Copyright is when someone is given the right to print, publish or make a film.
5 0
3 years ago
Read 2 more answers
Other questions:
  • 3k means about 3 thousand bytes. how would you express two hundred million bytes?
    8·1 answer
  • Which type of graph or chart measures
    15·2 answers
  • The Apple iPhone was a revolutionary product when it was introduced in 2007. To what extent do you agree or disagree with this s
    8·1 answer
  • If you were infiltrating a network (10.16.0.0/16), and searching for vulnerabilities (while trying to remain undetected), why wo
    11·2 answers
  • _KOH + _Cu(CIO3)2 - __KCIO3 +<br>_Cu(OH)2​
    12·1 answer
  • I CANT DO SKIN MODS ON BRAWLHALLA RIGHT!!!! IM SO MADDDDDDDDDDD
    11·1 answer
  • Jill is configuring the AutoArchive feature in Outlook 2016. What is the default setting in relation to when AutoArchive
    8·1 answer
  • Area Triangolo Rettangolo in c++
    6·1 answer
  • The most important part of a computer​
    14·2 answers
  • List one unprofessional AND one professional example of internet/social media
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!