Create a script file that asks the user to input the number of rows, number of columns, and a constant integer value (may be negative, zero or positive) and then creates the matrix.

Use a user-defined function to obtain the input. Check that the number of rows and number of columns is between 1 and 8 inclusive [1:8], and that the constant value IS an integer. Give the user another chance if they enter an illegal value, do not just shut down the program. You can either put the user function in the body of the main script file or create a separate file and submit it at the end of the exam in one of the fake questions. Check your program for these 2 cases:

2 rows, 4 columns, value of -77
2 rows, 6 columns, value of 13

Answers

Answer 1

Answer:

def script_input():

   chances = 2

   while chances > 0:

       global rows

       global columns

       global constant

       rows = int(input("Enter the number of rows: "))

       columns = int(input("Enter the number of columns: "))

       constant = int(input("Enter the constant: "))

       if rows > 0 and rows <= 8 and columns > 0 and columns <= 8 and \

           isinstance(constant, int):

           chances -= 2

       else:

           chances -= 1

script_input()

print(f"{rows} rows, {columns} columns, value of {constant}")

Explanation:

The python script defines a function that gets the user input of row, column and constant value variables, then the script prints out the number of rows and columns for the matrix to be created.


Related Questions

An astronomer of 65 kg of mass hikes from the beach to the observatory atop the mountain in Mauna Kea, Hawaii (altitude of 4205 m). By how much (in newtons) does her weight change when she goes from sea level to the observatory?

Answers

Answer:

[tex]0.845\ \text{N}[/tex]

Explanation:

g = Acceleration due to gravity at sea level = [tex]9.81\ \text{m/s}^2[/tex]

R = Radius of Earth = 6371000 m

h = Altitude of observatory = 4205 m

Change in acceleration due to gravity due to change in altitude is given by

[tex]g_h=g(1+\dfrac{h}{R})^{-2}\\\Rightarrow g_h=9.81\times(1+\dfrac{4205}{6371000})^{-2}\\\Rightarrow g_h=9.797\ \text{m/s}^2[/tex]

Weight at sea level

[tex]W=mg\\\Rightarrow W=65\times 9.81\\\Rightarrow W=637.65\ \text{N}[/tex]

Weight at the given height

[tex]W_h=mg_h\\\Rightarrow W_h=65\times 9.797\\\Rightarrow W_h=636.805\ \text{N}[/tex]

Change in weight [tex]W_h-W=636.805-637.65=-0.845\ \text{N}[/tex]

Her weight reduces by [tex]0.845\ \text{N}[/tex].


Support with three reasons the decision to use a plastic material for the package in the following
scenario.
Situation: A client has hired Jose, a materials engineer, to develop a package for an item he has begun
to market. The object needs to be mailed to customers within three days of being ordered.

Answers

Answer:

its durable. it's cheap. its recyclable

Explanation:

Plastic is made of lots of recycled materials that make it very useful and cheap.

Determine the size of memory needed for CD recording of a piece of music, which lasts for 26 minutes, is done with a 20-bit Analog-to-Digital Converter (ADC) in stereo (2 channels), at the rate of 44.1 kSa/s, with the compression factor 6 (allow 10% error margin).

Answers

Answer: the size of memory needed for the CD recording is 28.7 MB

Explanation:

so in the case of stereo, the bitrate is;

⇒ 26 × 60 × 44.1 × 10³ × 2

=   137592 × 10³  

for 10 bit

⇒ 137592 × 10³ × 10

= 1375920 × 10³ bits

now divide by 8 (convert to bytes)

⇒ (1375920 × 10³) / 8

= 171,990,000 BYTE

divide by 1000 (convert to kilobytes)

= 171,990,000 / 1000

= 171,990 KILOBYTES

now Given that, the compression ratio is 6      

so  

171,990 / 6

= 28665 KB

we know that. 1 MB = 1000 KB

x MB = 28665 KB

x MB = 28665 / 1000

⇒ 28.665 MB ≈ 28.7 MB

Therefore the size of memory needed for the CD recording is 28.7 MB

How many flip-flop values are complemented in an 8-bit binary ripple counter to reach the next count value after: 0110111 and 01010110?

Answers

Answer:

- Four (4) flip-flop values will complemented

- one (1) flip-flop value will complemented

Explanation:

To find how many flip flop number of bits complemented, we just need to figure out what the next count in the sequence is and find how many bits have changed.

