/ Python And R Data science skills: 10 ds python If statement randn function in telugu vlr training

Sunday 4 February 2018

10 ds python If statement randn function in telugu vlr training

10 If continue
In [5]:
import numpy as ns
In [7]:
from numpy.random import randn
In [8]:
randn()
Out[8]:
0.35048202440449683
In [28]:
x=randn()
if x>1:
    answer="bigthan1"
print (x)
print(answer)
0.6876527458930721
bigthan1
In [68]:
answer=None
x=randn()
if x>1:
    answer="bigthan1"
print (x)
print(answer)
1.4786900722252716
bigthan1
In [86]:
answer=None
x=randn()
if x>1:
    answer="bigthan1"
else:
    answer="small than1"
    
print (x)
print(answer)
-1.3212164579151455
small than1
In [93]:
#nested if
answer=None
x=randn()
if x>1:
    answer="bigthan 1"
else:
    if x>=-1:
        answer="between 1 and -1"
    else:
        answer="LessThan -1"
    
    
print (x)
print(answer)
-1.5836002674690706
LessThan -1

No comments:

Post a Comment