============================================================
#example
a=input()
b=input()
print("enter values for a,b")
print(a)
print(b)
b=input()
print("enter values for a,b")
print(a)
print(b)
OUTPUT:
enter values for a,b
10
20
10
20
a+b
'1020'
============================================================
#example
print("enter values for a,b")
a=input()
b=input()
print("================")
print(a)
print(b)
print("================")
x=int(a)
print(x)
print(type(x))
print("================")
y=int(b)
print(y)
print(type(y))
OUTPUT:
enter values for a,b
10
20
================
10
20
================
10
<class 'int'>
================
20
<class 'int'>
============================================================
#example
print("enter the values")
a=int(input())
b=int(input())
print("=======================")
print("a value is:",a)
print("b value is:",b)
OUTPUT:
enter the values
10
20
=======================
a value is: 10
b value is: 20
============================================================
#example
a=int(input("enter variable a:"))
print("=============================")
print("a value is :",a)
output:
enter variable a:10
=============================
a value is : 10
============================================================
#example
print("enter values")
a=input().split()
print(a)
output:
enter values
10 20 30 40 50
['10', '20', '30', '40', '50']
============================================================
#example
print("# add a newline or veritical space b/w two outputs")
print(" ")
print("hello")
print("welcome python")
print("================================")
#By using Seperator
print("# By using Seperator")
print("hello","welcome","python")
print(" ")
print("hello","welcome","python",sep="\n")
print(" ")
print(" ")
print("hello","welcome","python",sep="-")
print("================================")
#By using END
print("# By using Seperator")
print(" ")
print("hello")
print("welcome python")
print(" ")
print("hello",end=" ")
print("welcome python")
print(" ")
print("================================")
#By using format specifiers
print("# By using format specifiers")
a=4.5
b=10
print("a is float and b is integer")
print(" ")
print("%f is float and %d is integer"%(a,b))
print("Note: float will have 6 precessions")
print(" ")
c=3.3333333333333
print("c value is=%f"%(c))
print("c value is with 2f : c=%.2f"%(c))
print("c value is with 4f: c=%.4f"%(c))
print("================================")
#By using without format specifiers
print("# By using without specifiers")
print("%f is float and %d is integer"%(a,b))
print("Note: float will have 6 precessions")
Output:
# add a newline or veritical space b/w two outputs
hello
welcome python
================================
# By using Seperator
hello welcome python
hello
welcome
python
hello-welcome-python
================================
# By using Seperator
hello
welcome python
hello welcome python
================================
# By using format specifiers
a is float and b is integer
4.500000 is float and 10 is integer
Note: float will have 6 precessions
c value is=3.333333
c value is with 2f : c=3.33
c value is with 4f: c=3.3333
================================
# By using without specifiers
4.500000 is float and 10 is integer
Note: float will have 6 precessions