content stringlengths 7 1.05M |
|---|
def tail(filename, n=10):
'Return the last n lines of a file'
with open(filename) as f:
return deque(f, n)
|
render = ez.Node()
aspect2D = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -20
# Create a a model:
dirt = ez.load.texture('dirt.png')
mesh = ez.load.mesh('hex.bam')
model = ez.Model( mesh, parent=render)
model.shader = ez.load.shader('shaded.glsl')
model.set_shader_input('texture0', dirt)
# Our task functi... |
# Given: A positive integer n≤7.
#
# Return: The total number of permutations of length n, followed by a list of all such permutations (in any order).
def to_string(list):
return " ".join(list)
def permute(list, start, end):
if start == end:
print(to_string(list))
else:
for i in range(star... |
#
# PySNMP MIB module TIMETRA-CLEAR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-CLEAR-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:09:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
n, m = map(int, input().split())
array = [input() for _ in range(n)]
k = int(input())
for row in sorted(array, key=lambda row: int(row.split()[k])):
print(row)
|
class WordDictionary:
def __init__(self):
"""
Initialize your data structure here.
"""
self.endWord = False
self.children = [None] * 26
def addWord(self, word: str) -> None:
"""
Adds a word into the data structure.
"""
curr = sel... |
def count(char,word):
total=0
for any in word:
if any in char:
total = total + 1
return total
result = count('a','banana')
print(result)
|
class VariableEngine:
"""A simple package for handling variables in string."""
def __init__(self, prefix: str = None, suffix: str = None):
self.variables = {}
self.prefix = str(prefix) if prefix else '' #If prefix is none prefix defaults to ''
self.suffix = str(suffix) if suffix else s... |
class Solution:
def canBeTypedWords(self, text: str, brokenLetters: str) -> int:
result = 0
words = text.split(" ")
set_chars = set(brokenLetters)
for i in words:
set_word = set(i)
sub = set_word - set_chars
if len(set_word) == len(sub):
... |
#Decorator Pattern
def my_decorator(func):
def wrap_func(*args, **kwargs):
print("**********")
func(*args, **kwargs)
print("**********")
return wrap_func
@my_decorator
def hello(greeting,emoji, withLove="your love"):
print(greeting,emoji, withLove)
hello('yo yo', '<3') |
"""
Write a function to detect if a string is valid or not
"abc_123{}"
"{abc_123}"
"abc_{1}23"
"abc_123{()}()"
"abc_123{()}[()]&"
invalid
"}abc_123{"
"abc_123{"
"ab{[}]"
Raise exception which has the position at which the error occured.
"""
class RaiseException(Exception):
pass
def validate(text):
"""
... |
# Copyright (c) 2017-2018 CRS4
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribut... |
# Copyright 2018 Jetperch LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
class Solution:
def numJewelsInStones(self, J: str, S: str) -> int:
#map = {}
#for i in range(len(J)):
# map[J[i]] = 0
count = 0
for i in range(len(S)):
if str([S[i]][0]) in J: count +=1
return count
J = "aAB"
S = "aAAbbbb"
print(Solution().numJewelsI... |
n = int(input())
sum1 = 0
for i in range(1, n + 1):
if n % i == 0:
sum1 += i
print(sum1)
|
class Config:
SCHEME = "https"
HOST = SCHEME + "://mobile-api-gateway.truemoney.com"
DEVICE_OS = "android"
DEVICE_ID = "574e0139a8e4460dac351feac6157871"
DEVICE_TYPE = "Zenfone Max"
DEVICE_VERSION = "7.1.2"
APP_NAME = "wallet"
APP_VERSION = "4.18.0"
HEADERS = {
"User-Agent": "okhttp/3.9.0",
"Connection"... |
def MoveManyStepsForward(numberOfSteps):
for everySingleNumberInTheRange in range(numberOfSteps):
env.step(0)
async def main():
MoveManyStepsForward(50)
await sleep()
MoveManyStepsForward(150) |
def distanceK(self, root, target, K):
conn = collections.defaultdict(list)
def connect(parent, child):
if parent and child:
conn[parent.val].append(child.val)
conn[child.val].append(parent.val)
if child.left: connect(child, child.left)
if child.right: connect(chil... |
#!/usr/local/bin/python
# encoding: utf-8
"""
*Code elements for TBS htmlframework*
:Author:
David Young
:Date Created:
April 16, 2013
:dryx syntax:
- ``xxx`` = come back here and do some more work
- ``_someObject`` = a 'private' object that should only be changed for debugging
:Notes:
- If you ... |
entries = [
{
'env-title': 'atari-enduro',
'score': 0.0,
},
{
'env-title': 'atari-space-invaders',
'score': 656.91,
},
{
'env-title': 'atari-qbert',
'score': 6433.38,
},
{
'env-title': 'atari-seaquest',
'score': 1065.98,
},
... |
name = "fRoDo"
lowercase_name = name.lower()
uppercase_name = name.upper()
titlecase_name = name.title()
print(lowercase_name, uppercase_name, titlecase_name) |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 8 11:35:38 2019
@author: john
"""
def intcode(input_list, l):
l = [int(x) for x in l] # Convert list values to ints
end = False # set up a condition for the while
pointer = 0 # initialize the pointer to the first position
... |
# Limiar da Matriz Quadrada :: github.com/sliatecinos
# ================================================================================
# Ref.externa: https://www.facebook.com/groups/608492105999336/permalink/2061101090738423/
# Entradas do usuario (lado, limiar, ordem da matriz)
lado_diagonal = input('Estarao "... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Реализовать класс Bankomat, моделирующий работу банкомата. В классе должны
содержаться поля для хранения идентификационного номера банкомата, информации о
текущей сумме денег, оставшейся в банкомате, минимальной и максимальной суммах,
которые позволяется снять клиент... |
'''
priceIsRight = 15
if priceIsRight:
print("Price is too low!")
if priceIsRight:
print("Price is almost there!")
if priceIsRight:
print("Price is exactly that!")
if priceIsRight:
print("Price is too high!")
'''
priceIsRight = int(input("Enter your number: "))... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr1 , arr2 , m , n , x ) :
count , l , r = 0 , 0 , n - 1
while ( l < m and r >= 0 ) :
if ( ( arr1 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class QuickSort:
"""
快速排序
"""
def __init__(self):
pass
def quicksort(self, nums):
if len(nums) == 1 or len(nums) == 0:
return nums
less = []
greater = []
middle_num = nums.pop()
for num i... |
# coding: utf-8
# BlackSmith general configuration file
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Jabber server to connect
SERVER = 'example.com'
# Connecting Port
PORT = 5222
# Jabber server`s connecting Host
HOST = 'example.com'
# Using TLS (True - to enable, False - to disable)
SECURE ... |
# -----------------------------------------------------------------------------
# This piece of work is inspired by Pollere' VerSec:
# https://github.com/pollere/DCT
# But this code is implemented independently without using any line of the
# original one, and released under Apache License.
#
# Copyright (C) 2019-2022 ... |
#!/usr/bin/env python
# -*- coding: utf-8; -*-
# Copyright (c) 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
DEFAULT_OCI_CONFIG_FILE = "~/.oci/config"
DEFAULT_PROFILE = "DEFAULT"
DEFAULT_CONDA_PACK_FOLDER = "~/conda"
CONDA_P... |
"""
File: boggle.py
Name:
----------------------------------------
TODO:
"""
# This is the file name of the dictionary txt file
# we will be checking if a word exists by searching through it
FILE = 'dictionary.txt'
dict_list = []
final = []
def main():
"""
TODO:
"""
read_dictionary()
temp = ''
word_lst = []
for... |
INPUT = ">^^v^<>v<<<v<v^>>v^^^<v<>^^><^<<^vv>>>^<<^>><vv<<v^<^^><>>><>v<><>^^<^^^<><>>vv>vv>v<<^>v<>^>v<v^<>v>><>^v<<<<v^vv^><v>v^>>>vv>v^^^<^^<>>v<^^v<>^<vv^^<^><<>^>><^<>>><><vv><>v<<<><><>v><<>^^^^v>>^>^<v<<vv^^<v<^<^>^^v^^^^^v<><^v><<><^v^>v<<>^<>^^v^<>v<v^>v>^^<vv^v><^<>^v<><^><v^><><><<<<>^vv^>^vvvvv><><^<vv^v^v>... |
def timer(start: float, end: float) -> str:
"""
Timer function. Compute execution time from strart to end (end - start).
:param start: start time
:param end: end time
:return: end - start
"""
hours, rem = divmod(end - start, 3600)
minutes, seconds = divmod(rem, 60)
return "{:0>2}:{:0... |
#
# PySNMP MIB module CISCO-IMAGE-UPGRADE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IMAGE-UPGRADE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:01:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
#!/opt/local/bin/python
sum_3_5 = 0
for i in range(1,1000):
if i % 3 == 0 or i % 5 == 0:
print(i)
sum_3_5 += i
print(sum_3_5)
|
class Animal(object):
def __init__(self, name):
self.name = name
def eat(self, food):
print("%s is eating %s" % (self.name, food))
class Dog(Animal):
def fetch(self, thing):
print("%s goes after the %s" % (self.name, thing))
class Cat(Animal):
def swatstring(self):
pri... |
__version__ = '0.0.1'
__url__ = 'http://github.com/blazaid/pycodes/'
__author__ = 'blazaid'
def check_ean13():
pass |
class Parser:
"""The Parser is the class that handles the player's input. The player
writes commands, and the parser performs natural language understanding
in order to interpret what the player intended, and how that intent
is reflected in the simulated world.
"""
def __init__(self, game):
... |
# Tablica T jest długości n, ale zawiera tylko ceil(logn) różnych wartości. Proszę zaproponować
# jak najszybszy algorytm sortujący taką tablicę.
def counting_sort(T, k):
C = [0]*len(T)
B = [0]*10
for i in range(len(T)):
index = T[i]/k
B[int(index % 10)] += 1
for i in range(1, 10):
... |
# List of the training runs for the different target dataset sizes
TRAINING_RUNS = [
'large_dataset/20200616_090434',
'medium_dataset/20200616_214425',
'small_dataset/20200617_143139'
]
|
def func(max):
res = []
for i in range(1, max):
# 对15取余为0 输出fizzbuzz
if i % 15 == 0:
res.append('fizzbuzz')
# 对3取余为0,输出fizz
elif i % 3 == 0:
res.append('fizz')
# 对5取余为0,输出为buzz
elif i % 5 == 0:
res.append('buzz')
# 不符合以上... |
# -*- coding: UTF-8 -*-
# https://dormousehole.readthedocs.io/en/latest/config.html#config
class Config(object):
SECRET_KEY = 'e9d37baf44de4b11a76159c50820468f'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://xingweidong:xingweidong&123@localhost/idss_stock' # 股票数据库,默认
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... |
MONTHS_MAPS = {"janvier" : '01',
"février": '02',
"fevrier": '02',
"mars": '03',
"avril": '04',
"mai": '05',
"juin": '06',
"juillet": '07',
"août": '08',
"aout": '08',
... |
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# print("{:~^45}".format(" Simple while loop "))
# i = 1
# while i<=5 :
# print(i)
# i += 1
# print("\n{:~^45}".format(" Example: sum all numbers in [1..100] "))
# i = 1
# sum = 0
# while i <= 100:
# sum += i
# i += 1
# print("sum = ", sum)
# print("\n{:~^45}".format(" Task: sum even numbers in [1..100] "))
# i ... |
aqiRanges = (0, 50, 100, 150, 200, 300, 500)
aqiDescriptions = ("Good", "Moderate", "Unhealthy for Sensitive Groups",
"Unhealthy", "Very Unhealthy", "Hazardous")
aqiDescription = ""
pm25ranges = (0, 12, 35.4, 55.4, 150.4, 250.4, 500.4)
pm10ranges = (0, 54, 154, 254, 354, 424, 604)
no2ranges = (0, ... |
def test_evens():
yield check_even_cls
class Test(object):
def test_evens(self):
yield check_even_cls
class Check(object):
def __call__(self):
pass
check_even_cls = Check()
|
local = {}
incluir = True
while incluir:
nome = input('qual seu nome? :')
local_escolhido = input('Qual local de suas próximas férias? :')
local[nome] = local_escolhido
repetir = input('Gostaria de incluir outro na enquete?(Yes/No):')
if repetir == 'no':
incluir = False
print('Resultados d... |
def sommig(n):
result = 0
while(n>=1):
result += n
n-=1
return result
print(sommig(3))
print(sommig(8))
print(sommig(17))
print(sommig(33)) |
class Job(object):
def __init__(self, server_host, job_id, train_strategy, train_model, train_model_class_name, aggregate_strategy,
distillation_alpha=None):
self.server_host = server_host
self.job_id = job_id
self.train_strategy = train_strategy
self.train_model = ... |
numero = int(input('Número: '))
dobro = numero*2
triplo = numero*3
raiz = numero**(1/2)
print(f'Dobro: {dobro}, Triplo: {triplo}, Raiz quadrada: {raiz:.2f}')
|
def foo(bar1, bar2, bar3,
bar4
): # FD102
return
|
class Page(object):
'''
页面基类,用于所有页面的继承
初始化,地址,驱动,超时时间
打开网页方法
查找单个元素方法
查找多个元素方法
页面打开检查
调用JavaScript代码
'''
bbs_url='https://mail.qq.com'
def __init__(self,selenium_driver,base_url=bbs_url,parent=None):
self.base_url=base_url
self.timeout=30
self.dr... |
class Solution:
def canPermutePalindrome(self, s: str) -> bool:
wordset = set()
for c in s:
if c in wordset:
wordset.remove(c)
else:
wordset.add(c)
return len(wordset)<=1
A = Solution()
s = "aab"
print(A.canPermutePalindrome(s)) |
"""
Constants used by the Data Structure Generator (DSG)
and the Spec Executor
"""
# MAGIC Numbers:
# Data spec magic number
DSG_MAGIC_NUM = 0x5B7CA17E
# Application data magic number
APPDATA_MAGIC_NUM = 0xAD130AD6
# Version of the file produced by the DSE
DSE_VERSION = 0x00010000
# DSG Arrays and tables sizes:
MAX... |
def get_sea_monster():
sea_monster = [
" # ",
"# ## ## ###",
" # # # # # # ",
]
return sea_monster, len(sea_monster), len(sea_monster[0])
def mark_sea_monsters_at_coord(grid, x, y):
sm, sm_y, sm_x = get_sea_monster()
for yval in range(y, y + sm_y):
for xval ... |
''' Esta função conta o número de ocorrências de cada palavra em uma frase '''
def count_words(sentence):
for s in ".:!&@$%^&": sentence=sentence.replace(s,'')
for s in "\n\r\t,_": sentence=sentence.replace(s,' ')
counts={}
for word in sentence.lower().split():
word = word.strip('\'')
... |
def check_if_multiple(test_num,list_of_multiples):
for i in list_of_multiples:
if not i:
continue
if not test_num%i:
return test_num
return 0
def sum_of_multiples(number, multiples_list = None):
multiples_list = multiples_list or [3,5]
#implicitly check if None is passed to the function
return sum(l... |
def algorithm_name(id, config):
algorithm = config['experiment.simple']['algorithm'].rsplit('.', 1)[1]
# env = config['experiment.simple']['environment'].rsplit('.', 1)[1]
tr_radius = get_setting(config, 'algorithm.subdomainbo', 'tr_radius')
beta = get_setting(config, 'model', 'beta')
tr_method = ge... |
'''This module contains the output formatters for pyPaSWAS'''
class DefaultFormatter(object):
'''This is the default formatter for pyPasWas.
All available formatters inherit from this formatter.
The results are parsed into a temporary file, which can be used by the main
program for permanen... |
x:int = 1
o:object = None
x = o = 42
|
m = int(input())
m = m % 1440
a = m // 60
b = m % 60
print(a, b)
|
# by Kami Bigdely
# Remove control flag
# Reference: https://stackoverflow.com/a/10140333/81306
# This code snippet reads up to the end of the file
n = 16
file = 'foobar.file'
def readfile(file, n):
with open(file, 'rb') as fp:
chunk = fp.read(n)
if chunk == '': # end of file, stop running.
... |
class Solution:
def minDeletionSize(self, A: List[str]) -> int:
res = 0
for col_str in zip(*A):
if list(col_str) != sorted(col_str):
res += 1
return res
|
_base_ = [
'../_base_/models/simmim_swin-base.py',
'../_base_/datasets/imagenet_simmim.py',
'../_base_/schedules/adamw_coslr-200e_in1k.py',
'../_base_/default_runtime.py',
]
# data
data = dict(samples_per_gpu=128)
# optimizer
optimizer = dict(
lr=2e-4 * 2048 / 512,
betas=(0.9, 0.999),
eps=... |
height = int(input())
for i in range(1,height+1):
for j in range(1, height+1):
if(i == height//2 or i == height or j == 1 or j == height and i >= height//2 or (j%2==1 and i<= height//2)):
print("*",end=" ")
else:
print(end=" ")
print()
# Sample Input :- 7
#... |
"""
We *could* implement our own Vulkan backend, so we would not need the wgpu lib.
It would be a lot of work to build and maintain though, so unless the
Rust wgpu project is abandoned or something, this is probably a bad idea.
"""
raise NotImplementedError()
|
# Copyright (c) 2015-2020 Avere Systems, Inc. All Rights Reserved.
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
__version__ = "0.5.4.3"
__version_info__ = (0, 5, 4, 3)
|
house = [ ['hallway', 14.35],
['kitchen', 15.0],
['living room', 19.0],
['bedroom', 12.5],
['bathroom', 8.75] ]
# Code the for loop
for x in house:
print(str(x[0]) + ' area is ' + str(x[1]) + 'm')
|
lst = []
num = int(input("Input the number of items: "))
for n in range(num):
# Arguments for Ordinal Numbers in a Set
ord = str(n+1)
if n == 0:
ord += "st"
elif n == 1:
ord += "nd"
elif n == 2:
ord += "rd"
else:
ord += "th"
numbers = int(input("Enter the "+ o... |
# Author: Konrad Lindenbach <klindenb@ualberta.ca>,
# Emmanuel Odeke <odeke@ualberta.ca>
# Copyright (c) 2014
# Table name strings
MESSAGE_TABLE_KEY = "Message"
RECEIPIENT_TABLE_KEY = "Receipient"
MESSAGE_MARKER_TABLE_KEY = "MessageMarker"
MAX_NAME_LENGTH = 60 # Arbitrary value
MAX_BODY_LENGTH = 200 # Arbitr... |
# 2.5 정리
# 이번 장에서는 자연어를 대상으로,
# 특히 컴퓨터에게 '단어의 의미'를 이해하기 위한 주제로 진행함
# 시소러스 기법
'''
단어들의 관련성을 사람이 수작업으로 하나씩 정의한다.
이 작업은 매우 힘들고 (느낌의 미세한 차이를 나타낼 수 없다 등) 표현력에도 한계가 있다.
'''
# 통계 기반 기법
'''
말뭉치로부터 단어의 의미를 자동으로 추출하고, 그 의미를 벡터로 표현한다.
구체적으로
1. 단어의 동시발생 행렬을 만든다.
2. PPMI 행렬로 변환한다.
3. 안정... |
"""
Each dataset has bug report ids and the ids of duplicate bug reports.
"""
class BugDataset(object):
def __init__(self, file):
f = open(file, 'r')
self.info = f.readline().strip()
self.bugIds = [id for id in f.readline().strip().split()]
self.duplicateIds = [id for id in f.readl... |
CFG = {
"spatial_input": 2,
"spatial_output": 2,
"temporal_input": 8,
"temporal_output": 12,
"bins": [0, 0.01, 0.1, 1.2],
"noise_weight": [0.05, 1, 4, 8],
"noise_weight_eth": [0.175, 1.5, 4, 8],
}
|
#!/usr/bin/env python3
def main():
lb_size = int(input())
spectrum = list(map(int, input().split()))
result = sequence_peptide(spectrum, lb_size)
print('-'.join(list(map(str, result))))
AMINO_MASSES = [57, 71, 87, 97, 99, 101, 103, 113, 114, 115, 128, 129, 131, 137, 147, 156, 163, 186]
def _attach... |
def fullName(first_name, last_name):
return f'Your first name is {first_name} and last name is {last_name}'
print(fullName(first_name = 'Qaidjohar', last_name = 'Jawadwala'))
# name = fullName('Qaidjohar','Jawadwala')
# print(name) |
iN = int(input())
a_list = list(map(int, input().split()))
multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])
even_num = len(a_list) - odd_num
not4 = even_num - multi4
if not4 >0 :
if odd_num <= multi4:
print("Yes")
else:
print("No")
else:
if... |
## 连接
multiLineStr = 'hell' + \
'o, w' + \
'orld'
print(multiLineStr)
# 会输出 hello, world
## 条件分支
### 条件控制
furry = True
small = True
if furry:
if small:
print(" It' s a cat.")
else:
print(" It' s a bear!")
else:
if small:
print(" It' s a skink!")
else:
print(" It'... |
# Time complexity: O(n^3 log n + klogk)
# Space complexity: O(k)
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
nums.sort()
res = []
length = len(nums)
for i in range(0, length - 3):
if i != 0 and nums[i] == nums[i - 1]:
... |
class GKRect(object):
"""
GKRect is a lightweight rectangle object that is used in many places in Sketch.
It has many of the same methods as MSRect but they cannot always be used
interchangeably
"""
def __init__(self, x, y, width, height):
self._x = x
self._y = y
self._wi... |
class Problem2:
def __init__(self, campoints=None, campoints_true = None, robposes=None):
self._campoints = campoints
self._robposes = robposes
self._campoints_true = campoints_true
@property
def campoints(self):
return self._campoints
@campoints.setter
def campoint... |
class Author:
enable = True
name = "Someone"
description = (
"台灣/台北/高雄人。現暫居美國,於伊利諾香檳大學(UIUC)就讀資管碩士。近年內的工作與興趣都是軟體工程。"
)
image_url = "https://storage.googleapis.com/blog-someone-tw-static/post/author.png"
url = "/post/1/about"
class Facebook:
enable = True
app_id = "3441995197806... |
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'conditions': [
['OS!="win"', {
'variables': {
'config_h_dir':
'.', # crafted for gcc/linux.
},
}, { # else, ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""gitogether
Scripts:
+ :mod:`.__main__` - argparse entry point
Module:
"""
__version__ = (0, 0, 0)
|
# https://leetcode.com/problems/binary-tree-preorder-traversal
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def preorderTraversal(self, root: Optional[T... |
class Solution:
def get_num(self, s, start):
index = start
while index < len(s) and s[index].isdigit():
index += 1
return int(s[start:index]), index
def calculate_helper(self, s, start):
result, sign, index = 0, 1, start
operator = ['+', '-']
while ... |
text = "zeub"
hexa = ""
for i in text:
hexa += str(hex(ord(i)))[2:].zfill(4)
print(hexa)
hexa = "002B00330033003600380039003000300034003000300030" #YOLOO
hexa = [hexa[i:i+4] for i in range(0, len(hexa), 4)]
text=""
for i in hexa:
text+=chr(int(i, 16))
print(text) |
class Node:
def __init__(self, value: int) -> None:
self.value = value
self.left = None
self.right = None
class BinarySearchTree:
def __init__(self) -> None:
self.root = None
def insert(self, value: int) -> bool:
new_node = Node(value)
if self.root ... |
class ArrayStack:
def __init__(self):
self.data = []
def isEmpty(self):
return len(self.data) == 0
def push(self, val):
return self.data.append(val)
def pop(self):
if self.isEmpty():
raise Empty("Stack underflow!")
return self.data.pop()
def ... |
# 자작 문제풀이
# Question number. 003
# Author: Lee Jeongwoo
# Github name: zao95
# ========== Question ==========
# python-packer를 이용하여 실행파일 제작
# ==============================
def abc():
print("a")
abc()
print(hex(id(abc())))
print(hex(id("abc"))) |
# pylint: skip-file
'''
Contains banner for the application.
'''
class COLORS:
RED = '\033[91m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
LINK = '\033[94m'
PURPLE = '\033[95m'
CYAN = '\033[96m'
PRIMARY = '\033[97m'
SECONDARY = '\033[90m'
END = '\033[0m'
PINK = '\033[95m'
banner ... |
#
# 771. Jewels and Stone
#
# You're given strings J representing the types of stones that are jewels, and
# S representing the stones you have.
#
# Each character in S is a type of stone you have. You want to know how many of
# the stones you have are also jewels.
#
# The letters in J are guaranteed distinct, and all ... |
#!/usr/bin/env python3
"""
Consider a list (list = []). You can perform the following commands:
insert i e: Insert integer e at position i.
print: Print the list.
remove e: Delete the first occurrence of integer e.
append e: Insert integer e at the end of the list.
sort: Sort the list.
pop: Pop the last element from ... |
arr = []
b = False
with open("input","r") as f:
for i in f.readlines():
arr = arr + [int(i.rstrip("\n"))]
length = len(arr)
for i in range(0,length):
for j in range(0,length):
for k in range(0,length):
if (arr[i]+arr[j]+arr[k] == 2020):
print("Result = ", arr... |
def func():
pass
return
#file length check
if __name__ == '__main__':
try:
f = open('./testfile.txt', 'r') #1.file read -> open('')
length = len(f.read()) #2.length 설정
f.close() #... |
def classify(number):
return _classify(number) if number != 1 else 'deficient'
def _classify(number) -> str:
classif: str
aliquot: int = _aliquot(number)
if aliquot > number:
classif = 'abundant'
elif aliquot < number:
classif = 'deficient'
else:
classif = 'perfect'
... |
def f(a):
a += 2
return a
b = 1
b = f(b)
print(b)
|
"""
Simple yeetroot example
"""
def yeetRoot():
num = int( input( "which number would you like the square root of? "))
# return print( "the square root of {} is: {:.5f}".format( num, num**.5) )
return num**.5 |
db = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv"
# database file downloaded from
# https://www.weather.gov/source/gis/Shapefiles/County/c_03mr20.zip
# to get the lat and long values for US counties
dbf = "./c_03mr20.dbf"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.