0% found this document useful (0 votes)
38 views

Hint: Represent A Ball On A Plane As A Tuple of (X, Y, R), R Being The Radius If (Distance

The document provides hints and instructions for writing several Python functions: a function to check for collisions between two balls based on their positions and radii; functions to find the mean, median and mode of a set of numbers; a function to check if two strings are nearly equal allowing for one mutation; and functions to find duplicate elements, unique elements, and the cumulative product of elements in a list.

Uploaded by

Subbu Suni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Hint: Represent A Ball On A Plane As A Tuple of (X, Y, R), R Being The Radius If (Distance

The document provides hints and instructions for writing several Python functions: a function to check for collisions between two balls based on their positions and radii; functions to find the mean, median and mode of a set of numbers; a function to check if two strings are nearly equal allowing for one mutation; and functions to find duplicate elements, unique elements, and the cumulative product of elements in a list.

Uploaded by

Subbu Suni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Write a function ball_collide that takes two balls as parameters and computes if they are
colliding. Your function should return a Boolean representing whether or not the balls are
colliding.
Hint: Represent a ball on a plane as a tuple of (x, y, r), r being the radius If (distance
between two balls centers) <= (sum of their radii) then (they are colliding)

2. Find mean, median, mode for the given set of numbers in a list.
3. Write a function nearly_equal to test whether two strings are nearly equal. Two strings a
and b are nearly equal when a can be generated by a single mutation on b.
4. Write a function dups to find all duplicates in the list.
5. Write a function unique to find all the unique elements of a list.
6. Write a function cumulative_product to compute cumulative product of a list of numbers.

You might also like