Spicewood Stables Inc. was established in Austin, Texas, on April 1, 2019. The company provides stables, care for animals and grounds for riding and showing horses. The following transactions are provided for your review:
In: Accounting
Problem 3: Minimum
In this problem, we will write a function to find the smallest element of a list. We are, in a sense, reinventing the wheel since the min() function already performs this exact task. However, the purpose of this exercise is to have you think through the logic of how such a function would be implemented from scratch.
Define a function named minimum(). The function should accept a single parameter named x, which is expected to be a list of elements of the same type. The function should return the smallest element of x. The function should work on lists of integers, floats, and strings. In each case, the "smallest" element is defined as the one with the lowest ranking with respect to the < comparison operator. For strings, this should yield the earliest string when ordered alphabetically.
The function should not print anything. It should not create any new lists, and should involve only one loop.
Furthermore, this function should not make use of ANY built-in Python functions other than range() and len(). No credit will be awarded for solutions that use the min() function.
We will now test the minimum() function. Create a new code cell to perform the steps below. Create three lists as shown below:
list1 = [9.8, 7.4, 5.6, 4.8, 4.8, 5.3, 4.1, 9.6, 5.4]
list2 = [3.4, 7.6, 8.7, 7.5, 9.8, 7.5, 6.7, 8.7, 8.4]
list3 = ['St. Louis', 'Kansas City', 'Chicago', 'Little Rock', 'Omaha']
Use the minimum() function to calculate the minimum of each of these lists, printing the results
In: Computer Science
Complete the Python function called 'greetings(time)' that accepts a time in "HH:MM" format as a string. The function should return a greeting message based on the hour given in the time object as follow:
If the time is before noon: 'Good Morning.', if it is in the afternoon: 'Good Day.'
Please use the following template for your python script to
define the greetings() function and name it as
mt_q3.py. Replace the place holder
[seneca_id] with your Seneca email user
name. You are allowed to use any built-in functions in the
greetings() function.
#!/usr/bin/env python3
# program: mt_q3.py
# author_id: [seneca_id]
def greetings(time):
greeting_message = ''
# put code below to set the appropriate greeting
message based on the time of the day
# before noon: Good Morning.
# after noon: Good Day.
return greeting_message
if __name__ == '__main__':
time = input('What is the time in HH:MM?
')
print('Hello,',greetings(time))
Note: In the output of the following sample run, bold face
characters in red color are typed in by user on
the keyboard.
Sample run of the mt_q3.py script:
[rchan@centos7 mt_test]$ python3 mt_q3.py
What is the time in HH:MM? 00:01
Hello, Good Morning.
[rchan@centos7 mt_test]$ python3 mt_q3.py
What is the time in HH:MM? 11:59
Hello, Good Morning.
[rchan@centos7 mt_test]$ python3 mt_q3.py
What is the time in HH:MM? 12:00
Hello, Good Day.
[rchan@centos7 mt_test]$ python3 mt_q3.py
What is the time in HH:MM? 23:59
Hello, Good Day.
In: Computer Science
Marketing Scenario
You are the director of marketing for a company based out of Chicago IL and your firm sells custom-built athletic braces for college and pro athletes. The company wants to expand your customer base into senior citizens and begins to design and sell a new knee brace that will help older folks.
1. The new brace goes on sale JULY 1st 2020. Your company advertises on social media, their website, and senior citizens can buy the brace at local retailers like Target or Wal-Mart. The prices range from $19.99 to $34.99
2. Your company's key marketing message during the product launch is this: "Golden Brace is made for seniors who need additional support to stay active! We care about you!"
3. On September 1st 2020, your social media platform is flooded with complaints that the brace is starting to shred or fall apart after repeated use. Thankfully no person has been injured but a few customers are upset and they are sounding off.
4. Your boss tells you that they were aware of a possible manufacturing defect but decided to let it go. In addition, you are told that the marketing for the brace never stated that it should be worn all the time...only when senior citizens were choosing to be active.
5. Your boss finally tells you that it is YOUR JOB to find a solution. If not, you may be replaced.
So....
1. What is your DETAILED solution to the problem?
2. What is ethically wrong in this scenario?
In: Economics
The Zambian Government has embarked on various
developmental projects throughout the country. The
projects include Water and Sanitation, Roads, Schools and
Hospitals. Private companies have also invested
in shopping malls in various parts of the country. This has
resulted in a boost for the construction industry.
a. Discuss why there is an increase in the use of steel as compared
to concrete in most of the building
works around the country under construction.
b. Consider the iron value chain from material extraction to
disposal, at what point according to your
assessment is the most energy used? As a design engineer, at what
stage do you think is your
intervention most important and what role can you play in making
iron more sustainable?
c. One of the project which the Government is implementing is the
water project in Western Province
of Zambia particularly Mongu District. Two surface concrete
reservoirs of 1.5 Mega litres each will
be constructed within the Central Business District (CBD). Since
the site is within the CBD, the wall
fence should be built and source of sand for block moulding will
come from the same site as the area
is sandy and it is quite large. As a material/site Engineer advice
on the type of material, construction
and precaution which should be considered for this project.
d. Some works which have already been completed for the water
project especially buildings
constructed of concrete roofing have started leaking after 1 year.
What could be the possible causes
of leaking roofs and how can this be sorted out.
In: Civil Engineering
Modified from Chapter 07 Programming Exercise 5
Original Exercise:
Rock, Paper, Scissors Modification
Programming Exercise 11 in Chapter 6 asked you to design a program
that plays the Rock, Paper, Scissors game. In the program, the user
enters one of the three strings—"rock", "paper", or "scissors"—at
the keyboard. Add input validation (with a case-insensitive
comparison) to make sure the user enters one of those strings
only.
Modifications:
Turn IN:
Raptor flowchart file (or alternative flowchart
screenshot)
If you are on Windows
please try using the built-in "Snip & Sketch" program to take a
perfectly sized screenshot.
Thonny Python file (or Python file is written in any
IDE/program)
Turn in the actual
Python code file "file_name.py"
In: Computer Science
Javascript
1. Write a function which receives four arguments (array, start, end, delimiter). Copy the array values from the start to end index separated by delimiter\'s value. function([1,2,3,4],1,3,'*') // returns 2*3*4 as string
2. Write a function to change the case of all the characters in string based on their position which matches the value of the pos parameter passed to function(str, pos [even|odd]). Example: function(‘abCd’, ‘odd’) // returns Abcd
3 Write a function which receives two arguments (array, oddOrEven) based on the value of oddOrEven (odd or even value) the function will return the sum of all the array elements that matches the type of oddOrEven value. function([1,1,2,3,4],11) // returns 5 (which is the sum of all odd numbers)
DO NOT USE THESE BUILT IN FUNCTIONS BELOW
endsWith() includes() indexOf() lastIndexOf() localeCompare() match() repeat() replace() search() slice() split() startsWith() substr() substring() toLocaleLowerCase() toLocaleUpperCase() toLowerCase() toString() toUpperCase() trim() valueOf() trimLeft and trimRight unshift() valueOf()
includes() indexOf() lastIndexOf() localeCompare() match()
repeat() replace() search() slice() split() startsWith() substr()
substring() toLocaleLowerCase() toLocaleUpperCase() toLowerCase()
toString() toUpperCase() trim() valueOf() trimLeft and trimRight
unshift() valueOf()
concat() copyWithin() every() fill() filter() find() findIndex()
forEach() indexOf() isArray() join() lastIndexOf() map() pop()
push() reduce() reduceRight() reverse() shift() slice() some()
sort() splice() toString()
In: Computer Science
5. Write a program that prints all numbers between 27 and 78, one number per line.
6. In questions 6,7 the following list is used: [1,2,5,6,3,77,9,0,3,23,0.4,-12.4,-3.12]
7. Using “for” loop, write program that finds the smallest number in the list.
8. Using “for” loops, calculate arithmetic mean of all numbers in the list. Do not use built-in function in Python.
9. For this question envision you are creating a dummy alert to help the doctor determine if patient needs a mammogram or not: Ask the user to answer the following questions:
• "What is your patient’s gender? Please answer F for female, M for male " and store it in a variable "gender".
• "What is your patient’s age? " store it in a variable "age"
• "Does your patient have family history of breast cancer? Please answer with True or False " store it in a variable name "history" The program should display the following alert messages based on conditions:
• If patient is female and over 40 the system should alert the doctor to "consider ordering mammogram”
• If the patient is female but younger than 40 the program should go to next step and consider patient family history to determine if mammogram is recommended. If patient has family history of breast cancer the program should display a message "consider mammogram because of family history". If not just display "my not need mammogram" • In any other case the alert should say "no mammogram order recommended". Suggestion: Attention to the variable types when you input and compare.
In: Computer Science
USING MATLAB:
Using the data from table below fit a fourth-order polynomial to the data, but use a label for the year starting at 1 instead of 1872. Plot the data and the fourth-order polynomial estimate you found, with appropriate labels. What values of coefficients did your program find? What is the LMS loss function value for your model on the data?
| Year Built | SalePrice |
| 1885 | 122500 |
| 1890 | 240000 |
| 1900 | 150000 |
| 1910 | 125500 |
| 1912 | 159900 |
| 1915 | 149500 |
| 1920 | 100000 |
| 1921 | 140000 |
| 1922 | 140750 |
| 1923 | 109500 |
| 1925 | 87000 |
| 1928 | 105900 |
| 1929 | 130000 |
| 1930 | 138400 |
| 1936 | 123900 |
| 1938 | 119000 |
| 1939 | 134000 |
| 1940 | 119000 |
| 1940 | 244400 |
| 1942 | 132000 |
| 1945 | 80000 |
| 1948 | 129000 |
| 1950 | 128500 |
| 1951 | 141000 |
| 1957 | 149700 |
| 1958 | 172000 |
| 1959 | 128950 |
| 1960 | 215000 |
| 1961 | 105000 |
| 1962 | 84900 |
| 1963 | 143000 |
| 1964 | 180500 |
| 1966 | 142250 |
| 1967 | 178900 |
| 1968 | 193000 |
| 1970 | 149000 |
| 1971 | 149900 |
| 1972 | 197500 |
| 1974 | 170000 |
| 1975 | 120000 |
| 1976 | 130500 |
| 1977 | 190000 |
| 1978 | 206000 |
| 1980 | 155000 |
| 1985 | 212000 |
| 1988 | 164000 |
| 1990 | 171500 |
| 1992 | 191500 |
| 1993 | 175900 |
| 1994 | 325000 |
| 1995 | 236500 |
| 1996 | 260400 |
| 1997 | 189900 |
| 1998 | 221000 |
| 1999 | 333168 |
| 2000 | 216000 |
| 2001 | 222500 |
| 2002 | 320000 |
| 2003 | 538000 |
| 2004 | 192000 |
| 2005 | 220000 |
| 2006 | 205000 |
| 2007 | 306000 |
| 2008 | 262500 |
| 2009 | 376162 |
| 2010 | 394432 |
In: Computer Science
The following task does not involve writing program code: instead, you will be writing function signatures for hypothetical functions (you will be defining functions in subsequent tasks).
In: Computer Science