Ask Question
13 January, 06:08

Write a function that takes an integer as an argument and returns True if the number is within the range 1 to 555 (not inclusive, i. e. neither 1 nor 555 are in range).

+1
Answers (1)
  1. 13 January, 08:59
    0
    The program to this question as follows:

    Program:

    def Range (n) : #defining a method Range and pass variable n as a parameter

    if (1
    return True #return value

    else:

    return False #return value

    n=int (input ('Enter the value: ')) #defining variable n and input a value

    d=Range (n) #defining variable d and call the method that holds value

    print (d) #print value

    Output:

    Enter the value: 34

    True

    Explanation:

    In the above python code, a function "Range" is defined, which uses a variable n as a parameter, inside the function, the conditional statement is used, inside the if block, if the input value is in the range between 1 to 555. if it is true will return a value that is "True" or it will go to the else part that returns a value "False".

    Outside the function, variable n is defined, which uses input function for input the value from the user, and another variable d is defined, that holds function return value and uses print function to print its value.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a function that takes an integer as an argument and returns True if the number is within the range 1 to 555 (not inclusive, i. e. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers