Write three versions of function line. The first version takes no parameter and displays a line of 10 asterisks. The second version takes an integer parameter and displays a line of n asterisks. The third version takes an integer and a character as parameters and displays a line of given character of n length.
Added by Kristen F.
Step 1
This function will simply print a line of 10 asterisks. - Define the function with the name `line` and no parameters. - Inside the function, use the `print` function to display a string consisting of 10 asterisks. Show more…
Show all steps
Your feedback will help us improve your experience
Liam Haas-Neill and 71 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Programming Language = Python 3. Recursive Lines Write a recursive function that accepts an integer argument, n. The function should display n lines of asterisks on the screen, with the first line showing 1 asterisk, the second line showing 2 asterisks, up to the nth line which shows n asterisks. Sample Output A AA AAA AAAA NOTE: Print A NOT * character as an output for n.
Vandit T.
5. Numbers as Strings Complete the describing function in the editor. When given a integer n, returns; * the string representation of the integer but only for integers in the (inclusive) range 0-10 * for integers outside the range, it return OTHER Example * For n = 2, the output should be describing(n) = "TWO" * For n = 3, the output should be describing(n) = "THREE" * For n = -11, the output should be describing(n) = "OTHER" Function Description describing has the following parameter: int n: the integer to analyze Returns: String: an uppercase string containing the a description of the integer Constraints * 0 <= |n| <= 10
Michael F.
Create a function that takes n integers and returns the highest number. Name of function - pp() Example: pp(1,2,3) = 3 pp(1,2) = 2 pp(1,2,3,4,5) = 5 Restriction: • Write one-line code for this question. • Character limit of code - Less than 12 characters. Yes. It's a challenge!
Liam H.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD