PYTHON BUILT-IN FUNCTIONS
Python Built-in function: We are going to learn how to get input from the user through the input function and also how to calculate the length of the string through len() function and also learn more about Python’s built-in function. Both are predefined functions that is very important to understand. There are many predefined functions in python like str(), int() and float(), etc that have been discussed in the previous lectures.
The input function is used to get input from the user. The input function is a predefined function in Python Documentation that is used to get input from the user.
Let we take an example program that takes input from the user and prints on the screen.
print ("What is your roll no?")
input () #used to get input from the user
print ("Thank You!")
y=input ("what is your name? ") # print message and take input
print ("Thank you for authentication!" +y)
Description: This example program get input from user and print on the screen. Input function is a predefined function that gets input from the user. The print function is used to print following userâ€™s input on the screen. In the fourth line of program, input() function that takes input from user and store in the given variable â€œyâ€.
Len stands for length. Len() function is a predefined function that returns the length of the string. Which is used to calculate the length of the string? Let we take an example to understand the basic concept of len() function.
name = "computer" # str is a veriable
Description: len()Â function given us information of stringâ€™s length. You can print the length of any string by using print statements.
We will read more about them in upcoming lectures with the passage of time. Every concept will be clear on the same platform. I assure you that you will not need to read someone else lectures. I hope this lecture is very helpful to understand “Python Built in function”.