Contoh 1:
>>> nom1 = float(3.333)
>>> nom2 = float(10.401)
>>> nom3 = nom1 + nom2
>>> print (nom3)
13.734
>>> round (nom3,2)
13.73
>>> round (nom3,1)
13.7
>>> round (nom3,0)
14.0
>>> round (nom3,5)
13.734
>>>
Contoh 2:
>>> a = str ('helo')
>>> b = str ('Dunia')
>>> c = str ('!')
>>> print (a,b,c)
helo Dunia !
>>> print (a,b+c)
helo Dunia!
>>> print (a*4)
helohelohelohelo
>>>
Contoh 3:
>>> x = 13
>>> x > 3
True
>>> x < 0
False
>>>
>>> nom1 = float(3.333)
>>> nom2 = float(10.401)
>>> nom3 = nom1 + nom2
>>> print (nom3)
13.734
>>> round (nom3,2)
13.73
>>> round (nom3,1)
13.7
>>> round (nom3,0)
14.0
>>> round (nom3,5)
13.734
>>>
Contoh 2:
>>> a = str ('helo')
>>> b = str ('Dunia')
>>> c = str ('!')
>>> print (a,b,c)
helo Dunia !
>>> print (a,b+c)
helo Dunia!
>>> print (a*4)
helohelohelohelo
>>>
Contoh 3:
>>> x = 13
>>> x > 3
True
>>> x < 0
False
>>>
0 comments:
Post a Comment