Good Day, Am a new self-developing programmer on python. Please i need python codes to this questions.
1. According to the description of R-rated films: Children under 17 require an accompanying parent or adult guardian (age 21 or older) and adults 25 years and under must show ID. And children under the age of 6 are not allowed in after 6:00pm.
Deadpool is an R-rated movie.
If the age is less than 6, return 'You are not allowed to watch Deadpool after 6.00pm'.
If the age is 6 or more but less than 17, return 'You must be accompanied by a guardian who is 21 or older'.
If the age is 17 or more but less than 25, return 'You are allowed to watch Deadpool, right after you show some ID'.
If the age is 25 or greater, return 'Yay! You can watch Deadpool with no strings attached!'.
If the age is invalid, return 'Invalid age'.
2. Design an iterative and a recursive function called 'replicate_iter' and 'replicate_recur' respectively which will receive two arguments: 'times' which is the number of times to repeat and 'data' which is the number or string
to be repeated.
The function should return an array containing repetitions of the data argument. For instance, replicate_recur(3, 5) or replicate_iter(3,5) should return [5,5,5]. If the times argument is negative or zero, return an empty array. If the argument is invalid,raise a ValueError.
3. Create a function called binary_converter. Inside the function, implement an algorithm to convert decimal numbers between 0 and 255 to their binary equivalents.
For any invalid input, return string Invalid input
Example: For number 5 return string 101
4. Write a function called manipulate_data which will act as follows:
When given a list of integers, return a list, where the first element is the count of positives numbers and the second element is the sum of negative numbers
5. • Create a class called BankAccount that has the methods withdraw and deposit with no implementation.
• Create a class called SavingsAccount that inherits from BankAccount. SavingsAccount should have a constructor that only takes in a self argument. This constructor sets a property called balance to 500. (This should be the minimum balance at any given time).
o In the SavingsAccount class, implement the deposit method that takes in cash deposit amounts, updates the balance accordingly and then returns the balance. For a negative deposit amounts, return Invalid deposit amount.
o In the SavingsAccount class, implement the withdraw method that takes in the cash withdrawal amount, deducts this amount from the current balance and returns the balance. This method should NEVER allow the balance to get below 500. (Check for this condition and output Cannot withdraw beyond the minimum account balance if it happens). Also, outputCannot withdraw beyond the current account balance if withdrawal amount is greater than current balance. For a negative withdrawal amount, return Invalid withdraw amount.
• Create a class called CurrentAccount that inherits from BankAccount. CurrentAccount should have a constructor that only takes in the self argument and sets a property called balance to 0.
o In the CurrentAccount class, implement a deposit method that takes in cash deposit amounts, updates the balance accordingly and then returns the balance. For a negative deposit amount, return Invalid deposit amount.
o In the CurrentAccount class, implement a withdraw method that takes in the cash withdrawal amount, deducts this amount from the current balance and returns the balance. For a negative withdrawal amount, return Invalid withdraw amount. Withdrawing more than the current balance should fail with message Cannot withdraw beyond the current account balance
6. Country X calculates tax for its citizens using a graduated scale rate as shown below:
1. Yearly Income: 0 - 1000
Tax Rate: 0%
2. Yearly Income: 1,001 - 10,000
Tax Rate: 10%
3. Yearly Income: 10,001 - 20,200
Tax Rate: 15%
4. Yearly Income: 20,201 - 30,750
Tax Rate: 20%
5. Yearly Income: 30,751 - 50,000
Tax Rate: 25%
6. Yearly Income: Over 50,000
Tax Rate: 30%
Write a Python function named calculate_tax that will take as an argument, a dictionary containing key-value pairs of people's names as the keys and their yearly incomes as the values.
The function should return a dictionary containing key-value pairs of the same people’s names as keys and their yearly tax bill as the values. For example, given the sample input below:
The output would be as follows:
The tax for James would be calculated as follows:
1. The first 1000 (1000 - 0)
Calculation: 1,000 * 0%
2. The next 9000 (10,000 - 1,000)
Calculation: 9,000 * 10%
3. The next 10,200 (20,200 -10,000)
Calculation: 10,200 * 15%
4. The remaining 300 (20,500 - 20,200)
Calculation: 300 * 20%
5. Total Income: 20,500
Total Tax: 0 + 900 + 1530 + 60 = 2490
Thanks for your reply in anticipation