Remember th

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Instructions

  1. Write a function create_password() expects two parameters: pet_name (a string) and fav_number (an integer).

The function returns a new password generated using the following pattern:

fav_number followed by the pet_name followed by the star * and fav_number again (see the example below).

  1. Create a program that gets a pet name and a favorite number as input from the user, calls the above function, and then prints the output as shown below.

Example

Input:

Angel 3

Output:

Your new password is "3Angel*3".

Note that the double quotes are part of the output.

The assert in the provided template is checking that this function call is returning the correct value (i.e., a correctly-formed string).

assert create_password("Angel", 3) == "3Angel*3"

Hints

  • Remember that you cannot directly concatenate an integer and a string - you need to convert an integer into a string using either str() or by using f-strings.

Troubleshooting

  • If you are getting AssertionError make sure that your create_password() function is returning the correct value.
  • If you are failing the Unit Tests but passing all of the "Compare Output" tests: make sure that your create_password() function is returning the correct value. This error is likely due to the if __name__ == '__main__': block printing the right value, but the function create_password() is not creating/returning the correct value.

provided code:

def _(_):
    """
    The function expects
    param: var_name (var_type)
    The result is ...
    """

if __name__ == '__main__':
    # TODO: Type your code here. Your code must call the function.
    assert create_password("Angel", 3) == "3Angel*3"

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Asymptotic Analysis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education