questionwrite down a function called issorted


Question

Write down 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 suppose (as a precondition) that elements of the list can be compared with comparison operators <, >, etc.

For instance, is_sorted([1,2,2]) should return True and is_sorted(['b','a']) should return False.

Two words are anagrams if you be able to 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.

The Birthday Paradox-

1. Inscribe a function called has_duplicates that takes a list and returns true if there is any element that comes out more than once. It has to not modify the original list.

2. If there are twenty three students in your class, what are chances that two of you have the same birthday? You can estimate this probability by generating random samples of twenty three birthdays and checking for matches.

 

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: questionwrite down a function called issorted
Reference No:- TGS0444034

Expected delivery within 24 Hours