Question
Write a Python program using Python 3.6.2. The program should be saved as a text file with the extention '.py'. The program should have the
Write a Python program using Python 3.6.2. The program should be saved as a text file with the extention '.py'.
The program should have the following three functions:
1. A function named isRelativelyPrime that takes two integers as parameters and returns True if there is no common divisor other than 1 for the two integers, False otherwise.
IsRelativelyPrime(6,8) should return False as they have a common divisor 2.
IsRelativelyPrime(12,7) should return True as they have no common divisor other than 1.
Hint : Use the gcd function of math module.
2. A function named isEvenOccurrences that takes two parameters, an integer list and an integer and returns True if the integer appears even number of times in the list else False. If the list is empty or if the integer does not appear at all in the list, it should return True.
isEvenOccurrences([2,5,7,8,5,5,1],5) should return False while isEvenOccurrences([1,2,4,1],1) should return True.
3. A function named removeDuplicates that takes a list of strings as a parameter and returns a new list that consists of strings in the original list in the same order but with duplicates removed. Do not change the list passed in as parameter.
removeDuplicates([Hello, hi, Howdy, hi, Hello]) should return [Hello,hi]
removeDuplicates([]) should return [].
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