===========================================================
Reading the Data Dynamically to the Python Program
===========================================================
=>In Python Programming, To read the Data Dynamically from Keyboard, we have 2
Pre-Defined Functions. They are
1. input()
2. input(Mesage)
-------------------------------------------------------------------------------------------------------------------------------
------------------------------
1. input()
-------------------------------------------------------------------------------------------------------------------------------
------------------------------
=>Syntax: varname=input()
=>This Function is used for Reading any type of Data from Key Board and placed in LSH
Varname and the value present in LHS Var is of type <class, str>.
=>As Python Programmer, we convert str type value into Other Type (If Possible) by
using Type Casting Techniques.
-------------------------------------------------------------------------------------------------------------------------------
------------------------------
2. input(Mesage)
-------------------------------------------------------------------------------------------------------------------------------
------------------------------
=>Syntax: varname=input(Message)
=>Here Message Represents User-Prompting Message ans whose type is str
=>This Function is used for Reading any type of Data from Key Board and placed in LSH
Varname and the value present in LHS Var is of type <class, str> and with this Function,
Additionally we get User Prompting Message.
=>As Python Programmer, we convert str type value into Other Type (If Possible) by
using Type Casting Techniques.
-------------------------------------------------------------------------------------------------------------------------------
------------------------------
#[Link]
print("Enter Any Value:")
kvr=input()
print(kvr,type(kvr))
#[Link]
kvr=input("Enter Any Value:")
print(kvr,type(kvr)) # 123 <class 'str'>
#Assume we entered int type value in str format
x=int(kvr)
print(x,type(x))
#[Link]
x=float(input("Enter Any Value:"))
print(x,type(x))
#[Link]
x=float(input("Enter First Value:"))
y=float(input("Enter Second Value:"))
z=x*y
print("-"*50)
print("Val of x={}".format(x))
print("Val of y={}".format(y))
print("Result={}".format(z))
print("-"*50)
#[Link]
print("Enter Two Numerical Values:")
x=float(input())
y=float(input())
print("Mul({},{})={}".format(x,y,x*y))
#[Link]
z=float(input("Enter First Value:"))*float(input("Enter Second Value:"))
print("Mul={}".format(z))
#[Link]
print("Mul={}".format(float(input("Enter
FirstValue:"))*float(input("EnterSecond Value:"))))
#Program for Calculating Area of Rect
#Area of Rect = Length x Breadth
#[Link]
length=float(input("Enter Length:"))
breadth=float(input("Enter Breadth:"))
#Cal Area of Rect
area=length*breadth
print("*"*50)
print("\t\tLength of Rect={}".format(length))
print("\t\tBreadth of Rect={}".format(breadth))
print("\t\tArea of Rect={}".format(area))
print("*"*50)
#program for Cal Simple Interest and total amount to pay
#[Link]
p=float(input("Enter Principle Amount:"))
t=float(input("Enter Time:"))
r=float(input("Enter Rate of Interest:"))
#Cal si and totmat to pay
si=(p*t*r)/100
totamt=p+si
print("-"*50)
print("\tPrinciple Amount:{}".format(p))
print("\tTime:{}".format(t))
print("\tRate of Interest:{}".format(r))
print("-"*50)
print("\tSIMPLE INTEREST={}".format(si))
print("\tTOTAL AMOUNT TO PAY={}".format(totamt))
print("-"*50)
#Program for Calculating Area and Perimeter of Circle
#[Link]
r=float(input("Enter Radius:"))
ca=3.14*r*r
cp=2*3.14*r
print("-"*50)
print("\tRadius={}".format(r))
print("\tArea of Circle={}".format(ca))
print("\tPerimter of Circle={}".format(cp))
print("-"*50)
print("===============OR================")
print("\tRadius={}".format(r))
print("\tArea of Circle=%0.2f" %ca)
print("\tPerimter of Circle=%0.2f" %cp)
print("-"*50)
print("===============OR================")
print("\tRadius={}".format(r))
print("\tArea of Circle=",round(ca,2))
print("\tPerimter of Circle=",round(cp,2))
print("-"*50)
#>>> a=1234.561234
#>>> round(a,-2)
#1200.0
#>>> a=1234.561234
#>>> round(a,-3)
#1000.0
#>>> a=1234.561234
#>>> round(a,-4)
0.0