content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
s = input().lower()
search = input().lower().strip()
str_list = []
# Tokenize
token = ""
for c in s:
if c not in [' ','\'','"','.',',']:
token += c
else:
if len(token) > 0:
str_list.append(token)
token = ""
if len(token) > 0:
str_list.append(token)
# Search
print('Fou... | s = input().lower()
search = input().lower().strip()
str_list = []
token = ''
for c in s:
if c not in [' ', "'", '"', '.', ',']:
token += c
elif len(token) > 0:
str_list.append(token)
token = ''
if len(token) > 0:
str_list.append(token)
print('Found' if search in str_list else 'Not F... |
def multiply(a, b):
return a * b
result = multiply(2,3)
print(result)
| def multiply(a, b):
return a * b
result = multiply(2, 3)
print(result) |
'''https://leetcode.com/problems/decode-string/'''
class Solution:
def decodeString(self, s: str) -> str:
stack = []
curNum = 0
curStr = ''
for i in s:
if i=='[':
stack.append(curStr)
stack.append(curNum)
curNum = 0
... | """https://leetcode.com/problems/decode-string/"""
class Solution:
def decode_string(self, s: str) -> str:
stack = []
cur_num = 0
cur_str = ''
for i in s:
if i == '[':
stack.append(curStr)
stack.append(curNum)
cur_num = 0
... |
'''
Backward method to solve 1D reaction-diffusion equation:
u_t = k * u_xx
with Neumann boundary conditions
at x=0: u_x(0,t) = 0 = sin(2*np.pi)
at x=L: u_x(L,t) = 0 = sin(2*np.pi)
with L = 1 and initial conditions:
u(x,0) = (1.0/2.0)+ np.cos(2.0*np.pi*x) - (1.0/2.0)*np.cos(3*np.pi*x)
u_x(x,t) = (-4.0*(... | """
Backward method to solve 1D reaction-diffusion equation:
u_t = k * u_xx
with Neumann boundary conditions
at x=0: u_x(0,t) = 0 = sin(2*np.pi)
at x=L: u_x(L,t) = 0 = sin(2*np.pi)
with L = 1 and initial conditions:
u(x,0) = (1.0/2.0)+ np.cos(2.0*np.pi*x) - (1.0/2.0)*np.cos(3*np.pi*x)
u_x(x,t) = (-4.0*(... |
#!/usr/bin/python3
'''
Program:
This is a table of environment variable of deep learning python.
Usage:
import DL_conf.py // in your deep learning python program
editor Jacob975
20180123
#################################
update log
20180123 version alpha 1:
Hello!, just a test
'''
# Comment of what ki... | """
Program:
This is a table of environment variable of deep learning python.
Usage:
import DL_conf.py // in your deep learning python program
editor Jacob975
20180123
#################################
update log
20180123 version alpha 1:
Hello!, just a test
"""
path_of_python = '/usr/bin/python3'
path... |
n = int(input())
i = 2
while n != 1:
if n%i == 0: n//=i;print(i)
else: i+=1 | n = int(input())
i = 2
while n != 1:
if n % i == 0:
n //= i
print(i)
else:
i += 1 |
def best_par_in_df(search_df):
'''
This function takes as input a pandas dataframe containing the inference
results (saved in a file having 'search_history.csv' ending) and returns
the highest-likelihood parameters set that was found during the search.
Args:
- search_df (pandas DataFrame object... | def best_par_in_df(search_df):
"""
This function takes as input a pandas dataframe containing the inference
results (saved in a file having 'search_history.csv' ending) and returns
the highest-likelihood parameters set that was found during the search.
Args:
- search_df (pandas DataFrame object... |
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
class Production(Config):
SQLALCHEMY_DATABASE_URI = '<Production DB URL>'
class Development(Config):
# psql postgresql://Nghi:nghi1996@localhost/postgres
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'pos... | class Config(object):
debug = False
testing = False
sqlalchemy_track_modifications = False
class Production(Config):
sqlalchemy_database_uri = '<Production DB URL>'
class Development(Config):
debug = True
sqlalchemy_database_uri = 'postgresql://Nghi:nghi1996@localhost/postgres'
sqlalchemy_... |
def rotateImage(a):
size = len(a)
b = []
for col in range(size):
temp = []
for row in reversed(range(size)):
temp.append(a[row][col])
b.append(temp)
return b
if __name__ == '__main__':
a = [
[1,2,3],
[4,5,6],
[7,8,9],
]
print(rota... | def rotate_image(a):
size = len(a)
b = []
for col in range(size):
temp = []
for row in reversed(range(size)):
temp.append(a[row][col])
b.append(temp)
return b
if __name__ == '__main__':
a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(rotate_image(a)) |
class Context:
def time(self):
raise NotImplemented
def user(self):
raise NotImplemented
class DefaultContext(Context):
def __init__(self, current_time, current_user_id):
super(DefaultContext, self).__init__()
self.current_time = current_time
self.current_user_id... | class Context:
def time(self):
raise NotImplemented
def user(self):
raise NotImplemented
class Defaultcontext(Context):
def __init__(self, current_time, current_user_id):
super(DefaultContext, self).__init__()
self.current_time = current_time
self.current_user_id ... |
# This program knows about the schedule for a conference that runs over the
# course of a day, with sessions in different tracks in different rooms. Given
# a room and a time, it can tell you which session starts at that time.
#
# Usage:
#
# $ python conference_schedule.py [room] [time]
#
# For instance:
#
# $ python ... | schedule = {'Main Hall': {'10:00': 'Django REST framework', '11:00': 'Lessons learned from PHP', '12:00': "Tech interviews that don't suck", '14:00': 'Taking control of your Bluetooth devices', '15:00': "Fast Python? Don't Bother!", '16:00': 'Test-Driven Data Analysis'}, 'Seminar Room': {'10:00': 'Python in my Science ... |
"grpc_py_library.bzl provides a py_library for grpc files."
load("@rules_python//python:defs.bzl", "py_library")
def grpc_py_library(**kwargs):
py_library(**kwargs)
| """grpc_py_library.bzl provides a py_library for grpc files."""
load('@rules_python//python:defs.bzl', 'py_library')
def grpc_py_library(**kwargs):
py_library(**kwargs) |
#Conceito Mec
l=int(input())
p=int(input())
r= p / l
if r <= 8:
print("A")
elif 9 <= r <= 12:
print("B")
elif 13 <= r <= 18:
print("C")
elif r > 18:
print("D") | l = int(input())
p = int(input())
r = p / l
if r <= 8:
print('A')
elif 9 <= r <= 12:
print('B')
elif 13 <= r <= 18:
print('C')
elif r > 18:
print('D') |
## inotify_init1 flags.
IN_CLOEXEC = 0o2000000
IN_NONBLOCK = 0o0004000
## Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH.
IN_ACCESS = 0x00000001
IN_MODIFY = 0x00000002
IN_ATTRIB = 0x00000004
IN_CLOSE_WRITE = 0x00000008
IN_CLOSE_NOWRITE = 0x00000010
IN_OPEN = 0x0000... | in_cloexec = 524288
in_nonblock = 2048
in_access = 1
in_modify = 2
in_attrib = 4
in_close_write = 8
in_close_nowrite = 16
in_open = 32
in_moved_from = 64
in_moved_to = 128
in_create = 256
in_delete = 512
in_delete_self = 1024
in_move_self = 2048
in_close = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE
in_move = IN_MOVED_FROM | IN_... |
def costodepasajes():
#definir variables y otros
montoP=0
#datos de entrada
cantidadX=int(input("ingrese la cantidad de estudiantes:"))
#proceso
if cantidadX>=100:
montoP=cantidadX*20
elif cantidadX<100 and cantidadX>49:
montoP=cantidadX*35
elif cantidadX<50 and cantidadX>19:
montoP=cantidad... | def costodepasajes():
monto_p = 0
cantidad_x = int(input('ingrese la cantidad de estudiantes:'))
if cantidadX >= 100:
monto_p = cantidadX * 20
elif cantidadX < 100 and cantidadX > 49:
monto_p = cantidadX * 35
elif cantidadX < 50 and cantidadX > 19:
monto_p = cantidadX * 40
... |
mylist=[] #python now knows it is a 1D list
mylist.append(5) #append is to add a thing to the end
print(mylist) #will print only 5
mylist.append(6)
print(mylist) #will print 5 AND 6
mylist[1]=7 #value 7 will overwrite the value in position 1 of mylist (which is 6)
num=int(input("Enter number to append to the list"))
... | mylist = []
mylist.append(5)
print(mylist)
mylist.append(6)
print(mylist)
mylist[1] = 7
num = int(input('Enter number to append to the list'))
mylist.append(num)
print('Unsorted List is ', mylist)
print(mylist[2])
mylist.sort()
print('Sorted list is ', mylist)
looplist = []
for i in range(10):
looplist.append(int(i... |
# HEAD
# Classes - Polymorphism
# DESCRIPTION
# Describes how to create polymorphism using classes
# RESOURCES
#
# Creating Parent class
class Parent():
par_cent = "parent"
def p_method(self):
print("Parent Method invoked with par_cent", self.par_cent)
return self.par_cent
# Inheriting... | class Parent:
par_cent = 'parent'
def p_method(self):
print('Parent Method invoked with par_cent', self.par_cent)
return self.par_cent
class Childone(Parent):
chi_one_cent = 'childtwo'
def c_one_method(self):
print('Child Method invoked with chi_one_cent', self.chi_one_cent)
... |
# Information connected to the email account
email = "email@website.com"
password = "password"
server = "server.website.com"
port = 25
# The folder with settings (rss-links.txt and time.txt)
folder = "path to folder"
| email = 'email@website.com'
password = 'password'
server = 'server.website.com'
port = 25
folder = 'path to folder' |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'and closedBra closedParen coma comment div do doubleColon doubleEquals elif else end endline equals exit id if int integer less lessEquals minus more moreEquals mul not... | _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'and closedBra closedParen coma comment div do doubleColon doubleEquals elif else end endline equals exit id if int integer less lessEquals minus more moreEquals mul not notEquals openBra openParen or parens plus print program rea read real string subroutine swap... |
__author__ = 'cosmin'
class Validator:
def __init__(self):
pass | __author__ = 'cosmin'
class Validator:
def __init__(self):
pass |
catalogue = {
'iphone': {
'X': 800,
'XR': 900,
'11': 1000,
'12': 1200,
},
'ipad': {
'mini': 400,
'air': 500,
'pro': 800,
},
'mac': {
'macbook air': 999,
'macbook': 1299,
... | catalogue = {'iphone': {'X': 800, 'XR': 900, '11': 1000, '12': 1200}, 'ipad': {'mini': 400, 'air': 500, 'pro': 800}, 'mac': {'macbook air': 999, 'macbook': 1299, 'macbook pro': 1799}}
for (key, value) in catalogue.items():
print('-' * 10)
print(key)
for (k, v) in value.items():
print(k, '', v)
print... |
#
# PySNMP MIB module LBHUB-BRIDGE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LBHUB-BRIDGE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:05:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
a = int(input())
if(a>1000000):
print(0)
else:
c = int(input())
if(c==a):
print(0)
else:
ver = []
var = []
for i in range(a):
b = float(input())
var.append(b)
j=0
sumout = []
for element in var:
k=j
... | a = int(input())
if a > 1000000:
print(0)
else:
c = int(input())
if c == a:
print(0)
else:
ver = []
var = []
for i in range(a):
b = float(input())
var.append(b)
j = 0
sumout = []
for element in var:
k = j
... |
def main():
total = float
print("**********Think in te last five game that you buy**********")
game1 = input("What's the game?: ")
time1 = float(input(f"How many hours did you play {game1}?: "))
price1 = float(input(f"How many dollars did you spend in the {game1}?: "))
print("--------------... | def main():
total = float
print('**********Think in te last five game that you buy**********')
game1 = input("What's the game?: ")
time1 = float(input(f'How many hours did you play {game1}?: '))
price1 = float(input(f'How many dollars did you spend in the {game1}?: '))
print('-------------------... |
class Solution:
def minCostToMoveChips(self, position: List[int]) -> int:
even_cnt = 0
odd_cnt = 0
for i in position:
if i % 2 == 0:
even_cnt += 1
else:
odd_cnt += 1
return min(even_cnt, odd_cnt)
| class Solution:
def min_cost_to_move_chips(self, position: List[int]) -> int:
even_cnt = 0
odd_cnt = 0
for i in position:
if i % 2 == 0:
even_cnt += 1
else:
odd_cnt += 1
return min(even_cnt, odd_cnt) |
n = int(input())
positives = []
negatives = []
for i in range(n):
current_number = int(input())
if current_number >= 0:
positives.append(current_number)
else:
negatives.append(current_number)
#============ Comprehension ===============
#numbers = [int(input()) for _ in range(n)]
#positive... | n = int(input())
positives = []
negatives = []
for i in range(n):
current_number = int(input())
if current_number >= 0:
positives.append(current_number)
else:
negatives.append(current_number)
print(positives)
print(negatives)
print(f'Count of positives: {len(positives)}. Sum of negatives: {s... |
#
# PySNMP MIB module JUNIPER-LSYSSP-NATSRCPOOL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-LSYSSP-NATSRCPOOL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:00:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, value_size_constraint, constraints_union, single_value_constraint) ... |
print("hola mundo")
x=4
y=2
print(x+y)
#suma=x+y
#print(suma)
#suma | print('hola mundo')
x = 4
y = 2
print(x + y) |
#
# PySNMP MIB module REDLINE-AN50-PMP-V2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/REDLINE-AN50-PMP-V2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:46:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint) ... |
# -*- coding: utf-8 -*-
# @Time: 2020/5/8 22:38
# @Author: GraceKoo
# @File: interview_2.py
# @Desc: https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/
class Solution:
def replaceSpace(self, s: str) -> str:
s_list = list()
for s_value in s:
if s_value == " ":
s_list... | class Solution:
def replace_space(self, s: str) -> str:
s_list = list()
for s_value in s:
if s_value == ' ':
s_list.append('%20')
else:
s_list.append(s_value)
return ''.join(s_list)
so = solution()
print(so.replaceSpace('We are happy.'... |
class Statement:
transactions = []
def append_transaction(self, transaction):
self.transactions.append(transaction)
def print(self):
for transaction in self.transactions:
print(str(transaction)) | class Statement:
transactions = []
def append_transaction(self, transaction):
self.transactions.append(transaction)
def print(self):
for transaction in self.transactions:
print(str(transaction)) |
lista = []
dados = []
oper = ''
maior = menor = 0
nomeMaior = ''
nomeMenor = ''
while oper != 'sair':
dados.append(str(input('Digite o seu nome: ')))
dados.append(int(input('Digite o seu peso: ')))
if len(lista) == 0:
maior = menor = dados[1]
else:
if dados[1] > maior:
maior... | lista = []
dados = []
oper = ''
maior = menor = 0
nome_maior = ''
nome_menor = ''
while oper != 'sair':
dados.append(str(input('Digite o seu nome: ')))
dados.append(int(input('Digite o seu peso: ')))
if len(lista) == 0:
maior = menor = dados[1]
else:
if dados[1] > maior:
maio... |
class FeedException(Exception):
def __init__(self, *args, **kwargs):
self.message = kwargs.pop('message')
| class Feedexception(Exception):
def __init__(self, *args, **kwargs):
self.message = kwargs.pop('message') |
# -*- coding: utf-8 -*-
_name1 = [
'Chikorita', 'Bayleef', 'Meganium', 'Cyndaquil', 'Quilava',
'Typhlosion', 'Totodile', 'Croconaw', 'Feraligatr', 'Sentret',
'Furret', 'Hoothoot', 'Noctowl', 'Ledyba', 'Ledian',
'Spinarak', 'Ariados', 'Crobat', 'Chinchou', 'Lanturn',
'Pichu', 'Cleffa', 'Igglybuff', ... | _name1 = ['Chikorita', 'Bayleef', 'Meganium', 'Cyndaquil', 'Quilava', 'Typhlosion', 'Totodile', 'Croconaw', 'Feraligatr', 'Sentret', 'Furret', 'Hoothoot', 'Noctowl', 'Ledyba', 'Ledian', 'Spinarak', 'Ariados', 'Crobat', 'Chinchou', 'Lanturn', 'Pichu', 'Cleffa', 'Igglybuff', 'Togepi', 'Togetic', 'Natu', 'Xatu', 'Mareep',... |
# Solution to part 2 of day 14 of AOC 2015, Reindeer Olympics
# https://adventofcode.com/2015/day/14
f = open('input.txt')
whole_text = f.read()
f.close()
race = 2503
deers = {}
all_deers = {}
for line in whole_text.split('\n'):
# print(line)
# Example,
# Comet can fly 14 km/s for 10 seconds, but then m... | f = open('input.txt')
whole_text = f.read()
f.close()
race = 2503
deers = {}
all_deers = {}
for line in whole_text.split('\n'):
(reindeer, _, _, speed_str, _, _, fly_str, _, _, _, _, _, _, rest_str, _) = line.split(' ')
(speed, fly, rest) = (int(speed_str), int(fly_str), int(rest_str))
deers[reindeer] = 0
... |
word=input()
n=int(input())
first_half=word[:n]
second_half=word[n+1:]
result=(first_half+second_half)
print(result) | word = input()
n = int(input())
first_half = word[:n]
second_half = word[n + 1:]
result = first_half + second_half
print(result) |
# pyre-ignore-all-errors
# TODO: Change `pyre-ignore-all-errors` to `pyre-strict` on line 1, so we get
# to see all type errors in this file.
# We mentioned in the talk that consuming values of union type often requires a
# case split. But there are also cases where the case split is not necessary.
# This example dem... | class Dog:
def bark(self) -> None:
print('Whoof! Whoof!')
def play(self) -> None:
print('Dog playing!')
def chase(self, dog: Dog) -> None:
print('Dog is chasing another dog!')
class Cat:
def meow(self) -> None:
print('Meow! Meow!')
def play(self) -> None:
... |
def calculateWeight(name, allSupporters):
summation = 0
if (len(allSupporters[name]) > 1):
for e in allSupporters[name][1]:
summation += calculateWeight(e, allSupporters)
return allSupporters[name][0]+summation
def findAppropriateTree(name, allSupporters):
allWeights = []
for i ... | def calculate_weight(name, allSupporters):
summation = 0
if len(allSupporters[name]) > 1:
for e in allSupporters[name][1]:
summation += calculate_weight(e, allSupporters)
return allSupporters[name][0] + summation
def find_appropriate_tree(name, allSupporters):
all_weights = []
f... |
# Performing operations on the DataFrame
# DataFrame transformations
# select()
# filter()
# groupby()
# orderby()
# dropDuplicates()
# withColumnRenamed()
# DataFrame actions
# printSchema()
# head()
# show()
# count()
# columns
# describe()
# 1. Initial EDA
# Print the first 10 observations
people_df.show(10)
# ... | people_df.show(10)
print('There are {} rows in the people_df DataFrame.'.format(people_df.count()))
print('There are {} columns in the people_df DataFrame and their names are {}'.format(len(people_df.columns), people_df.columns))
people_df_sub = people_df.select('name', 'sex', 'date of birth')
people_df_sub.show(10)
pe... |
# Headers copied directly from browser request
static = {
'accept': 'application/json, text/plain, */*',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
'referer': 'https://www.nowgatewayx.com/login',
'sec-ch-ua': '"Chromium";v="94", "Google Chrome";v="94", "... | static = {'accept': 'application/json, text/plain, */*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8', 'referer': 'https://www.nowgatewayx.com/login', 'sec-ch-ua': '"Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform... |
def return_func():
pass
def func():
return return_func
a = func()
a()
| def return_func():
pass
def func():
return return_func
a = func()
a() |
n = int(input())
a = set(map(int, input().split()))
m = int(input())
b = set(map(int, input().split()))
d = list(a.union(b).difference(a.intersection(b)))
d.sort()
for i in d:
print(i)
| n = int(input())
a = set(map(int, input().split()))
m = int(input())
b = set(map(int, input().split()))
d = list(a.union(b).difference(a.intersection(b)))
d.sort()
for i in d:
print(i) |
#
# @lc app=leetcode.cn id=43 lang=python3
#
# [43] multiply-strings
#
None
# @lc code=end | None |
class PortfolioFilter:
def __init__(self, column, options=None, portfolio_options=None, values=None, industry_codes=None,
inverted=False, include_null=False, domain=None):
self.key = column + '-0'
self.column = column
self.options = options if options is not None else []
... | class Portfoliofilter:
def __init__(self, column, options=None, portfolio_options=None, values=None, industry_codes=None, inverted=False, include_null=False, domain=None):
self.key = column + '-0'
self.column = column
self.options = options if options is not None else []
self.portfo... |
# There's no logic or real code here... just data. You need to add some code to
# the test!
alice_name = "Alice"
alice_age = 20
alice_is_drinking = True
bob_name = "Bob"
bob_age = 12
bob_is_drinking = False
charles_name = "Charles"
charles_age = 22
charles_is_drinking = True
| alice_name = 'Alice'
alice_age = 20
alice_is_drinking = True
bob_name = 'Bob'
bob_age = 12
bob_is_drinking = False
charles_name = 'Charles'
charles_age = 22
charles_is_drinking = True |
def test_role_check(test_role):
test_role = test_role.refresh()
assert test_role.id
assert test_role.slug == "test"
def test_role_update(test_role):
assert test_role.slug == "test"
test_role.slug = "test1"
test_role.save()
assert test_role.refresh().slug == "test1"
| def test_role_check(test_role):
test_role = test_role.refresh()
assert test_role.id
assert test_role.slug == 'test'
def test_role_update(test_role):
assert test_role.slug == 'test'
test_role.slug = 'test1'
test_role.save()
assert test_role.refresh().slug == 'test1' |
# for i in [0, 1, 2, 3, 4, 5]:
# print(i)
# for j in range(10):
# print(j)
names = ["Harry", "Ron", "Hermione", "Ginny"]
for character in names:
print(character)
| names = ['Harry', 'Ron', 'Hermione', 'Ginny']
for character in names:
print(character) |
class Product():
def __init__(self, requirements: list):
self.requirements = []
for r in requirements:
self.requirements.append(r.type)
class Requirement():
def __init__(self, _type: str, name):
self.name = name
self.type = _type
| class Product:
def __init__(self, requirements: list):
self.requirements = []
for r in requirements:
self.requirements.append(r.type)
class Requirement:
def __init__(self, _type: str, name):
self.name = name
self.type = _type |
p = 196732205348849427366498732223276547339
secret = 4919
# Solved through brute force that secret = 4919, see sageSecret
def calc_root(num, mod, n):
#Create a modular ring with mod as the modulus
f = GF(mod)
# temp = num mod Modulus
temp = f(num)
#Calculate the nth root temp on this modular field
... | p = 196732205348849427366498732223276547339
secret = 4919
def calc_root(num, mod, n):
f = gf(mod)
temp = f(num)
return temp.nth_root(n)
def gen_v_list(primelist, p, secret):
a = []
for prime in primelist:
a.append(calc_root(prime, p, secret))
return a
def decode_int(i, primelist):
... |
n = int(input())
a = list(map(int, input().split()))
ss = sum(a)
a.sort()
if ss%2 == 1:
for i in range(0, n):
if a[i]%2 == 1:
ss -= a[i]
break
print(ss) | n = int(input())
a = list(map(int, input().split()))
ss = sum(a)
a.sort()
if ss % 2 == 1:
for i in range(0, n):
if a[i] % 2 == 1:
ss -= a[i]
break
print(ss) |
n = input("Enter a binary number to convert to decimal: ")
bit_exp = 0
decimals = []
for bit in n[::-1]:
if int(bit) == 1:
decimals.append(2**bit_exp)
bit_exp += 1
decimal = sum(decimals)
print(decimals)
print(decimal)
'''Varigarble -- 2020'''
| n = input('Enter a binary number to convert to decimal: ')
bit_exp = 0
decimals = []
for bit in n[::-1]:
if int(bit) == 1:
decimals.append(2 ** bit_exp)
bit_exp += 1
decimal = sum(decimals)
print(decimals)
print(decimal)
'Varigarble -- 2020' |
def main(data,n):
initial = n
dict = {}
for i in range(n):
dict[data[i]] = True
# Check for initial value
if data[i]==initial:
s = ''
while initial in dict:
s += str(initial) + ' '
initial -= 1
print(s)
else:... | def main(data, n):
initial = n
dict = {}
for i in range(n):
dict[data[i]] = True
if data[i] == initial:
s = ''
while initial in dict:
s += str(initial) + ' '
initial -= 1
print(s)
else:
print(' ')
if __na... |
# __init__.py
# Version of the turtlefy package
__version__ = "0.8.12"
| __version__ = '0.8.12' |
#enter the celcius temperature to be converted
Celcius_temperature = float(input("Enter celcius temperature: "))
#formula for converting celcius temperature to fahrenheit temperature
Fahrenheit = (Celcius_temperature * (9/5)) + 32
#printing the fahrenheit temperature
print(Fahrenheit)
| celcius_temperature = float(input('Enter celcius temperature: '))
fahrenheit = Celcius_temperature * (9 / 5) + 32
print(Fahrenheit) |
n=int(input())
matrix=[0]*(n+1)
dp=[[[0]*2 for j in range(n+1)] for i in range(n+1)]
dp2=[[[0]*2 for j in range(n+1)] for i in range(n+1)]
for i in range(1,n+1):
matrix[i]=[0]
matrix[i].extend([*map(int,input().split())])
ans=0
for i in range(1,n+1):
for j in range(1,n+1):
dp[i][j][1]=dp2[i][j][1]=... | n = int(input())
matrix = [0] * (n + 1)
dp = [[[0] * 2 for j in range(n + 1)] for i in range(n + 1)]
dp2 = [[[0] * 2 for j in range(n + 1)] for i in range(n + 1)]
for i in range(1, n + 1):
matrix[i] = [0]
matrix[i].extend([*map(int, input().split())])
ans = 0
for i in range(1, n + 1):
for j in range(1, n + ... |
def readint():
while True:
try:
num = int(input('Insert a integer:'))
if type(num) == int:
return num
except:
print('\033[1;31mERROR: Please, insert a valid integer.\033[m')
| def readint():
while True:
try:
num = int(input('Insert a integer:'))
if type(num) == int:
return num
except:
print('\x1b[1;31mERROR: Please, insert a valid integer.\x1b[m') |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | project = 'Fortran Programming Language'
copyright = ''
author = ''
extensions = ['ablog', 'myst_parser', 'sphinx_panels', 'sphinx.ext.intersphinx']
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
html_theme = 'pydata_sphinx_theme'
html_static_path = ['_static']
html_css_files = ... |
def tem_bomba_direita(board, position):
if position + 1 >= len(board):
return False
if board[position+1] == "*":
return True
return False
def tem_bomba_esquerda(board, position):
if position - 1 < 0:
return False
if board[position-1] == "*":
return True
return F... | def tem_bomba_direita(board, position):
if position + 1 >= len(board):
return False
if board[position + 1] == '*':
return True
return False
def tem_bomba_esquerda(board, position):
if position - 1 < 0:
return False
if board[position - 1] == '*':
return True
retur... |
i01.integratedMovement.removeObject("pole")
i01.integratedMovement.removeAi("kinect",i01.integratedMovement.Ai.AVOID_COLLISION)
i01.rest()
sleep(3)
i01.integratedMovement.moveTo("rightArm",-300,500,400)
mouth.speakBlocking("Hello, I am vinmoov")
sleep(3)
i01.rest()
mouth.speakBlocking("I want to talk to you about a new... | i01.integratedMovement.removeObject('pole')
i01.integratedMovement.removeAi('kinect', i01.integratedMovement.Ai.AVOID_COLLISION)
i01.rest()
sleep(3)
i01.integratedMovement.moveTo('rightArm', -300, 500, 400)
mouth.speakBlocking('Hello, I am vinmoov')
sleep(3)
i01.rest()
mouth.speakBlocking('I want to talk to you about a... |
# Authors: David Mutchler, Dave Fisher, and many others before them.
print('Hello, World')
print('hi there')
print('one', 'two', 'through my shoe')
print(3 + 9)
print('3 + 9', 'versus', 3 + 9)
# done: After we talk together about the above, add PRINT statements that print:
# done: 1. A Hello message to a friend.
... | print('Hello, World')
print('hi there')
print('one', 'two', 'through my shoe')
print(3 + 9)
print('3 + 9', 'versus', 3 + 9)
print('hi mommy')
print('2345 + 3467 =', 2345 + 3467)
print('3607 * 34227 =', 3607 * 34227)
for x in range(10):
print('I Love You Daddy!')
for x in range(10):
print('I love you', x + 2) |
def removeDuplicates(nums):
n = len(nums)
mp = {}
for i in range(0 , n):
if nums[i] not in mp:
mp[nums[i]] = nums[i]
op = mp.keys()
return op
op = removeDuplicates([0,0,1,1,1,2,2,3,3,4])
print(op)
| def remove_duplicates(nums):
n = len(nums)
mp = {}
for i in range(0, n):
if nums[i] not in mp:
mp[nums[i]] = nums[i]
op = mp.keys()
return op
op = remove_duplicates([0, 0, 1, 1, 1, 2, 2, 3, 3, 4])
print(op) |
c.NotebookApp.open_browser = False
c.NotebookApp.ip='0.0.0.0' #'*'
c.NotebookApp.port = 8192
c.NotebookApp.password = u'sha1:45f7d7ac038c:c36b98f22eac5921c435095af65a9a00b0e1eeb9'
c.Authenticator.admin_users = {'jupyter'}
c.LocalAuthenticator.create_system_users = True
| c.NotebookApp.open_browser = False
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.port = 8192
c.NotebookApp.password = u'sha1:45f7d7ac038c:c36b98f22eac5921c435095af65a9a00b0e1eeb9'
c.Authenticator.admin_users = {'jupyter'}
c.LocalAuthenticator.create_system_users = True |
#Actividad 7 Ejercicios For
numeros = [1, 2, 3, 4, 5, 6, 7, 8 , 9, 10]
numeros2 = [1, 2, 3, 4, 5, 6, 7, 8 , 9, 10]
cadena="BIENVENIDOS"
indice=0
for letra in "UNIVERSIDAD ESTATAL DE SONORA":
print(letra)
else:
print("FIN DEL BUCLE")
for i in numeros:
print(i)
print("")
for x in numeros:
... | numeros = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
numeros2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
cadena = 'BIENVENIDOS'
indice = 0
for letra in 'UNIVERSIDAD ESTATAL DE SONORA':
print(letra)
else:
print('FIN DEL BUCLE')
for i in numeros:
print(i)
print('')
for x in numeros:
x *= 20
print(x)
for x in numeros:... |
# Kalman filter | KalmanFilter(VAR, EST_VAR)
STD_DEV = 0.075
VAR = 0.1
EST_VAR = STD_DEV ** 2
# PID
P_ = 3.6
I_ = 0.02
D_ = 0.6
PID_MIN_VAL = -50
PID_MAX_VAL = 50
| std_dev = 0.075
var = 0.1
est_var = STD_DEV ** 2
p_ = 3.6
i_ = 0.02
d_ = 0.6
pid_min_val = -50
pid_max_val = 50 |
class Solution:
def countGoodTriplets(self, arr: List[int], a: int, b: int, c: int) -> int:
s1=0
x=len(arr)
for i in range(x-2):
for j in range(i+1,x-1):
if abs(arr[i]-arr[j])<=a:
for k in range(j+1,x):
if abs(arr[j]-arr... | class Solution:
def count_good_triplets(self, arr: List[int], a: int, b: int, c: int) -> int:
s1 = 0
x = len(arr)
for i in range(x - 2):
for j in range(i + 1, x - 1):
if abs(arr[i] - arr[j]) <= a:
for k in range(j + 1, x):
... |
for i in range(int(input())):
x = list(map(int, input().split()))
x.sort()
print(x[-2])
| for i in range(int(input())):
x = list(map(int, input().split()))
x.sort()
print(x[-2]) |
#
# PySNMP MIB module VPMT-OPT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VPMT-OPT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:28:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection, constraints_union) ... |
# Define minimum distance threshold in map
dist_thresh = 0.5
scaling_factor = int(1 / dist_thresh)
# Define threshold around goal
goal_thresh = int(scaling_factor * 1.5)
# Define map size
width, height = 300, 200
map_size = (scaling_factor * height), (scaling_factor * width)
# Define all the possible no. of actions
max... | dist_thresh = 0.5
scaling_factor = int(1 / dist_thresh)
goal_thresh = int(scaling_factor * 1.5)
(width, height) = (300, 200)
map_size = (scaling_factor * height, scaling_factor * width)
max_actions = 5
half_actions = max_actions // 2
total_angle = 360
no_parent = -1
node_generated = 1
start_parent = -99 |
def outside(r, c, size):
if r < 0 or c < 0 or r >= size or c >= size:
return True
return False
def get_next_pos(r, c, command):
if command == 'up':
return r - 1, c
elif command == 'down':
return r + 1, c
elif command == 'left':
return r, c - 1
elif command == 'r... | def outside(r, c, size):
if r < 0 or c < 0 or r >= size or (c >= size):
return True
return False
def get_next_pos(r, c, command):
if command == 'up':
return (r - 1, c)
elif command == 'down':
return (r + 1, c)
elif command == 'left':
return (r, c - 1)
elif comman... |
# eradicate a destroyed file system snapshot named myfs.mysnap
client.delete_file_system_snapshots(names=["myfs.mysnap"])
# Other valid fields: ids
# See section "Common Fields" for examples
| client.delete_file_system_snapshots(names=['myfs.mysnap']) |
'''
The Olympic competitions between 1952 and 1988 took place during the height of the Cold War between the United States of America (USA) & the Union of Soviet Socialist Republics (USSR). Your goal in this exercise is to aggregate the number of distinct sports in which the USA and the USSR won medals during the Cold W... | """
The Olympic competitions between 1952 and 1988 took place during the height of the Cold War between the United States of America (USA) & the Union of Soviet Socialist Republics (USSR). Your goal in this exercise is to aggregate the number of distinct sports in which the USA and the USSR won medals during the Cold W... |
grades = int(input())
name_exam = str(input())
grade = int(input())
poor_grade = 0
pas = True
average = 0
problems_solved = 0
last_name_exam = str()
while name_exam != "Enough":
if int(grade) <= 4:
poor_grade += 1
if poor_grade == grades:
pas = False
break
problems_solved += 1
a... | grades = int(input())
name_exam = str(input())
grade = int(input())
poor_grade = 0
pas = True
average = 0
problems_solved = 0
last_name_exam = str()
while name_exam != 'Enough':
if int(grade) <= 4:
poor_grade += 1
if poor_grade == grades:
pas = False
break
problems_solved += 1
av... |
# Coding is all about making things easier for ourselves.
# Some times you will be writing the same code over and
# over again. When this happens, it is often best to write
# a function.
# functions are defined with the def keyword:
def paulsFunction():
# anything inside the function will execute when I call it
... | def pauls_function():
print('Hello! Nice function!')
pauls_function() |
def narcissistic(num):
sum = 0
iterableNum = str(num)
for i in iterableNum:
sum += int(i) ** len(iterableNum)
return True if sum == num else False
# One-liner:
def narcissistic2(num):
return num == sum(int(i) ** len(str(num)) for i in str(num)) | def narcissistic(num):
sum = 0
iterable_num = str(num)
for i in iterableNum:
sum += int(i) ** len(iterableNum)
return True if sum == num else False
def narcissistic2(num):
return num == sum((int(i) ** len(str(num)) for i in str(num))) |
def answer_type(request, json_list, nested):
for question in json_list:
if question['payload']['object_type'] == 'task_instance':
question['answer_class'] = 'task_answer'
| def answer_type(request, json_list, nested):
for question in json_list:
if question['payload']['object_type'] == 'task_instance':
question['answer_class'] = 'task_answer' |
# Solution 1
# def remove_duplicates(arr):
# val_tracker = {}
# for num in arr:
# if num not in arr:
# val_tracker[num] = 1
# else:
# print('True')
# return True
# print('False')
# return False
# Solution 2
def remove_duplicates(arr):
unique ... | def remove_duplicates(arr):
unique = set(arr)
if len(unique) != len(arr):
print('True')
return True
else:
print('False')
return False
test_arr = [1, 1, 1, 1, 2, 3, 4, 5, 5, 5]
answer_arr = set(test_arr)
remove_duplicates(test_arr) |
index = 1
result = 0
while index < 1000:
if index % 3 ==0 or index % 5 == 0:
result = result + index
index = index + 1
print(result) | index = 1
result = 0
while index < 1000:
if index % 3 == 0 or index % 5 == 0:
result = result + index
index = index + 1
print(result) |
class NoticeModel:
def __init__(self, dbRow):
self.ID = dbRow["ID"]
self.Message = dbRow["Message"]
self.Timestamp = dbRow["Timestamp"] | class Noticemodel:
def __init__(self, dbRow):
self.ID = dbRow['ID']
self.Message = dbRow['Message']
self.Timestamp = dbRow['Timestamp'] |
def keep_one_mRNA_with_same_stop_codon_position(f):
output = []
nameset = set()
with open(f, 'r') as FILE:
for line in FILE:
if line[0] == '#':
output.append(line.strip())
else:
s = line.strip().split('\t')
if s[6] ==... | def keep_one_m_rna_with_same_stop_codon_position(f):
output = []
nameset = set()
with open(f, 'r') as file:
for line in FILE:
if line[0] == '#':
output.append(line.strip())
else:
s = line.strip().split('\t')
if s[6] == '+':
... |
class Building(object):
def __init__(self, south, west, width_WE, width_NS, height=10):
self.south = south
self.west = west
self.width_WE = width_WE
self.width_NS = width_NS
self.height = height
def corners(self):
north_west = [self.south+self.width_NS, self.... | class Building(object):
def __init__(self, south, west, width_WE, width_NS, height=10):
self.south = south
self.west = west
self.width_WE = width_WE
self.width_NS = width_NS
self.height = height
def corners(self):
north_west = [self.south + self.width_NS, self.w... |
def bio(*args):
header = ["Name", "Roll no.", "Regd no.", "Branch", "Stream", "Sem", "Phone no.", "Address"]
for head, data in zip(header, args):
print("%-10s: %s"%(head, data))
bio("Md.Azharuddin", "36725", "1701105431", "CSE", "B.Tech", "7th", "9078600498", "Arad Bazar, Balasore") | def bio(*args):
header = ['Name', 'Roll no.', 'Regd no.', 'Branch', 'Stream', 'Sem', 'Phone no.', 'Address']
for (head, data) in zip(header, args):
print('%-10s: %s' % (head, data))
bio('Md.Azharuddin', '36725', '1701105431', 'CSE', 'B.Tech', '7th', '9078600498', 'Arad Bazar, Balasore') |
class Subscription(object):
def __init__(self, sid, subject, queue, callback, connetion):
self.sid = sid
self.subject = subject
self.queue = queue
self.connetion = connetion
self.callback = callback
self.received = 0
self.delivered = 0
self.bytes = 0
... | class Subscription(object):
def __init__(self, sid, subject, queue, callback, connetion):
self.sid = sid
self.subject = subject
self.queue = queue
self.connetion = connetion
self.callback = callback
self.received = 0
self.delivered = 0
self.bytes = 0
... |
class Animation():
def __init__(self):
self.vertex_n = 0
self.verticies = []
def get_coord(self, V_kind):
print("\n\t***\nFor vertex %s please enter:\n" % V_kind)
x = input('X: ')
y = input('Y: ')
z = input('Z: ')
pos = [x, y, z]
return pos
def add_Vertex(self):... | class Animation:
def __init__(self):
self.vertex_n = 0
self.verticies = []
def get_coord(self, V_kind):
print('\n\t***\nFor vertex %s please enter:\n' % V_kind)
x = input('X: ')
y = input('Y: ')
z = input('Z: ')
pos = [x, y, z]
return pos
de... |
with open("input.txt", "r") as f:
lines = [line.strip() for line in f.readlines()]
gamma = ""
epsilon = ""
for i in range(0, len(lines[0])):
zero = 0
one = 0
for line in lines:
if line[i] == "0":
zero += 1
else: one += 1
if(zero >... | with open('input.txt', 'r') as f:
lines = [line.strip() for line in f.readlines()]
gamma = ''
epsilon = ''
for i in range(0, len(lines[0])):
zero = 0
one = 0
for line in lines:
if line[i] == '0':
zero += 1
else:
one += 1
... |
COLOUR_CHOICES = [
('white', 'White'),
('grey', 'Grey'),
('blue', 'Blue'),
]
COLUMN_CHOICES = [
('12', 'Full Width'),
('11', '11/12'),
('10', '5/6'),
('9', 'Three Quarters'),
('8', 'Two Thirds'),
('7', '7/12'),
('6', 'Half Width'),
('5', '5/12'),
('4', 'One Third'),
... | colour_choices = [('white', 'White'), ('grey', 'Grey'), ('blue', 'Blue')]
column_choices = [('12', 'Full Width'), ('11', '11/12'), ('10', '5/6'), ('9', 'Three Quarters'), ('8', 'Two Thirds'), ('7', '7/12'), ('6', 'Half Width'), ('5', '5/12'), ('4', 'One Third'), ('3', 'One Quarter'), ('2', '1/6'), ('1', '1/12')]
langua... |
x = 1 # int
y = 2.8 # float
z = 1j # complex
# convert from int to float
a = float(x)
# convert from float to int
b = int(y)
# convert from int to complex
c = complex(x)
print(a)
print(b)
print(c)
print(type(a))
print(type(b))
print(type(c))
| x = 1
y = 2.8
z = 1j
a = float(x)
b = int(y)
c = complex(x)
print(a)
print(b)
print(c)
print(type(a))
print(type(b))
print(type(c)) |
class Identifier:
def __init__(self, id):
self.id = id
def eval(self, env):
if self.id in env:
return env[self.id]
else:
error("Referencing " + self.id + " before assignment")
def __repr__(self):
return "Identifier: {0}".format(self.i... | class Identifier:
def __init__(self, id):
self.id = id
def eval(self, env):
if self.id in env:
return env[self.id]
else:
error('Referencing ' + self.id + ' before assignment')
def __repr__(self):
return 'Identifier: {0}'.format(self.id) |
WORKERS = 50
RESULT_FILE = 'results.json'
ZIP_CODE_FILE = './reference/zips.csv'
| workers = 50
result_file = 'results.json'
zip_code_file = './reference/zips.csv' |
NAME = 'send_message.py'
ORIGINAL_AUTHORS = [
'Justin Walker'
]
ABOUT = '''
Sends a message to another channel.
'''
COMMANDS = '''
>>> .send #channel .u riceabove .m how are you?
Sends a message to #channel like
'IronPenguin from #channel says to riceabove: how are you?'
>>> .send #channel hi all
Sends a messag... | name = 'send_message.py'
original_authors = ['Justin Walker']
about = '\nSends a message to another channel.\n'
commands = '\n>>> .send #channel .u riceabove .m how are you?\nSends a message to #channel like\n\'IronPenguin from #channel says to riceabove: how are you?\'\n\n>>> .send #channel hi all\nSends a message to ... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def printList(self):
temp = self.head
while temp :
print(temp.data, end=" ")
temp = temp.next
def append(self, new_data):
new_node = Node(new_data)
if self.hea... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def print_list(self):
temp = self.head
while temp:
print(temp.data, end=' ')
temp = temp.next
def append(sel... |
class IUserCommandRepository:
def create_user(self, user):
pass
def update_user_auth_token(self, user_id, auth_token):
pass
def increment_user_score(self, user_id, score):
pass
| class Iusercommandrepository:
def create_user(self, user):
pass
def update_user_auth_token(self, user_id, auth_token):
pass
def increment_user_score(self, user_id, score):
pass |
out = []
push = out.append
concate = ' '.join
while True:
try:
a, b = [int(x) for x in input().split()]
except EOFError:
break
ans = []
ans_append = ans.append
for num in range(a, b+1):
num = str(num)
length = len(num)
check = str(sum(pow(int(x), length) for x... | out = []
push = out.append
concate = ' '.join
while True:
try:
(a, b) = [int(x) for x in input().split()]
except EOFError:
break
ans = []
ans_append = ans.append
for num in range(a, b + 1):
num = str(num)
length = len(num)
check = str(sum((pow(int(x), length) ... |
def characters_between(start: str, end: str):
start = ord(start)
end = ord(end)
if start < end:
for letter in range(start + 1, end):
print(chr(letter), end=' ')
else:
for i in range(end + 1, start, -1):
print(chr(i), end=' ')
a = input()
b = input()
characters_b... | def characters_between(start: str, end: str):
start = ord(start)
end = ord(end)
if start < end:
for letter in range(start + 1, end):
print(chr(letter), end=' ')
else:
for i in range(end + 1, start, -1):
print(chr(i), end=' ')
a = input()
b = input()
characters_bet... |
def solve(sudoku):
find = find_empty(sudoku)
if not find:
return True
else:
row, col = find
for i in range(1,10):
if valid(sudoku, i, (row, col)):
sudoku[row][col] = i
if solve(sudoku):
return True
sudoku[row][col] = 0
r... | def solve(sudoku):
find = find_empty(sudoku)
if not find:
return True
else:
(row, col) = find
for i in range(1, 10):
if valid(sudoku, i, (row, col)):
sudoku[row][col] = i
if solve(sudoku):
return True
sudoku[row][col] = 0
re... |
MONGODB_URI = "mongodb://localhost:27017"
MONGODB_DATABASE = 'Cose2'
MONGODB_USER_COLLECTION = 'users'
MONGODB_TOPIC_COLLECTION = 'topics'
MONGODB_COMMENT_COLLECTION = 'comments' | mongodb_uri = 'mongodb://localhost:27017'
mongodb_database = 'Cose2'
mongodb_user_collection = 'users'
mongodb_topic_collection = 'topics'
mongodb_comment_collection = 'comments' |
'''
Created on Mar 31, 2018
@author: Burkhard A. Meier
'''
# list with loop
loop_numbers = [] # create an empty list
for number in range(1, 101): # use for loop
loop_numbers.append(number) # append 100 numbers to list
print(loop_numbers)
# list compreh... | """
Created on Mar 31, 2018
@author: Burkhard A. Meier
"""
loop_numbers = []
for number in range(1, 101):
loop_numbers.append(number)
print(loop_numbers)
comp_numbers = [number for number in range(1, 101)]
print(comp_numbers)
comp_numbers_three = [number for number in range(1, 101) if number % 3 == 0]
print(comp_n... |
Rt = [[1,2,3 ], [2, 4, 5], [3,6,7], [4,8,9],[5,10,11],[6,12,13],[7,14,15]]
def findRoot(RT):
S = set()
for i in RT:
for j in i:
S.add( j )
print (S)
for i in RT :
for j in i[1:]:
S.remove( j )
print (S)
try :
for i in S :
... | rt = [[1, 2, 3], [2, 4, 5], [3, 6, 7], [4, 8, 9], [5, 10, 11], [6, 12, 13], [7, 14, 15]]
def find_root(RT):
s = set()
for i in RT:
for j in i:
S.add(j)
print(S)
for i in RT:
for j in i[1:]:
S.remove(j)
print(S)
try:
for i in S:
retval ... |
c.NbServer.base_url = '/paws-public/'
c.NbServer.bind_ip = '0.0.0.0'
c.NbServer.bind_port = 8000
c.NbServer.publisher_class = 'paws.PAWSPublisher'
c.NbServer.register_proxy = False
c.PAWSPublisher.base_path = '/data/project/paws/userhomes'
| c.NbServer.base_url = '/paws-public/'
c.NbServer.bind_ip = '0.0.0.0'
c.NbServer.bind_port = 8000
c.NbServer.publisher_class = 'paws.PAWSPublisher'
c.NbServer.register_proxy = False
c.PAWSPublisher.base_path = '/data/project/paws/userhomes' |
del_items(0x800A0E14)
SetType(0x800A0E14, "char StrDate[12]")
del_items(0x800A0E20)
SetType(0x800A0E20, "char StrTime[9]")
del_items(0x800A0E2C)
SetType(0x800A0E2C, "char *Words[118]")
del_items(0x800A1004)
SetType(0x800A1004, "struct MONTH_DAYS MonDays[12]")
| del_items(2148142612)
set_type(2148142612, 'char StrDate[12]')
del_items(2148142624)
set_type(2148142624, 'char StrTime[9]')
del_items(2148142636)
set_type(2148142636, 'char *Words[118]')
del_items(2148143108)
set_type(2148143108, 'struct MONTH_DAYS MonDays[12]') |
# Excel Column Number
# https://www.interviewbit.com/problems/excel-column-number/
#
# Given a column title as appears in an Excel sheet, return its corresponding
# column number.
#
# Example:
#
# A -> 1
#
# B -> 2
#
# C -> 3
#
# ...
#
# Z -> 26
#
# AA -> 27
#
# AB -> 28
#
# # # # # # # # # # # # # # # # # # # # # # # ... | class Solution:
def title_to_number(self, A):
res = 0
for char in A:
diff = ord(char) - ord('A') + 1
res = res * 26 + diff
return res
if __name__ == '__main__':
s = solution()
print(s.titleToNumber('AA'))
print(s.titleToNumber('A')) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.