ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 9.00

Write a recursive function sublstCount

Create an recursive python program. The questions are in the file

 

 

1. Write a recursive function sublstCount() that takes an arbitrarily nested list as a parameter
and returns the number of sublists in the list. You are not allowed to use any list methods in
your function other than indexing (e.g. lst[i] for some integer i), slicing (e.g. lst[i:j] for some
non-negative integers i and j), or len(). The function must be recursive and must return (NOT
print) the number of sublists. This function may not use any loops. Remember that you can
test whether an item is a list by writing: if type(item) == list. You may assume that the initial
value given to the function is a list, and your function does not have to behave in any
reasonable way when given something other than a list as a parameter. Please remember
that the examples are just that. Your function must work correctly on all valid parameters,
and you may not make any assumptions about the number of nested sublists or the depth of
the nesting in the list provided as a parameter to the function. The following shows the
function results on several parameters: 2. Write a recursive function itemCount() that takes an arbitrarily nested list as a parameter
and returns the number of items in the list. An item is a non-list value stored inside the list
or inside of some sublist of the list (or a sublist of a sublist of the list, etc.) You are not
allowed to use any list methods in your function other than indexing (e.g. lst[i] for some nonnegative integer i) or slicing (e.g. lst[i:j] for some non-negative integers i and j). The function
should not use a loop. The function must be recursive and must return (not print) the
number of items. Remember that you can test whether an item is a list by writing: if
type(item) == list. You may assume that the initial value given to the function is a list, and
your function does not have to behave in any reasonable way when given something other
than a list as a parameter.

Answers

(11)
Status NEW Posted 02 May 2017 05:05 AM My Price 9.00

-----------

Not Rated(0)