lab02
.py
keyboard_arrow_up
School
Skyline College *
*We aren’t endorsed by this school
Course
MISC
Subject
Computer Science
Date
Feb 20, 2024
Type
py
Pages
3
Uploaded by MasterBuffalo3986
"""C88C Lab 2"""
"""
C88C Spring 2024:
Please credit any folks in C88C that you collaborated with,
and any online sources you searched for.
Remember, it's OK to ask for help, and to search for topics, but
you may not search for specific solutions or copy any code directly.
List Collaborators:
Credit Any Online Sources (google searches, etc):
"""
# Question 1
def odd_even(x):
"""Classify a number as odd or even.
>>> odd_even(4)
'even'
>>> odd_even(3)
'odd'
"""
return 'even' if x % 2 == 0 else 'odd'
def classify(s):
"""
Classify all the elements of a sequence as odd or even
>>> classify([0, 1, 2, 4])
['even', 'odd', 'even', 'even']
"""
return [odd_even(x) for x in s]
#Question 2
def find_word(words, n):
"""
>>> find_word(["cat", "window", "zookeeper"], 5)
'window'
>>> find_word(["cat", "dog", "fish"], 3)
'fish'
>>> find_word(["cat", "dog", "bro"], 3)
''
>>> find_word(["python", "java", "SQL"], 4)
'python'
"""
for word in words:
if len(word) > n:
return word
return ''
# Question 3
def if_this_not_that(i_list, this):
"""
>>> original_list = [1, 2, 3, 4, 5]
>>> if_this_not_that(original_list, 3)
that
that
that
4
5
"""
for item in i_list:
if item > this:
print(item)
else:
print("that")
# Question 4
def shuffle(cards):
"""Return a shuffled list that interleaves the two halves of cards.
>>> lst = [1, 2, 3, 4, 5, 6, 7, 8]
>>> shuffle(lst)
[1, 5, 2, 6, 3, 7, 4, 8]
>>> shuffle(range(6))
[0, 3, 1, 4, 2, 5]
>>> cards = ['AH', '1H', '2H', '3H', 'AD', '1D', '2D', '3D']
>>> shuffle(cards)
['AH', 'AD', '1H', '1D', '2H', '2D', '3H', '3D']
>>> cards # should not be changed
['AH', '1H', '2H', '3H', 'AD', '1D', '2D', '3D']
"""
assert len(cards) % 2 == 0, 'len(cards) must be even'
mid = len(cards) // 2
first_half = cards[ :mid]
second_half = cards[mid: ]
shuffled = []
for i in range(mid):
shuffled.append(first_half[i])
shuffled.append(second_half[i])
return shuffled
# Question 5
def pairs(n):
"""Returns a new list containing two element lists from values 1 to n
>>> pairs(1)
[[1, 1]]
>>> x = pairs(2)
>>> x
[[1, 1], [2, 2]]
>>> pairs(5)
[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]
>>> pairs(-1)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
6
DO NOT COPY FROM OTHER WEBSITES
Correct and detailed answer will be Upvoted else downvoted. Thank you!
arrow_forward
please note (The diagram should adhere to compressed Chen notation)
overview:a website about the cutest pet competition. a person registers on the website and then decides to be either a voter or has a competing pet. If he registers as a competitor, he creates a profile for his pet, then chooses to classify his pet, whether it is a dog or a cat, and then displays pictures of his pet on the website to people. If he registered as a voter, he enters the site and then chooses the classification, dog or cat. After choosing, pictures of competing pets are shown to him, and he chooses the cutest and gives it a like as he can also write a comment in the comment section of that picture . after that, when the competition ends you can see the leaderboards page to see the best pets scores
Do the following ER Diagram please : The model should be relevant and appropriate in the context of the specification. The diagram should adhere to compressed Chen notation and should give data types for the…
arrow_forward
"Counters calculate or note down the number that how many times an event occurred."
Comment on the aforementioned statement.
arrow_forward
Written Use Case
Follow the sample format shown in the attached photo.Sample have its label, while the one you should make a written use case is the one who have blue ovals
arrow_forward
Subject Name : Computer practical = Excel
Note : Choose the correct Answer .
Q\
1-To insert a new cell in position D3, while the previous contents of the cell becomes in D4 by *
Home tab, insert cell, shift cells up
Insert tab, insert cell, shift cells up
Home tab, insert cell, shift cells down
2-To unfreeze column title by *
View tab, window group, unfreeze top row.
Insert tab, window group, unfreeze top row.
Review tab, window group, unfreeze top row.
3-To select the sheet by *
Click on title bar
Click on square in top corner
Click on home tab
4-To hide formula bar by *
View tab, show/hide group, click on formula bar
Home tab, show/hide group, right click on formula bar
Review tab, show/hide group, click on formula bar
5-The content of the cell C10 appeared in *
Title bar
Excel window
Formula bar
6-To delete the cell C3, while the contents of the cell C4 replaced it by *
Home tab, delete cells, shift cells right
Home tab, delete cell, shift cells up
Home tab, delete cell, shift…
arrow_forward
ER diagram for the following use cases:
Intro/Homepage: This first case will be used to give the user the first look at what the whole project is about. They see the beginning stage and interact with all the links to the movies, characters, and descriptions.
Browse MCU Shows: This case will be for the customers and users to be able to navigate through the feature and see what they are specifically. They can use it to find which exact Marvel Cinematic Universe movie/show they wish to watch and see what character they like.
View MCU Movie Details: This case will be for users to get more information about specific Marvel movies/shows. It will give more details like the cast, the run time, the review score, the characters involved and etc.
arrow_forward
Is a cell that references another cell identifying where changes will occur in the
worksheet as a result of changing the value in the cell you are identifying as a
referenced cell.
Reference Cell
Precedint Cell
Formula Cell
Dependent Cell
Question 15
Is a cell that is referenced in a formula that shows you how a particular cell is
calculated.
Dependent Cell
Precedent Cell
Reference Cell
Formula Cell
arrow_forward
Fast answer please.
arrow_forward
follow this please to make the a UML PlantText code: A museum needs a software app to better visitor experience, key needs for the software app are: >>Artwork Management: >>The system has to keeps a comprehensive catalog of the museum's artworks, artifacts, and exhibitions. Every item in the collection should have detailed information like the title, artist, date of creation, historical significance, and exhibition location. The locations are: permanent galleries, exhibition halls, and outdoor spaces. >>Visitor Management: >>The system should facilitate the management of visitor information: ticket purchases and visitor demographics. Visitors can buy tickets online or in-person for many exhibitions, tours, and special events that the museum offers. Exhibitions are held for a duration of time and in a spicific location in the museum, which is mentioned on the purchased tickets. Tours are facilitated on a selected date for a group of 15 to 40 visitors with a…
arrow_forward
Written Use Case
Follow the sample format shown in the attached photo.Sample have its label, while the one you should make a written use case is the one who have blue ovalsNOTE: YOU SHOULD MAKE THE WRITTEN USE CASE AS YOU CAN SEE IN THE SAMPLE TABLE. SOMEONE IS ANSWERING MY QUESTION WRONG!
arrow_forward
Differentiate primary, candidate, and superkey.
arrow_forward
Homework practice - Please answer ALL sub-part questions (they all are related to one another) via Microsoft Access. Please only attempt this if your going to answer all of them. Positive feedback is guaranteed. Thank you! All the information is provided on the image (needs to be created on Microsoft Access).
arrow_forward
Req: mvc model
dont copy/paste please
The system enables the specialist and guardian to treat and follow up on autism disorder cases. The specialist can add exercises and diagnostic tests for the patient, print reports, and communicate with the guardian. The guardian can view the patient's progress, communicate with the doctor, and add reviews or notes.
arrow_forward
Please provide an example of how one of the four access control options may be implemented. Why should you choose this option above the others in its field?
arrow_forward
Just draw the UML diagram
MyWellness is an -health application that allows you to monitor your health status and details.
The application also allows you to get in touch with your doctors for quick consultations and
questions, in addition to getting appointments. The application has three main users:
Administrator, Patient, and Doctor.
Patients need to have an account to interact with the application. They can register by providing a
username and a password, then proceed to create their protiles by entering intormation such as full
name, email, phone number, address, and birthdate. In addition to the regular profile, patients have
a medical profile that contains the following information: height, weight, insurance (yes/no),
allergies, disabilities, and different previous medical conditions. Patients also have access to the
history of visits; they can see the general (for all doctors) history and the history per doctor. In this
history, they see the date of the visit and the…
arrow_forward
"Counters calculate or note down the number that how many times an event occurred."
Comment on the mentioned statement.
arrow_forward
QUESTION PROVIDE IN ATTACHMENT. KINDLY SEE.
MATCH OUTPUT AS IT IS WITH QUESTION OUTPUT.
arrow_forward
true/false
Both professor and assistant can create a new course (use case Create course) ( )
arrow_forward
You can move a chart to a new worksheet in the workbook.
Select one:
a. True
b. False
You can remove a legend from a chart.
Select one:
a. True
b. False
arrow_forward
Define the following.
1.Access work area 2. Object tab 3. Navigation pane 4. Status bar 5. Datasheet view 6. Datasheet
arrow_forward
SUPPLIER
PRODUCT
ProductCode
ProductnName
unitPrice
SupCode
supCode
(Number, 3)
SupName
(text, 20)
АВC LLC
(Number, 10)
[Char(10)]
(>0)
1111111
Calculator
10
111
111
2222222
Notebook
2.5
777
222
ХҮX LLC
3333333
Book-AI
20
222
3333
PQR LLC
4444444
Pen
-2.0
222
222
AXL LLC
5555555
Pencil
.500
111
Eraser
.500
222
arrow_forward
QUESTION 1
The OMCA club operations
When members join OMCA health club, they pay a fee for a certain length of time. Most memberships are for 1 year, but memberships for short periods are available. Due to various promotions throughout the year, it is common for members to pay different amounts for the same length of membership. The club wants to e-mail reminders to members to ask them to renew their memberships one month before their memberships expire. Some members have been angry with staff when asked to renew at a much higher rate than their original membership contract. So, the club needs staff to keep track of the price paid so that the managers can override the regular prices with special prices when members are asked to renew. The system must keep track of these new prices so that renewals can be processed accurately. One of the problems in the health club industry is the high turnover rate of members. Although some members remain active for many years, about half of the…
arrow_forward
Question p .Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this line
arrow_forward
Identify Testing Types
c. While doing Beta testing, a customer noticed a hectic delay in the page loading ofan application. He was so frustrated and went to the feedback page of thecompany site and complained about the lazy loading issue. Garreth, a supportspecialist of the company, looked into the incoming issue he received from thecustomer who wrote about the page loading issue. Garreth logged into the defecttracking tool and started writing details about the new issue reported by thecustomer and it has a field to enter the type of issue. So, help Garreth identifytesting types.
arrow_forward
More ideas please?
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Related Questions
- 6 DO NOT COPY FROM OTHER WEBSITES Correct and detailed answer will be Upvoted else downvoted. Thank you!arrow_forwardplease note (The diagram should adhere to compressed Chen notation) overview:a website about the cutest pet competition. a person registers on the website and then decides to be either a voter or has a competing pet. If he registers as a competitor, he creates a profile for his pet, then chooses to classify his pet, whether it is a dog or a cat, and then displays pictures of his pet on the website to people. If he registered as a voter, he enters the site and then chooses the classification, dog or cat. After choosing, pictures of competing pets are shown to him, and he chooses the cutest and gives it a like as he can also write a comment in the comment section of that picture . after that, when the competition ends you can see the leaderboards page to see the best pets scores Do the following ER Diagram please : The model should be relevant and appropriate in the context of the specification. The diagram should adhere to compressed Chen notation and should give data types for the…arrow_forward"Counters calculate or note down the number that how many times an event occurred." Comment on the aforementioned statement.arrow_forward
- Written Use Case Follow the sample format shown in the attached photo.Sample have its label, while the one you should make a written use case is the one who have blue ovalsarrow_forwardSubject Name : Computer practical = Excel Note : Choose the correct Answer . Q\ 1-To insert a new cell in position D3, while the previous contents of the cell becomes in D4 by * Home tab, insert cell, shift cells up Insert tab, insert cell, shift cells up Home tab, insert cell, shift cells down 2-To unfreeze column title by * View tab, window group, unfreeze top row. Insert tab, window group, unfreeze top row. Review tab, window group, unfreeze top row. 3-To select the sheet by * Click on title bar Click on square in top corner Click on home tab 4-To hide formula bar by * View tab, show/hide group, click on formula bar Home tab, show/hide group, right click on formula bar Review tab, show/hide group, click on formula bar 5-The content of the cell C10 appeared in * Title bar Excel window Formula bar 6-To delete the cell C3, while the contents of the cell C4 replaced it by * Home tab, delete cells, shift cells right Home tab, delete cell, shift cells up Home tab, delete cell, shift…arrow_forwardER diagram for the following use cases: Intro/Homepage: This first case will be used to give the user the first look at what the whole project is about. They see the beginning stage and interact with all the links to the movies, characters, and descriptions. Browse MCU Shows: This case will be for the customers and users to be able to navigate through the feature and see what they are specifically. They can use it to find which exact Marvel Cinematic Universe movie/show they wish to watch and see what character they like. View MCU Movie Details: This case will be for users to get more information about specific Marvel movies/shows. It will give more details like the cast, the run time, the review score, the characters involved and etc.arrow_forward
- Is a cell that references another cell identifying where changes will occur in the worksheet as a result of changing the value in the cell you are identifying as a referenced cell. Reference Cell Precedint Cell Formula Cell Dependent Cell Question 15 Is a cell that is referenced in a formula that shows you how a particular cell is calculated. Dependent Cell Precedent Cell Reference Cell Formula Cellarrow_forwardFast answer please.arrow_forwardfollow this please to make the a UML PlantText code: A museum needs a software app to better visitor experience, key needs for the software app are: >>Artwork Management: >>The system has to keeps a comprehensive catalog of the museum's artworks, artifacts, and exhibitions. Every item in the collection should have detailed information like the title, artist, date of creation, historical significance, and exhibition location. The locations are: permanent galleries, exhibition halls, and outdoor spaces. >>Visitor Management: >>The system should facilitate the management of visitor information: ticket purchases and visitor demographics. Visitors can buy tickets online or in-person for many exhibitions, tours, and special events that the museum offers. Exhibitions are held for a duration of time and in a spicific location in the museum, which is mentioned on the purchased tickets. Tours are facilitated on a selected date for a group of 15 to 40 visitors with a…arrow_forward
- Written Use Case Follow the sample format shown in the attached photo.Sample have its label, while the one you should make a written use case is the one who have blue ovalsNOTE: YOU SHOULD MAKE THE WRITTEN USE CASE AS YOU CAN SEE IN THE SAMPLE TABLE. SOMEONE IS ANSWERING MY QUESTION WRONG!arrow_forwardDifferentiate primary, candidate, and superkey.arrow_forwardHomework practice - Please answer ALL sub-part questions (they all are related to one another) via Microsoft Access. Please only attempt this if your going to answer all of them. Positive feedback is guaranteed. Thank you! All the information is provided on the image (needs to be created on Microsoft Access).arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE LNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageNew Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning