Pythonques - Ipynb - Colaboratory
Pythonques - Ipynb - Colaboratory
ipynb - Colaboratory
num=int(input("enter the number"))
sqrt=num**0.5
print("the square root of %0.3f is %0.3f"%(num,sqrt))
#for Complex number
import cmath
num=complex(input("enter the complex number"))
sqrt=cmath.sqrt(num)
print('the square root of {0} is {1:0.3f}+{2:0.3f}j'.format(num,sqrt.real,sqrt.imag
#solve quadratic equation ax**2+bx+c=0
import cmath
a=int(input("enter the vale of a"))
b=int(input("enter the vale of b"))
c=int(input("enter the vale of c"))
ans=(b**2)-(4*a*c)
pos_sol=(-b-cmath.sqrt(ans))/(2*a)
neg_sol=(-b+cmath.sqrt(ans))/(2*a)
print('The answer is {} and {}'.format(pos_sol,neg_sol))
x=input("enter the first number")
y=input("enter the second number")
temp=x
https://colab.research.google.com/drive/1XHVIGAYFqJZiGQNbU21JeJLoQZ5qAU7s#scrollTo=F6KJTXZnlz1w&printMode=true 1/3
05/06/2022, 02:06 .pythonQues.ipynb - Colaboratory
x=y
y=temp
print("The value of x after swapping:{}".format(x))
print("The value of y after swapping:{}".format(y))
kilometers=float(input("enter the value in kilometer"))
factor_for_conversion=0.621371
miles=factor_for_conversion*kilometers
print("%0.2f kilometer is equal to %0.2f miles",(kilometers,miles))
x = "nitesh"
if not type(x) is int:
raise TypeError("type your name properly")
--------------------------------------------------------------------------
-
https://colab.research.google.com/drive/1XHVIGAYFqJZiGQNbU21JeJLoQZ5qAU7s#scrollTo=F6KJTXZnlz1w&printMode=true 2/3
05/06/2022, 02:06 .pythonQues.ipynb - Colaboratory
Could not connect to the reCAPTCHA service. Please check your internet connection and reload to get a
reCAPTCHA challenge.
https://colab.research.google.com/drive/1XHVIGAYFqJZiGQNbU21JeJLoQZ5qAU7s#scrollTo=F6KJTXZnlz1w&printMode=true 3/3