subject

Hello, I need help writing some Python 3+ programs. The instructions are:1) 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'2) 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 of the decimal point. Return the three counts in that order: even_count, odd_count, zero_count. Be careful of the "edge case" where the number starts with a decimal point—conversion of such a number to a string places a zero before the decimal point. See correct behavior in the final test case below. For example: digit_count(1234567890123) returns (5, 7, 1) digit_count(123400.345) returns (2, 2, 2) print(digit_count(123.)) returns (1, 2, 0) print(digit_count(.123)) returns (0, 0, 0)3) String has a method s. isdigit() that returns True if string s contains only digits and False otherwise, i. e. s is a string that represents an integer. Write a function named float_check that takes one parameter that is a string and returns True if the string represents a float and False otherwise. For the purpose of this function we define a float to be a string of digits that has at most one decimal point. Note that under this definition an integer argument will return True. Remember "edge cases" such as "45." or ".45"; both should return True. For example: float_check('1234') returns Truefloat_check('123.45') returns Truefloat_check('123.45.67') returns Falsefloat_check('34e46') returns Falsefloat_check('.45') returns Truefloat_check('45.') returns Truefloat_check('45..') returns False

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:30
Light travels at a speed of 186,000 miles a second. the distance light travels in a year is 5,865,690,000,000 miles/year 5,865,695,000,000 miles/year 58,656,950,000,000 miles/year 6,789,000,0000 miles/year
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Which task uses a simple parameter?
Answers: 1
question
Computers and Technology, 24.06.2019 06:50
What are the things you are considering before uploading photos on social media?
Answers: 1
question
Computers and Technology, 25.06.2019 04:10
8. create an abstract student class for parker university. the class contains fields for student id number, last name, and annual tuition. include a constructor that requires parameters for the id number and name. include get and set methods for each field; the settuition() method is abstract. create three student subclasses named undergraduatestudent, graduatestudent, and studentatlarge, each with a unique settuition() method. tuition for an undergraduatestudent is $4,000 per semester, tuition for a graduatestudent is $6,000 per semester, and tuition for a studentatlarge is $2,000 per semester. write an application that creates an array of at least six objects to demonstrate how the methods work for objects for each student type. save the files as student.java, undergraduatestudent.java, graduatestudent.java, studentatlarge.java, and studentdemo.java.
Answers: 1
You know the right answer?
Hello, I need help writing some Python 3+ programs. The instructions are:1) Write a function rotate(...
Questions
question
Mathematics, 22.03.2021 20:00
question
Mathematics, 22.03.2021 20:00
Questions on the website: 13722363