Ask 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. neither 1 nor 555 are in range).

+3
Answers (1)
  1. 2 January, 15:15
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers