Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python tuples and lists: indexing, slicing, copying, etc. in array notation using basic operations such as: len(), +, * ,in, [:], .append, .insert, .extend, .remove,
Python tuples and lists: indexing, slicing, copying, etc. in array notation using basic operations such as: len(), +, * ,in, [:], .append, .insert, .extend, .remove, .reverse, .sort, list, tuple
_________________________________________________________________________________ def make_a_different_tuple(tuple_input): """ return a modification of the given tuple: Finish this function which takes a tuple as input and returns another tuple with the first and last item, and your name in the middle. For example, if the input tuple is ("this", "is", "input", "tuple"), after calling this function, the return value should be ("this", "Yang", "tuple") """ def process_a_nested_tuple(tuple_param): """ process a nested tuple: The input tuple follows the format below: (artist name, album name,year, (song1, length1), (song2, length2)....) Process the given tuple_param and output the content following the format below: The "album name" is a album of artist_name released in year. Track listing: song1 length1 song2 length2 ... This function has no return value. """ def tuple_as_return_value(r, n): """ use tuple as return value: Given a radius of a whole pizza and the number of slices it will be cut into. Return a tuple of areas of one slice, two slices """ # ---------------------------------- # test print(make_a_different_tuple(("hello", "who", "is making changes?"))) print(make_a_different_tuple((0,1,2,3,99.3))) print("--"*20) # test music_and_me = ("Michael Jackson", "Music & Me", 1973,("With a Child's Heart", "3:34"), ("Up Again", "2:47"), ( "All the Things You Are", "2:55")) process_a_nested_tuple(music_and_me) print("--"*20) # test print(tuple_as_return_value(10,6)) print(tuple_as_return_value(10,8))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started