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
nata0808 [166]
3 years ago
11

Remember from Lab 3C that Mad Libs are activities that have a person provide various words, which are then used to complete a sh

ort story in unexpected (and hopefully funny) ways. Extend your program from Lab 3C that repeats asking the user for input and displaying the short story until the user wants to quit. Enter a name: Eric Enter a place: Lou & Harry's Enter a number: 12 Enter a plural noun: cars Enter an adjective: orange Eric went to Lou & Harry's to buy 12 different types of cars but unfortunately, the cars were all orange so Erie went back to Lou & Harry's to return them. Do you want to quit ly/n)? Enter a name: Derek Enter a place: JoAnn Fabrics and Crafts Enter a number: 3 Enter a plural noun: sewing machines Enter an adjective: pretty Derek went to JoAnn Fabrics and Crafts to buy 3 different types of sewing machines but unfortunately, the sewing machines were all pretty so Erie 'went back to JoAnn Fabric and Crafts to return them. Do you want to quit ty/n)? y Goodbye ACTIVITY 16 25.1: LAB 9A Mad Lib - Loop 0120 U MacBook Pro 16.26 LAB 9B: Varied Amount of Input Data Overview Create a program that can manipulate data in a list. Objectives To be able to get input from the user on one line, modify the data type, and perform mathematical operations on the data. Description Statistics are often calculated with varying amounts of input data. Write a program that takes any number of integers on a single lineas Input, and output the average (as a float with 2 decimal points) and the max. When you output the average, you must use the formato method or you will not pass one of the test cases Hint remember that the input comes in as a single string: you need to get each token of the string and create a list of integers instead Section 9.7 has an example of this Ex If the input is Enter the input: 15 2005 the output is The average and max are: 10.00 20 if the input is: Enter the input: 12 10 15 20 25 22 14 18 20 20 the output is The average and max are: 17.60 25 16.27 LAB 9C: Filter and Sort a List Overview Be able to remove and sort items in a list Objectives To understand how to populate a list, remove certain items from a list, sort a list, and display the contents of a list Description Write a program that gets a list of integers from input, and outputs non-negative integers in ascending order (lowest to highest). Zero is considered a non-negative integer EX Enter a list of numbers: 10 -7 4 39 -6 12 2 The non-negative and sorted numbers are: 2 4 10 12 39 For coding simplicity, follow every output value by a space. Do not end with newline ACTIVITY 1627.1: LAB 9C: Filter and Sort a List 0/25 main.py Load default template. 1 " Type your code here."
Engineering
1 answer:
Harlamova29_29 [7]3 years ago
7 0

Answer:

Python code is explained below

Explanation:

CODE(TEXT): -

9A.py:-

def sentence(): #function to read input and display

  name = input("Enter a name: ") #input name

  place = input("Enter a place: ") #input place

  number = int(input("Enter a number: ")) #input number typecasted to int

  noun = input("Enter a plural noun: ") #input plural noun

  adjective = input("Enter an adjective: ") #input adjective

  print("\n{} went to {} to buy {} different types of {}".format(name, place, number, noun)) #format is used to display o/p

  print("but unfortunately, the {} were all {} so {} went back to {} to return them.\n".format(noun, adjective,name, place))

op = "n" #initially op = n i.e. user not wanting to quit

while op != "y" : #while user does not input y

  sentence() #input words from user

  op = input("Do you want to quit [y/n]? ") #prompt to continue or quit

  if op == "y": #if yes then print goodbye and exit

      print("Goodbye")

      break

  else: #else print newline and take input

      print("")

9B.py: -

#inputs are strings by default applying a split() function to a string splits it into a list of strings

#then with the help of map() function we can convert all the strings into integers

numbers = list(map(int, input("Enter the input: ").split()))

sum = 0 #sum is initially 0

for i in range(len(numbers)): #loops for all the elements in the list

  sum = sum + numbers[i] #add the content of current element to sum

avg = sum/ len(numbers) #average = (sum of all elements)/ number of elements in the list

max = numbers[0] #initially max = first number

for i in range(1, len(numbers)): #loops for all remaining elements

  if numbers[i] > max : #if their content is greater than max

      max = numbers[i] #update max

print("The average and max are: {:.2f} {}".format(avg, max)) #format is used to print in formatted form

#.2f is used to print only 2 digits after decimals

9C.py: -

#inputs are strings by default applying a split() function to a string splits it into a list of strings

#then with the help of map() function we can convert all the strings into integers

numbers = list(map(int, input("Enter a list of numbers: ").split()))

numbers = [elem for elem in numbers if elem >= 0] #using list comprehension

#loops for all elements of the list and keep only those who are >= 0

numbers.sort() #list inbuilt function to sort items

print("The non-negative and sorted numbers are: ", end = "")

for num in numbers: #for all numbers in the list print them

  print("{} ".format(num), end = "")

