content stringlengths 7 1.05M |
|---|
class Solution:
def combinationSum(self, candidates, target):
# candidates.sort()
# dp = [[[]]] + [[] for i in range(target)]
# for i in range(1, target + 1):
# for number in candidates:
# if number > i:
# break
# for ... |
# OpenWeatherMap API Key
api_key_owm= "b80fd2ed7964ad60c921362b393b0613"
# Google API Key
api_key_g = "YOUR KEY HERE!"
|
n = int(input("입력 횟수: "))
for i in range(n):
temp = int(input("값: "))
if temp > n:
n = temp
print("최댓값:", n)
|
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def plusOne(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
def reverse(cur):
... |
# demonstrate template string functions
def main():
# Usual string formatting with format()
str1 = "You're watching {0} by {1}".format("Advanced Python", "Joe Marini")
print(str1)
# TODO: create a template with placeholders
# TODO: use the substitute method with keyword arguments
... |
def test_devices(spotify_user_auth):
assert spotify_user_auth.devices()
def test_recently_played_tracks(spotify_user_auth):
assert spotify_user_auth.recently_played_tracks()
def test_play_album(spotify_user_auth, reise_reise_album_id):
assert spotify_user_auth.play(album_id=reise_reise_album_id) is not ... |
# O(log n)
def binary_search(items, item):
bottom = 0
top = len(items) - 1
while bottom <= top:
middle = int((bottom + top) / 2)
guess = items[middle]
if guess == item:
return middle
if guess > item:
top = middle - 1
else:
... |
class Solution:
# One Liner (Accepted + Top Voted), O(n) time and space
def getConcatenation(self, nums: List[int]) -> List[int]:
return nums + nums
# Extend (Sample), O(n) time and space
def getConcatenation(self, nums: List[int]) -> List[int]:
ans = nums
ans.extend(nums)
... |
def challenge_to_string(scheme, params):
s = scheme
for name, value in params.items():
s += ' {}="{}"'.format(name, value.replace('\\', '\\\\').replace('"', '\\"'))
return s
class WWWAuthenticateMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
re... |
URL_HOST_FILES = [
# "https://adaway.org/hosts.txt",
"http://winhelp2002.mvps.org/hosts.txt",
"http://hosts-file.net/ad_servers.txt",
"http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext",
"http://someonewhocares.org/hosts/hosts",
]
|
songs = ["Like a Rolling Stone", "Satisfaction", "Imagine", "What's Going On", "Respect", "Good Vibrations"]
playcounts = [78, 29, 44, 21, 89, 5]
plays = {key:value for key, value in zip(songs, playcounts)}
print(plays)
plays["Purple Haze"] = 1
plays["Respect"] = 94
library = {"The Best Songs": plays, "Sunday Feelin... |
#count the no. of same string and print for ex wwwwrrrig will be w4r3ig
def countnsay(s):
n = len(s)
say = ""
cur = ""
count = 1
for i in range(n-1):
curr = s[i]
nxt = s[i+1]
if curr == nxt:
count +=1
elif(count>1):
cur+=curr
say+=(... |
# Index of practices
'''
Part I - List
1) Create a empty list
2) Append to list
2.1) One bye One
2.2) By '*'
2.3) By extend()
2.4) By for
3) Joint 2 lists
4) Lenth a list
5) Pick out from list
5.1) Pick 1 ( By [index] )
5.2) Pick by for
5.3) If exist ( By 'in')
6) Delete in list
6.1) D... |
"""
2309 : 일곱 난쟁이
URL : https://www.acmicpc.net/problem/2309
Input :
20
7
23
19
10
15
25
8
13
Output :
7
8
10
13
19
20
23
"""
heights = [int(input()) for _ in range(9)]
height... |
N = int(input())
M = []
for i in range(N):
x, y = [int(x) for x in input().split()]
M.append([x, y])
areatotal = 0
for i in range(N):
if i != 0:
for j in range(i, -1, -1):
if M[i][0] > M[j][0]:
menorx = M[j][0]
if M[i][1] > M[j][1]:
menory = M[... |
"""Variables globales de la clase PyTikZ"""
def init():
global ruta_raiz
global ruta_imagen
global carpetas_necesarias
ruta_raiz = ""
ruta_imagen = ""
#"imagen" -> Todas las carpetas en "imagen", son las que se encuentra en "C:\Users\juanf\Pictures" (Window) o "sdcard/dcim" (Android).
carpet... |
def distance(s1, s2):
d = 0
l1 = list(s1)
l2 = list(s2)
for i in range(len(l1)):
if l2.count(l1[i]) == 0:
d += 1
continue
l2_index = l2.index(l1[i], i)
l2_distance = l2_index - i
if l2_distance > 0:
l2.pop(l2_distance)
... |
"""
"""
class MyIterator:
def __init__(self, c):
self.c = c
self.i = 0
def __next__(self):
if self.i < len(self.c.mylist):
self.i += 1
return self.c.mylist[self.i - 1]
else:
... |
def main():
a = [1, 2, 3]
print(a[0])
print(a[1])
print(a[2])
a.append(4)
print(a[3])
a += [5, 6, 7]
a = a + [8, 9, 10]
print(a[4])
print(a[-1])
if __name__ == '__main__':
main()
|
# set comprehension
odd_number_set = { x for x in range(10) if x % 2 == 1 }
# expected output:
'''
{1, 3, 5, 7, 9}
'''
print( odd_number_set ) |
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
longest = 0
longestSub = ""
for char in s:
if char not in longestSub:
longestSub += char
else:
while char in longestSub:
longestSub = longestSub[1:]
... |
n = int(input())
k_lst = [int(input()) for _ in range(n)]
k_lst.sort(reverse=True)
cnt = 1
for i in range(n-1):
if k_lst[i] == k_lst[i+1]:
continue
if k_lst[i] > k_lst[i+1]:
cnt += 1
print(cnt)
|
"""
냉난방기의 온도를 조절하는 리모콘이 있다.
리모컨의 온도 조절 버튼은 총 6개로 다음과 같다.
- 1도 증가, 감소
- 5도 증가, 감소
- 10도 증가, 감소
현재 설정된 온도와 목표 온도가 주어지면 최소 몇 번의 버튼을 눌러야 목표 온도를 설정할 수 있는지를 구하는 프로그램을 작성하시오.
"""
global a, b, res
a, b = map(int, input().split())
res = 60
def solution(temp, cnt):
global a, b, res
if cnt > res: return
if temp ==... |
N = int(input())
A = {}
for i in range(N):
A[i] = []
for j in range(int(input())):
A[i].append([int(n) for n in input().split()])
|
# -*- coding: utf-8 -*-
# Digital Ocean api urls
ACCOUNT_INFO = 'account/'
ACTION_LIST = 'actions/'
DOMAIN_LIST = 'domains/'
DROPLETS = 'droplets/'
IMAGES = 'images/'
KEYS = 'account/keys/'
REGIONS = 'regions/'
SIZES = 'sizes/' |
class MissingUserDatabaseURLError(Exception):
def __init__(self):
self.message = 'Users database URL is not provided'
super().__init__(self.message)
|
# -*- coding: utf-8 -*-
__author__ = 'Aaron Bassett'
__email__ = 'engineering@getadministrate.com'
__version__ = '0.14.0'
|
# Copyright 2016 Srinivas Venkattaramanujam (author: Srinivas Venkattaramanujam)
# Licensed under the Apache License, Version 2.0 (the "License")
# Until we have a config file
class Config:
TRAIN_FEATS = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/train_90/feats.scp'
TRAIN_ALIGNMENTS = '/speech1/DIT_PROJ/sri... |
#! /root/anaconda3/bin/python
t = (1, 2, 3, 4, 5)
del t
try:
print(t)
except NameError:
print(NameError)
|
"""
Author: Ben Carlson
Project: 100DaysPython
File: module1_day01_installing.py
Creation Date: 2019-06-03
Description: Use this script to confirm successful installation of the PyCharm IDE
"""
print("Hello World!")
|
# -*- coding:utf-8 -*-
'''
@Author: yanwii
@Date: 2018-08-16 15:18:52
'''
class BatchManager(object):
def __init__(self, batch_size=1):
self.batch_size = batch_size
self.data = []
self.batch_data = []
self.head_vocab = {"unk":0}
self.tail_vocab = {"unk":0}
sel... |
# _*_ coding:utf8-
a=raw_input("enter password:")
class ep3:
def __init__(self,a):
self.a=a
def pd(self):
if len(self.a)>=8:
return self.a
else:
print("invalid password ,chang du bu gou")
exit(0)
def pd2(self):
a=self.pd()
b = a.i... |
"""
Kullanıcıdan bir dik üçgenin dik olan iki kenarını(a,b) alın ve hipotenüs uzunluğunu bulmaya çalışın.
Hipotenüs Formülü: a^2 + b^2 = c^2
"""
print("Dik üçgenin hipotenüs uzunluğunu bulma")
print("a²+b²=c²")
a = int(input("a'yı giriniz :"))
b = int(input("b'yı giriniz :"))
c = (a**2+b**2)**0.5
print(a**2,"+",b**2,"=... |
class IncompleteStructureError(Exception):
"""An exception to raise when a structure is incomplete."""
def __init__(self, message):
self.message = message
class NonStandardAminoAcidError(Exception):
"""An exception to raise when a structure contains a Non-standard amino acid."""
def __init__(s... |
def parse(d):
return (
([frozenset(c) for c in g.split()] for g in l.split("|")) for l in d.split("\n")
)
def aoc(data):
return sum(len(d) in (2, 3, 4, 7) for _, b in parse(data) for d in b)
|
#
# @lc app=leetcode.cn id=453 lang=python3
#
# [453] 最小移动次数使数组元素相等
#
# @lc code=start
class Solution:
def minMoves(self, nums: List[int]) -> int:
minnum = min(nums)
res = 0
for i in nums:
if i != minnum:
res += i - minnum
return res
# @lc code... |
# Copyright 2018 The Bazel Authors. 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 la... |
class Solution(object):
def letterCasePermutation(self, S):
"""
:type S: str
:rtype: List[str]
"""
res = []
self.dfs(S, res, "")
return res
def dfs(self, S, res, word):
if not S:
res.append(word)
return
if S[0].... |
# AND : both need to be TRUE
# has_high_income = True
# has_good_credit = False
# if has_high_income and has_good_credit:
# print('Eligible for loan')
# OR : at least one needs to be TRUE
has_high_income = False
has_good_credit = True
if has_high_income or has_good_credit:
print('Eligible for loan')
# NOT :... |
# from testfixtures import TempDirectory
# import pytest
"""
def test_reset_no_flags_should_delete_all_configs(tmpdir):
mock_dir = tmpdir.mkdir("temp")
pypcmgr_config = mock_dir.join(".pypcmgrconfig")
hook_config = mock_dir.join(".pre-commit-config.yaml")
assert len(mock_dir.listdir()) == ["temp"]
de... |
board=[]
for i in range(10):
board.append(list(map(int,input().split()))) #입력
x, y = 1, 1
board[x][y]=9
while True:
if(board[x][y]==2): # 좌표가 2면 9로바꾸고 스탑 = 먹이를 먹음
board[x][y]=9 # 다음으로 넘어가 만약 y축으로 한칸 옮기고
b... |
PGS_TOKEN = 'C888EE7F420841CF92D0B0063EDDFC7D'
PGS_EMAIL = 'pagseguro@panfleteria.com.br'
# from datetime import datetime
# from datetime import date
# from datetime import timedelta
# dates = [d0]
# dates_two = list()
# def date_paginator(x, y):
# print x, y
# if pages == 1 and pages_mods == 0:
# _date =... |
# Irmãos - OBI 2020
c = int(input())
b = int(input())
dif = b - c
a = b + dif
print(a)
|
class Presenter:
def __init__(self):
pass
@staticmethod
def date_slashes_as_dashes(date_str):
if date_str.find("/") == -1:
return date_str
else:
mdy = date_str.split("/")
return mdy[2] + "-" + mdy[0] + "-" + mdy[1]
@staticmethod
def value... |
# see: numpy.core.overrides
def set_module(module):
def decorator(func):
if module is not None:
func.__module__ = module
return func
return decorator
|
"""
Given a string s, return the longest palindromic substring in s.
Example 1:
Input: s = "babad"
Output: "bab"
Explanation: "aba" is also a valid answer.
Example 2:
Input: s = "cbbd"
Output: "bb"
Constraints:
1 <= s.length <= 1000
s consist of only digits and English letters.
"""
class Solution:
def lo... |
class Movie():
"""Class that represents a Movie"""
def __init__(self, movie_title, storyline, poster_image,
trailer_youtube, duration):
"""Inits all data of a movie
Args:
movie_title(str): Movie title
storyline(str): Movie storyline
poster_ima... |
#
# PySNMP MIB module Unisphere-Data-DS3-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-DS3-CONF
# Produced by pysmi-0.3.4 at Mon Apr 29 21:23:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
while True:
try:
a = ord(input()[:1])
except EOFError:
break
b = ord(input()[:1])
print((b-a+26) % 26)
|
# program to count the numbers of occurrences of characters in the given string and store them in a dictionary
string = input("Enter a string: ")
d = {}
for i in string:
if i not in d.keys():
d[i] = 1
else:
d[i] += 1
print(d)
|
class Config(object):
'''
Each environment will be a class that inherits from the main class config
Configurations that will be the same across all environment will go into config,
while configuration that are specific to an environment will go into the relevant environment below
'''
SECRET_KEY... |
collected_data = {
"form_id": "2",
"name": "Test",
"client_id": "11",
"form_element_templates": [
{"name": "Full name", "value": "john doe"},
{"name": "Gender", "value": "male"},
{"name": "Country", "value": "morocco"},
],
}
form_element_field = {
"id": "2",
"name": ... |
def numPrimo(numero):
flag=True
for i in range (2,numero):
resto=numero%i
if resto==0:
flag=False
return flag
#main
num=2
while num>0:
num=int(input("Insira um número par maior que 2: "))
if num>0 and num%2==0:
primo1=0
primo2=0
original=num
... |
"""
List of constants used in the project
"""
SERVER_PORT = 8082
MAX_KEY_LENGTH = 21
|
"""
It should receive a sequence of n numbers.
If no argument is provided, return sum of numbers 1..100.
Look closely to the type of the function's default argument ...
"""
def sum_numbers(numbers=None):
if numbers is None:
return sum(range(1, 101))
else:
return sum(numbers)
if __name__ == ... |
#
# @lc app=leetcode.cn id=16 lang=python3
#
# [16] 最接近的三数之和
#
# https://leetcode-cn.com/problems/3sum-closest/description/
#
# algorithms
# Medium (45.81%)
# Likes: 564
# Dislikes: 0
# Total Accepted: 151.1K
# Total Submissions: 329.6K
# Testcase Example: '[-1,2,1,-4]\n1'
#
# 给定一个包括 n 个整数的数组 nums 和 一个目标值 target... |
"""
15 / 15 test cases passed.
Runtime: 40 ms
Memory Usage: 15 MB
"""
class Solution:
def numberOfArithmeticSlices(self, nums: List[int]) -> int:
n = len(nums)
if n < 3:
return 0
dp = [0] * n
for i in range(1, n - 1):
if nums[i] - nums[i - 1] == nums[i + 1] - ... |
liga = f"Moi je m'appelle 'Lolita'\n"
ligb = f"Lo ou bien Lola, du pareil au même\n"
ligc = f"Quand je rêve aux loups, c\'est Lola qui saigne\n"
ligd = f"[...]\n"
lige = f"C\'est pas ma faute\n"
ligf = f"Et quand je donne ma langue aux chats je vois les autres\n"
ligg = f"Tout prêts à se jeter sur moi, c'est pas ma fau... |
def is_correct_bracket_seq(n):
"""
На вход подаётся последовательность из скобок трёх видов: [], (), {}.
Напишите функцию которая принимает на вход скобочную
последовательность и возвращает True,
если последовательность правильная, а иначе False.
"""
while '()' in n or '[]' in n or '{}' in n... |
#!/usr/bin pypy3
# ------------------------ Simplest form of learning ------------------------
weight = .5
input = .5
target = .8
step_amount = .001 # <= How much to move weights each iteration
for iteration in range(1101) : # <= repeat the learning many times so that
... |
# AWS GENERAL SETTINGS:
AWS_REGION = "us-east-1"
AWS_PROFILE = "default" # The same profile used by your AWS CLI installation
SSH_KEY_NAME = "key.pem" # Expected to be in ~/.ssh
AWS_BUCKET = "dummybucket"
# EC2 AND ECS INFORMATION:
ECS_CLUSTER = "default_cluster"
# SQS QUEUE INFORMATION:
SQS_DEAD_LETTER_QUEUE = "ar... |
inp = open('input_d18.txt').read()
xl = len(inp)-1
yl = 400000
tiles = [[False for _ in range(xl)] for _ in range(yl)] # True if trap
def get_tile(x,y):
if x < 0 or x >= xl or y < 0 or y >= yl:
return False
return tiles[y][x]
def is_trap(x,y):
left,center,right = get_tile(x-1,y-1),get_tile(x,y-1)... |
#
# PySNMP MIB module MERU-CONFIG-STATICSTATION-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MERU-CONFIG-STATICSTATION-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:01:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... |
"""Serializers"""
def serialize_greeting(greeting):
"""."""
return {
'id': None,
'type': 'greeting',
'attributes': {
'word': greeting.get('word', None),
'propertyTwo': greeting.get('propertyTwo', None),
'propertyThree': greeting.get('propertyThree', ... |
def f8(n):
m = n
sum = 0
while m!=0:
x = m%10
sum = sum + x**3
m = m//10
if sum == n:
print(n, " is an Armstrong number")
else:
print(n, " is not an Armstrong number")
f8(153)
f8(125) |
# Define the number of memory threads
MEMORY_THREAD_NUM = 4
# Define the number of ebs threads
EBS_THREAD_NUM = 4
# Define the number of proxy worker threads
PROXY_THREAD_NUM = 4
# Number of tiers
MIN_TIER = 1
MAX_TIER = 2
# Define port offset
SERVER_PORT = 6560
NODE_JOIN_BASE_PORT = 6660
NODE_DEPART_BASE_PORT = 67... |
t=input().split()
hi=int(t[0])
hf=int(t[1])
if hi==hf:
ht=24
elif hi>hf:
ht=(24-hi)+hf
elif hi<hf:
ht=hf-hi
print("O JOGO DUROU %d HORA(S)" %ht)
|
# Atharv Kolhar
# Python Bytes
"""
Write a Program to convert Integers to Roman Symbols
Between number 1 to 1000
"""
def integer_to_roman(number):
n = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000]
rn = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M']
roman_num = ""
i... |
N = int(input())
ROCK, PAPER, SCISSORS = 'R', 'P', 'S'
beating_move_by_move = {
ROCK: PAPER,
PAPER: SCISSORS,
SCISSORS: ROCK,
}
MAX_CHARS = 500
IMPOSSIBLE = 'IMPOSSIBLE'
for case_id in range(1, N + 1):
nb_robots = int(input())
robot_programs = [input() for _ in range(nb_robots)]
best_combinat... |
class Pessoa:
ano_atual = 2019
def __init__(self, nome, idade):
self.nome = nome
self.idade = idade
def get_ano_nascimento(self):
print(self.ano_atual - self.idade)
@classmethod #Eu nao entendi a logica aq, sem nexo
def por_ano_nascimento(cls, nome, ano_nascimento):
... |
##Q3. Write a program to print table of 2
#############################################################################################################
##Program Objective: to print table of 2 ##
##Coded by: KNR ... |
def funcaoOrig(x):
return(x - 2)
def raizFuncao(a, b):
erro = 0.1
cont = 0
while((funcaoOrig(a)) * (funcaoOrig(b)) >= 0):
print(f'\nErro!\nCom os valores {a} e {b}, eh impossivel calcularmos as raizes da funcao original!')
a = float(input('\nDigite outro valor para a: '))
b = float(input('Digite ou... |
def make_default_resolver(field_attr_name):
def resolver(source, args, info):
property = getattr(source, field_attr_name, None)
if callable(property):
return property()
return property
resolver.__name__ = 'resolve_{}'.format(field_attr_name)
return resolver
|
"""
Physical parameters of the laboratory Crazyflie quadrotors.
Additional sources:
https://bitcraze.io/2015/02/measuring-propeller-rpm-part-3
https://wiki.bitcraze.io/misc:investigations:thrust
https://commons.erau.edu/cgi/viewcontent.cgi?article=2057&context=publication
Notes:
k_thrust is inferred fro... |
# Time: O(n)
# Space: O(1)
class Solution(object):
def validMountainArray(self, A):
"""
:type A: List[int]
:rtype: bool
"""
i = 0
while i+1 < len(A) and A[i] < A[i+1]:
i += 1
j = len(A)-1
while j-1 >= 0 and A[j-1] > A[j]:
j -=... |
strs = ["flower","flow","flight"]
if len(strs) == 0:
print("")
exit()
prefix = strs[0]
for str in strs:
while(str.find(prefix) != 0):
prefix = prefix[0:len(prefix)-1]
if len(prefix) == 0:
print("")
exit()
print(prefix)
|
d1 = {1:'Sugandh', 2:'Divya', 3:'Mintoo'}
print(d1) # D1
print("deleting an item from the dictionary...")
del d1[3]
print(d1) # D2
print("deleting an entire dictionary...")
del d1
print(d1) # D3
|
'''
Template untuk solusi Lab 09 kelas A.
'''
class Bangunan:
'''
Sebuah bangunan.
'''
def __init__(self, nama_bangunan, lama_sewa, harga_sewa):
self.nama = nama_bangunan
self.lama_sewa = lama_sewa
self.harga_sewa = harga_sewa
def get_harga_sewa(self):
'''
M... |
# list的使用
# 1.新建一个列表fruits
fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana']
# 新增一个元素
# append: 在list列表后增加元素
fruits.append("pear")
print(fruits)
# insert: 指定位置增加元素
fruits.insert(0, "pear")
print(fruits)
# 指定元素的位置
# count:从1开始
print(fruits.count("pear"))
print(fruits.count("apple"))
# 搞错了,这个不是... |
def crime_list(z): #function definition
f=open(z,"r") #open csv file in read mode
d1=dict()
d2=dict()
list1=[]
list2=[]
for line in f:
line.strip()
for lines in line.split(','):
list1.append(lines[-1])
list2.append(lines[-2])
for y in list1:
if y not in d1:
d1[y]=1
else:
d1[y... |
def part1(lines):
total = 0
for box in lines:
dim = list(map(int, box.split("x")))
lw = dim[0] * dim[1]
wh = dim[1] * dim[2]
hl = dim[2] * dim[0]
total += 2*lw + 2*wh + 2*hl + min(lw,wh,hl)
return total
def part2(lines):
total = 0
for box in lines:
di... |
def _findwinners(players):
best = -1
winners = []
for i in range(len(players)):
if players[i]:
if best == -1 or players[i] > best:
best = players[i]
winners = [i]
elif players[i] == best:
winners.append(i)
return winners
de... |
__add_idle_call = None
__remove_idle_call = None
__add_timeout_call = None
__remove_timeout_call = None
__setup_event_loop = None
__start_event_loop = None
__stop_event_loop = None
__idle_call_dict = {}
__timeout_call_dict = {}
def add_idle_call(func, *args, **kwargs):
global __add_idle_call
global __idle_cal... |
"""Maps between model names and more readable versions.
Model/code names (on the left) are used internally by Cavecalc. Readable names
are largely used in the GUI. Conversion between them is handled by the
setter.NameSwitcher class.
"""
database = "PHREEQC Database Filename"
phreeqc_log_file = "Log PHREEQ... |
def avg(list):
return (float(sum(list)) / len(list))
def apply(map, f_x, f_y):
return {f_x(x): f_y(y) for x,y in map.items()}
def linear(a, b):
return (lambda x: (a * x + b))
def read_csv(filename):
file = open(filename, "r")
labels = file.readline()[:-1].split(',')
print("We get {} from {}".... |
class test:
def __init__(self):
pass
def printer(self):
print("hello world!")
if __name__=='__main__':
foo = test()
foo.printer()
|
res = client.get_arrays_space()
print(res)
if type(res) == pypureclient.responses.ValidResponse:
print(list(res.items))
# list array space of file systems
res = client.get_arrays_space(type='file-system')
print(res)
if type(res) == pypureclient.responses.ValidResponse:
print(list(res.items))
# list historical a... |
# Created by MechAviv
# Map ID :: 940001210
# Eastern Region of Pantheon : East Sanctum
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.forcedInput(0)
sm.forcedInput(2)
sm.sendDelay(30)
sm.forcedInput(0)
OBJECT_1 = sm.sendNpcController(3000103, -300, 220)
sm... |
# dictionary of key signatures
keySigSemanticToLP = {
"Cm": "\\key c \\minor ",
"CM": "\\key c \\major ",
"C#m": "\\key cis \\minor ",
"C#M": "\\key cis \\major ",
"Cbm": "\\key ces \\minor ",
"CbM": "\\key ces \\major ",
"Dm": "\\key d \\minor ",
"DM": "\\key d \\major ",
... |
class PyDisFishError(Exception):
"""Base error class for the module"""
pass
class FetchError(PyDisFishError):
"""Error that's raised when _fetch_list() fails
This is probably something either on your end or discord's
"""
pass
class NotReady(PyDisFishError):
"""Error th... |
# 2019-01-31
# number sorting and reading in list
score = [[80, 85, 90], [82, 87, 92], [75, 92, 84]]
for i in range(len(score)):
student = score[i]
score_sum = 0
for j in student:
score_sum += j
# append the sum of scores
score[i] = [score_sum] + score[i]
# sorts the students according to... |
mysql={
'host':"localhost",
'user':'root',
'password':'Liscannor10',
'database': 'datarepresentation'
} |
# Soma ímpares múltiplos de três
soma = 0
x = 0
for i in range(1, 501, 2):
if i % 3 == 0:
x += 1
soma += i
print(f"A soma dos {x} valores e {soma} ") |
d = dict()
d['0']='O'
d['1']='l'
d['3']='E'
d['4']='A'
d['5']='S'
d['6']='G'
d['8']='B'
d['9']='g'
s = input()
for c in s:
print(d[c] if c in d else c, end='') |
MIN_SQUARE = 0
MAX_SQUARE = 63
MAX_INT = 2 ** 64 - 1
STARTING_FEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
# DIRECTIONS
NORTH = 8
EAST = 1
SOUTH = -8
WEST = -1
NE = 9
SE = -7
SW = -9
NW = 7
NWW = NW + WEST
NNW = NORTH + NW
NNE = NORTH + NE
NEE = NE + EAST
SEE = SE + EAST
SSE = SOUTH + SE
SSW = SO... |
num = input()[::-1]
# num = num[::-1]
for i in num:
if int(i)==0:
print("ZERO")
else:
symbol = chr(int(i) + 33)
print(symbol*int(i))
|
"""
Faça uma função e um programa de teste para o cálculo do volume de uma esfera. Sendo que o raio é passado por
parâmetro: V = 4/3 * π * R³ 3.14159265
Doctests:
>>> volumecir(50)
523598.33
>>> volumecir(12)
7238.22
>>> volumecir(87)
2758328.59
>>> volumecir(5)
523.60
"""
def volumecir(raio: int):
resp = float... |
# Copyright (c) 2012 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.
{
'targets': [
{
'target_name': 'libwebp_dec',
'type': 'static_library',
'dependencies' : [
'libwebp_dsp',
'libwe... |
class CronDayOfWeek(int):
"""
Job Manager cron scheduling day of week. Zero represents Sunday.
-1 represents all days of a week and only supported for cron
schedule create and modify.
Range : [-1..6].
"""
@staticmethod
def get_api_name():
return "cron-day-of-week"
|
class Solution:
def isPowerOfFour1(self, num):
"""
:type num: int
:rtype: bool
"""
x = 1
while x != num:
if x < num:
x <<= 2
else:
return False
return True
def isPowerOfFour2(self, num):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.