<jupyter_start><jupyter_text>1. Looping   while loop<jupyter_code>error = 50.0
while error > 1 :
    error = error / 4
    print(error)<jupyter_output>12.5
3.125
0.78125<jupyter_text>For loop<jupyter_code>random_string = ['data','science','indonesia','chapter','bandung']
print(random_string)<jupyter_output>['data', 'science', 'indonesia', 'chapter', 'bandung']<jupyter_text>loop for each<jupyter_code>for word in random_string:
    print(word)<jupyter_output>data
science
indonesia
chapter
bandung<jupyter_text>loop for by index<jupyter_code>for i in range(len(random_string)):
    print i,' : ',random_string[i]<jupyter_output>0  :  data
1  :  science
2  :  indonesia
3  :  chapter
4  :  bandung<jupyter_text>enumerate for loop<jupyter_code>for index, tinggi in enumerate(keluarga):
    print("Index " + str(index) + ": " + str(tinggi))<jupyter_output>Index 0: 1.73
Index 1: 1.68
Index 2: 1.71
Index 3: 1.89<jupyter_text>2. Conditional<jupyter_code>z = 4
if z % 2 == 0 :
    print("z adalah genap")
z = 5
if z % 2 == 0 :
    print("z adalah genap")
else :
    print("z adalah ganjil")
z = 3
if z % 2 == 0:
    print("z habis dibagi 2")
elif z % 3 == 0:
    print("z habis dibagi 3")
else :
    print("z tidak habis dibagi 2 maupun 3")
if 'data' in random_string: 
    print 'data found'
else : 
    print 'data not found'<jupyter_output>data found<jupyter_text>3.Function format<jupyter_code># def functionname( parameters ):
#    "function_docstring"
#    function_suite
#    return [expression]
def personal_info(name,age,gender):
    print 'name : ',name
    print 'age : ',age
    print 'gender : ',gender
personal_info(name='adam',age=23,gender='M')
def personal_info(name,age,gender):
    output = {} 
    output['name']=name
    output['age']=age
    output['gender']=gender
    return output
info = personal_info(name='adam',age=23,gender='M')
info<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14187400741132875, 'fraction_numerical': 0.03229221810481736, 'mean_word_length': 4.815384615384615, 'pattern_counts': {'":': 1, '<': 23, '<?xml version=': 0, '>': 24, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '601728', 'license': 'MIT', 'n_tokens_mistral': 778, 'n_tokens_neox': 723, 'n_words': 161, 'path': 'mfm bandung material/1-3. Loop , conditional, function.ipynb', 'repo_name': 'adamaulia/data-science-with-python', 'size': '1889'}