Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment overview This lab exercise provides practice with file processing You will work with a partner on this exercise during your lab session. Two people

image text in transcribed
image text in transcribed
Assignment overview This lab exercise provides practice with file processing 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 lab05.py and keep adding your functions to the same file. 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 retums True if the string represents a leap year, and retums 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 "lab05.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 retum 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.O Demonstrate your completed program to your TA. on-line students should submit the completed program (named "lab05.py") for grading via the Mirmir system. Part C: Digit Count Write a function named digit count that takes one parameter that is a number (int or float) and returns a count of even digits, a count of odd digits, and a count of zeros that are to the left ofthe decimal point. Return the three counts in that order: even count, odd count ero count. Be careful of the "edge casc" where the number starts with a decimal point conversion of such a

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago