Question
Objective: Working with functions. Use the .py source file provided. Replace the DDDDDDDDD wih your student_number. (-1 mark if not completed) Tasks Task 1: how_many_vowels()
Objective:
Working with functions.
Use the .py source file provided. Replace the DDDDDDDDD wih your student_number.
(-1 mark if not completed)
Tasks
Task 1: how_many_vowels() (7 marks)
1) Complete the how_many_vowels() function according to the function documentation on the .py source file provided.
Mark Breakdown
2) 2 additional doctests are created
a) Doctest present (0.5 marks x 2 = 1 mark)
b) Doctest output is accurate (0.5 marks x 2 = 1 mark)
3) Does function pass all assignment doctests provided? (0.5 marks x 4 = 2 marks)
4) Function body code (3 marks)
Task 2: odd_or_even() (8 marks)
1) Complete the odd_or_even() function according to the function documentation on the .py source file provided.
Mark Breakdown
2) 2 additional doctests are created
a) Doctest present (0.5 marks x 2 = 1 mark)
b) Doctest output is accurate (0.5 marks x 2 = 1 mark)
3) Does function pass all assignment doctests provided? (0.4 marks x 5 = 2 marks)
4) Function body code (4 marks)
Task 3: extract_letters() (10 marks)
1) Complete the extract_letters() function according to the function documentation on the .py source file provided.
Mark Breakdown
2) 2 additional doctests are created
a) Doctest present (0.5 marks x 2 = 1 mark)
b) Doctest output is accurate (0.5 marks x 2 = 1 mark)
3) Does function pass all assignment doctests provided? (0.5 marks x 4 = 2 marks)
4) Function body code (6 marks)
Task 4: extract_numbers() (10 marks)
1) Complete the extract_numbers() function according to the function documentation on the .py source file provided.
Mark Breakdown
2) 2 additional doctests are created
a) Doctest present (0.5 marks x 2 = 1 mark)
b) Doctest output is accurate (0.5 marks x 2 = 1 mark)
3) Does function pass all assignment doctests provided? (0.5 marks x 4 = 2 marks)
4) Function body code (6 marks)
LINK:
https://learn-ca-central-1-prod-fleet01-xythos.content.blackboardcdn.com/5ea890ce0c586/44661269?X-Blackboard-S3-Bucket=learn-ca-central-1-prod-fleet01-xythos&X-Blackboard-Expiration=1690221600000&X-Blackboard-Signature=mzvHEBXkTDL9nuQ0OWcixT3M5jLXIOmWe%2BoEizor3zY%3D&X-Blackboard-Client-Id=305246&X-Blackboard-S3-Region=ca-central-1&response-cache-control=private%2C%20max-age%3D21600&response-content-disposition=inline%3B%20filename*%3DUTF-8%27%27assignment3_DDDDDDDDD%25281%2529.py&response-content-type=application%2Foctet-stream&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH0aDGNhLWNlbnRyYWwtMSJHMEUCIErsXP7sepYXM9vMX%2FuQZGS1Egm0QVB3lR8KlhAvs%2FUBAiEA3hO74qwVgm8Qn3ssSXzmZptoMwznWM%2B12Z4SRcz%2B1PUqxgUIFhADGgw2MzU1Njc5MjQxODMiDDEX%2FuI%2FEtbw%2F6sDKyqjBcVJpgT9wcsL4TGyjXaBCjl0QbypSMgwbjJzA3fa1txsdc%2FQMamkg7F5AgpGYO%2FInu2a8JQt%2FbahTHJ3Sf4pEa5DVnVTjqrQvh3rn%2BOjAKV6EufpxPJUovLX3U6iS4OowJoIGCHy%2FCXoWwSxwZVrf2Wx89qmKbobV2%2FGJyxG58XO9bkKkrBt2NIQxxbdwPcoyZo5Vj4G1%2BB6os80i1NHoEwXKwl1UV%2FS90yDdWnrIXVifvb3PY2QHVRnR8ps3%2B3zH%2B8JWfOQLv9sq5Sf5%2FXIisdCOSDaxh6EVysq31dSoQNiSWHZyxQj131yCpx2itRfses%2FTyQrgQSjeij7G3rW06Lo9gnEzgLOJlEDxTj99X3aFTxhfJFxM%2BiyjYuEnlwZXmyi%2FMzUnRqYEH0fMN%2FCvjBurnCCM7beeW1EVDSHldHPqMchKf23QPcr%2F527sdh7ZYwZ6MhB%2Fk5lmEjwrWkHVwYrQMY%2BmhtdFTD5EftOSArFGs%2F4ItZgmPpN5COBgkwj69L%2BZPldfKXdPZi0LaJThQ2H737%2F0GvSmjDmMghWsUoh%2B4LDKm19An5G3%2FbC50pthBSmZfg7T2pvTtOn8QfhEH3eLdFr4KfzXrrHkb3PL%2FKr6draG1Ye4hf7WmpKutSbf1yemBWS9L6crqj9yA4TxmX4OK9Z2XCK5MXxe%2FcDATXrHm9bGXvZB5%2BFQ33u0au1iEY6UQQuooEmoc5hhq4ih2385EWL%2Bexyw8TwvdG5TD3%2F1Ghk5NTgXEGTUfPohXdGPJEcu8TTTsuZRfhQO14krcnN6tzqhlhQTuFt3OyWVWhSPmtJhfVmm6c0ptCdtt0jl7Arz%2FXkyd1gV5otsddZr2N1t%2Bm3cB9qpQctCTHgE41WoHj4drteFAKVonAJfKkDRfmu7TCG7PmlBjqxAa4h1Nes%2BYuGAfRwGWS0bWzCNSnzZO5WtIX0%2ByBuzrzLiO%2Fs0QNsUvRrIAtNOhe9JklTpzfspF165h0y1VVDChy9ETEkCr6dN5gaqZTfRfTsZvybvWuVdbB3rhZm14xq4E6ybL0cp0T1zZuI8Gocqd9rp1n1d2EwFyynuPmWbHuLVQJPVoFkBP2AsZqJLtGkI1dnVoGelV5kH8yjd6uIB%2BY4rOiKtdIyZUGBnt3lZME1Ww%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230724T120000Z&X-Amz-SignedHeaders=host&X-Amz-Expires=21600&X-Amz-Credential=ASIAZH6WM4PLT5VKN477%2F20230724%2Fca-central-1%2Fs3%2Faws4_request&X-Amz-Signature=ec447d7f69cf4bde5c1cdd1910cd85aaddbadba759260668fe91e3479f87bb30&fbclid=IwAR2jOwRPBwwBb_ifiEBn1N1_hCiUQb2-bXkUS9aYjhZRu0KMHrn5ga5QdGc
OR CODE PROVIDE:
"""
Assignment 3 File
Please complete the functions based on their definitions and examples
"""
# First name
# Last name
# Student ID
def how_many_vowels(text):
"""
This function counts the number of vowels in a text. Vowels are the characters a,e,i,o,u and are case insensitive
:param text: string data
:return: the number of vowels found in the string data
>>> how_many_vowels("ABC")
1
>>> how_many_vowels("aEiO")
4
>>> how_many_vowels("TRY")
0
>>> how_many_vowels("First Question")
5
Add 2 more Doctests
"""
pass # code goes here. Replace 'pass' with your own python code
def odd_or_even(data):
"""
This function determines either
a) if the numerical value is odd or even
b) if the number of characters of a string is odd or even
c) if the number of elements in a list or tuple is add or even
d) If any other data type, there is no return
:param data: either a number, string, list or tuple (all four data types must be acceptable)
:return: either the text "odd" or "even" or no return
>>> odd_or_even("hello world")
'odd'
>>> odd_or_even(1234)
'even'
>>> odd_or_even(12.34)
'even'
>>> odd_or_even(list(range(2, 11)))
'odd'
>>> odd_or_even(tuple("cool"))
'even'
Add 2 more Doctests
"""
pass # code goes here. Replace 'pass' with your own python code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started