taking a look at the a) 00110111

we need to just 1 to the value,

so

00110111 +  0000001  = 00111000        

So here, only the first four bits are complemented.

Therefore Four (4) flip-flop values will complemented

Next

b) 01010110

we also add 1 to the value

01010110  + 00000001  = 01010111

only the first bit is complemented.

Therefore one (1) flip-flop value will complemented

LOLOLOLOKOLLOLLOLOLOO STRIKER KID THINKS HES SO GOOD LLOLOLOLOLOLOLOLOLOLOOLOLOLOLOLOLOL

Answers

Rnekfkfkdkfjfnmdlwocbrig

Answer:

UUUUUUMMMM do you mean in soccer ????????????????

Explanation:

An engineer must design a rectangular box that has a volume of 9 m3 and that has a bottom whose length is twice its width. What are the dimensions of the box so that the total surface area (of all six sides) of the box is minimized

Answers

Answer:

[tex]Length =3[/tex]   [tex]Height = 2[/tex]   and  [tex]Width = \frac{3}{2}[/tex]

Explanation:

Given

[tex]Volume = 9m^3[/tex]

Represent the height as h, the length as l and the width as w.

From the question:

[tex]Length = 2 * Width[/tex]

[tex]l = 2w[/tex]

Volume of a box is calculated as:

[tex]V = l*w*h[/tex]

This gives:

[tex]V = 2w *w*h[/tex]

[tex]V = 2w^2h[/tex]

Substitute 9 for V

[tex]9 = 2w^2h[/tex]

Make h the subject:

[tex]h = \frac{9}{2w^2}[/tex]

The surface area is calculated as:

[tex]A = 2(lw + lh + hw)[/tex]

Recall that: [tex]l = 2w[/tex]

[tex]A = 2(2w*w + 2w*h + hw)[/tex]

[tex]A = 2(2w^2 + 2wh + hw)[/tex]

[tex]A = 2(2w^2 + 3wh)[/tex]

[tex]A = 4w^2 + 6wh[/tex]

Recall that: [tex]h = \frac{9}{2w^2}[/tex]

So:

[tex]A = 4w^2 + 6w * \frac{9}{2w^2}[/tex]

[tex]A = 4w^2 + 6* \frac{9}{2w}[/tex]

[tex]A = 4w^2 + \frac{6* 9}{2w}[/tex]

[tex]A = 4w^2 + \frac{3* 9}{w}[/tex]

[tex]A = 4w^2 + \frac{27}{w}[/tex]

To minimize the surface area, we have to differentiate with respect to w

[tex]A' = 8w - 27w^{-2}[/tex]

Set A' to 0

[tex]0 = 8w - 27w^{-2}[/tex]

Add [tex]27w^{-2}[/tex] to both sides

[tex]27w^{-2} = 8w[/tex]

Multiply both sides by [tex]w^2[/tex]

[tex]27w^{-2}*w^2 = 8w*w^2[/tex]

[tex]27 = 8w^3[/tex]

Make [tex]w^3[/tex] the subject

[tex]w^3 = \frac{27}{8}[/tex]

Solve for w

[tex]w = \sqrt[3]{\frac{27}{8}}[/tex]

[tex]w = \frac{3}{2}[/tex]

Recall that : [tex]h = \frac{9}{2w^2}[/tex]   and [tex]l = 2w[/tex]

[tex]h = \frac{9}{2 * \frac{3}{2}^2}[/tex]

[tex]h = \frac{9}{2 * \frac{9}{4}}[/tex]

[tex]h = \frac{9}{\frac{9}{2}}[/tex]

[tex]h = 9/\frac{9}{2}[/tex]

[tex]h = 9*\frac{2}{9}[/tex]

[tex]h= 2[/tex]

[tex]l = 2w[/tex]

[tex]l = 2 * \frac{3}{2}[/tex]

[tex]l = 3[/tex]

Hence, the dimension that minimizes the surface area is:

[tex]Length =3[/tex]   [tex]Height = 2[/tex]   and  [tex]Width = \frac{3}{2}[/tex]

The purpose of pasteurizing milk is to
A. Kill pathogens
B. Break down milk fat
C. Add vitamins and minerals
D. Prevent spoilage by sunlight

Plis can someone help me ?

Answers

Answer:

i think it c

Explanation:

The answer to your problem is B

