AITCHISON COLLEGE Topic: Input Statement
PREP SCHOOL
ICT Department
Objectives
Students will be able to:
• Understand INPUT Statement in Python
• Learn use of different datatypes in INPUT Statement
• Apply input functions using examples
Input Statement
•Input statement is used to get input from the user.
a=int(input("Enter the first number"))
b=int(input("Enter the second number"))
c=a+b
print ("Sum of these numbers is",c)
Std1=str(input(“Enter Name”))
Std2=str(input(“Enter Name”))
print (Std1, Std2, “are present in the class today”)
Examples
Question 1
Which function is used to get input from user?
a) input()
b) print()
c) output()
d) All of the above
Question 2
What will happen if we don’t specify datatype in input
statement?
User can
enter
string data
in an
integer
Question 3
Which of the following is correct syntax for input()?
a) int(input())=a
b) a=int(input())
c) a=input(int())
d) input(int())=a
Question 4
Why is the following input statement is not user friendly?
a=int(input())
It is not
specified
what to
enter
Question 5
What will be the line of code for following output?
Enter your height: 6.2
h=float(input(“Enter your height:”))
Recap
In this lesson, we have discussed:
• Concept of input in python
• Syntax of Input Statement
• Application of input using examples
Thank You