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
8090 [49]
3 years ago
15

Write a function that takes a number of rows, a number of columns, and a string and returns a two-dimensional array of the dimen

sions specified where each element is the string given. Sample run: mat = fill_str(4, 2, "2D​") print(mat) Prints the following: [['2D', '2D'], ['2D', '2D'], ['2D', '2D'], ['2D', '2D']]
Computers and Technology
1 answer:
Darya [45]3 years ago
6 0

Answer:

Explanation:

The following code is written in Python. The function, as asked, takes in three parameters and creates a 2D array with the dimensions specified in the inputs and fills it with the element passed for the third parameter.

def createArray(rows, columns, element):

   my_array = []

   for x in range(rows):

       sub_arr = []

       for y in range(columns):

           sub_arr.append(element)

       my_array.append(sub_arr)

   return my_array

You might be interested in
To construct a battery with a current of 6 A, you would connect six 1 A cells
Eva8 [605]

in series i believe

6 0
3 years ago
Write a C++ program that reads students' names followed by their test scores. The program should output each students' name foll
Mashutka [201]

Answer:

#include<iostream>

#include<conio.h>

using namespace std;

struct studentdata{

char Fname[50];

char Lname[50];

int marks;

char grade;

};

main()

{

studentdata s[20];

for (int i=0; i<20;i++)

   {

cout<<"\nenter the First name of student";

cin>>s[i].Fname;

cout<<"\nenter the Last name of student";

cin>>s[i].Lname;

cout<<"\nenter the marks of student";

cin>>s[i].marks;

}  

 

for (int j=0;j<20;j++)

{

if (s[j].marks>90)

{

 s[j].grade ='A';

}

else if (s[j].marks>75 && s[j].marks<90)

{

   s[j].grade ='B';

}

else if (s[j].marks>60 && s[j].marks<75)

{

 s[j].grade ='C';

}

else

{

 s[j].grade ='F';

}

}

int highest=0;

int z=0;

for (int k=0;k<20; k++)  

{

if (highest<s[k].marks)

{

 highest = s[k].marks;

 z=k;

}

 

}

cout<<"\nStudents having highest marks"<<endl;

 

cout<<"Student Name"<< s[z].Fname<<s[z].Lname<<endl;

cout<<"Marks"<<s[z].marks<<endl;

cout<<"Grade"<<s[z].grade;

getch();  

}

Explanation:

This program is used to enter the information of 20 students that includes, their first name, last name and marks obtained out of 100.

The program will compute the grades of the students that may be A,B, C, and F. If marks are greater than 90, grade is A, If marks are greater than 75 and less than 90, grade is B. For Mark from 60 to 75 the grade is C and below 60 grade is F.

The program will further found the highest marks and than display the First name, last name, marks and grade of student who have highest marks.

6 0
3 years ago
What is the number 5280 in binary
Tpy6a [65]
0001010010100000?
Hopefully I'm right
7 0
3 years ago
Five corporations own over 90 percent of the media in the US.<br> 1.True<br> 2.False
avanturin [10]
<span>Five corporations own over 90 percent of the media in the US : </span>1.True.

7 0
4 years ago
18. Which console pioneered the ability for gamers to save their game and resume from that point?
mina [271]
I think it is D
Hope my answer help
Sorry it is wrong
4 0
3 years ago
Other questions:
  • If you want to conserve ink or toner, you can instruct PowerPoint to print ____ documents.
    10·1 answer
  • A(n) _____ can be used to reveal a competitor’s program code, which can then be used to develop a new program that either duplic
    9·1 answer
  • If a drastic change in environmental conditions results in a prolonged drought, how would the total population of ferns be affec
    14·2 answers
  • Programs which tell the computer what to do:<br> a. Software<br> b. ROM<br> c. RAM<br> d. Hard disk
    6·2 answers
  • Which column and row references are updated when you copy the formula: =F$5+12?
    14·1 answer
  • Generally, websites ending in .edu, .gov, and .org are less likely to be biased, or to show preference toward a certain financia
    12·1 answer
  • If you decide you want to meet someone you met online, what should you do first? A. Tell your best friend. B. Call the person yo
    12·1 answer
  • Heya! I’m quite lonely, so here are some points. I want to play some mc with others but the only version I’m able to play is edu
    11·2 answers
  • I've been stuck on these two basic javascript assignments for an embarrassingly long time. The teacher refuses to help me and th
    13·1 answer
  • Why must the image be reduced when the field of view is widened to take in more of the scene?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!