Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Compose a function that accepts a single list as an argument. It should print all of the contents of the list without using a

image text in transcribed
image text in transcribed
1. Compose a function that accepts a single list as an argument. It should print all of the contents of the list without using a loop. For example, \[ \begin{array}{l} \text { print_1st }([1,2,3,4]) \text { \# output (via print): }[1,2,3,4] \\ \text { print_1st }([]) \text { \#output (via print): [] } \\ \end{array} \] 2. Compose a function that accepts a single list as an argument. It should print each element of the list on its own line, in the same order they appear in the list. If the list is empty, print nothing. For example, print_1st_one_by_one ([1,2,3,4]) II output (via print): \#i 1 #2 \# 23 \# \# 4 3. Compose a function that accepts a single list as an argument. It should print each element of the list on its own line, in reverse order. If the list is empty, print nothing. For example, print_1st_reverse( (1,2,3,4]) \# output (via print): 4. 4 (1) 3 \# 1 You are NOT allowed to use the following constructs unless specified in the assignment directions. Using the following constructs will result in 0 (zero) for the entire submission (assignment, timed test, etc.). The restricted items are as follows: - Concepts not discussed in lectures yet - String functions - Member functions - Exceptions (can use) : len () and x=x+[y1,y2,y3] - Built-in functions \& types - Exceptions (can use): str(), readline(), open(), close(), write(), read(), range(), split() - Cannot use .append, sort, etc. - Cannot use "Slicing" - Cannot use "list comprehension" - Cannot use "not in" (together) - Cannot use "in" - not allowed with conditionals - Exception (can use): with range () - Cannot use " and \{\} - Exception (can use): mathematical operations (multiply \& exponents) - Data type functions - Exceptions (can use): int(), str (), float () - Break - Continue - Nested Constructs - Exceptions (can use): 2-D list - Multiple returns \& Multiple assignments - Recursion (not allowed unless the question explicitly states otherwise) - Functions within functions (Definitions) -- invocation is fine - Default Parameters - Global variables - Keyword as variable names

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions

Question

Challenges Facing Todays Organizations?

Answered: 1 week ago