Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USE python without pthread I need code Assignment Overview This lab exercise provides practice with functions. You will work with a partner on this exercise
USE python without pthread I need code
Assignment Overview This lab exercise provides practice with functions. You will work with a partner on this exercise during your lab session. Two people should work at one computer. Occasionally switch the person who is typing. Talk to each other about what you are doing and why so that both of you understand each step Mirmir testing: create one file named 1ab04.py and keep adding your functions to the same file, but comment out any instructions outside of functions when you run Mimir tests. Part A: Leap Year A leap year in the Gregorian calendar system is a year that is divisible by 400 or a year that is divisible by 4 but not by 100. Write a function named leap_year that takes one string parameter. It returns True if the string represents a leap year, and returns False otherwise For example, 1896, 1904, and 2000 are leap years, but 1900 is not. Therefore, leap_year ('1896') returns True (Optional challenge: write the function suite as one line.) Demonstrate your completed program to your TA. On-line students should submit the completed program (named "lab04.py") for grading via the Mirmir system. Part B: Rotate Write a function rotate (s,n) that has one string parameter s followed by a positive integer parameter n. It returns a rotated string such that the last n characters have been moved to the beginning If the string is empty or a single character, the function should simply return the string unchanged. Assume that n is less than or equal to the length of s and that n is a positive intger. For example rotate 'abcdefgh', 3) returns 'fghabcde' (Optional challenge: write the function to handle n larger than the length of s.) Demonstrate your completed program to your TA. On-line students should submit the completed program (named "lab04.py") for grading via the Mirmir systemStep 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