Skip to content

Instantly share code, notes, and snippets.

View wmprawiro's full-sized avatar
:shipit:
I may be slow to respond.

Wagyu wmprawiro

:shipit:
I may be slow to respond.
View GitHub Profile
from os import system
data_bansos = {
"123123" : {
"Nama Lengkap" : "Ali",
"Alamat" : "Kudus",
"Pekerjaan" : "Guru",
"Gaji" : "2000000",
"Anggota Keluarga" : "3"
},
#include <iostream>
#include <string.h>
using namespace std;
struct Node {
char nama[30];
Node *next;
};
Node *head = NULL, *tail = NULL;
#include <iostream>
#include <string.h>
using namespace std;
struct Node {
char nama[30];
Node *next;
};
Node *head = NULL, *tail = NULL;
class Kontak(object):
def __init__(self, nama, nomor):
self.nama = nama
self.nomor = nomor
from pustaka import *
kontak = []
def main():
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
@wmprawiro
wmprawiro / selectionSort.py
Created April 8, 2021 14:32
ascending & descending selection sort
# ascending (data terurut menaik)
def selectionSort(mylist):
for i in range(len(mylist)-1, 0, -1):
max = 0
for j in range(1, 1+1):
if mylist[j] > mylist[max]:
max = j
temp = mylist[i]
mylist[i] = mylist[max]
mylist[max] = temp
@wmprawiro
wmprawiro / bubbleSort.py
Created April 8, 2021 14:21
sorting dengan bubble sort
# ascending (data terurut menaik)
def bubbleSort(mylist):
for i in range(len(mylist)-1, 0, -1):
for j in range(i):
if mylist[j] > mylist[i]:
temp = mylist[j]
mylist[j] = mylist[j+1]
mylist[j+1] = temp
@wmprawiro
wmprawiro / kontak.py
Created April 8, 2021 14:02
program kontak sederhana menggunakan python
# Program Kontak
# List Kontak
namaKontak = ['Naufal', 'Hazim']
noTelepon = ['08123456789', '08987654321']
def daftarKontak(): # fungsi untuk menampilkan kontak yang tersimpan di list kontak
print('Daftar Kontak:')
for i in range(len(namaKontak)):
print('Nama: {}'.format(namaKontak[i]))
@wmprawiro
wmprawiro / descending.py
Created April 8, 2021 13:48
data descending (data terurut menurun)
def insertionSrt(data):
for x in range(1, len(data)):
isi = data[x]
pos = x
while pos > 0 and data[pos-1] < isi:
data[pos] = data[pos-1]
pos = pos-1
data[pos] = isi