Question: Hi, I am doing repl.it, I need to solve these problems in coding in python 3 1. Given two integers - the number of rows
Hi, I am doing repl.it, I need to solve these problems in coding in python 3
1.
Given two integers - the number of rows m and columns n of mn 2d list - and subsequent m rows of n integers, followed by one integer c. Multiply every element by c and print the result.
Example input
3 4 11 12 13 14 21 22 23 24 31 32 33 34 2
Example output
22 24 26 28 42 44 46 48 62 64 66 68
2.
Given two integers - the number of rows m and columns n of mn 2d list - and subsequent m rows of n integers, find the maximal element and print its row number and column number. If there are many maximal elements in different rows, report the one with smaller row number. If there are many maximal elements in the same row, report the one with smaller column number.
Example input
3 4 0 3 2 4 2 3
(maximal element is highlighted)
Example output
1 2
3.
Given an integer n, create a two-dimensional array of size nn according to the following rules and print it:
On the main diagonal put 0.
On the diagonals adjacent to the main put 1.
On the next adjacent diagonals put 2, and so forth.
Example input
5
Example output
0 1 2 3 4 1 0 1 2 3 2 1 0 1 2 3 2 1 0 1 4 3 2 1 0
4.
Statement
Given an integer n, create a two-dimensional array of size nn according to the following rules and print it:
On the antidiagonal put 1.
On the diagonals above it put 0.
On the diagonals below it put 2.
Example input
4
Example output
0 0 0 1 0 0 1 2 0 1 2 2 1 2 2 2
5.
Statement
Given two integers - the number of rows m and columns n of mn 2d list - and subsequent m rows of n integers, followed by two non-negative integers i and j less than n, swap the columns i and j of 2d list and print the result.
Example input
3 4 11 12 13 14 21 22 23 24 31 32 33 34 0 1
Example output
12 11 13 14 22 21 23 24 32 31 33 34
6.
Statement
Given an odd positive integer n, produce a two-dimensional array of size nn. Fill each element with the character "." . Then fill the middle row, the middle column and the diagonals with the character "*". You'll get an image of a snow flake. Print the snow flake in nn rows and columns and separate the characters with a single space.
Example input
7
Example output
* . . * . . * . * . * . * . . . * * * . . * * * * * * * . . * * * . . . * . * . * . * . . * . . *
7.
Statement
Given two positive integers n and m, create a two-dimensional array of size nm and populate it with the characters "."and "*" in a chequered pattern. The top left corner should have the character "." .
Example input
6 8
Example output
. * . * . * . * * . * . * . * . . * . * . * . * * . * . * . * . . * . * . * . * * . * . * . * .
-Thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
