Important Notice:

Course Content
Accepting Input from the Console
0/1
Introduction to Python (Chapter-3) M3-R5.1
About Lesson
  1. input()

यह फंक्शन keyboard के माध्यम से data को string के form में input करता है। type casting method का प्रयोग करके string data को related data type में convert किया जाता है।

Syntax:-         variable=input(“message”)

Example:-     

name=input(‘Enter Your Name : ‘)

print(“Hello”,name)

Output-

Enter Your Name : akhilesh

Hello akhilesh

 

Example 1: wap to accept student’s details using the input function and display it. (details like- Reg. No. , Name, Course, DOB, Address)

Note:- यदि हम किसी भी input किए गये data का type पता करता चाहते हैं तो हमें type() function का उपयोग करना पड़ेगा। जैसे-

num=input(“Enter any Integer Number”)

flt=input(“Enter the Decimal Number”)

name=input(“enter any name”)

print(“Testing of Data type that You can Enter”)

print(“type of num is “,type(num))

print(“type of flt is “,type(flt))

print(“type of name is “,type(name))

 

                          

  1. input()

                     This function inputs data in the form of string through keyboard. Using type casting method, string data is converted into related data type.

Syntax:-         variable=input(“message”)

Example:-     

name=input(‘Enter Your Name : ‘)

print(“Hello”,name)

Output-

Enter Your Name : akhilesh

Hello akhilesh

 

Example 1: wap to accept student’s details using the input function and display it. (details like- Reg. No. , Name, Course, DOB, Address)

 Note:- If we want to know the type of any inputted data then we have to use type() function. As-

num=input(“Enter any Integer Number”)

flt=input(“Enter the Decimal Number”)

name=input(“enter any name”)

print(“Testing of Data type that You can Enter”)

print(“type of num is “,type(num))

print(“type of flt is “,type(flt))

print(“type of name is “,type(name))

error: Content is protected !!