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
List the main activities of exploration??
Trava [24]

Answer:  Exploration includes plethora of activities and depend upon the kind  of exploration a person is doing. But most include some of the basic activities like research , investigation, planning and execution.

Suppose we want to explore new petroleum sites then we would have to start with studying the geography of that area, then according to our research we will analyse the hot spots or the sector where probability of finding of oil field is highest, post that appropriate man power is skilled professionals, tools and machinery will be brought at the site so that execution can take place.

3 0
3 years ago
Discuss the differences between conduction and convective heat transfer.
FrozenT [24]

Answer:

Basically there are two principal differences between the convection and conduction heat transfer

Explanation:

The conduction heat transfer is referred to the transfer between two solids due a temperature difference, while for, the convective heat transfer is referred to the transfer between a fluid (liquid or gas) and a solid. Also, they used different coefficients for its calculation.

We can include on the explanation that conduction thermal transfer is due to temperature difference, while convection thermal transfer is due to density difference.

8 0
3 years ago
Argue the importance to society of incorporating green building into an engineer’s designs, with at least two examples.
klio [65]
It is important because now a days we all need help from engineers
3 0
3 years ago
Let S = { p q |p, q are prime numbers greater than 0} and E = {0, −2, 2, −4, 4, −6, 6, · · · } be the set of even integers. . Pr
Finger [1]

Answer:

prove that | S | = | E | ; every element of S there is an Image on E , while not every element on E has an image on S

Explanation:

Given that S = { p q |p, q are prime numbers greater than 0}

                    E = {0, −2, 2, −4, 4, −6, 6, · · · }

To prove  by constructing a bijection from S to E

detailed  solution attached below

After the bijection :

<em>prove that | S | = | E |</em> :  every element of S there is an Image on E , while not every element on E has an image on S

∴ we can say sets E and S are infinite sets

7 0
3 years ago
A walrus loses heat by conduction through its blubber at the rate of 220 W when immersed in −1.00°C water. Its internal core tem
Llana [10]

Answer:

The average thickness of the blubber is<u> 0.077 m</u>

Explanation:

Here, we want to calculate the average thickness of the Walrus blubber.

We employ a mathematical formula to calculate this;

The rate of heat transfer(H) through the Walrus blubber = dQ/dT = KA(T2-T1)/L

Where dQ is the change in amount of heat transferred

dT is the temperature gradient(change in temperature) i.e T2-T1

dQ/dT = 220 W

K is the conductivity of fatty tissue without blood = 0.20 (J/s · m · °C)

A is the surface area which is 2.23 m^2

T2 = 37.0 °C

T1 = -1.0 °C

L is ?

We can rewrite the equation in terms of L as follows;

L × dQ/dT = KA(T2-T1)

L = KA(T2-T1) ÷ dQ/dT

Imputing the values listed above;

L = (0.2 * 2.23)(37-(-1))/220

L = (0.2 * 2.23 * 38)/220 = 16.948/220 = 0.077 m

7 0
3 years ago
Other questions:
  • At a 4 percent annual growth rate in GDP per capita, it will take
    15·1 answer
  • (TCO 4) A system samples a sinusoid of frequency 190 Hz at a rate of 120 Hz and writes the sampled signal to its output without
    12·1 answer
  • What is temperature coefficient of resistance
    12·1 answer
  • What is differences Between hard shoulder &amp; soft shoulder in civil Engineerin?
    9·1 answer
  • A diesel engine with an engine volume of 4.0 L and an engine speed of 2500 rpm operates on an air–fuel ratio of 18 kg air/kg fue
    6·2 answers
  • Do you think the industrial revolution helped or hurt workers? Why?
    8·1 answer
  • What are the main causes of injuries when using forklifts?
    5·1 answer
  • Hey any one ride dirtbikes here
    5·2 answers
  • What are difference between conic sectional and solids?
    15·1 answer
  • Alguém para conversa
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!