Write a function called is_sorted that takes


Write a function called is_sorted that takes a list as a parameter and returns True if the list is sorted in ascending order and False otherwise. You can assume (as a precondition) that the elements of the list can be compared with the comparison operators <, >, etc.
For example, is_sorted([1,2,2]) should return True and is_sorted(['b','a']) should return False.
Exercise 9.4 Two words are anagrams if you can rearrange the letters from one to spell the other.
Write a function called is_anagram that takes two strings and returns True if they are anagrams.
Exercise 9.5 The (so-called) Birthday Paradox:
1. Write a function called has_duplicates that takes a list and returns True if there is any element that appears more than once. It should not modify the original list.
2. If there are 23 students in your class, what are the chances that two of you have the same birthday? You can estimate this probability by generating random samples of 23 birthdays and checking for matches. Hint: you can generate random birthdays with the randint function in
the random module.  

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write a function called is_sorted that takes
Reference No:- TGS088638

Expected delivery within 24 Hours