There are tons of built-in functions in python which makes it more advanced and up to date language.Python has now become on of the most used programming languages than Java or C language. Although Java is preferred in some particular coding is sides but Python is best suitable.
Some common built-in Functions of Python that you need know as a beginner and how they work is as follows:
print() function
print() function is used to print a specific block of characters.
input="Hello! I am a xyz."
print(input)
The output will look like-
Hello! I am a xyz.
Adding strings before we print something
So here comes the question ,what is string?Strings are basically a collection of character. If we store Hello in a variable; here, variable is a collection of character and H,e,l,l,o are each a character.
If we want to add string before we print the output we can do it in the following way-
input="Hello!I am a xyz."
print("Output is:",input)
The output will look like-
Output is:Hello!I am a xyz.
Uppercase and lowercase function
Python recognises uppercase and lowercase characters differently.To convert a string of uppercase letters to lowercase -
input="HELLO"
print(input.lowercase())
The output will look like-
hello
To convert a string of lowercase letters to uppercase-
input="hello"
print(input.uppercase())
The output will look like-
HELLO
To remove unwanted space
input="hello I am xyz."
print(input.strip())
The output will look like-
helloIamxyz.
Top comments (0)