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
vodka [1.7K]
3 years ago
5

python Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E.

Print a space after each seat, including after the last. Ex: num_rows = 2 and num_cols = 3 prints: 1A 1B 1C 2A 2B 2Cnum_rows = 2num_cols = 3# Note 1: You will need to declare more variables# Note 2: Place end=' ' at the end of your print statement to separate seats by spaces

Engineering
1 answer:
MissTica3 years ago
3 0

Explanation:

First of all get the input from the user, number of rows and number of columns where rows represents seat digit number and column represents the seat letter

rows is initialized to 1 to ensure that row starts at 1 or you can remove it then seat number will start from 0.

The first loop is used for digits starting from 1 to number of rows

The second loop is used for letters starting from 1 to number of columns

since rows and cols are not of the same type that's why we are converting the int type to string type

print(str(rows)+cols) counter will keep updating the columns A, B, C.....

rows= rows + 1 counter will keep updating the rows 1, 2, 3....

Code:

Please refer to the attached image.

Output:

Please enter the number of rows: 2

Please enter the number of columns: 3

1A

1B

1C

2A

2B

2C

You might be interested in
2. What is the main job of a cylinder head?
Anna11 [10]

Answer:

Explanation:

The cylinder head sits on the engine and closes off the combustion chamber. The gap that remains between the cylinder head and the engine is completed by the head gasket. Another task of the cylinder head is to ensure the constant lubrication of the cylinder        

3 0
3 years ago
Some aircraft component is fabricated from an aluminum alloy that has a plane strain fracture toughness of 35 MPa m . It has bee
GaryK [48]

Answer:  Fracture will not occur since Kc (32.2 MPa√m) ∠ KIc (35  MPa√m).

Explanation:

in this question we are asked to determine if an aircraft will fracture for a given fracture toughness.

let us begin,

from the question we have that;

stress = 325 MPa

fracture toughness (KIc) = 35  MPa√m

the max internal crack length = 1.0 m

using the formula;

Y = KIc/σ√(πα)    ---------------(1)

solving for Y we have;

Y =  35 (MPa√m) / 250 (MPa) √(π × 2×10⁻3/2m)

Y = 2.50

so to calculate the fracture roughness;

Kc = Y × σ√(πα)   = 2.5 × 3.25√(π × 1×10⁻³/2) = 32.2 MPa√m

Kc = 32.2 MPa√m

From our results we can say that fracture will not occur since Kc (32.2 MPa√m) is less than KIc (35  MPa√m) of the material.

cheers i hope this helps!!!!

8 0
3 years ago
Create a C language program that can be used to construct any arbitrary Deterministic Finite Automaton corresponding to the FDA
otez555 [7]

Answer:

see the explanation

Explanation:

/* C Program to construct Deterministic Finite Automaton */

#include <stdio.h>

#include <DFA.h>

#include <stdlib.h>

#include <math.h>

#include <string.h>

#include <stdbool.h>

struct node{

struct node *initialStateID0;

struct node *presentStateID1;

};

printf("Please enter the total number of states:");

scanf("%d",&count);

//To create the Deterministic Finite Automata

DFA* create_dfa DFA(){

  q=(struct node *)malloc(sizeof(struct node)*count);

  dfa->initialStateID = -1;

  dfa->presentStateID = -1;

  dfa->totalNumOfStates = 0;

  return dfa;

}

//To make the next transition

void NextTransition(DFA* dfa, char c)

{

  int tID;

  for (tID = 0; tID < pPresentState->numOfTransitions; tID++){

       if (pPresentState->transitions[tID].condition(c))

      {

          dfa->presentStateID = pPresentState->transitions[tID].toStateID;

          return;

      }

  }

  dfa->presentStateID = pPresentState->defaultToStateID;

}

//To Add the state to DFA by using number of states

void State_add (DFA* pDFA, DFAState* newState)

{  

  newState->ID = pDFA->numOfStates;

  pDFA->states[pDFA->numOfStates] = newState;

  pDFA->numOfStates++;

}

void transition_Add (DFA* dfa, int fromStateID, int(*condition)(char), int toStateID)

{

  DFAState* state = dfa->states[fromStateID];

  state->transitions[state->numOfTransitions].toStateID = toStateID;

  state->numOfTransitions++;

}

void reset(DFA* dfa)

{

  dfa->presentStateID = dfa->initialStateID;

}

