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
Type the correct answer in the box. Spell all words correctly.
Rudik [331]

Answer:ii dant overstand

Explanation:

5 0
3 years ago
What does the line strung between the batter boards represent?
soldi70 [24.7K]

Batter boards (or battre boards, Sometimes mispronounced as "battle boads") are temporary frames, set beyond the corners of a planned foundation at precise elevations. These batter boards are then used to hold layout lines (construction twine) to indicate the limits (edges and corners) of the foundation.

7 0
2 years ago
Read 2 more answers
Three identical fatigue specimens (denoted A, B, and C) are fabricated from a nonferrous alloy. Each is subjected to one of the
Law Incorporation [45]

Answer:

B A and C

Explanation:

Given:

Specimen         σ_{max}                      σ_{min}

A                       +450                      -150

B                       +300                      -300

C                       +500                      -200

Solution:

Compute the mean stress

σ_{m} =  (σ_{max}  +  σ_{min})/2

σ_{mA} =  (450 + (-150)) / 2

       =  (450 - 150) / 2  

       = 300/2

σ_{mA} = 150 MPa

σ_{mB}  = (300 + (-300))/2

        = (300 - 300) / 2

        = 0/2  

σ_{mB}  = 0 MPa

 

σ_{mC}  = (500 + (-200))/2

        = (500 - 200) / 2

        = 300/2

σ_{mC}  = 150 MPa  

Compute stress amplitude:

σ_{a} =  (σ_{max}  -  σ_{min})/2    

σ_{aA} =  (450 - (-150)) / 2

       =  (450 + 150) / 2

       = 600/2

σ_{aA} = 300 MPa

σ_{aB} =  (300- (-300)) / 2

       =  (300 + 300) / 2

       = 600/2

σ_{aB}  = 300 MPa

σ_{aC}  = (500 - (-200))/2

        = (500 + 200) / 2

        = 700 / 2

σ_{aC}   = 350 MPa

From the above results it is concluded that the longest  fatigue lifetime is of specimen B because it has the minimum mean stress.

Next, the specimen A has the fatigue lifetime which is shorter than B but longer than specimen C.

In the last comes specimen C which has the shortest fatigue lifetime because it has the higher mean stress and highest stress amplitude.

7 0
3 years ago
A 2-m3 rigid tank initially contains air at 100 kPa and 22°C. The tank is connected to a supply line through a valve. Air is flo
Finger [1]

Answer:

9.58 Kg of air has entered the tank.

heat entered=3483.76 Kilo.Joule

Explanation:

(A) R=287 Kilo.J/Kg.K

as per initial conditions P=100 Kilo.Pa ,V=2 cubic meter, T=22 C=295.15 K,

using the relation P*V=m*R*T

m=(100*1000*2)/(287*295.15)=2.36 Kg this is the mass that is already present in tank.

after filling tank at 600 Kilo.Pa.

P=600 Kilo Pa T=77 C=350.15 K

P*V=m*R*T

m=(600*1000*2)/(287*350.15)=11.94 Kg

mass that has entered=11.94-2.36=9.58 Kg

(b) using air psychometric  property table

specific heat content initial  100 KILO Pa and 22 C=295.576 Kilo.Joule/Kg

specific heat content final  600 Kilo Pa and 77 C=350.194 Kilo.Joule/Kg

heat at initial stage=295.576*2.36=697.56 Kilo.Joule

heat at final stage=350.194*11.94=4181.32 Kilo.Joule

heat entered=4181.32-697.56=3483.76 Kilo.Joule

3 0
3 years ago
Rearrange the formula to make “u” the subject. <br><br> v - u<br> ——— = t<br> a
solong [7]

Answer:

u = v - a * t

Explanation:

   v - u

t = ------

       a

v  - u  =  a * t

v - a * t = u

therefore,  u = v - a * t

5 0
3 years ago
Other questions:
  • Explain in detail the difference between the microstructures of a cold worked sample and Recrystallized sample ?
    15·1 answer
  • A parison is extruded from a die with outside diameter = 11.5 mm and inside diameter = 7.5 mm. The observed die swell = 1.25. Th
    8·1 answer
  • Please Help It's really Important
    12·1 answer
  • You must signal [blank] before any turn or lane change.
    11·1 answer
  • The amount of time an activity can be delayed and yet not delay the project is termed:_________
    14·1 answer
  • It is the tool used to measure the amount of electric current​
    6·2 answers
  • Storing parts outside doesn't cause any environmental risks as long as the items are covered.
    12·2 answers
  • Which is an alloy made up of iron and carbon and has high compressive and tensile strength?
    6·1 answer
  • An ideal Rankine cycle with reheat uses water as the working fluid. The conditions at the inlet to the first-stage turbine are p
    12·1 answer
  • A teenage brain is already fully developed to enable us to manage risks effectively.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!