content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
valores = input().split()
valores = list(map(int,valores))
h1, h2 = valores
if(h1 == h2):
print('O JOGO DUROU %d HORA(S)' %24)
else:
if(h2 < h1):
print('O JOGO DUROU %d HORA(S)' %((24 - h1) + h2))
else:
print('O JOGO DUROU %d HORA(S)' %(h2 - h1)) | valores = input().split()
valores = list(map(int, valores))
(h1, h2) = valores
if h1 == h2:
print('O JOGO DUROU %d HORA(S)' % 24)
elif h2 < h1:
print('O JOGO DUROU %d HORA(S)' % (24 - h1 + h2))
else:
print('O JOGO DUROU %d HORA(S)' % (h2 - h1)) |
def WriteOBJ(filename, vertrices, vts, vns, facesV, facesVt, facesVn):
f=file(filename,"w+")
for vertex in vertrices:
f.write("v ")
for i in range(len(vertex)):
f.write(str(vertex[i]))
f.write(" ")
f.write("\n")
if len(vts) != 0:
for vt in vts:
... | def write_obj(filename, vertrices, vts, vns, facesV, facesVt, facesVn):
f = file(filename, 'w+')
for vertex in vertrices:
f.write('v ')
for i in range(len(vertex)):
f.write(str(vertex[i]))
f.write(' ')
f.write('\n')
if len(vts) != 0:
for vt in vts:
... |
num1=10
num2=20
num3=30
num4=40
num5=50
num6=60
nihaoma=weijialan
| num1 = 10
num2 = 20
num3 = 30
num4 = 40
num5 = 50
num6 = 60
nihaoma = weijialan |
while True:
try:
chars = input()
# nums = int(chars)
level0 = ['zero']
level1 = ['','one','two','three','four','five','six', 'seven',' eight','nine', 'ten']
level1_1= ['','eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixten', 'seventeen', 'eighteen', 'nineteen']
... | while True:
try:
chars = input()
level0 = ['zero']
level1 = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', ' eight', 'nine', 'ten']
level1_1 = ['', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixten', 'seventeen', 'eighteen', 'nineteen']
level2 = ['',... |
items = [2, 25, 9]
divisor = 12
for item in items:
if item%divisor == 0:
found = item
break
else: # nobreak
items.append(divisor)
found = divisor
print("{items} contains {found} which is a multiple of {divisor}"
.format(**locals()))
| items = [2, 25, 9]
divisor = 12
for item in items:
if item % divisor == 0:
found = item
break
else:
items.append(divisor)
found = divisor
print('{items} contains {found} which is a multiple of {divisor}'.format(**locals())) |
class Solution:
def hIndex(self, citations):
n = len(citations)
at_least = [0] * (n + 2)
for c in citations:
at_least[min(c, n + 1)] += 1
for i in xrange(n, -1, -1):
at_least[i] += at_least[i + 1]
for i in xrange(n, -1, -1):
if... | class Solution:
def h_index(self, citations):
n = len(citations)
at_least = [0] * (n + 2)
for c in citations:
at_least[min(c, n + 1)] += 1
for i in xrange(n, -1, -1):
at_least[i] += at_least[i + 1]
for i in xrange(n, -1, -1):
if at_least[i... |
class ColumnRef:
table = ''
column = ''
cascade_row = None
def __init__(self, table, column, cascade_row=True):
# cascade_row=True means that row in table should be removed
# if value in column that owns reference is not found.
# i.e, reference from stop_times.stop_id to stops.... | class Columnref:
table = ''
column = ''
cascade_row = None
def __init__(self, table, column, cascade_row=True):
self.table = table
self.column = column
self.cascade_row = cascade_row |
"""
Author: Cameron Tee
A class keeping track of the game stats.
Only one life in Flappy Bird.
This class controls the game state (whether playing or not).
"""
class GameStats():
def __init__(self, settings):
"""
Initialise the gamestats object.
"""
self.settings = settings
self.reset_stats(... | """
Author: Cameron Tee
A class keeping track of the game stats.
Only one life in Flappy Bird.
This class controls the game state (whether playing or not).
"""
class Gamestats:
def __init__(self, settings):
"""
Initialise the gamestats object.
"""
self.settings = settings
self.reset_st... |
'''
URL: https://leetcode.com/problems/move-zeroes/
Difficulty: Easy
Title: Move Zeroes
'''
################### Code ###################
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
... | """
URL: https://leetcode.com/problems/move-zeroes/
Difficulty: Easy
Title: Move Zeroes
"""
class Solution:
def move_zeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
zero_count = 0
i = 0
while i < len(nums):
... |
numbers = [1,2,3,4,5,6,7,11]
res = 0
for num in numbers:
res = res + num
print("with sum: ",sum(numbers))
print("without sum: ",res) | numbers = [1, 2, 3, 4, 5, 6, 7, 11]
res = 0
for num in numbers:
res = res + num
print('with sum: ', sum(numbers))
print('without sum: ', res) |
def remove_duplicates(S: str) -> str:
r = S[0]
for i in range(1, len(S)):
if len(r) == 0:
r += S[i]
else:
if r[-1] == S[i]:
if len(r) == 1:
r = ''
else:
r = r[:-1]
else:
r ... | def remove_duplicates(S: str) -> str:
r = S[0]
for i in range(1, len(S)):
if len(r) == 0:
r += S[i]
elif r[-1] == S[i]:
if len(r) == 1:
r = ''
else:
r = r[:-1]
else:
r += S[i]
return r |
f1, f2 = map(float, input().split())
flutuacao = 1.0 * (1.0 + f1/100) * (1 + f2/100)
print("%.6f" % ((flutuacao - 1.0)*100)) | (f1, f2) = map(float, input().split())
flutuacao = 1.0 * (1.0 + f1 / 100) * (1 + f2 / 100)
print('%.6f' % ((flutuacao - 1.0) * 100)) |
class Primes:
def __init__(self, first, last=None):
self.curr = None
if last is None:
self.first = 2
self.last = first
else:
self.first = first
self.last = last
def __iter__(self):
return self
def __next__(self):
if s... | class Primes:
def __init__(self, first, last=None):
self.curr = None
if last is None:
self.first = 2
self.last = first
else:
self.first = first
self.last = last
def __iter__(self):
return self
def __next__(self):
if s... |
a, b = map(int, input().split())
while a != 0 and b != 0:
if a > 0 and b > 0:
print("primeiro")
elif a < 0 < b:
print("segundo")
elif a < 0 and b < 0:
print("terceiro")
elif a > 0 > b:
print("quarto")
a, b = map(int, input().split())
| (a, b) = map(int, input().split())
while a != 0 and b != 0:
if a > 0 and b > 0:
print('primeiro')
elif a < 0 < b:
print('segundo')
elif a < 0 and b < 0:
print('terceiro')
elif a > 0 > b:
print('quarto')
(a, b) = map(int, input().split()) |
# https://github.com/michal037
class Singleton:
def __new__(cls, *_, **__):
self = object.__new__(cls)
cls.__new__ = lambda *a, **b: self
return self
def singleton(self):
self.__class__.__new__ = lambda *c, **d: self
### EXAMPLE 1 ### EXAMPLE 1 ### EXAMPLE 1 ### EXAMPLE 1 ### EXAMPLE 1 ##########
class My... | class Singleton:
def __new__(cls, *_, **__):
self = object.__new__(cls)
cls.__new__ = lambda *a, **b: self
return self
def singleton(self):
self.__class__.__new__ = lambda *c, **d: self
class Myclass(Singleton):
def __init__(self, a, *args, **kwargs):
self.val = a... |
"""
Write a function, connected_components_count, that takes in the adjacency list of an undirected graph.
The function should return the number of connected components within the graph.
depth first
n = number of nodes
e = number edges
Time: O(e)
Space: O(n)
"""
def count(graph):
visited = set()
count = 0
... | """
Write a function, connected_components_count, that takes in the adjacency list of an undirected graph.
The function should return the number of connected components within the graph.
depth first
n = number of nodes
e = number edges
Time: O(e)
Space: O(n)
"""
def count(graph):
visited = set()
count = 0
... |
class TriggerPool:
def __init__(self):
self.triggers = [] # Trigger list
self.results = [] # Result list
def add(self, trigger):
"""add one trigger to the pool"""
self.triggers.append(trigger)
def test(self, model, data):
"""test untested triggers"""
... | class Triggerpool:
def __init__(self):
self.triggers = []
self.results = []
def add(self, trigger):
"""add one trigger to the pool"""
self.triggers.append(trigger)
def test(self, model, data):
"""test untested triggers"""
untested_triggers = range(len(self.... |
def climbStairs(n: int) -> int:
stairs = [1, 1]
for i in range(2, n + 1):
stairs.append(stairs[-1] + stairs[-2])
return stairs[n] | def climb_stairs(n: int) -> int:
stairs = [1, 1]
for i in range(2, n + 1):
stairs.append(stairs[-1] + stairs[-2])
return stairs[n] |
text=input('Enter and check if your input is a palindrome or not: ')
ltext=text.lower()
rtext="".join((reversed(ltext)))
if rtext==ltext:
print('Your input is a palindrome.')
else:
print('Your input is not a palindrome.') | text = input('Enter and check if your input is a palindrome or not: ')
ltext = text.lower()
rtext = ''.join(reversed(ltext))
if rtext == ltext:
print('Your input is a palindrome.')
else:
print('Your input is not a palindrome.') |
"""
Running Successfully
import unittest
import math
from PIL import Image
from SyntheticDataset2.ImageCreator.specified_target_with_background import SpecifiedTargetWithBackground
class SpecifiedTargetWithBackgroundTestCase(unittest.TestCase):
def setUp(self):
self.path_to_background = "tests/images/com... | """
Running Successfully
import unittest
import math
from PIL import Image
from SyntheticDataset2.ImageCreator.specified_target_with_background import SpecifiedTargetWithBackground
class SpecifiedTargetWithBackgroundTestCase(unittest.TestCase):
def setUp(self):
self.path_to_background = "tests/images/com... |
def kmp(s):
p = [-1]
k = -1
for c in s:
while k >= 0 and s[k] != c:
k = p[k]
k += 1
p.append(k)
return p
def period(s):
k = len(s) - kmp(s)[-1]
if len(s) % k == 0:
return k
return len(s)
s = input()
m = int(input())
p = period(s)
print(m // p % (10**9 + 7))
| def kmp(s):
p = [-1]
k = -1
for c in s:
while k >= 0 and s[k] != c:
k = p[k]
k += 1
p.append(k)
return p
def period(s):
k = len(s) - kmp(s)[-1]
if len(s) % k == 0:
return k
return len(s)
s = input()
m = int(input())
p = period(s)
print(m // p % (1... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def split(self, head):
slow = head
fast = head
slow_pre = head
while fast and fast.next:
slow_pre = slow
... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def split(self, head):
slow = head
fast = head
slow_pre = head
while fast and fast.next:
slow_pre = slow
(slow, fast) = (slow.next, fas... |
"""
File: circulararray.py
Author: Brian Atwell
Date: August 21, 2018
Descrioption: This a python implementation of a circular array using a list.
This implementation could be used as a queue or an array.
Copyright (c) 2018, Brian Atwell
All rights reserved.
Redistribution and use in source and binary forms, with or... | """
File: circulararray.py
Author: Brian Atwell
Date: August 21, 2018
Descrioption: This a python implementation of a circular array using a list.
This implementation could be used as a queue or an array.
Copyright (c) 2018, Brian Atwell
All rights reserved.
Redistribution and use in source and binary forms, with or... |
def solve(arr, duration):
if len(arr) == 0:
return 0
result = 0
start = arr[0]
for i in range(1, len(arr)):
if arr[i] - arr[i - 1] > duration:
result += arr[i - 1] + duration - start
start = arr[i]
result += arr[-1] + duration - start
return result
A ... | def solve(arr, duration):
if len(arr) == 0:
return 0
result = 0
start = arr[0]
for i in range(1, len(arr)):
if arr[i] - arr[i - 1] > duration:
result += arr[i - 1] + duration - start
start = arr[i]
result += arr[-1] + duration - start
return result
a = [1,... |
class Solution:
def setZeroes(self, matrix):
rows, cols = set(), set()
for i, r in enumerate(matrix):
for j, c in enumerate(r):
if c == 0:
rows.add(i)
cols.add(j)
l = len(matrix[0])
for r in rows:
matrix... | class Solution:
def set_zeroes(self, matrix):
(rows, cols) = (set(), set())
for (i, r) in enumerate(matrix):
for (j, c) in enumerate(r):
if c == 0:
rows.add(i)
cols.add(j)
l = len(matrix[0])
for r in rows:
... |
""" Base Controller for interacting with the Scene """
class BaseController:
def __init__(self):
super(BaseController, self).__init__()
def start(self):
raise NotImplementedError()
def reset(self, scene_name=None):
raise NotImplementedError()
def step(self, acti... | """ Base Controller for interacting with the Scene """
class Basecontroller:
def __init__(self):
super(BaseController, self).__init__()
def start(self):
raise not_implemented_error()
def reset(self, scene_name=None):
raise not_implemented_error()
def step(self, action, raise... |
counter = 0
b = 106700
c = 123700
step = 17
for target in range(b, c + step, step):
flag = False
d = 2
while d != target:
e = target // d
if e < d:
break
if target % d == 0:
flag = True
#print("d: {0:d} e: {1:d} b: {2:d}".format(d, e, target))
break
... | counter = 0
b = 106700
c = 123700
step = 17
for target in range(b, c + step, step):
flag = False
d = 2
while d != target:
e = target // d
if e < d:
break
if target % d == 0:
flag = True
break
d += 1
if flag:
counter += 1
els... |
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def sayHello(self):
print("Hello my name is {} and I am {} years old".format(self.name, self.age))
worker = Person("Alina", 21)
print(worker.age)
print(worker.name)
worker.sayHello() | class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def say_hello(self):
print('Hello my name is {} and I am {} years old'.format(self.name, self.age))
worker = person('Alina', 21)
print(worker.age)
print(worker.name)
worker.sayHello() |
def partition(a,l,r):
#assert: Previous proof but partitions between l and r
# It considers the first element as a pivot and moves all smaller element to left of it and greater elements to right
x=a[l]
n=len(a)
i=l
j=r
while(i<j):
if a[i]>=x and a[j]<=x:
a[i],a[j... | def partition(a, l, r):
x = a[l]
n = len(a)
i = l
j = r
while i < j:
if a[i] >= x and a[j] <= x:
(a[i], a[j]) = (a[j], a[i])
i += 1
j -= 1
elif a[i] < x:
i += 1
else:
j -= 1
return (a, i)
def kth(a, l, r, k):
... |
user_createaccount = []# Empty user_create account
class User:
def __init__(self,username,password,email):
"""
created insatances of the user class
"""
self.username = username
self.email = email
self.password = password
User.user = {"username":self.usernam... | user_createaccount = []
class User:
def __init__(self, username, password, email):
"""
created insatances of the user class
"""
self.username = username
self.email = email
self.password = password
User.user = {'username': self.username, 'email': self.email, ... |
'''
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
You should preserve the original relative order of the nodes in each of the two partitions.
Example:
Input: head = 1->4->3->2->5->2, x = 3
Output: 1->2->2->4->3->5
Runtime: 20 ms, faster... | """
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
You should preserve the original relative order of the nodes in each of the two partitions.
Example:
Input: head = 1->4->3->2->5->2, x = 3
Output: 1->2->2->4->3->5
Runtime: 20 ms, faster... |
# coding=utf-8
# See main file for licence
# pylint: disable=W0401,W0403
#
# by Mazoea s.r.o.
#
"""
Tesseract constants.
"""
size_of_int32 = 4
NUM_CP_BUCKETS = 24
CLASSES_PER_CP = 32
NUM_BITS_PER_CLASS = 2
BITS_PER_WERD = (8 * size_of_int32)
BITS_PER_CP_VECTOR = (CLASSES_PER_CP * NUM_BITS_PER_CLASS)
WERDS_PER_CP... | """
Tesseract constants.
"""
size_of_int32 = 4
num_cp_buckets = 24
classes_per_cp = 32
num_bits_per_class = 2
bits_per_werd = 8 * size_of_int32
bits_per_cp_vector = CLASSES_PER_CP * NUM_BITS_PER_CLASS
werds_per_cp_vector = BITS_PER_CP_VECTOR / BITS_PER_WERD
class_pruner_struct_size = NUM_CP_BUCKETS * NUM_CP_BUCKETS... |
# Copyright 2020 Rubrik, Inc.
#
# 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, distri... | """
Collection of methods for live mount of a virtual machine.
"""
error_messages = {'INVALID_FIELD_TYPE': "'{}' is an invalid value for '{}'. Value must be in {}.", 'REQUIRED_ARGUMENT': '{} field is required.', 'REQUIRED_KEYS_IN_CONFIG': 'Config field should contain datastoreId, hostId or clusterId and snapshotId.', '... |
def factorial(n):
fact=1
for i in range(1,n+1):
fact*=i
print(fact)
factorial(5)
| def factorial(n):
fact = 1
for i in range(1, n + 1):
fact *= i
print(fact)
factorial(5) |
print('''@#############################################################MMMMMMMMMMMMMMMMMMBBBBMMMMBB&AMBAHM###MMMMMMM#
@hG&&AA&&A&G&&&&GG&AA&&&&&AAAAAA&&&G&&&GGhh&AAAG93XX39h93X225iiiS5SSSSSSSiSiSSisssssiisssi:.;s;iXX25Sii25SSA
@hAAHAAHAHAAAAAAAAAAAAAAAAAAAAAAAHHHAAAG&&3Ssi5G&GG&&GG9333X2552222222255525rrSSS55SSSiSS5X;:... | print('@#############################################################MMMMMMMMMMMMMMMMMMBBBBMMMMBB&AMBAHM###MMMMMMM#\n@hG&&AA&&A&G&&&&GG&AA&&&&&AAAAAA&&&G&&&GGhh&AAAG93XX39h93X225iiiS5SSSSSSSiSiSSisssssiisssi:.;s;iXX25Sii25SSA\n@hAAHAAHAHAAAAAAAAAAAAAAAAAAAAAAAHHHAAAG&&3Ssi5G&GG&&GG9333X2552222222255525rrSSS55SSSiSS5X;:... |
class InvalidTraceHeader(Exception):
"""Thrown if a bad trace header was passed in."""
class InvalidMessageID(Exception):
"""Thrown if a bad message id was passed in."""
| class Invalidtraceheader(Exception):
"""Thrown if a bad trace header was passed in."""
class Invalidmessageid(Exception):
"""Thrown if a bad message id was passed in.""" |
# SETTINGS FILE
# TOKEN - discord app token
# BOT PREFIX - no explanation needed (uhh I think)
# API_AUTH - hypixel api auth
# DB_CLIENT - your DB URI
# DB_NAME - no explanation needed
# APPLICATION_ID - discord app id
TOKEN=''
BOT_PREFIX='$'
API_AUTH=''
DB_CLIENT = ''
DB_NAME = ''
APPLICATION_ID=''
| token = ''
bot_prefix = '$'
api_auth = ''
db_client = ''
db_name = ''
application_id = '' |
# -*- coding: utf-8 -*-
class Symbol(object):
def __init__(self, symbol):
self.number = int(symbol['number'])
self.numberEx = int(symbol['numberEx'])
self.name = symbol['name']
self.var = symbol['var']
def __str__(self):
return '\t\t\t\tNumber: {0} \n\t\t\t\tNu... | class Symbol(object):
def __init__(self, symbol):
self.number = int(symbol['number'])
self.numberEx = int(symbol['numberEx'])
self.name = symbol['name']
self.var = symbol['var']
def __str__(self):
return '\t\t\t\tNumber: {0} \n\t\t\t\tNumberEx: {1} \n\t\t\t\tName: {2} \... |
def mutate(soup):
paragraphs = get_max_paragraph_set(soup)
headline = soup.find('h1')
html = str(headline) + '\n'
for paragraph in paragraphs:
html += str(paragraph) + '\n'
return html
def get_max_paragraph_set(soup):
paragraph_map = build_paragraph_map(soup)
key = get_max_key(paragraph_map)
if key is None:... | def mutate(soup):
paragraphs = get_max_paragraph_set(soup)
headline = soup.find('h1')
html = str(headline) + '\n'
for paragraph in paragraphs:
html += str(paragraph) + '\n'
return html
def get_max_paragraph_set(soup):
paragraph_map = build_paragraph_map(soup)
key = get_max_key(parag... |
a = 3
while a >= 3:
print("CSK Wins")
break
user_input = input('Enter City')
while user_input == 'Chennai':
print('Chennai pasanga da')
break
user_in = input('Enter Country')
while type(user_in) == str:
if user_in == 'India':
print('India is the best')
break
else:
pri... | a = 3
while a >= 3:
print('CSK Wins')
break
user_input = input('Enter City')
while user_input == 'Chennai':
print('Chennai pasanga da')
break
user_in = input('Enter Country')
while type(user_in) == str:
if user_in == 'India':
print('India is the best')
break
else:
print('... |
letters = 'aeiou'
txt = input("Podaj tekst: ")
txt = txt.casefold()
count = {}.fromkeys(letters,0)
for ch in txt:
if ch in count:
count[ch] +=1
print(count)
| letters = 'aeiou'
txt = input('Podaj tekst: ')
txt = txt.casefold()
count = {}.fromkeys(letters, 0)
for ch in txt:
if ch in count:
count[ch] += 1
print(count) |
"""
Theory
> Instance vs Class
> Attributes, methods, inheritance, polymorphism
"""
class Scout():
pass
ratarca = Scout() | """
Theory
> Instance vs Class
> Attributes, methods, inheritance, polymorphism
"""
class Scout:
pass
ratarca = scout() |
#!/usr/bin/python3
class Line:
def __init__(self, x1, y1, x2, y2):
self.x1 = int(x1)
self.y1 = int(y1)
self.x2 = int(x2)
self.y2 = int(y2)
self.rangex = abs(self.x2 - self.x1)
self.rangey = abs(self.y2 - self.y1)
def print(self):
print(str(self.x1) + "," ... | class Line:
def __init__(self, x1, y1, x2, y2):
self.x1 = int(x1)
self.y1 = int(y1)
self.x2 = int(x2)
self.y2 = int(y2)
self.rangex = abs(self.x2 - self.x1)
self.rangey = abs(self.y2 - self.y1)
def print(self):
print(str(self.x1) + ',' + str(self.y1) + '... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
# handle exceptions
if head==None or head.next==None:
re... | class Solution:
def delete_duplicates(self, head: ListNode) -> ListNode:
if head == None or head.next == None:
return head
prehead = list_node(val=-1000, next=head)
pre = prehead
curr = head
post = head.next
counter = 1
while post:
whi... |
# -*- coding: utf-8 -*-
# Author: Daniel Yang <daniel.yj.yang@gmail.com>
#
# License: BSD 3 clause
def demo():
# reference: https://scikit-learn.org/stable/modules/classes.html#module-sklearn.cluster
# https://scikit-learn.org/stable/modules/clustering.html
pass
| def demo():
pass |
# Event: LCCS Python Fundamental Skills Workshop
# Date: May 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Purpose: A program to demonstrate how to create lists
# Lists can be created with data (each value is a list element)
boysNames = ['John', 'Jim', 'Alex', 'Fred']
girlsNames = ['Sarah... | boys_names = ['John', 'Jim', 'Alex', 'Fred']
girls_names = ['Sarah', 'Alex', 'Pat', 'Mary']
favourite_songs = ['Moondance', 'Linger', 'Stairway to Heaven']
fruits = ['Strawberry', 'Lemon', 'Orange', 'Raspberry', 'Cherry']
vehicle_count = [0, 0, 0, 0, 0, 0]
account_details = [1234, 'xyz', 'Alex', '1 Main Street', 827.56... |
NL = b'\n'
DATA_SIZE = 4
FRAME_SIZE = 4
HEADER_SIZE = DATA_SIZE + FRAME_SIZE
TIMESTAMP_SIZE = 8
ATTEMPTS_SIZE = 2
MSG_ID_SIZE = 16
MSG_HEADER = TIMESTAMP_SIZE + ATTEMPTS_SIZE + MSG_ID_SIZE
| nl = b'\n'
data_size = 4
frame_size = 4
header_size = DATA_SIZE + FRAME_SIZE
timestamp_size = 8
attempts_size = 2
msg_id_size = 16
msg_header = TIMESTAMP_SIZE + ATTEMPTS_SIZE + MSG_ID_SIZE |
def run(df, docs):
for doc in docs:
doc.start("t11 - Transform Unique Id", df)
# Creates a unique id
df['nProcesso_agrupamento'] = str(df['nProcesso']) + '_' + str(df['agrupamento'])
for doc in docs:
doc.end(df)
return df
| def run(df, docs):
for doc in docs:
doc.start('t11 - Transform Unique Id', df)
df['nProcesso_agrupamento'] = str(df['nProcesso']) + '_' + str(df['agrupamento'])
for doc in docs:
doc.end(df)
return df |
numbers = [9, 8, 72, 22, 21, 81, 2, 1, 11, 76, 32, 54]
def highest_num(numbers_in):
highest = numbers_in[0]
for count in range(len(numbers_in)):
if highest < numbers_in[count]:
highest = numbers_in[count]
return highest
highest_out = highest_num(numbers)
print("The highest number... | numbers = [9, 8, 72, 22, 21, 81, 2, 1, 11, 76, 32, 54]
def highest_num(numbers_in):
highest = numbers_in[0]
for count in range(len(numbers_in)):
if highest < numbers_in[count]:
highest = numbers_in[count]
return highest
highest_out = highest_num(numbers)
print('The highest number is', h... |
with (a, c,):
pass
with (a as b, c):
pass
async with (a, c,):
pass
async with (a as b, c):
pass
| with a, c:
pass
with a as b, c:
pass
async with a, c:
pass
async with a as b, c:
pass |
class FilasColumnas:
def __init__(self, nombre, filas, columnas):
self.nombre = nombre
self.filas = filas
self.columnas = columnas
def getNombre(self):
return self.nombre
def getFilas(self):
return self.filas
def getColumnas(self):
return s... | class Filascolumnas:
def __init__(self, nombre, filas, columnas):
self.nombre = nombre
self.filas = filas
self.columnas = columnas
def get_nombre(self):
return self.nombre
def get_filas(self):
return self.filas
def get_columnas(self):
return self.filas |
#!/usr/bin/env python
# coding: utf-8
# Write a function to which would return the greatest common of factor.
#
# <b> Input : 18, 27</b>
#
# <b> return: 9 </b>
#
#
# In[1]:
# Get the smallest of the both inputs
# Loop through the find the GCD#
def gcd(x,y):
small=min(x,y)
for i in range(1,small+1):
... | def gcd(x, y):
small = min(x, y)
for i in range(1, small + 1):
if x % i == 0 and y % i == 0:
gcd = i
return gcd
print(gcd(18, 27))
def gcd(x, y):
small = min(x, y)
print('x', x)
print('y', y)
print('small', small)
for i in range(1, small + 1):
if x % i == 0 a... |
peple = ["gilbert", "david", "richard"]
print("welcome to my parlor, " + peple[0])
print("welcome to my parlor, " + peple[1])
print("welcome to my parlor, " + peple[2])
print("richard is too stupid to come, so his not comming.")
peple = ["gilbert", "david"]
print("welcome to my parlor, " + peple[0])
print("wel... | peple = ['gilbert', 'david', 'richard']
print('welcome to my parlor, ' + peple[0])
print('welcome to my parlor, ' + peple[1])
print('welcome to my parlor, ' + peple[2])
print('richard is too stupid to come, so his not comming.')
peple = ['gilbert', 'david']
print('welcome to my parlor, ' + peple[0])
print('welcome to m... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyNvidiaMlPy(PythonPackage):
"""Python Bindings for the NVIDIA Management Library."""
homepage = "http://w... | class Pynvidiamlpy(PythonPackage):
"""Python Bindings for the NVIDIA Management Library."""
homepage = 'http://www.nvidia.com/'
url = 'https://pypi.io/packages/source/n/nvidia-ml-py/nvidia-ml-py-11.450.51.tar.gz'
version('11.450.51', sha256='5aa6dd23a140b1ef2314eee5ca154a45397b03e68fd9ebc4f72005979f511c... |
BINDING_ADDRESS = ':1080' # <ADDRESS>:<PORT>
BINDING_PORT = 1080
LOCAL_CERT_FILE = './local.pem'
REMOTE_CERT_FILE = './remote.pem'
BACKLOG = 128
LOG_LEVEL = 'info'
BLOCK_SIZE = 2048 # in bytes
STAFF_BINDING_ADDRESS = '127.0.0.1'
STAFF_TCP_PORT = 32000
STAFF_UDP_PORT = 32000
STAFF_PROXY = '127.0.0.1:1080' ... | binding_address = ':1080'
binding_port = 1080
local_cert_file = './local.pem'
remote_cert_file = './remote.pem'
backlog = 128
log_level = 'info'
block_size = 2048
staff_binding_address = '127.0.0.1'
staff_tcp_port = 32000
staff_udp_port = 32000
staff_proxy = '127.0.0.1:1080'
staff_dns = '8.8.8.8:53,8.8.4.4:53'
staff_dn... |
def return_after_n_recursion_one(n):
return_after_n_recursion_one(n-1)
def return_after_n_recursion_two(n):
if n < 3: # Base return: identify a condition after which you will start returning
return 'Cap'
return_after_n_recursion_two(n-1)
def return_after_n_recursion(n):
if n < 3: # Base retu... | def return_after_n_recursion_one(n):
return_after_n_recursion_one(n - 1)
def return_after_n_recursion_two(n):
if n < 3:
return 'Cap'
return_after_n_recursion_two(n - 1)
def return_after_n_recursion(n):
if n < 3:
return 'Cap'
return return_after_n_recursion(n - 1)
if __name__ == '__... |
def KadaneAlgo(alist, start, end):
#Returns (l, r, m) such that alist[l:r] is the maximum subarray in
#A[start:end] with sum m. Here A[start:end] means all A[x] for start <= x <
#end.
max_ending_at_i = max_seen_so_far = alist[start]
max_left_at_i = max_left_so_far = start
# max_right_at_i is alw... | def kadane_algo(alist, start, end):
max_ending_at_i = max_seen_so_far = alist[start]
max_left_at_i = max_left_so_far = start
max_right_so_far = start + 1
for i in range(start + 1, end):
if max_ending_at_i > 0:
max_ending_at_i += alist[i]
else:
max_ending_at_i = al... |
# to allow api client save environment state to database.
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
# we use cached_db backend for longlive and fast sessions.
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
SESSION_COOKIE_NAME = 'sid'
SESSION_COOKIE_AGE = 86400 * 60 # 2... | session_serializer = 'django.contrib.sessions.serializers.PickleSerializer'
session_engine = 'django.contrib.sessions.backends.cached_db'
session_cookie_name = 'sid'
session_cookie_age = 86400 * 60
if PRODUCTION:
session_cookie_domain = '.{{project_name}}.com' |
class GraphNode(object):
def __init__(self, val):
self.value = val
self.children = []
def add_child(self, new_node):
self.children.append(new_node)
def remove_child(self, del_node):
if del_node in self.children:
self.children.remove(del_node)
class... | class Graphnode(object):
def __init__(self, val):
self.value = val
self.children = []
def add_child(self, new_node):
self.children.append(new_node)
def remove_child(self, del_node):
if del_node in self.children:
self.children.remove(del_node)
class Graph(objec... |
x = 'Hello "Prayuth"' # Single-Quote
y = "Good Bye! 'Prayuth'" # Double-Quote
z = x + y
print(x)
print(y)
print(z) | x = 'Hello "Prayuth"'
y = "Good Bye! 'Prayuth'"
z = x + y
print(x)
print(y)
print(z) |
# built in
def hammingWeight(self, n):
"""
:type n: int
:rtype: int
"""
return bin(n).count('1')
# Using bit operation to cancel a 1 in each round
# Think of a number in binary n = XXXXXX1000, n - 1 is XXXXXX0111. n & (n - 1) will be XXXXXX0000
# which is just remove the last significant 1
def h... | def hamming_weight(self, n):
"""
:type n: int
:rtype: int
"""
return bin(n).count('1')
def hamming_weight(self, n):
"""
:type n: int
:rtype: int
"""
c = 0
while n:
n &= n - 1
c += 1
return c
class Solution:
def hamming_weight(self, n: int) -> int:
... |
class Solution:
def findMedianSortedArrays(self, nums1, nums2) -> float:
x = len(nums1)
y = len(nums2)
if y < x:
# Making sure nums1 is the smaller length array
return self.findMedianSortedArrays(nums2, nums1)
maxV = float('inf')
minV = float('-inf')
... | class Solution:
def find_median_sorted_arrays(self, nums1, nums2) -> float:
x = len(nums1)
y = len(nums2)
if y < x:
return self.findMedianSortedArrays(nums2, nums1)
max_v = float('inf')
min_v = float('-inf')
(start, end, median) = (0, x, 0)
while ... |
def substring_match(T, S):
"""
Simple substring matching.
O(|S| * |T - S|) Time
O(1) Space
"""
return any([T[idx:idx+len(S)] == S for idx in range(len(T) - len(S) + 1)])
"""
for idx in range(len(T) - len(S) + 1):
print(T[idx:idx + len(S)], S)
if T[idx:idx + len(S)] == S:
return True
retur... | def substring_match(T, S):
"""
Simple substring matching.
O(|S| * |T - S|) Time
O(1) Space
"""
return any([T[idx:idx + len(S)] == S for idx in range(len(T) - len(S) + 1)])
'\n for idx in range(len(T) - len(S) + 1):\n print(T[idx:idx + len(S)], S)\n if T[idx:idx + len(S)] == S:\n return True... |
def user_has_reporting_location(user):
sql_location = user.sql_location
if not sql_location:
return False
return not sql_location.location_type.administrative
| def user_has_reporting_location(user):
sql_location = user.sql_location
if not sql_location:
return False
return not sql_location.location_type.administrative |
class Solution:
def canCompleteCircuit(self, gas, cost):
sum = 0
total = 0
start = 0
for i in range(len(gas)):
total += (gas[i] - cost[i])
if sum < 0:
sum = gas[i] - cost[i]
start = i
else:
sum += (ga... | class Solution:
def can_complete_circuit(self, gas, cost):
sum = 0
total = 0
start = 0
for i in range(len(gas)):
total += gas[i] - cost[i]
if sum < 0:
sum = gas[i] - cost[i]
start = i
else:
sum += ga... |
"""
Author: Xavid Ramirez
Email: xavid.ramirez01@utrgv.edu
Date: November 2, 2016
Desc: Hamming word encoding and decoding program. The python program
Will take either a set of bits to encode or decode. Encode will
encode the bits into Hamming Encoding. Decoding will check the
given bits, check the par... | """
Author: Xavid Ramirez
Email: xavid.ramirez01@utrgv.edu
Date: November 2, 2016
Desc: Hamming word encoding and decoding program. The python program
Will take either a set of bits to encode or decode. Encode will
encode the bits into Hamming Encoding. Decoding will check the
given bits, check the par... |
def encrypt(text,s):
result = ""
# transverse the plain text
for i in range(len(text)):
char = text[i]
# Encrypt uppercase characters in plain text
if (char.isupper()):
result += chr((ord(char) + s-65) % 26 + 65)
# Encrypt lowercase characters in plain text
... | def encrypt(text, s):
result = ''
for i in range(len(text)):
char = text[i]
if char.isupper():
result += chr((ord(char) + s - 65) % 26 + 65)
else:
result += chr((ord(char) + s - 97) % 26 + 97)
return result
text = 'ATTACKATONCYE'
s = 4
print('Plain Text : ... |
def amount_of_elements_smaller(matrix, i, j):
'''Count the amount of elements smaller than m[i][j] in the (square) matrix.
Each column and row is sorted in ascending order.
>>> amount_of_elements_smaller([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1)
4
'''
size = len(matrix)
assert size == len(ma... | def amount_of_elements_smaller(matrix, i, j):
"""Count the amount of elements smaller than m[i][j] in the (square) matrix.
Each column and row is sorted in ascending order.
>>> amount_of_elements_smaller([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1)
4
"""
size = len(matrix)
assert size == len(ma... |
class FieldTypeError(Exception):
"""Value has wrong datatype"""
pass
class ToManyMatchesError(Exception):
"""Found multiple Nodes instead of one."""
pass
class DoesNotExist(Exception):
"""Object Does not exist."""
pass
class RelationshipMatchError(Exception):
"""Err with Relationships.... | class Fieldtypeerror(Exception):
"""Value has wrong datatype"""
pass
class Tomanymatcheserror(Exception):
"""Found multiple Nodes instead of one."""
pass
class Doesnotexist(Exception):
"""Object Does not exist."""
pass
class Relationshipmatcherror(Exception):
"""Err with Relationships."""... |
# coding: utf-8
# __The Data Set__
# In[1]:
r = open('la_weather.csv', 'r')
# In[2]:
w = r.read()
# In[3]:
w_list = w.split('\n')
# In[4]:
weather = []
for w in w_list:
wt = w.split(',')
weather.append(wt)
weather[:5]
# In[5]:
del weather[0]
# In[6]:
col_weather = []
for w in weather:
... | r = open('la_weather.csv', 'r')
w = r.read()
w_list = w.split('\n')
weather = []
for w in w_list:
wt = w.split(',')
weather.append(wt)
weather[:5]
del weather[0]
col_weather = []
for w in weather:
col_weather.append(w[1])
col_weather[:5]
first_element = col_weather[0]
first_element
last_element = col_weathe... |
URL_CONFIG ="www.python.org"
DEFAULT_VALUE = 1
DEFAULT_CONSTANT = 0
| url_config = 'www.python.org'
default_value = 1
default_constant = 0 |
class Solution:
def reverse(self, x: int) -> int:
negative = x<0
x = abs(x)
reversed = 0
while x!= 0:
reversed = reversed*10 + x%10
x //= 10
if reversed > 2**31-1:
return 0
return reversed if not negative else... | class Solution:
def reverse(self, x: int) -> int:
negative = x < 0
x = abs(x)
reversed = 0
while x != 0:
reversed = reversed * 10 + x % 10
x //= 10
if reversed > 2 ** 31 - 1:
return 0
return reversed if not negative else -reversed |
""" modules for income tax """
# import datetime
class TaxReturn:
""" Tax return class """
def hello(self, x):
print("hello ", x)
print("Hi")
taxreturn = TaxReturn()
taxreturn.hello("monkey")
| """ modules for income tax """
class Taxreturn:
""" Tax return class """
def hello(self, x):
print('hello ', x)
print('Hi')
taxreturn = tax_return()
taxreturn.hello('monkey') |
# type: ignore
__all__ = [
"meshc",
"barh",
"trisurf",
"compass",
"isonormals",
"plotutils",
"ezcontour",
"streamslice",
"scatter",
"rgb2ind",
"usev6plotapi",
"quiver",
"streamline",
"triplot",
"tetramesh",
"rose",
"patch",
"comet",
"voronoi",... | __all__ = ['meshc', 'barh', 'trisurf', 'compass', 'isonormals', 'plotutils', 'ezcontour', 'streamslice', 'scatter', 'rgb2ind', 'usev6plotapi', 'quiver', 'streamline', 'triplot', 'tetramesh', 'rose', 'patch', 'comet', 'voronoi', 'contourslice', 'histogram', 'errorbar', 'reducepatch', 'ezgraph3', 'interpstreamspeed', 'sh... |
#!/usr/bin/python
print('Hello Git!')
print("Nakano Masaki")
| print('Hello Git!')
print('Nakano Masaki') |
a = [int(x) for x in input().split()]
a.sort() #this command sorts the list in ascending order
if a[-2]==a[-1]:
print(a[-3]+a[1])
else:
print(a[-2] + a[1])
| a = [int(x) for x in input().split()]
a.sort()
if a[-2] == a[-1]:
print(a[-3] + a[1])
else:
print(a[-2] + a[1]) |
# The MessageQueue class provides an interface to be implemented by classes that store messages.
class MessageQueue(object):
# add a single message to the queue
def add(self, folder_id, folder_path, message_type, parameters=None, sender_controller_id=None, sender_user_id=None, timestamp=None):
pass
... | class Messagequeue(object):
def add(self, folder_id, folder_path, message_type, parameters=None, sender_controller_id=None, sender_user_id=None, timestamp=None):
pass
def receive(self):
pass |
info = open("phonebook.txt", "r+").readlines()
ph = {}
for i in range(len(info)):
word = info[i].split()
ph[word[0]]=word[1]
for i in sorted(ph.keys()):
print(i,ph[i]) | info = open('phonebook.txt', 'r+').readlines()
ph = {}
for i in range(len(info)):
word = info[i].split()
ph[word[0]] = word[1]
for i in sorted(ph.keys()):
print(i, ph[i]) |
print("Welcome to the roller coaster!")
height = int(input("What is your height in cm? "))
canRide = False
if height > 120:
age = int(input("What is your age in years? "))
if age > 18:
canRide = True
else:
canRide = False
else:
canRide = False
if canRide:
print('You can r... | print('Welcome to the roller coaster!')
height = int(input('What is your height in cm? '))
can_ride = False
if height > 120:
age = int(input('What is your age in years? '))
if age > 18:
can_ride = True
else:
can_ride = False
else:
can_ride = False
if canRide:
print('You can ride the ... |
#
# PySNMP MIB module MYLEXDAC960SCSIRAIDCONTROLLER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MYLEXDAC960SCSIRAIDCONTROLLER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:06:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using P... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ... |
class GCodeSegment():
def __init__(self, code, number, x, y, z, raw):
self.code = code
self.number = number
self.raw = raw
self.x = x
self.y = y
self.z = z
self.has_cords = (self.x is not None or self.y is not None or self.z is not None)
if self.has... | class Gcodesegment:
def __init__(self, code, number, x, y, z, raw):
self.code = code
self.number = number
self.raw = raw
self.x = x
self.y = y
self.z = z
self.has_cords = self.x is not None or self.y is not None or self.z is not None
if self.has_cords... |
print('Welcom to the Temperature Conventer.')
fahrenheit = float(input('\nWhat is the given temperature in Fahrenheit degrees? '))
celsius = (fahrenheit - 32) * 5 / 9
celsius = round(celsius, 4)
kelvin = (fahrenheit + 569.67) * 5 / 9
kelvin = round(kelvin, 4)
print('\nThe given temperature is equal to:')
print('\nFahr... | print('Welcom to the Temperature Conventer.')
fahrenheit = float(input('\nWhat is the given temperature in Fahrenheit degrees? '))
celsius = (fahrenheit - 32) * 5 / 9
celsius = round(celsius, 4)
kelvin = (fahrenheit + 569.67) * 5 / 9
kelvin = round(kelvin, 4)
print('\nThe given temperature is equal to:')
print('\nFahre... |
StageDict = {
"welcome":"welcome",
"hasImg":"hasImg",
"registed":"registed"
} | stage_dict = {'welcome': 'welcome', 'hasImg': 'hasImg', 'registed': 'registed'} |
# -*- coding: utf-8 -*-
class CookieHandler(object):
"""This class intends to Handle the cookie field described by the
OpenFlow Specification and present in OpenVSwitch.
Cookie field has 64 bits. The first 32-bits are assigned to the id
of ACL input. The next 4 bits are assigned to the op... | class Cookiehandler(object):
"""This class intends to Handle the cookie field described by the
OpenFlow Specification and present in OpenVSwitch.
Cookie field has 64 bits. The first 32-bits are assigned to the id
of ACL input. The next 4 bits are assigned to the operation type and
t... |
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project au... | {'includes': ['../../../webrtc/build/common.gypi'], 'targets': [{'target_name': 'rbe_components', 'type': 'static_library', 'include_dirs': ['<(webrtc_root)/modules/remote_bitrate_estimator'], 'sources': ['<(webrtc_root)/modules/remote_bitrate_estimator/test/bwe_test_logging.cc', '<(webrtc_root)/modules/remote_bitrate_... |
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
i = 0
while i < len(nums):
if nums[i] == val: nums.pop(i)
else: i += 1
return len(nums) | class Solution:
def remove_element(self, nums: List[int], val: int) -> int:
i = 0
while i < len(nums):
if nums[i] == val:
nums.pop(i)
else:
i += 1
return len(nums) |
class Base():
"""
This class represents the base variation of the game upon which other variations can be
built, utilizing the functionalities of this class.
If the superclass does not override all of these functions in this class, an error is
thrown.
"""
def __init__(self, players):
... | class Base:
"""
This class represents the base variation of the game upon which other variations can be
built, utilizing the functionalities of this class.
If the superclass does not override all of these functions in this class, an error is
thrown.
"""
def __init__(self, players):
... |
class Animal:
def __init__(self, nombre):
self.nombre = nombre
def dormir(self):
print("zZzZ")
def mover(self):
print("caminar")
class Sponge(Animal):
def mover(self):
pass
class Cat(Animal):
def hacer_ruido(self):
print("Meow")
class Fish(Animal):
d... | class Animal:
def __init__(self, nombre):
self.nombre = nombre
def dormir(self):
print('zZzZ')
def mover(self):
print('caminar')
class Sponge(Animal):
def mover(self):
pass
class Cat(Animal):
def hacer_ruido(self):
print('Meow')
class Fish(Animal):
... |
{
'targets': [
{
'target_name': 'ftdi_labtic',
'sources':
[
'src/ftdi_device.cc',
'src/ftdi_driver.cc'
],
'include_dirs+':
[
'src/',
],
'conditions':
[
['OS == "win"',
{
'include_dirs+':
[
... | {'targets': [{'target_name': 'ftdi_labtic', 'sources': ['src/ftdi_device.cc', 'src/ftdi_driver.cc'], 'include_dirs+': ['src/'], 'conditions': [['OS == "win"', {'include_dirs+': ['lib/'], 'link_settings': {'conditions': [["target_arch=='ia32'", {'libraries': ['-l<(module_root_dir)/lib/i386/ftd2xx.lib', '-l<(module_root_... |
def print_head(msg: str):
start = "| "
end = " |"
line = "-" * (len(msg) + len(start) + len(end))
print(line)
print(start + msg + end)
print(line)
| def print_head(msg: str):
start = '| '
end = ' |'
line = '-' * (len(msg) + len(start) + len(end))
print(line)
print(start + msg + end)
print(line) |
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
def rpmpack_dependencies():
go_rules_dependencies()
go_register_toolchains()
gazelle_dependencies()
go_repository(
name = "com_g... | load('@io_bazel_rules_go//go:deps.bzl', 'go_register_toolchains', 'go_rules_dependencies')
load('@bazel_gazelle//:deps.bzl', 'gazelle_dependencies', 'go_repository')
def rpmpack_dependencies():
go_rules_dependencies()
go_register_toolchains()
gazelle_dependencies()
go_repository(name='com_github_pkg_er... |
#rekursif adalah fungsi yg memanggil dirinya sendiri ok sip
def cetak(x):
print(x)
if x>1:
cetak(x-1)
elif x<1:
cetak(x+1)
cetak(5)
| def cetak(x):
print(x)
if x > 1:
cetak(x - 1)
elif x < 1:
cetak(x + 1)
cetak(5) |
def more_zeros(s):
s = "".join(dict.fromkeys(s)) # Getting rid of the duplicates in order
s2 = [bin(ord(i))[2:] for i in s]
s2 = [len(i)>2*i.count('1') for i in s2]
return [i for j, i in enumerate(s) if s2[j]]
print(more_zeros("DIGEST"))
| def more_zeros(s):
s = ''.join(dict.fromkeys(s))
s2 = [bin(ord(i))[2:] for i in s]
s2 = [len(i) > 2 * i.count('1') for i in s2]
return [i for (j, i) in enumerate(s) if s2[j]]
print(more_zeros('DIGEST')) |
tc = int(input())
while tc:
tc -= 1
n, k = map(int, input().split())
if k > 0:
print(n%k)
else:
print(n) | tc = int(input())
while tc:
tc -= 1
(n, k) = map(int, input().split())
if k > 0:
print(n % k)
else:
print(n) |
arr = list(map(int,input().split()))
i = 1
while True:
if i not in arr:
print(i)
break
i+=1
| arr = list(map(int, input().split()))
i = 1
while True:
if i not in arr:
print(i)
break
i += 1 |
"""
Define citations for ESPEI
"""
ESPEI_CITATION = "B. Bocklund, R. Otis, A. Egorov, A. Obaied, I. Roslyakova, Z.-K. Liu, ESPEI for efficient thermodynamic database development, modification, and uncertainty quantification: application to Cu-Mg, MRS Commun. (2019) 1-10. doi:10.1557/mrc.2019.59."
ESPEI_BIBTEX = """@ar... | """
Define citations for ESPEI
"""
espei_citation = 'B. Bocklund, R. Otis, A. Egorov, A. Obaied, I. Roslyakova, Z.-K. Liu, ESPEI for efficient thermodynamic database development, modification, and uncertainty quantification: application to Cu-Mg, MRS Commun. (2019) 1-10. doi:10.1557/mrc.2019.59.'
espei_bibtex = '@artic... |
class Token:
def __init__(self, t_type, lexeme, literal, line):
self.type = t_type
self.lexeme = lexeme
self.literal = literal
self.line = line
def __repr__(self):
return f"Token(type: {self.type}, lexeme: {self.lexeme}, literal: {self.literal}, line: {self.line})"
c... | class Token:
def __init__(self, t_type, lexeme, literal, line):
self.type = t_type
self.lexeme = lexeme
self.literal = literal
self.line = line
def __repr__(self):
return f'Token(type: {self.type}, lexeme: {self.lexeme}, literal: {self.literal}, line: {self.line})'
cla... |
CONNECTION = {
'server': 'example@mail.com',
'user': 'user',
'password': 'password',
'port': 993
}
CONTENT_TYPES = ['text/plain', 'text/html']
ATTACHMENT_DIR = ''
ALLOWED_EXTENSIONS = ['csv']
| connection = {'server': 'example@mail.com', 'user': 'user', 'password': 'password', 'port': 993}
content_types = ['text/plain', 'text/html']
attachment_dir = ''
allowed_extensions = ['csv'] |
class LNode:
def __init__(self, elem, next_=None):
self.elem = elem
self.next = next_
class LCList:
def __init__(self):
self._rear = None
def is_empty(self):
return self._rear is None
def prepend(self, elem):
p = LNode(elem)
if self._rear is None:
p.next = p
self._rear = p
else:
p.next = s... | class Lnode:
def __init__(self, elem, next_=None):
self.elem = elem
self.next = next_
class Lclist:
def __init__(self):
self._rear = None
def is_empty(self):
return self._rear is None
def prepend(self, elem):
p = l_node(elem)
if self._rear is None:
... |
counter = 0
while counter <= 5:
print("counter", counter)
counter = counter + 1
else:
print("counter has become false ") | counter = 0
while counter <= 5:
print('counter', counter)
counter = counter + 1
else:
print('counter has become false ') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.