Python function program to print and accept login credentials

In this python function program, we will create a function to print and accept login credentials.

What is Function?
It is a block of code that executes when it is called.
To create a function use def keyword.

Steps to solve the program
  1. Create a function login.
  2. Use the def keyword to define the function.
  3. Take name and password as input through the function.
  4. Then print Credential accepted.
  5. Call the function to print the output.
				
					def login():
    name = input("Enter name: ")
    password = input("Enter password")
    print("Credential accepted")
login()
				
			

Output :

				
					Enter name: Atharv
Enter password1234
Credential accepted
				
			

Related Articles

get a list of odd numbers from 1 to 100.

get the addition with the return statement.

Leave a Comment