Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your team captain decided to keep all your decisions password protected. Write a function that takes three parameters: a string, a positive integer and a

image text in transcribed

image text in transcribed

Your team captain decided to keep all your decisions password protected. Write a function that takes three parameters: a string, a positive integer and a boolean. Rules: - If one or more inputs do not satisfy the specified type, return 'ERROR!'. - Reverse a given string. - If a number is even, make it odd by adding 1 - If a number is odd, make it even by subtracting 1 - Flip the value of the boolean parameter. Then put all these components together into a string and return it. def password(text, number, boolean): """ Creates a password based on the given parameters: text is reversed, numbers becomes either even or odd, boolean value is flipped Parameters: text: a string number: an integer boolean: a boolean value Returns a password by adding altered components to the string. > password ("trip", "is", True) 'ERROR!' \> password(17, "is", True) 'ERROR!' password ("trip", 18, 20) 'ERROR!' \> password("trip", 18, False) 'pirt19True' > password("car", 21, True) 'rac20False' """ Hint: - Look up: "How to check the type of a variable in Python" - Look up: "How to reverse a string in Python" - Look up: "How to convert an integer to a string in Python

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions

Question

what are the provisions in the absence of Partnership Deed?

Answered: 1 week ago

Question

1. What is called precipitation?

Answered: 1 week ago

Question

1.what is dew ?

Answered: 1 week ago