Skip to main content

Posts

Python Hacker Rank Question and Answer -- Hands-on - Namespaces

  Python - Namespaces Write the function definition for the function  ' Assign ' to assign the different types of variables in its parameters to new variables. Parameters: 1.An INTEGER in the variable ' i ' 2.A FLOAT in the variable ' f ' 3.A STRING in the variable ' s ' 4.A BOOLEAN in the variable ' b '   New Variables to be assigned with : 1.An INTEGER in the variable ' w ' 2.A FLOAT in the variable ' x ' 3.A STRING in the variable ' y ' 4.A BOOLEAN in the variable ' z '   Assign the parameter variables  Respectively . and Print these in the following order: 1.w 2.x 3.y 4.z 5.Display all the objects defined in the current namespace by using the 'dir' function   Input Format for Custom Testing: # In the first line, value for ' i ' # In the second line, value for ' f ' # In the third line, value for ' s ' # In the fourth line, value for ' b '   Sample Test Case 1:   Sampl...

Python Hacker Rank Question and Answer

Python Question And Answers  Question : Python - Get Additional Info   Define a function called ` docstring `  which takes one parameter .  The  parameter 'function-name' is a  Python  built-in function  name.   The function definition code stub is given in the editor. Generate a  Docstring of the input function  based on the condition given below:   The Docstring must give the maximum information about the function.     Constraints Input must be a string. Input Format Format for Custom Testing   In the input, any python built-in function is   given as a string.     Sample Case 0   Sample Input STDIN      Function -----      -------- print   → functionname = print Sample Output: Help on built-in function print in module builtins: print(...) print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) Prints the values to a stream...