Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Add a doctest test for your function add with two different numbers to add than the numbers given in the examples. Make sure
1. Add a doctest test for your function add with two different numbers to add than the numbers given in the examples. Make sure to use the symbols >>> and add the expected value afterward. Hint: If you can't figure out the expected value, run it with an empty expected value and see what the error says it should expect. 2. Add a doctest test for your function mult. 3. Write the regular expression pattern = that will match a username with: (eg. username = "tabby2x") a. Only alphanumeric characters 4. Write the regular expression pattern that will match a user id with: (eg. userid="12355") a. Only numeric characters 5. Write the regular expression pattern that will match both files and filed. 6. Write the regular expression pattern that will match three letter words that are preceded by a dot and space character. 7. Write the regular expression pattern that will match an email with: (eg. email='ex@ex.ex") a. At Least 1 alphabetic character before the at symbol b. Exactly 1 at symbol c. At Least 1 alphabetic character after the at symbol d. Exactly 1 period symbol e. At Least 1 alphabetic character after the period symbol (You need to escape this character). Google it to figure out how 8. Write a regex for matching telephone numbers Challenge: 1. Write the regular expression pattern that will match a password with: (eg. password = "a8e316$#"). The characters can be in any order a. At least 1 number b. At Least 1 alphabetic character. c. At Least 1 special character (1#$%&/) Doctest There are 4 important components of the documentation for functions in Python: Description Example (with a real argument and a real expected output) O The function call with the real argument has a >>> in front of it to tell doctype it is the expected output Arguments Return def greet (name) : """Description: This function greets the person passed in as a parameter Examples for doctest >>> greet ("Kiki") Hello, Kiki. Good morning! 'Kiki' >>>greet (name="Jackie") Hello, Jackie. Good morning! 'Jackie' Argument: name, the name of the user to greet Return: name, So we can I save it for later print ("Hello, + return name "1 name + "1 # Use Doc Test doctest.testmod () Good morning!")
Step by Step Solution
★★★★★
3.41 Rating (160 Votes )
There are 3 Steps involved in it
Step: 1
1 Doctest test for function add def addnum1 num2 Returns the sum of two numbers Example add2 3 5 add...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