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
When removing a diesel engine from a truck, Technician A says it is OK to disconnect an air con­ditioning hose, but the refriger
agasfer [191]

Answer:

Technician B is right.

Explanation:

Air conditioning refrigerant contains Freon R22 and R410a, which have been linked to environmental damages, including ozone depletion, global warming, and energy-inefficiency.  For environmentally-savvy entities and individuals, there is the modern move to a more environment-friendly refrigerant, known as R-32.   Technician A's advice to vent the refrigerant outside the shop is in bad taste.  He does not seem to be aware of the environmental footprint of such an action.  Venting gas outside, in addition to the environmental damages, is also a waste of resources, and therefore, costly.  This is why Technician B's advice should be preferred.

5 0
3 years ago
DRIVERS ED
forsale [732]

Answer:

b

Explanation:

only if there signal is turned on

8 0
2 years ago
Read 2 more answers
A formal indication from a state, on letterhead, or an official state form, that shows the applicant has valid driving privilege
alex41 [277]

A formal indication from a state, on letterhead, or an official state form, which shows that an applicant has valid driving privileges and is clear to apply for a Colorado driver's license is called a clearance.

<h3>What is a learner's license?</h3>

A learner's license is also referred to as learner's permit and it can be defined as a category of driver's license that is issued to an individual who is learning how to drive an automobile vehicle (car).

<h3>What is a license?</h3>

A license is also referred to as a certificate and it can be defined as an authorization that is typically issued by state governments to a driver, so as to avail him or her the legal ability to physically driver in all the states across a country.

In this scenario, we can infer and logically deduce that a clearance is a formal indication from a state which shows and affirms that an applicant has valid driving privileges, and is permitted to apply for a Colorado driver's license.

Learn more about learner's license here: brainly.com/question/26289148

#SPJ1

7 0
1 year ago
A tool used to put a concave edge on a plane iron is
tigry1 [53]

Answer:

C) grinder

Explanation:

7 0
2 years ago
Read 2 more answers
The terms batten seam, standing seam, and flat seam all describe types of:
abruzzese [7]

Answer:

<em> (A) architectural sheet metal roofing</em>

Explanation:

 By the <em>name itself we can judge</em> that the <em>'Architectural sheet metal roofing'</em> is a <em>kind of metal roofing</em>.

And these type of metal roofing is primarily used for small and big houses, small buildings and as well as in a building that is for commercial use they can be totally flat as well as little bit sloped.  

And the words similarly like<em> </em><em>batten and standing seam</em>, and <em>flat seam all tells us that these are the types of</em> architectural sheet metal roofing.

5 0
2 years ago
Other questions:
  • Occurs between a tire on a vehicle and the roadway when a wall of water separates the tire from
    15·1 answer
  • How do Solar Engineers Help Humans?<br> (2 or more sentences please)
    9·1 answer
  • As shown, a load of mass 10 kg is situated on a piston of diameter D1 = 140 mm. The piston rides on a reservoir of oil of depth
    9·1 answer
  • Air at 7 deg Celcius enters a turbojet engine at a rate of 16 kg/s and at a velocity of 300 m/s (relative to engine). Air is hea
    7·1 answer
  • What is the hardest part of thermodynamics?
    5·1 answer
  • 4. Which of the following is the first thing you should do when attempting
    13·2 answers
  • Give five examples of
    14·1 answer
  • For some transformation having kinetics that obey the Avrami equation, the parameter n is known to have a value of 2. If, after
    14·1 answer
  • Which is the correct way of dual dimensioning using the position method
    7·1 answer
  • 12. What procedure should you follow when taking measurements?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!