A person walks into a refrigerated warehouse with head uncovered. Model the head as a 25- cm diameter sphere at 35°C with a surface emissivity of 0.95. Heat is lost from the head to the surrounding air at 25°C by convection with a convection coefficient of ???????????????? ???????? ????????????????∙???????? , and by radiation to the surrounding black walls at 15°C. Determine the total rate of heat loss. StefanBoltzmann Constant, ???????? = ????????. ???????????????? × ????????????????−???????? ???????? ????????????????∙???????????????? . (10 points)

Answers

Answer:

Hello some parts of your question is missing below is the missing part

Convection coefficient = 11 w/m^2. °c

answer : 44.83 watts

Explanation:

Given data :

surface emissivity ( ε )= 0.95

head ( sphere) diameter( D )  = 0.25 m

Temperature of sphere( T )  = 35° C

Temperature of surrounding ( T∞ )  = 25°C

Temperature of surrounding surface ( Ts ) = 15°C

б  = ( 5.67 * 10^-8 )

Determine the total rate of heat loss

First we calculate the surface area of the sphere

As = [tex]\pi D^{2}[/tex]  

= [tex]\pi * 0.25^2[/tex] =  0.2 m^2

next we calculate heat loss due to radiation

Qrad = ε * б * As( [tex]T^{4} - T^{4} _{s}[/tex] )  ---- ( 1 )

where ;

ε = 0.95

б = ( 5.67 * 10^-8 )

As = 0.2 m^2

T = 35 + 273 = 308 k

Ts = 15 + 273 = 288 k

input values into equation 1

Qrad = 0.95 * ( 5.67 * 10^-8 ) * 0.2 ( (308)^4 - ( 288)^4 )

         = 22.83  watts

Qrad ( heat loss due to radiation ) = 22.83 watts

calculate the heat loss due to convection

Qconv = h* As ( ΔT )

           = 11*0.2 ( 35 -25 )  = 22 watts

Hence total rate of heat loss

=  22 + 22.83

= 44.83 watts

Which of the following terms describes the path from an electrical source to a switch or plug?
transmitter
circuit breaker
raceway
breaker panel

Answers

Answer:

transmitter hope thus helped!

Explanation:

Raceway is the answer

"A raceway is an enclosed conduit that forms a physical pathway for electrical wiring."

The purpose of pasteurizing milk is to A. Kill pathogens B. Break down milk fat C. Add vitamins and minerals D. Prevent spoilage by sunlight

Answers

Answer: A Kill pathogens

What phenomenon allows water to reach the top of a building?
greywater
venting
water pressure
Owater vapor

Answers

Answer:

Option C: water pressure.

Explanation:

Water pressure allows water to reach the top of a building.

In a compression test, a steel test specimen (modulus of elasticity 30 106 lb/in2 ) has a starting height 2.0 in and diameter 1.5 in. The metal yields (0.2% offset) at a load 140,000 lb. At a load of 260,000 lb, the height has been reduced to 1.6 in. Determine (a) yield strength and (b) fl ow curve parameters (strength coeffi cient and strain-hardening exponent). Assume that the cross-sectional area increases uniformly during the test.

Answers

Answer:

A) σ_y = 79096 lb/in² = 79.1 ksi

B) strain-hardening exponent = 0.102

(strength coefficient = 137838.78 lb/in²

Explanation:

A) Formula for volume is;

V = πd²h/4

We are given;

height 2.0 in and diameter 1.5 in

Thus;

V = (π × 1.5² × 2)/4

V = 3.53 in³

Area is;

A = πd²/4

A = (π × 1.5²)/4

A = 1.77 in²

Yield strength is gotten from the formula;

σ_y = Force/Area

We are given load = 140,000 lb

Thus;

σ_y = 140000/1.77

σ_y = 79096 lb/in²

B) We are given

modulus of elasticity: E = 30 × 10^(6) lb/in²

Formula for strain is;

ε = σ_y/E

ε = 79096/(30 × 10^(6))

ε = 0.00264

The metal yields (0.2% offset), thus;

strain offsets = 0.00264 + 0.002

strain offsets: ε1 = 0.00464

Thus;

(h_i - h_o)/h_o = 0.00464

(h_i/h_o) - 1 = 0.00464

(h_i/h_o) = 1.00464

h_i = h_o(1.00464)

h_o = 2 in

Thus; h_i = 2(1.00464) = 2.00928 in

Area = Volume/height = 3.53/2.00928 = 1.757 in²

True stress is;