5 0
4 years ago
For this problem, you may not look at any other code or pseudo-code (even if it is on the internet), other than what is on our w
sergiy2304 [10]

Answer:

(a)

(i) pseudo code :-

current = i

// assuming parent of root is -1

while A[parent] < A[current] && parent != -1 do,

if A[parent] < A[current] // if current element is bigger than parent then shift it up

swap(A[current],A[parent])

current = parent

(ii) In heap we create a complete binary tree which has height of log(n). In shift up we will take maximum steps equal to the height of tree so number of comparison will be in term of O(log(n))

(b)

(i) There are two cases while comparing with grandparent. If grandparent is less than current node then surely parent node also will be less than current node so swap current node with parent and then swap parent node with grandparent.

If above condition is not true then we will check for parent node and if it is less than current node then swap these.

pseudo code :-

current = i

// assuming parent of root is -1

parent is parent node of current node

while A[parent] < A[current] && parent != -1 do,

if A[grandparent] < A[current] // if current element is bigger than parent then shift it up

swap(A[current],A[parent])

swap(A[grandparent],A[parent])

current = grandparent

else if A[parent] < A[current]

swap(A[parent],A[current])

current = parent

(ii) Here we are skipping the one level so max we can make our comparison half from last approach, that would be (height/2)

so order would be log(n)/2

(iii) C++ code :-

#include<bits/stdc++.h>

using namespace std;

// function to return index of parent node

int parent(int i)

{

if(i == 0)

return -1;

return (i-1)/2;

}

// function to return index of grandparent node

int grandparent(int i)

{

int p = parent(i);

if(p == -1)

return -1;

else

return parent(p);

}

void shift_up(int A[], int n, int ind)

{

int curr = ind-1; // because array is 0-indexed

while(parent(curr) != -1 && A[parent(curr)] < A[curr])

{

int g = grandparent(curr);

int p = parent(curr);

if(g != -1 && A[g] < A[curr])

{

swap(A[curr],A[p]);

swap(A[p],A[g]);

curr = g;

}

else if(A[p] < A[curr])

{

swap(A[p],A[curr]);

curr = p;

}

}

}

int main()

{

int n;

cout<<"enter the number of elements :-\n";

cin>>n;

int A[n];

cout<<"enter the elements of array :-\n";

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

cin>>A[i];

int ind;

cout<<"enter the index value :- \n";

cin>>ind;

shift_up(A,n,ind);

cout<<"array after shift up :-\n";

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

cout<<A[i]<<" ";

cout<<endl;

}

Explanation:

8 0
4 years ago
First drilled to a depth of 1 47/64 how much deeper must it be drilled to reach the depth indicated?
lara [203]

Answer:

  1 13/64

Explanation:

The depth of the hole is the height of the block less the remaining material below the hole:

  depth = 1 3/8 +1 15/16 - 3/8 = (1 3/8 -3/8) +1 15/16 = 2 15/16

We want to find the difference between this depth and the depth of the hole already drilled:

  2 15/16 -1 47/64 = 2 60/64 -1 47/64

  = (2 -1) +(60 -47)/64 = 1 13/64

The hole must be drilled 1 13/64 deeper to match the drawing.

7 0
2 years ago
Other questions:
  • A small pad subjected to a shearing force is deformed at the top of the pad 0.12 in. The heigfit of the pad is 1.15 in. What is
    7·1 answer
  • A gas refrigeration system using air as the working fluid has a pressure ratio of 5. Air enters the compressor at 0°C. The high-
    8·1 answer
  • Refrigerant-134a enters the coils of the evaporator of a refrigeration system as a saturated liquid–vapor mixture at a pressure
    12·1 answer
  • What does the DHCP server configures for each host?
    14·1 answer
  • A 120-volt fluorescent ballast has an input current of 0.34 ampere and an input power rating of 22 watts. The power factor of th
    13·1 answer
  • A good attitude toward blank means believing that the proper attitude and habits are extremely important
    6·1 answer
  • What was a campaign belief in the 1980 presidential election? Carter called for a stronger national defense. Carter promised to
    7·2 answers
  • Tech A says that a mechanical pressure regulator exhausts excess fluid back to the transmission pan. Tech B says that if the tra
    9·1 answer
  • If a client is shown the "Cadillac"
    11·1 answer
  • Which principle of the software engineering code of ethics has gilbert violated?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!