This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gunakan saat pytest error | |
pytest --capture=sys | |
# gunakan saat pytest success | |
pytest -s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rm -r --cached . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def selection_sort(mylist): | |
# i indicates how many items were sorted | |
for i in range(len(mylist)-1): | |
# To find the minimum value of the unsorted segment | |
# we first assume that the first element is the lowest | |
min_index = i | |
# We then use j to loop through the remaining elements | |
dex = 0 | |
for j in range(i+1, len(mylist)): | |
if mylist[j] < mylist[min_index]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//...dengan menggunakan step akan menghasilkan kelipatan 10 | |
//...yang dimulai dari 0 dan diakhiri di nilai 100 | |
//...array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100) | |
foreach (range(0, 100, 10) as $number) { | |
echo $number; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//...array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) | |
foreach (range(0, 12) as $number) { | |
echo $number; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//...kosongkan parameter password bila tidak ada password | |
$conn = mysql_connect("localhost", "root", ""); | |
//...bila koneksi gagal | |
if(!$conn) { | |
die("koneksi gagal, periksa lagi parameter."); | |
} | |
//...mysql_error() untuk menampilkan pesan error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//...kosongkan parameter password bila tidak ada password | |
$conn = mysql_connect("localhost", "root", ""); | |
//...bila koneksi gagal | |
if(!$conn) { | |
die("koneksi gagal, periksa lagi parameter."); | |
} else { | |
echo "koneksi berhasil."; | |
} |
NewerOlder