Skip to content

Instantly share code, notes, and snippets.

@s1s1ty
s1s1ty / dict_map.py
Created August 24, 2018 05:55
30-days-python-code
if __name__ == '__main__':
n = int(input())
d = {}
for i in range(n):
k, v = input().split()
d[k] = v
for i in range(n):
k = input()
if d.get(k, False):
@s1s1ty
s1s1ty / array.py
Created August 24, 2018 05:41
30-days-python-code
#!/bin/python3
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().rstrip().split()))
print(*arr[::-1])
@s1s1ty
s1s1ty / review.py
Created August 23, 2018 18:07
30-days-python-code
n = int(input())
while n >= 0:
s = input()
o, e = '', ''
for i in range(len(s)):
if i & 1:
o += s[i]
else:
e += s[i]
@s1s1ty
s1s1ty / loop.py
Created August 23, 2018 17:51
30-days-python-code
#!/bin/python3
import math
import os
import random
import re
import sys
def namta(n, i):
if i < 11:
@s1s1ty
s1s1ty / class_instance.py
Created August 23, 2018 17:44
30-days-of-code
class Person:
def __init__(self,initialAge):
if initialAge <= 0:
print('Age is not valid, setting age to 0.')
initialAge = 0
self.initialAge = initialAge
def amIOld(self):
if self.initialAge < 13:
print("You are young.")
@s1s1ty
s1s1ty / conditional_operator.py
Created August 23, 2018 17:22
30-days-python-code
#!/bin/python3
import math
import os
import random
import re
import sys
if __name__ == '__main__':
N = int(input())
@s1s1ty
s1s1ty / operators.py
Created August 23, 2018 17:13
30-days-python-code
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the solve function below.
def solve(meal_cost, tip_percent, tax_percent):
@s1s1ty
s1s1ty / hello.py
Created August 23, 2018 16:17
30-days-of-python-code
# Read a full line of input from stdin and save it to our dynamically typed variable, input_string.
input_string = input()
# Print a string literal saying "Hello, World." to stdout.
print('Hello, World.')
print(input_string)
# TODO: Write a line of code here that prints the contents of input_string to stdout.
@s1s1ty
s1s1ty / driver.go
Created July 31, 2018 07:30
driver-go-mysql-crud
package driver
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
// DB ...
@s1s1ty
s1s1ty / handler.go
Last active August 3, 2018 12:04
handler go mysql crud
package handler
import (
"encoding/json"
"fmt"
"net/http"
"strconv"
"github.com/go-chi/chi"
"github.com/s1s1ty/go-mysql-crud/driver"