σ = force/area = 140000/1.757

σ1 = 79681.27 lb/in²

At a load of 260,000 lb, the height has been reduced to 1.6 in. Thus;

Area = 3.53/1.6 = 2.206 in²

True stress is;

σ2 = 260000/2.206

σ2 = 117860.38 lb/in²

True strain;

ε2 = In(2/1.6)

ε2 = 0.223

From flow curve;

σ = kεⁿ

Thus;

σ1 = k(ε1)ⁿ

79681.27 = k(0.00464ⁿ) - - - (eq 1)

Also for σ2 = k(ε2)ⁿ;

117860.38 = k(0.223ⁿ) - - - - - (eq 2)

From eq 1,

k = 79681.27/0.00464ⁿ

Putting this for k in eq2 to get;

117860.38 = (0.223ⁿ) × 79681.27/0.00464ⁿ

117860.38/79681.27 = 0.223ⁿ/0.00464ⁿ

Solving for n, we have ≈ 0.102

Thus,K is;

k = 79681.27/0.00464^(0.102)

k = 137838.78 lb/in²

An ideal gas, consisting of n moles, undergoes an irreversible process in which the temperature has the same value at the beginning and end. If the volume changes from Vi to Vf , the change in entropy is given by:______

Answers

Answer:

n R ln(Vf/Vi)

Explanation:

Entropy is the loss of energy available to do work. Entropy is a state function (i.e. it depends only upon the current state of the system and is independent of how that state was prepared).

Since the temperature change of the ideal is constant, hence this is an isothermal expansion of a perfect gas. The change in entropy (ΔS) for an isothermal expansion of a perfect gas is given by:

[tex]\Delta S=nR*ln(\frac{V_f}{V_i})[/tex]

Where n is the amount of gas molecules in mol and R is the gas constant in JK⁻¹mol⁻¹given by R = [tex]N_A[/tex]k, k is Boltzmann's constant in J K⁻¹ and Avogadro's constant [tex]N_A[/tex] in mol⁻¹. Vf is the final volume and Vi the initial volume.

Other Questions
Which country has an economy based mostly on the production and sale ofenergy? SAT verbal scores are normally distributed with a mean of 430 and a standard deviation of 120 (based on the data from the College Board ATP). If a sample of 15 students is selected randomly, find the probability that the sample mean is above 500. Does the central limit theorem apply for this problem? Simplify. 18m 9v + 6v 7m PLEASE HELPI. Find the slope of the line graphed and draw a line parallel to it through the point on the answer sheet. How does photosynthesis occur the reactants collect in the _______. ________energy from the sun drives chemical reactants the products include glucose and _______.which is released into the air OPTIONS 1 nucleus chlorplast stem. 2 Water Light Nutrient. 3 nitrogen carbon dioxide oxygen. Large balloons are sold in packages of 12 Select the expressions that can represent the total number of balloons in p packages of large balloons.A 12-PB. 12*pC. P + 12D. p + 12E 12p Which factor helped shift American opinion away from neutrality during World War I? Which expression represents 6 less than a number, n? For every 2 cars you wash, your friend washes 3 cars. You wash a total of 8 cars. How many does your friend wash? PLS GIVE EXPLANATION What is the area of the shaded sector? Working alone, it takes Trevon eight hoursto pick forty bushels of apples. Brendacan pick the same amount in 10.8 hours.Find how long it would take them if theyworked together. develop a story between two friends and a dog on loyalty word limit 200 The cost of a ride at a fair is $2 each. It costs $10 for admission. If r representsthe cost of a ride, which equation represents the total cost, c, What's the midpoint of a line segment joining the points (5, 4) and (13, 12)?Question 8 options:A) (4, 4)B) (9, 4)C) (4, 8)D) (4, 4) A cross between a white rooster and a black hen results in 100% blue offspring. When two of theseblue offspring are mated, the probable phenotypic ratio seen in their offspring would beA) 1:1:2 B) 3:1 C) 1:2:1D) 2:1:1 4. Read the following sentence: "Chemistry is very complicated because there are somany different combinations."The word complicated meansA. simple and basicB. difficult to understandC. fun and excitingD. able to be learned easily The Scopes trial of 1925 focused on the help me g please dont use me for points porfa:( What is the conveyance of acceptance and acknowledgement of the person?ConfirmationO ClarificationOConfrontationConnection If triangle ABC= triangle DEF, which is a correct congruence statement