<jupyter_start><jupyter_text>Print<jupyter_code>print("Meow, saya adalah kucing")<jupyter_output>Meow, saya adalah kucing<jupyter_text>Variable<jupyter_code>pikiran = "saya merasa batal"
pikiran
pikiran = "saya merasa lapar"
pikiran<jupyter_output><empty_output><jupyter_text>Fungsi<jupyter_code>pikiran.replace("lapar", "ngantuk")
pikiran.upper()<jupyter_output><empty_output><jupyter_text>kalau pakai fungsi tertentu, nilainya tidak ditimpa(inplace)<jupyter_code>pikiran = pikiran.replace("lapar", "ngantuk")
pikiran
def ngegas(x):
    return x.upper() + "!"
ngegas(pikiran)
pikiran<jupyter_output><empty_output><jupyter_text>List<jupyter_code>lokasi = ["meja","sofa","kursi","tv","dapur"]
lokasi
lokasi[0]
lokasi[-1]
lokasi.append("kasur")
lokasi
len(lokasi) #len adalah singkatan dari length<jupyter_output><empty_output><jupyter_text>Slicing<jupyter_code>lokasi[1:3]
lokasi[2:5]
lokasi[:4]
lokasi[1:]<jupyter_output><empty_output><jupyter_text>Dictionary<jupyter_code>preferensi = {"susu": "suka", "tikus": "suka", "lemon": "tidak suka"}
preferensi
preferensi["susu"]
preferensi["lemon"]
preferensi["jeruk"] = "tidak suka"
preferensi
preferensi.keys()<jupyter_output><empty_output><jupyter_text>Conditional<jupyter_code>wadah = "seperti kasur"
if wadah == "seperti kotak":
    print("masuk")

elif wadah == "seperti bak mandi":
    print("kabur")

else:
    print("abaikan")<jupyter_output>abaikan<jupyter_text>Iterasi<jupyter_code>jenis_kucing = ["angora","persia","siberia","mesir"]
jenis_kucing[0]
for jenis in jenis_kucing:
    print(jenis)
 for jenis in jenis_kucing:
    print(jenis.upper() + " adalah jenis kucing")
 for jenis in jenis_kucing:
    print(f"kucing {jenis.upper()} adalah jenis kucing")
f"{pikiran} adalah sebuah pikiran"<jupyter_output><empty_output><jupyter_text>Latihan: Kucing berhitung<jupyter_code>for i in range(3, 7):
    print(i)
for i in range(21):
    if i > 18:
        print(18)
    else:
        print(i)
for i in range(21):
    print(min(i,18))<jupyter_output>0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
18
18
{'fraction_non_alphanumeric': 0.14417924987822697, 'fraction_numerical': 0.025815879201169022, 'mean_word_length': 7.703389830508475, 'pattern_counts': {'":': 5, '<': 38, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '475760', 'license': 'MIT', 'n_tokens_mistral': 987, 'n_tokens_neox': 943, 'n_words': 148, 'path': '01 - Python Introduction/.ipynb_checkpoints/Part 2 - Python for cats-checkpoint.ipynb', 'repo_name': 'iwanevandersyema/supervised_learning', 'size': '2053'}