-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_8Input.py
More file actions
30 lines (19 loc) · 999 Bytes
/
Python_8Input.py
File metadata and controls
30 lines (19 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#INPUT FUNCTION
"""
1- Input() is used to take input from User
2- It always returns a string
Syntax
var_name = input() #input() without text / Normal TEXT ✅✅✅
var_name = input("abc") #input() with text ✅✅✅
age = input("Enter the age = ")
"""
order = input("What you want sir ? Hot Coffee or Cold Coffee = ")
print("You Ordered ",order," will arrive in 10 minutes." )
num1 = input("Enter number1 = ")
num2 = input("Enter number2 = ")
print("Addition of both number is ",num1 + num2) #❌ Output will be treated and printed as string
print("Addition of both number is ",int(num1) + int(num2)) #✅ Output will be printed as integer as we have declared it as int ⭐⭐
#This can be also done in other way by declaring the num itself while taking input, such as :
num3 = int(input("Enter number 3 = ")) #⭐⭐⭐
num4 = input(int(6)) #it will take directly declared input of the int variable , basically it will store int value 6 in num4.⭐⭐⭐⭐
print(num4)