You might be interested in
This acronym is a reminder of the most common types of hazards or injuries caused by electricity.
yulyashka [42]

Answer:

BE SAFE

Explanation:

it stands for Burns, Electrocution, Shock, Arch Flash/Arc Blast, Fire, Explosions

3 0
2 years ago
A rigid 10-L vessel initially contains a mixture of liquid and vapor water at 100 °C, with a quality factor of 0.123. The mixtur
masya89 [10]

Answer:

Q_{in} = 46.454\,kJ

Explanation:

The vessel is modelled after the First Law of Thermodynamics. Let suppose the inexistence of mass interaction at boundary between vessel and surroundings, changes in potential and kinectic energy are negligible and vessel is a rigid recipient.

Q_{in} = U_{2} - U_{1}

Properties of water at initial and final state are:

State 1 - (Liquid-Vapor Mixture)

P = 101.42\,kPa

T = 100\,^{\textdegree}C

\nu = 0.2066\,\frac{m^{3}}{kg}

u = 675.761\,\frac{kJ}{kg}

x = 0.123

State 2 - (Liquid-Vapor Mixture)

P = 476.16\,kPa

T = 150\,^{\textdegree}C

\nu = 0.2066\,\frac{m^{3}}{kg}

u = 1643.545\,\frac{kJ}{kg}

x = 0.525

The mass stored in the vessel is:

m = \frac{V}{\nu}

m = \frac{10\times 10^{-3}\,m^{3}}{0.2066\,\frac{m^{3}}{kg} }

m = 0.048\,kg

The heat transfer require to the process is:

Q_{in} = m\cdot (u_{2}-u_{1})

Q_{in} = (0.048\,kg)\cdot (1643.545\,\frac{kJ}{kg} - 675.761\,\frac{kJ}{kg} )

Q_{in} = 46.454\,kJ

3 0
3 years ago
Pay attention to the following questions!
kupik [55]

Answer: the correct answer is D

3 0
2 years ago
The two boxcars A and B have a weight of 20 000 Ib and 30 000 Ib, respectively. If they coast freely down the incline when the b
Tpy6a [65]

Answer:

Answer for the question :

"the two boxcars A and B have a weight of 20 000 Ib and 30 000 Ib, respectively. If they coast freely down the incline when the brakes are applied to all the wheels of car A causing it to skid, determine the force in the coupling C between the two cars. The coefficient of kinetic friction between the wheels of A and the tracks is μk=0.5. The wheels of car B are free to roll. Neglect their mass in calculation."

is explained in the attachment.

Explanation:

Download pdf
3 0
3 years ago
Read 2 more answers
An aluminum alloy tube with an outside diameter of 3.50 in. and a wall thickness of 0.30 in. is used as a 14 ft long column. Ass
slega [8]

Answer:

slenderness ratio = 147.8

buckling load = 13.62 kips

Explanation:

Given data:

outside diameter is 3.50 inc

wall thickness 0.30 inc

length of column is 14 ft

E = 10,000 ksi

moment of inertia = \frac{\pi}{64 (D_O^2 -D_i^2)}

I = \frac{\pi}{64}(3.5^2 -2.9^2) = 3.894 in^4

Area = \frac{\pi}{4} (3.5^2 -2.9^2) = 3.015 in^2

radius = \sqrt{\frac{I}{A}}

r = \sqrt{\frac{3.894}{3.015}

r = 1.136 in

slenderness ratio = \frac{L}{r}

                              = \frac{14 *12}{1.136} = 147.8

buckling load = P_cr = \frac{\pi^2 EI}}{l^2}

P_{cr} = \frac{\pi^2 *10,000*3.844}{( 14\times 12)^2}

P_{cr} = 13.62 kips

3 0
3 years ago
Other questions:
  • A 2"" Sch 40 stainless steel (k = 14.9 W/m-K) pipe is to be used as the interior pipe of a double pipe heat exchanger. The expec
    6·1 answer
  • If a building is too humid, what harmful substance may be stored there?
    13·2 answers
  • A part has been tested to have Sut = 530 MPa, f = 0.9, and a fully corrected Se = 210 MPa. The design requirements call for the
    10·1 answer
  • Nitrogen enters a steady-flow heat exchanger at 150 kPa, 10°C, and 100 m/s, and it receives heat as it flows through it. Nitroge
    15·1 answer
  • Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    10·1 answer
  • Explain the underlying physical reason why when we conduct various heat treatments on 1018 steel we expect the modulus of elasti
    8·1 answer
  • Our aim is to calculate the efficiency of a gas turbine by assuming it operation can be modeled as a Carnot cycle. The kerosene
    9·1 answer
  • Poems that focus on one image usually have what purpose? PLEASE HELP MEH!!
    7·2 answers
  • What are the disadvantages of military shovels?
    12·1 answer
  • Which step in the engineering design process does not come before building a<br> prototype?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!