Question

IN PYTHON Define a python function named remain to take two integer parameters and return the...

IN PYTHON

Define a python function named remain to take two integer parameters and return the remainder when the first integer is divided by the second. Multiple lines of code are required. Indicate indention when necessary with a few taps of the spacebar.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I mentioned the number of spaces(intendation) required with # at the required line.

Code:

Output:

Raw code:

def remain(first,second):

remainder = first % second #use four spaces

return remainder #use four spaces

#Test case
a=6
b=3
print(remain(a,b)) #calling remain function on a and b

Hope you understand.if you have any doubts or if you want any modifications.please comment.

Thank you.Rate my answer.

Add a comment
Know the answer?
Add Answer to:
IN PYTHON Define a python function named remain to take two integer parameters and return the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Python, having trouble writing this function. Define a function named makeDictionary with two parameters. The...

    In Python, having trouble writing this function. Define a function named makeDictionary with two parameters. The first argument passed the function must be a list of strings to be used as keys, while the second is a list of the same length containing values (of some type). This function must return a dictionary consisting of the keys paired with the corresponding values. Help would be appreciated

  • Define a function named how_many_substr_of_string(...) which receives two parameters, the first parameters is a list with...

    Define a function named how_many_substr_of_string(...) which receives two parameters, the first parameters is a list with strings (name it  listst) and the second parameter is a single string (name it st). The function should return a number, indicating how many of the strings in the list listst are substrings in the string st As an example, the following code fragment: listst = ["a","bc","dd"] st = "abc" res = how_many_substr_of_string(listst,st) print (res) should produce the output: 2 Language Python

  • Python Write a function that takes in two numbers as parameters. The function will then return...

    Python Write a function that takes in two numbers as parameters. The function will then return the value of the first parameters squared by the second parameter. Print the value of the return statement. Take a screenshot of both your code and your properly executed code after you have run it. Submit the screenshots here along with your .txt file.

  • Define a function named how_many_substr_of_string(...) which receives two parameters, the first parameters is a list with...

    Define a function named how_many_substr_of_string(...) which receives two parameters, the first parameters is a list with strings (name it  listst) and the second parameter is a single string (name it st). The function should return a number, indicating how many of the strings in the list listst are substrings in the string st As an example, the following code fragment: listst = ["a","bc","dd"] st = "abc" res = how_many_substr_of_string(listst,st) print (res) should produce the output: 2 language:Python

  • In Python beginner code: Write a function named even_div, that takes two arguments (you can safely...

    In Python beginner code: Write a function named even_div, that takes two arguments (you can safely assume that both arguments will always be non-zero integers). When this function is called, it should return how many times the first argument can be divided by the second argument, if it is evenly divisible (no remainder). If it is not evenly divisible, the function should return 0. Examples: even_div(5, 2) will return 0 (5 divided by 2 is 2.5, not evenly divisible) even_div(10,...

  • Write a Python program which defines a function named "divide_two_numbers" that accepts two numeric parameters and...

    Write a Python program which defines a function named "divide_two_numbers" that accepts two numeric parameters and divides the first parameter by the second. Your divide_two_numbers function must check the second parameter before dividing; if it is zero, raise an ZeroDivisionError exception which includes the string "second parameter was zero!" as a parameter instead of processing the division. Your main function must call your divide_two_numbers function at least twice; one call must use two normal parameters to verify normal operation, the...

  • Define a function named insert that takes an integer atom and a sorted list as parameters....

    Define a function named insert that takes an integer atom and a sorted list as parameters. The function should return a list with the integer in the correct position in the sorted list. For example: insert [3, (2 4 6 8)] = (2 3 4 6 8) insert 9, ()] = (9) insert[3, (2 3 4 5)] = (23 3 4 5) Note that in the case of that last example, it does not matter which 3 comes first in...

  • Define a function named food which receives two parameters: an integer value representing the time of...

    Define a function named food which receives two parameters: an integer value representing the time of the day measured in hours from 0 to 24 and a Boolean value indicating whether a person likes sweets (True) or not (False). The function should return one single string with a message as follows. If it is earlier than 6, the message should say "no food" (regardless of the person liking sweets or not). If it is between 6 and 10 extremes included,...

  • Python 3 code Write a function named coinflip that accepts an input called flips. The function...

    Python 3 code Write a function named coinflip that accepts an input called flips. The function should sim-ulate flipping a coin flips times. The function should return True if the coin was the same result for every flip. You can assume the function receives a positive integer as input. Write a second function named simulation that runs trials of the coin flip experiment. simulation should accept two parameters: the number of trials, and the number of coin flips to do...

  • In C++ 1.Define a function named "sumCodes" that accepts two input parameters: "s "and "pos". "s"...

    In C++ 1.Define a function named "sumCodes" that accepts two input parameters: "s "and "pos". "s" is an object of the type "string" and "pos" is a boolean value with the default argument of "true". If "pos" is "true", the function returns the summation of the ASCII codes of all the characters located at the even indices of "s" and if "pos" is "false", the function returns the summation of the ASCII codes of all the characters located at the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT