Quick actions

cmd+k|ctrl+k

Navigation

Languages

Belajar python

Snippet info

Language

Python

Visibility

public

Author

fnurrahmah125

Created

2019-08-02T03:29:35Z

Updated

2019-08-02T03:29:35Z

#ouput print
print("Hello World!")
a=5
print('The value of a is', a)
nama = "John"
print("Hello, %s!" %nama)
age=15
print("%s is %d years old." % (nama, age))
mylist = [1,2,3]
print("A list: %s" % mylist)
# %s - String
# %d - Integer
# %f - Bilangan pecahan
# %<digit>f - Bilangan pecahan dengan jumlah digit angka dibelakang koma
# %x/%X - bilangan bulat dlm representasi Hexa (huruf kecil/besar)

#input
#num = input('Enter a number: ')

#numbers
b = 5
print(b, "is of type", type(b))
b = 2.0
print(b, "is of type", type(b))
b = 1+2j
print(b, "is complex number?", isinstance(1+2j, complex))

x = [5,10,15,20,25,30,35,40]
x[5]
x[-1]
x[3:5]
x[:5]
x[-3:]
INFO