<jupyter_start><jupyter_text>Intro to Python<jupyter_code>a = 200
b = 33<jupyter_output><empty_output><jupyter_text>Kondisional<jupyter_code>if b > a:
  print("b lebih besar daripada a")
elif a == b:
  print("a dan b bernilai sama")
else:
  print("a lebih besar daripada b")
if a > b and b == 33:
  print("b lebih besar daripada a")
if b > a: print("B")
print("A") if a > b else print("B")
print("A") if a > b else print("=") if a == b else print("B")
if a > b and b == 33:
  pass<jupyter_output><empty_output><jupyter_text>Perulangan<jupyter_code>asprak = ["Fahmi", "Bonbon"]
for x in asprak:
    print(x)
nama_saya = "Fahmi"
for x in nama_saya:
    print(x)
for x in range(6):
    print(x)

for x in range(2, 6):
    print(x)

for x in range(2, 30, 3):
    print(x)
asprak = ["Fahmi", "Bonbon", "Bana", "Awah"]
for x in asprak:
    if asprak == "Bonbon":
      continue;
    if asprak == "Bana":
      break;
      
    print(x)
i = 1
while i < 6:
  print(i)
  i += 1<jupyter_output><empty_output><jupyter_text>List, Set, dan TupleList<jupyter_code>asprak = {"Fahmi", "Bonbon", "Bana", "Awah"}
print(asprak)
asprak = ["Fahmi", "Bonbon", "Bana", "Awah", "Sandy"]
print(asprak)
print(asprak[1])      # Bonbon
print(asprak[-1])     # Sandy
print(asprak[1:3])    # ['Bonbon', 'Bana']
print(asprak[:2])     # ['Fahmi', 'Bonbon']
print(asprak[3:])     # ['Awah', 'Sandy']
print(asprak[-2:-1])  # ['Awah']
print(asprak[0:5:2])  # ['Fahmi', 'Bana', 'Sandy']
if "Awah" in asprak:
    print("Ada")
else:
    print("Tidak ada")
print(len(asprak))
asprak.append("Irvan")
print(asprak)
asprak.remove("Bana")
print(asprak)
asprak.clear()
print(asprak)<jupyter_output><empty_output><jupyter_text>Dictionary<jupyter_code>asprak_algo = {
    "nama": "<NAME>",
    "kelas": "D",
    "npm": "065118116"
}
print(asprak_algo)
print(asprak_algo["nama"])
asprak_algo["kelas"] = "C"
print(asprak_algo)
for x in asprak_algo:
  print(x)

for x in asprak_algo:
    print(asprak_algo[x])

for x in asprak_algo.values():
  print(x)

for key, value in asprak_algo.items():
  print(key, value)
if "nama" in asprak_algo:
    print("Ada")
asprak_algo["alamat"] = "Bogor"
print(asprak_algo)

asprak_algo.pop("kelas")
print(asprak_algo)<jupyter_output><empty_output><jupyter_text>Fungsi dan Lambda ExpressionFungsi<jupyter_code>def fungsiku():
  print("Hello World")
fungsiku()
def nama(depan, belakang="Fiqri"):
  print(depan, belakang)
nama("Fahmi")
nama("Fahmi", "Noor")
nama(depan="Fahmi", belakang="Noor")
def tambah(a, b):
  return a + b
print(tambah(20, 1))
x = lambda a : a + 10
print(x(5))
x = lambda a, b : a * b
print(x(5, 6))<jupyter_output><empty_output><jupyter_text>String Formatting<jupyter_code>a = 173.4566
b = "Fahmi"
print("Nama saya %s, tinggi badan %.2f" % (b, a))<jupyter_output><empty_output><jupyter_text>File<jupyter_code>with open('tes.txt', 'w') as f:
    nama = "Fahmi"
    f.write("Nama saya %s" % (nama))
with open('tes.txt', 'r') as f:
    print(f.read())
with open('tes.txt', 'r') as f:
    lines = f.readlines()
    print(lines)
with open('tes.txt', 'r') as f:
    for line in f:
        print(line)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18498402555910542, 'fraction_numerical': 0.01757188498402556, 'mean_word_length': 4.8964218455743875, 'pattern_counts': {'":': 5, '<': 35, '<?xml version=': 0, '>': 40, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '595376', 'license': 'MIT', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1384, 'n_words': 301, 'path': 'jupyter/python-fundamentals.ipynb', 'repo_name': 'fahminlb33/buku-ml-python', 'size': '3140'}