Print, Input - Jupyter Notebook
Print, Input - Jupyter Notebook
Parameter Description
object(s) Any object, and as many as you like. Will be converted to string before printed
sep='separator' Optional. Specify how to separate the objects, if there is more than one. Default is ''
end='end' Optional. Specify what to print at the end. Default is '\n' (line feed)
flush Optional. A Boolean, specifying if the output is flushed (True) or buffered (False). Default is False
In [2]: a,b=10,30
print(a,b)
10 30
In [3]: print(a,b,sep="\n")
10
30
In [8]: # End
print(a,end="rs.")
print(b)
10rs.30
In [ ]:
In [13]: # write a program which takes two number from user and display sum of it
In [9]: # Write a program to calculate SI (SI = Principle Amount * Rate of Interest * Time /100)
p = float(input("Enter Principle Amount"))
r = float(input("Enter Rate of Interest"))
t = float(input("Enter time"))
# Expression
si = (p*r*t)/100
print("Simple Interest of principle amount = {},rate of interest = {},time = {} will be {}".format(p,r,
#print(f"Simple Interest of principle amount = {p},rate of interest = {r},time = {t} will be {si}")
eval in Python
The eval() method parses the expression passed to it and runs python expression(code) within the program.
In [ ]:
In [ ]:
In [ ]:
Example
In [ ]: