content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteDuplicates(self, head):
current = head
while(current and current.next):
if(current.val == current.nex... | class Solution(object):
def delete_duplicates(self, head):
current = head
while current and current.next:
if current.val == current.next.val:
current.next = current.next.next
else:
current = current.next
return head |
def evaluate(board, fColor, fAntiColor):
def evaluateBoard(self, b):
score = 0
score += generalPosition(board, fColor, fAntiColor)
score += stableSides(board, fColor, fAntiColor)
return score
def generalPosition(board, fColor, fAntiColor):
score = 0
for row in range(0,8):
... | def evaluate(board, fColor, fAntiColor):
def evaluate_board(self, b):
score = 0
score += general_position(board, fColor, fAntiColor)
score += stable_sides(board, fColor, fAntiColor)
return score
def general_position(board, fColor, fAntiColor):
score = 0
for row in range(0, ... |
send_message_parameters = {
"type": "object",
"properties": {
"title": {"type": "string"},
"raw": {"type": "string"},
"is_warning": {"type": "boolean"},
"topic_id": {"type": "integer"},
"target_usernames": {"type": "array", "items": {"type": "string"}},
},
"requir... | send_message_parameters = {'type': 'object', 'properties': {'title': {'type': 'string'}, 'raw': {'type': 'string'}, 'is_warning': {'type': 'boolean'}, 'topic_id': {'type': 'integer'}, 'target_usernames': {'type': 'array', 'items': {'type': 'string'}}}, 'required': ['raw', 'target_usernames']}
create_post_parameters = {... |
def srch(l,start,end,r):
if(end>=1):
mid=(start+end)//2
if(l[mid]==r):
print(l[mid],start,end)
return mid
elif(l[mid]>r):
return srch(start,mid-1,r)
elif(l[mid]<r):
return (mid+1,end,r)
else:
return -1
l=list(map... | def srch(l, start, end, r):
if end >= 1:
mid = (start + end) // 2
if l[mid] == r:
print(l[mid], start, end)
return mid
elif l[mid] > r:
return srch(start, mid - 1, r)
elif l[mid] < r:
return (mid + 1, end, r)
else:
return -1... |
class code:
def __init__(self, code = 0, cmd_bytes = 0, reply_bytes = 0):
self.code = code
self.cmd_bytes = cmd_bytes
self.reply_bytes = reply_bytes
# General Commands
NO_OP = code(0x00, 0, 0)
SET_DEFAULTS = code(0x01, 0, 0)
CAMERA_RESET = code(0x02, 0, 0)
RESTORE_FACTORY_DEFAULTS = code(0... | class Code:
def __init__(self, code=0, cmd_bytes=0, reply_bytes=0):
self.code = code
self.cmd_bytes = cmd_bytes
self.reply_bytes = reply_bytes
no_op = code(0, 0, 0)
set_defaults = code(1, 0, 0)
camera_reset = code(2, 0, 0)
restore_factory_defaults = code(3, 0, 0)
serial_number = code(4, 0, ... |
class Account:
def __init__(self, cs_api, cmd_info):
self.cs_api = cs_api
self.uuid = cmd_info['account']
self._get_account()
def _get_account(self):
accounts = self.cs_api.listAccounts(id=self.uuid)
self.name = accounts['account'][0]['name'].lower()
self.network... | class Account:
def __init__(self, cs_api, cmd_info):
self.cs_api = cs_api
self.uuid = cmd_info['account']
self._get_account()
def _get_account(self):
accounts = self.cs_api.listAccounts(id=self.uuid)
self.name = accounts['account'][0]['name'].lower()
self.networ... |
print("Hello, ", end= ' ' )
print("My name is Sana Amir!")
print("\n")
print("Hey!", sep= '')
print("My name is Sana Amir!") | print('Hello, ', end=' ')
print('My name is Sana Amir!')
print('\n')
print('Hey!', sep='')
print('My name is Sana Amir!') |
#! /usr/bin/python3.2
# Note :
# I don't think that this program is *really* working for
# books > 8, but I don't have more tests to test it
#
class TooManyBooksException(Exception):
def __init__(self,*args):
super(*args)
# returns the price with as big discount as
# possible. Format: list of books, e.g.... | class Toomanybooksexception(Exception):
def __init__(self, *args):
super(*args)
def calculate_price(*books):
if len(books) > 5:
raise TooManyBooksException
coefs = [8, 7.2, 6.4, 4, 4.4]
books = [b for b in books if b]
if len(books) == 0:
return get_original_price(0)
if ... |
# Rename this file to config.py and fill out the fields
# Project Location (Latitude and Longitude - NYC is default)
GPS_LOCATION = [40.730610, -73.935242]
# Google Maps Time Zone API Auth
API_KEY = "AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXE"
# GMail settings
FROM_EMAIL = "SendersEmail@gmail.com"
TO_EMAIL = ["Recipien... | gps_location = [40.73061, -73.935242]
api_key = 'AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXE'
from_email = 'SendersEmail@gmail.com'
to_email = ['Recipient1@EmailProviderA.com, Recipient2@EmailProviderB.com']
user = 'SendersEmail@gmail.com'
pass = 'tXXXXXXXXXXXXXXg'
stream_token = 'lXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... |
class Solution:
def sumEvenAfterQueries(self, nums: List[int], queries: List[List[int]]) -> List[int]:
even_sum = sum([x for x in nums if x & 1==0])
res = []
for q in queries:
if nums[q[1]] & 1 ==0:
even_sum -= nums[q[1]]
nums[q[1]] += q[0]
... | class Solution:
def sum_even_after_queries(self, nums: List[int], queries: List[List[int]]) -> List[int]:
even_sum = sum([x for x in nums if x & 1 == 0])
res = []
for q in queries:
if nums[q[1]] & 1 == 0:
even_sum -= nums[q[1]]
nums[q[1]] += q[0]
... |
advancedSearch = [
{
"relevanceScore": "4",
"resourceType": "SoftLayer_Hardware",
"resource": {
"accountId": 307608,
"domain": "vmware.test.com",
"fullyQualifiedDomainName": "host14.vmware.test.com",
"hardwareStatusId": 5,
"hostname... | advanced_search = [{'relevanceScore': '4', 'resourceType': 'SoftLayer_Hardware', 'resource': {'accountId': 307608, 'domain': 'vmware.test.com', 'fullyQualifiedDomainName': 'host14.vmware.test.com', 'hardwareStatusId': 5, 'hostname': 'host14', 'id': 123456, 'manufacturerSerialNumber': 'AAAAAAAAA', 'notes': 'A test notes... |
#! /usr/bin/env python
'''
Andrew Till
Summer 2014
Gets ENDF vii1 XS from T2's site.
For thermal XS, see http://t2.lanl.gov/nis/data/data/ENDFB-VII-thermal/UinUO2' etc.
'''
class Nuclide:
def __init__(self, name, Z, A):
self.name = name
self.Z = Z
self.A = A
nuclideList = []
nuclideList... | """
Andrew Till
Summer 2014
Gets ENDF vii1 XS from T2's site.
For thermal XS, see http://t2.lanl.gov/nis/data/data/ENDFB-VII-thermal/UinUO2' etc.
"""
class Nuclide:
def __init__(self, name, Z, A):
self.name = name
self.Z = Z
self.A = A
nuclide_list = []
nuclideList.append(nuclide('Pu', 9... |
# Custom operators
# 25 nov 2018
# AR, AQ, Abdullah
def star_op (firstop, secondop):
return ( firstop * 2) + secondop
def squiggle_op (firstop,secondop):
return firstop**3 + secondop**2
def multidot (op1,op2):
return (op1*4)//op2
print ("8 starop 2 == ", star_op (8,2)) # == 18
print ("3 squiggle 2... | def star_op(firstop, secondop):
return firstop * 2 + secondop
def squiggle_op(firstop, secondop):
return firstop ** 3 + secondop ** 2
def multidot(op1, op2):
return op1 * 4 // op2
print('8 starop 2 == ', star_op(8, 2))
print('3 squiggle 2 == ', squiggle_op(3, 2))
print('2 multidot 2 == ', multidot(2, 2))
... |
def left(string,i=1):
i=string.index(i) if type(i)==str else i
return string[:i]
def right(string,i=1):
i=string[::-1].index(i[::-1]) if type(i)==str else i
return string[-i:] if i!=0 else "" | def left(string, i=1):
i = string.index(i) if type(i) == str else i
return string[:i]
def right(string, i=1):
i = string[::-1].index(i[::-1]) if type(i) == str else i
return string[-i:] if i != 0 else '' |
# /**
# * @author Sarath Chandra Asapu
# * @email sarath.chandra.asapu@accenture.com
# * @create date 2021-09-17 13:08:06
# * @modify date 2021-09-17 13:08:06
# * @desc [description]
# */
PROJECT_ID = 'peak-catbird-324206'
REGION = 'us-central1'
PIPELINE_NAME_TFX = 'pipelinetfxvertexai2-cicd'
DATASET = "LoanApp... | project_id = 'peak-catbird-324206'
region = 'us-central1'
pipeline_name_tfx = 'pipelinetfxvertexai2-cicd'
dataset = 'LoanApplyData-bank.csv'
data_path = 'gs://aivertex-bucket/TFX_Pipeline/data'
serving_model_dir = 'gs://aivertex-bucket/TFX_Pipeline/' + PIPELINE_NAME_TFX + '/serving_model_tfx'
pipeline_root = 'gs://aive... |
def validPass(s):
letters = 0
digits = 0
for c in s:
if c.isdigit():
digits += 1
elif c.isalpha():
letters += 1
else:
return False
return letters % 2 == 0 and digits % 2 == 1
def solution(S):
# write your code in Python 3.6
maxL = ... | def valid_pass(s):
letters = 0
digits = 0
for c in s:
if c.isdigit():
digits += 1
elif c.isalpha():
letters += 1
else:
return False
return letters % 2 == 0 and digits % 2 == 1
def solution(S):
max_l = -1
words = S.split(' ')
for wo... |
# a=int(input("Enter any no"))
# if a==1 :
# print("composit number")
# elif a==2 :
# print("no is prime no")
# else :
# i=1
# c=1
# while i<a/2 :
# if a%i==0 :
# c=c+1
# i=i+1
# if c>1 :
# print("no is not prime")
# else:
# print("no is prime"... | def checkprime(num):
if num > 1:
for i in range(2, num):
if num % i == 0:
print(num, 'is not a prime number')
print(i, 'times', num // i, 'is', num)
break
else:
print(num, 'is a prime number')
break
e... |
expected_output = {
"line":{
"pts/0":{
"active":False,
"name":"admin",
"time":"Jan 28 13:44",
"idle":".",
"pid":"8096",
"comment":"adding some comments"
},
"pts/1":{
"active":False,
"name":"admin",
"time":"Jan 28 13:44... | expected_output = {'line': {'pts/0': {'active': False, 'name': 'admin', 'time': 'Jan 28 13:44', 'idle': '.', 'pid': '8096', 'comment': 'adding some comments'}, 'pts/1': {'active': False, 'name': 'admin', 'time': 'Jan 28 13:44', 'idle': '.', 'pid': '8096'}, 'pts/2': {'active': True, 'name': 'admin', 'time': 'Jan 28 13:4... |
class FeaturesNotInFeatureDictError(Exception):
pass
class RolePatternDoesNotMatchExample(Exception):
pass | class Featuresnotinfeaturedicterror(Exception):
pass
class Rolepatterndoesnotmatchexample(Exception):
pass |
# https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem
if __name__ == '__main__':
a = int(input())
l = list(map(int,input().strip().split()))[:a]
b = max(l)
while max(l) == b:
l.remove(max(l))
print (max(l))
| if __name__ == '__main__':
a = int(input())
l = list(map(int, input().strip().split()))[:a]
b = max(l)
while max(l) == b:
l.remove(max(l))
print(max(l)) |
# Usage: python3 placements.py
# Output: a list of placements for places, in a grid determined by the parameters.
#
# Run this script to generate the file placements.xml which can be used for substitution in Mapnik XML.
grid = {
'vertical': 30,
'horizontal': 50,
}
step = 5
# Generate a list of placement tuple... | grid = {'vertical': 30, 'horizontal': 50}
step = 5
placements = [(x, y) for x in range(-grid['horizontal'], grid['horizontal'] + 1, step) for y in range(-grid['vertical'], grid['vertical'] + 1, step)]
placements.sort(key=lambda p: abs(p[0]) + abs(p[1]))
output = ''.join(map(lambda p: "<Placement dx='%s' dy='%s'/>" % p,... |
# Question 2 - List union
# Asmit De
# 04/28/2017
# Input list data and form lists
user_input = input('Enter a numbers for the 1st list: ')
list1 = [int(e) for e in user_input.split()]
user_input = input('Enter a numbers for the 2nd list: ')
list2 = [int(e) for e in user_input.split()]
# Create empty union ... | user_input = input('Enter a numbers for the 1st list: ')
list1 = [int(e) for e in user_input.split()]
user_input = input('Enter a numbers for the 2nd list: ')
list2 = [int(e) for e in user_input.split()]
union = []
for e in list1 + list2:
if e not in union:
union.append(e)
print('The distinct numbers in bot... |
def my_encryption(some_string):
character_set = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "
secret_key = "Dd18Abz2EqNPW hYTOjBvtVlpXaH6msFUICg4o0KZwJeryQx3f9kSinRu5L7cGM"
encription = ""
for x in some_string:
count = 0
for i in character_set:
if i == x:
encription += secret_key... | def my_encryption(some_string):
character_set = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '
secret_key = 'Dd18Abz2EqNPW hYTOjBvtVlpXaH6msFUICg4o0KZwJeryQx3f9kSinRu5L7cGM'
encription = ''
for x in some_string:
count = 0
for i in character_set:
if i == x:
... |
n = int(input())
arr = [int(e) for e in input().split()]
yoda = int(input())
yoda /= 2
for i in range(n):
if arr[i] >= yoda:
print(i, end=" ")
print()
| n = int(input())
arr = [int(e) for e in input().split()]
yoda = int(input())
yoda /= 2
for i in range(n):
if arr[i] >= yoda:
print(i, end=' ')
print() |
r=float(input("Input the radius of a circle:" ))
pi=3.14
area=pi*r*r
print("The area of circle is: ",area)
| r = float(input('Input the radius of a circle:'))
pi = 3.14
area = pi * r * r
print('The area of circle is: ', area) |
cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print ("There are ", cars, "cars available");
print ("There are only ", drivers, " drivers... | cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print('There are ', cars, 'cars available')
print('There are only ', drivers, ' drivers available')
pr... |
names = ['jack', 'john', 'mark', 'bill']
numbers = [20, 44, 3, 14]
# for name in names:
# print(name)
# for number in numbers:
# print(number)
for i in range(len(names)):
print(names[i].title() + ': ' + str(numbers[i]))
# the zip function
for name, number in zip(names, numbers):
print(name.title() + ': ' + ... | names = ['jack', 'john', 'mark', 'bill']
numbers = [20, 44, 3, 14]
for i in range(len(names)):
print(names[i].title() + ': ' + str(numbers[i]))
for (name, number) in zip(names, numbers):
print(name.title() + ': ' + str(number)) |
result = {
'First Name': 'Mark',
'Last Name': 'Watney',
'Missions': ['Ares1', 'Ares3'],
}
| result = {'First Name': 'Mark', 'Last Name': 'Watney', 'Missions': ['Ares1', 'Ares3']} |
# Read in all 3 rules
rules = [input().split() for i in range(3)]
# Read in the next line
temp = input().split()
# Separate it into the number of steps, the initial state and the final state
steps = int(temp[0])
initial = temp[1]
final = temp[2]
# Applies the given rule to s at the index.
def apply_rule(s, rule, index... | rules = [input().split() for i in range(3)]
temp = input().split()
steps = int(temp[0])
initial = temp[1]
final = temp[2]
def apply_rule(s, rule, index):
if index + len(rule[0]) > len(s):
return False
for i in range(0, len(rule[0])):
if s[i + index] != rule[0][i]:
return False
r... |
# mudanca de tipo
x=1
y="abc"
y=x
| x = 1
y = 'abc'
y = x |
def timeConversion(country, t):
dict1 = {"usa": +9.30,
"canada": +9.30,
"russia": +2.30,
"japan": -3.30,
"malysia": -2.30,
"singapur": -2.30,
"dubai": +1.30,
"israel": -2.30,
"germany": +3.30,
"italy... | def time_conversion(country, t):
dict1 = {'usa': +9.3, 'canada': +9.3, 'russia': +2.3, 'japan': -3.3, 'malysia': -2.3, 'singapur': -2.3, 'dubai': +1.3, 'israel': -2.3, 'germany': +3.3, 'italy': +3.3, 'england': +4.3}
if country in dict1.keys():
print('india:', t + dict1[country])
else:
print... |
def power_nums(nums):
print("(", nums[0], " - ", nums[1], ") ^ 2 = ", (nums[0]-nums[1])**2, sep="")
print("(", nums[0], " + ", nums[1], ") ^ 3 = ", (nums[0]+nums[1])**3, sep="")
def main():
nums = input().split()
for index, value in enumerate(nums):
nums[index] = int(nums[index])
power_num... | def power_nums(nums):
print('(', nums[0], ' - ', nums[1], ') ^ 2 = ', (nums[0] - nums[1]) ** 2, sep='')
print('(', nums[0], ' + ', nums[1], ') ^ 3 = ', (nums[0] + nums[1]) ** 3, sep='')
def main():
nums = input().split()
for (index, value) in enumerate(nums):
nums[index] = int(nums[index])
... |
D = [1, 1, 2, 2]
for i in range(4, 100001):
a = 0
for j in range(2, min(i+1, 7), 2):
a += D[i-j]
a %= 1000000009
D.append(a)
for _ in range(int(input())):
print(D[int(input())]) | d = [1, 1, 2, 2]
for i in range(4, 100001):
a = 0
for j in range(2, min(i + 1, 7), 2):
a += D[i - j]
a %= 1000000009
D.append(a)
for _ in range(int(input())):
print(D[int(input())]) |
def findDecision(obj): #obj[0]: Driving_to, obj[1]: Passanger, obj[2]: Weather, obj[3]: Temperature, obj[4]: Time, obj[5]: Coupon, obj[6]: Coupon_validity, obj[7]: Gender, obj[8]: Age, obj[9]: Maritalstatus, obj[10]: Children, obj[11]: Education, obj[12]: Occupation, obj[13]: Income, obj[14]: Bar, obj[15]: Coffeehouse,... | def find_decision(obj):
if obj[20] <= 2:
if obj[14] > 0.0:
if obj[8] <= 2:
if obj[6] <= 0:
if obj[1] <= 1:
return 'True'
elif obj[1] > 1:
return 'False'
else:
... |
STOPWORDS = [
'a',
'an',
'by',
'for',
'in',
'of',
'with',
'the',
]
| stopwords = ['a', 'an', 'by', 'for', 'in', 'of', 'with', 'the'] |
a=int(input("Enter A: "))
b=int(input("Enter B: "))
c=int(input("Enter C: "))
if a>b:
if a>c:
g=a
else:
g=c
else:
if b>c:
g=b
else:
g=c
print("Greater Number = ",g)
| a = int(input('Enter A: '))
b = int(input('Enter B: '))
c = int(input('Enter C: '))
if a > b:
if a > c:
g = a
else:
g = c
elif b > c:
g = b
else:
g = c
print('Greater Number = ', g) |
# https://leetcode.com/problems/balanced-binary-tree/
# Given a binary tree, determine if it is height-balanced.
# For this problem, a height-balanced binary tree is defined as:
# a binary tree in which the left and right subtrees of every node differ in
# height by no more than 1.
#################################... | class Solution:
def is_balanced(self, root: TreeNode) -> bool:
return self.max_depth(root) != -1
def max_depth(self, root):
if root == None:
return 0
l_depth = self.max_depth(root.left)
r_depth = self.max_depth(root.right)
if l_depth == -1 or r_depth == -1 o... |
class Node:
def __init__(self,data):
self.data=data
self.next=None #initialize next as null
class LinkedList:
def __init__(self):
self.head=None #pointer
#program to print content of the lsit
def printlist(self):
temp=self.head
while temp:
print(t... | 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)
temp = temp.next
llist = linked_list()
llist.h... |
#!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
# A dictionary is a searchable set of key-value pairs.
x = { 'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5 }
for i in x:
print('i is {}'.format(i))
# The above will only give us the keys.
# If we want to print key-value pairs,
# we can do th... | x = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5}
for i in x:
print('i is {}'.format(i))
y = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5}
for (k, v) in y.items():
print('k: {}, v: {}'.format(k, v)) |
def restartable(func):
def wrapper(*args, **kwargs):
answer = "y"
while answer == "y":
func(*args, **kwargs)
while True:
answer = input("Restart?\ty/n:")
if answer in ("y", "n"):
break
else:
... | def restartable(func):
def wrapper(*args, **kwargs):
answer = 'y'
while answer == 'y':
func(*args, **kwargs)
while True:
answer = input('Restart?\ty/n:')
if answer in ('y', 'n'):
break
else:
... |
# Lists
# - declaration & length
# - accessing items
# - mutable with append, remove
# - sorting
# - sum, min, max
# supplies = ['crayons', 'pencils', 'paper', 'Kleenex', 'eraser']
# print(supplies)
# supplies.append('markers')
# print(supplies)
# supplies.remove('crayons')
# print(supplies)
# supplies.sort()
# pri... | colors = ['red', 'orange', 'blue', 'pink']
alphabetical = sorted(colors)
print(colors)
print(alphabetical)
alphabetical = sorted(colors, reverse=True)
print(alphabetical)
reverse_colors = reversed(colors)
reverse_alpha = reversed(alphabetical)
print(reverseColors)
print(reverseAlpha)
print(list(reverseColors))
print(li... |
width = 4.5
height = 7.9
area = width * height
print("Area: {}".format(area))
| width = 4.5
height = 7.9
area = width * height
print('Area: {}'.format(area)) |
def most_frequent(name):
unsorted_dic = {}
most_frequent_dic = {}
for intex in range(len(name)):
if name[intex] not in unsorted_dic.keys():
unsorted_dic[name[intex]] = name.count(name[intex])
sorted_values = reversed(sorted(unsorted_dic.values()))
for values in sorted_va... | def most_frequent(name):
unsorted_dic = {}
most_frequent_dic = {}
for intex in range(len(name)):
if name[intex] not in unsorted_dic.keys():
unsorted_dic[name[intex]] = name.count(name[intex])
sorted_values = reversed(sorted(unsorted_dic.values()))
for values in sorted_values:
... |
def PatternCount(Pattern, Text):
count = 0
for i in range(len(Text)-len(Pattern)+1):
if Text[i:i+len(Pattern)] == Pattern:
count = count+1
return count
| def pattern_count(Pattern, Text):
count = 0
for i in range(len(Text) - len(Pattern) + 1):
if Text[i:i + len(Pattern)] == Pattern:
count = count + 1
return count |
def check(row_idx, col_idx):
existing = []
if row_idx - 1 >= 0 and col_idx - 1 >= 0:
existing.append([row_idx - 1, col_idx - 1])
if row_idx - 1 >= 0:
existing.append([row_idx - 1, col_idx])
if row_idx - 1 >= 0 and col_idx + 1 < len(matrix):
existing.append([row_idx - 1, co... | def check(row_idx, col_idx):
existing = []
if row_idx - 1 >= 0 and col_idx - 1 >= 0:
existing.append([row_idx - 1, col_idx - 1])
if row_idx - 1 >= 0:
existing.append([row_idx - 1, col_idx])
if row_idx - 1 >= 0 and col_idx + 1 < len(matrix):
existing.append([row_idx - 1, col_idx +... |
#!/usr/bin/env python3
def mark(hits, distance):
standard_multiplier = 3 #std distance = 4 Meter
points = hits * 3
return points
def exists():
try:
f = open("marklist.csv", "r")
f.close()
except FileNotFoundError:
f = open("marklist.csv", "w")
f.write("name,hits,note_in_punkten\n")
def main():
try:
... | def mark(hits, distance):
standard_multiplier = 3
points = hits * 3
return points
def exists():
try:
f = open('marklist.csv', 'r')
f.close()
except FileNotFoundError:
f = open('marklist.csv', 'w')
f.write('name,hits,note_in_punkten\n')
def main():
try:
f... |
simType = 'sym_file'
symProps = [
{'name': 'non_exist', 'RBs': [
{'pred_name': 'non_exist', 'pred_sem': [], 'higher_order': False,
'object_name': 'testLine1', 'object_sem': [['length', 1, 'length', 'nil', 'state'], ['length1', 1, 'length', 1, 'value']], 'P': 'nil'}], 'set': 'driver', 'analog': 0},
{'name': 'non_ex... | sim_type = 'sym_file'
sym_props = [{'name': 'non_exist', 'RBs': [{'pred_name': 'non_exist', 'pred_sem': [], 'higher_order': False, 'object_name': 'testLine1', 'object_sem': [['length', 1, 'length', 'nil', 'state'], ['length1', 1, 'length', 1, 'value']], 'P': 'nil'}], 'set': 'driver', 'analog': 0}, {'name': 'non_exist',... |
def group_by_codons(refnas, seqnas):
refcodons = []
seqcodons = []
lastrefcodon = None
lastseqcodon = None
bp = -1
for refna, seqna in zip(refnas, seqnas):
if not refna.is_single_gap:
bp = (bp + 1) % 3
if bp == 0:
# begin new codon
... | def group_by_codons(refnas, seqnas):
refcodons = []
seqcodons = []
lastrefcodon = None
lastseqcodon = None
bp = -1
for (refna, seqna) in zip(refnas, seqnas):
if not refna.is_single_gap:
bp = (bp + 1) % 3
if bp == 0:
lastrefcodon = []
... |
#Vowels Extract
def ExtractVowels(str):
vowels = "aeiou"
for i in str:
if i in vowels:
print(i, end="")
print() | def extract_vowels(str):
vowels = 'aeiou'
for i in str:
if i in vowels:
print(i, end='')
print() |
class Hotel:
def __init__(self, name):
self.name: str = name
self.rooms = []
self.guests: int = 0
@classmethod
def from_stars(cls, stars_count):
name = f"{stars_count} stars Hotel"
return cls(name)
def add_room(self, room):
self.rooms.append(room)
... | class Hotel:
def __init__(self, name):
self.name: str = name
self.rooms = []
self.guests: int = 0
@classmethod
def from_stars(cls, stars_count):
name = f'{stars_count} stars Hotel'
return cls(name)
def add_room(self, room):
self.rooms.append(room)
... |
class Solution:
def generateMatrix(self, n: int) -> List[List[int]]:
res = [[0 for _ in range(n)] for _ in range(n)]
tmp = list(range(1, n ** 2 + 1))
cnt = 0
while True:
for _ in range(cnt, n - cnt):
res[cnt][_] = tmp.pop(0)
if not tmp:
... | class Solution:
def generate_matrix(self, n: int) -> List[List[int]]:
res = [[0 for _ in range(n)] for _ in range(n)]
tmp = list(range(1, n ** 2 + 1))
cnt = 0
while True:
for _ in range(cnt, n - cnt):
res[cnt][_] = tmp.pop(0)
if not tmp:
... |
PING = {
'zen': 'Approachable is better than simple.',
'hook_id': 123456,
'hook': {
'type': 'Repository',
'id': 55866886,
'name': 'web',
'active': True,
'events': [
'pull_request',
],
'config': {
'content_type': 'json',
... | ping = {'zen': 'Approachable is better than simple.', 'hook_id': 123456, 'hook': {'type': 'Repository', 'id': 55866886, 'name': 'web', 'active': True, 'events': ['pull_request'], 'config': {'content_type': 'json', 'insecure_ssl': '0', 'secret': '********'}}, 'repository': {'id': 123456, 'name': 'filabel-testrepo-everyb... |
'''
Signal min, max, median
Now that you have the data read and cleaned, you can begin with statistical EDA. First, you will analyze the 2011 Austin weather data.
Your job in this exercise is to analyze the 'dry_bulb_faren' column and print the median temperatures for specific time ranges. You can do this using parti... | """
Signal min, max, median
Now that you have the data read and cleaned, you can begin with statistical EDA. First, you will analyze the 2011 Austin weather data.
Your job in this exercise is to analyze the 'dry_bulb_faren' column and print the median temperatures for specific time ranges. You can do this using parti... |
# Tree node class to get update about parents node too
class TreeNode:
def __init__(self, data):
self.data = data
self.parent=None
self.left = None
self.right = None
def __repr__(self):
return repr(self.data)
def add_left(self, node):
self.left = node
... | class Treenode:
def __init__(self, data):
self.data = data
self.parent = None
self.left = None
self.right = None
def __repr__(self):
return repr(self.data)
def add_left(self, node):
self.left = node
if node is not None:
node.parent = sel... |
length = int(input())
width = int(input())
height = int(input())
percent = float(input()) * 0.01
volume = length * width * height * 0.001
print(f'{volume*(1-percent):.3f}') | length = int(input())
width = int(input())
height = int(input())
percent = float(input()) * 0.01
volume = length * width * height * 0.001
print(f'{volume * (1 - percent):.3f}') |
#
# PySNMP MIB module HUAWEI-TUNNEL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-TUNNEL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:49:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ... |
class EDA:
def __init__(self, directory, sr=22050):
self.directory = directory
self.wav_name = os.listdir(directory)
self.count = len(self.wav_name)
self.file_duration = []
for filename in tqdm(self.wav_name):
signal, sr = librosa.load(os.path.join(self.directory,filename))
duration... | class Eda:
def __init__(self, directory, sr=22050):
self.directory = directory
self.wav_name = os.listdir(directory)
self.count = len(self.wav_name)
self.file_duration = []
for filename in tqdm(self.wav_name):
(signal, sr) = librosa.load(os.path.join(self.directo... |
#!/usr/bin/env python3
densenet121 = __import__('7-densenet121').densenet121
if __name__ == '__main__':
model = densenet121(32, 0.5)
model.summary()
| densenet121 = __import__('7-densenet121').densenet121
if __name__ == '__main__':
model = densenet121(32, 0.5)
model.summary() |
# Problem Statement
# Given two strings s and t, return if they are equal when both are typed into empty text editors.
# "#" means a backspace character.
# Note that after backspacing an empty text, the text will continue empty.
class Solution:
@staticmethod
def backspace_compare(s: str, t: str) -> bool:
... | class Solution:
@staticmethod
def backspace_compare(s: str, t: str) -> bool:
return generate_final_string(s) == generate_final_string(t)
def generate_final_string(raw_input: str) -> str:
result = ''
for character in raw_input:
if character == '#':
result = result[:-1]
... |
class Node:
def __init__(self, value, children=None):
if children is None:
children = []
self.value: str = value
self.children = children # type: List[Node]
def __str__(self):
return f"{self.value}, {self.children}"
__repr__ = __str__
def longestPath(fileSyst... | class Node:
def __init__(self, value, children=None):
if children is None:
children = []
self.value: str = value
self.children = children
def __str__(self):
return f'{self.value}, {self.children}'
__repr__ = __str__
def longest_path(fileSystem):
filenames =... |
load("//:third_party/javax_enterprise.bzl", javax_enterprise_deps = "dependencies")
load("//:third_party/com_github_scopt.bzl", com_github_scopt_deps = "dependencies")
load("//:third_party/velocity.bzl", velocity_deps = "dependencies")
load("//:third_party/oro.bzl", oro_deps = "dependencies")
load("//:third_party/o... | load('//:third_party/javax_enterprise.bzl', javax_enterprise_deps='dependencies')
load('//:third_party/com_github_scopt.bzl', com_github_scopt_deps='dependencies')
load('//:third_party/velocity.bzl', velocity_deps='dependencies')
load('//:third_party/oro.bzl', oro_deps='dependencies')
load('//:third_party/org_apache_ve... |
create_request_schema = {
"title": "JSON Schema for models request",
"type": "object",
"properties": {
"name": {
"description": "The name of the model",
"type": "string",
"minLength": 1,
},
"version": {
"description": "The version of th... | create_request_schema = {'title': 'JSON Schema for models request', 'type': 'object', 'properties': {'name': {'description': 'The name of the model', 'type': 'string', 'minLength': 1}, 'version': {'description': 'The version of the model', 'type': 'integer', 'minimum': 1}, 'id': {'description': 'The ID of the Google Dr... |
def initials(name: str):
names = name.split()
initials = ''.join(letter [0].upper() for letter in names)
return(initials)
| def initials(name: str):
names = name.split()
initials = ''.join((letter[0].upper() for letter in names))
return initials |
class Item():
def __init__(self,name,typez):
self._name = name
self._desc = None
self._type = typez
@property
def name(self):
return self._name
@name.setter
def name(self,namez):
self._name = namez
@property
def desc(self):
retur... | class Item:
def __init__(self, name, typez):
self._name = name
self._desc = None
self._type = typez
@property
def name(self):
return self._name
@name.setter
def name(self, namez):
self._name = namez
@property
def desc(self):
return self._de... |
def test_styleguide_can_render(app_):
response = app_.test_client().get('/_styleguide')
assert response.status_code == 200
| def test_styleguide_can_render(app_):
response = app_.test_client().get('/_styleguide')
assert response.status_code == 200 |
# Construct a tree with all functions mentioned. Do a pre-order traversal of the tree and only add alive people to the order.
class Person:
def __init__(self, childName):
self.name = childName
self.children = []
self.alive = True
class ThroneInheritance:
def __init__(self, ki... | class Person:
def __init__(self, childName):
self.name = childName
self.children = []
self.alive = True
class Throneinheritance:
def __init__(self, kingName: str):
self.king = person(kingName)
self.name2node = {kingName: self.king}
def birth(self, parentName: str,... |
HOURS = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve']
TENS_MINUTES = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']
MINUTES_ONES_PLACE = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', ... | hours = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve']
tens_minutes = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']
minutes_ones_place = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', ... |
class mobileEntity:
id=""
pseudonym = ""
trace = None
index_current_location = 0
in_mix_zone = False
mix_zone = None
number_of_anonymizations = 0
anon_history = None
def __init__(self,pseudonym,trace,id):
self.pseudonym = pseudonym
self.trace = [trace]
self.i... | class Mobileentity:
id = ''
pseudonym = ''
trace = None
index_current_location = 0
in_mix_zone = False
mix_zone = None
number_of_anonymizations = 0
anon_history = None
def __init__(self, pseudonym, trace, id):
self.pseudonym = pseudonym
self.trace = [trace]
s... |
def searchInsert(nums: list(), target: int) -> int:
start, end = 0, len(nums)
if len(nums) == 0:
return 0
while start < end:
mid = (start + end) // 2
if target == nums[mid]:
return mid
elif target < nums[mid]:
end = mid
else:
start ... | def search_insert(nums: list(), target: int) -> int:
(start, end) = (0, len(nums))
if len(nums) == 0:
return 0
while start < end:
mid = (start + end) // 2
if target == nums[mid]:
return mid
elif target < nums[mid]:
end = mid
else:
s... |
class Solution:
def checkIfExist(self, arr: List[int]) -> bool:
memo = set()
for a in arr:
if a in memo: return True
if a%2==0:
memo.add(a//2)
memo.add(a*2)
return False | class Solution:
def check_if_exist(self, arr: List[int]) -> bool:
memo = set()
for a in arr:
if a in memo:
return True
if a % 2 == 0:
memo.add(a // 2)
memo.add(a * 2)
return False |
customers = [
{
"customer id": 0,
"first name":"Shakeel",
"last name": "Haider",
"address": "S.I.T.E Town",
},
{
"customer id": 1,
"first name":"Zeeshan",
"last name": "Khan",
"address": "Orangi Town",
},
{
"customer id":... | customers = [{'customer id': 0, 'first name': 'Shakeel', 'last name': 'Haider', 'address': 'S.I.T.E Town'}, {'customer id': 1, 'first name': 'Zeeshan', 'last name': 'Khan', 'address': 'Orangi Town'}, {'customer id': 2, 'first name': 'Ibrar', 'last name': 'Shah', 'address': 'Mardan'}]
print(str(customers)) |
class PermissionsError(Exception):
pass
class DuplicatePermissionError(PermissionsError):
def __init__(self, name):
super(DuplicatePermissionError, self).__init__('Permission exists: {0}'.format(name))
class NoSuchPermissionError(PermissionsError):
def __init__(self, name):
super(NoSu... | class Permissionserror(Exception):
pass
class Duplicatepermissionerror(PermissionsError):
def __init__(self, name):
super(DuplicatePermissionError, self).__init__('Permission exists: {0}'.format(name))
class Nosuchpermissionerror(PermissionsError):
def __init__(self, name):
super(NoSuchP... |
# a piece of text with leading spaces
def useless_function():
a = 123
ab=927
abc = 215
if abc <= 500:
abcd = ab + abc
abcd += a
if abcd == abc:
abcd = 0
| def useless_function():
a = 123
ab = 927
abc = 215
if abc <= 500:
abcd = ab + abc
abcd += a
if abcd == abc:
abcd = 0 |
bind = '0.0.0.0:8000'
pid = 'gunicorn.pid'
django_settings = 'ourrevolution.settings'
debug = False
errorlog = 'gunicorn_error.log'
workers = 20
max_requests = 200
timeout = 30
graceful_timeout = 30
| bind = '0.0.0.0:8000'
pid = 'gunicorn.pid'
django_settings = 'ourrevolution.settings'
debug = False
errorlog = 'gunicorn_error.log'
workers = 20
max_requests = 200
timeout = 30
graceful_timeout = 30 |
def calc(len, wid,tree):
if len==wid==tree:
print("eq")
elif len==wid or wid==tree or tree==len:
print("iso")
else:
print("sce")
l = int(input("ENTER "))
w = int(input("ENTER "))
k = int(input("ENTER "))
for x in range(0,20):
calc(l,w,k)
| def calc(len, wid, tree):
if len == wid == tree:
print('eq')
elif len == wid or wid == tree or tree == len:
print('iso')
else:
print('sce')
l = int(input('ENTER '))
w = int(input('ENTER '))
k = int(input('ENTER '))
for x in range(0, 20):
calc(l, w, k) |
#
# PySNMP MIB module CADANT-CMTS-EQUIPMENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CADANT-CMTS-EQUIPMENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:44:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ... |
class StopMessageProcessing(Exception):
pass
class TelegramServerError(RuntimeError):
pass
class MalformedMessageDetectedError(TelegramServerError):
pass | class Stopmessageprocessing(Exception):
pass
class Telegramservererror(RuntimeError):
pass
class Malformedmessagedetectederror(TelegramServerError):
pass |
num1 = float(input())
num2 = float(input())
num3 = float(input())
mp = (num1*2 + num2*3 + num3*5)/10
print('MEDIA = {:.1f}' .format(mp))
| num1 = float(input())
num2 = float(input())
num3 = float(input())
mp = (num1 * 2 + num2 * 3 + num3 * 5) / 10
print('MEDIA = {:.1f}'.format(mp)) |
class ConverterClass:
TEXT = "text"
SPREADSHEET = "spreadsheet"
PRESENTATION = "presentation"
GRAPHIC = "graphic"
# MIME TYPES
TEXT_MIME_TYPES = {
"application/pdf": ["pdf"],
"application/msword": ["doc"],
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": ["docx"]... | class Converterclass:
text = 'text'
spreadsheet = 'spreadsheet'
presentation = 'presentation'
graphic = 'graphic'
text_mime_types = {'application/pdf': ['pdf'], 'application/msword': ['doc'], 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': ['docx'], 'application/vnd.oasis.open... |
# pma.py --maxTransitions 100 msocket
# 59 states, 100 transitions, 1 accepting states, 0 unsafe states, 0 finished and 0 deadend states
# actions here are just labels, but must be symbols with __name__ attribute
def send_call(): pass
def send_return(): pass
def recv_call(): pass
def recv_return(): pass
# states, k... | def send_call():
pass
def send_return():
pass
def recv_call():
pass
def recv_return():
pass
states = {0: {'msocket': {'send_arg': '', 'recv_arg': 0, 'buffers': ''}}, 1: {'msocket': {'send_arg': 'a', 'recv_arg': 0, 'buffers': ''}}, 2: {'msocket': {'send_arg': '', 'recv_arg': 4, 'buffers': ''}}, 3: {'m... |
# The JupyterLab user interface
c.Spawner.default_url = '/lab'
# Jupyterhub Log level
c.JupyterHub.log_level = 'DEBUG'
# LDAP configurations
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.use_ssl = False
c.LDAPAuthenticator.server_address = '103.127.28.120'
c.LDAPAuthent... | c.Spawner.default_url = '/lab'
c.JupyterHub.log_level = 'DEBUG'
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.use_ssl = False
c.LDAPAuthenticator.server_address = '103.127.28.120'
c.LDAPAuthenticator.bind_dn_template = 'uid={username},cn=users,cn=accounts,dc=pdcloudex,dc=c... |
cities = [
'Adak',
'Akiachak',
'Akiak',
'Akutan',
'Alakanuk',
'Aleknagik',
'Allakaket',
'Ambler',
'Anaktuvuk Pass',
'Anchor Point',
'Anchorage',
'Anderson',
'Angoon',
'Aniak',
'Anvik',
'Arctic Village',
'Atka',
'Atqasuk',
'Auke Bay',
'Barro... | cities = ['Adak', 'Akiachak', 'Akiak', 'Akutan', 'Alakanuk', 'Aleknagik', 'Allakaket', 'Ambler', 'Anaktuvuk Pass', 'Anchor Point', 'Anchorage', 'Anderson', 'Angoon', 'Aniak', 'Anvik', 'Arctic Village', 'Atka', 'Atqasuk', 'Auke Bay', 'Barrow', 'Beaver', 'Bethel', 'Bettles Field', 'Big Lake', 'Brevig Mission', 'Buckland'... |
#Programa Palindromo -> una palabra palindromo que se lee al derecho y al reves
#Ejemplo Luz azul
def palindromo(palabra):
palabra = palabra.replace(' ', '')
palabra = palabra.lower()
palabraInvertida = palabra[::-1]
if (palabra == palabraInvertida):
return True
else:
return False... | def palindromo(palabra):
palabra = palabra.replace(' ', '')
palabra = palabra.lower()
palabra_invertida = palabra[::-1]
if palabra == palabraInvertida:
return True
else:
return False
def run():
print('Validemos si es un palindromo')
palabra = input('Escribe tu palabra para v... |
class signup_locators():
# Locators for facebook Signup page
userfirstnametextbox_id = "u_0_j"
userlastnametextbox_id = "u_0_l"
| class Signup_Locators:
userfirstnametextbox_id = 'u_0_j'
userlastnametextbox_id = 'u_0_l' |
# model settings
model = dict(
type='CAE',
backbone=dict(type='CAEViT', arch='b', patch_size=16, init_values=0.1),
neck=dict(
type='CAENeck',
patch_size=16,
embed_dims=768,
num_heads=12,
regressor_depth=4,
decoder_depth=4,
mlp_ratio=4,
init_val... | model = dict(type='CAE', backbone=dict(type='CAEViT', arch='b', patch_size=16, init_values=0.1), neck=dict(type='CAENeck', patch_size=16, embed_dims=768, num_heads=12, regressor_depth=4, decoder_depth=4, mlp_ratio=4, init_values=0.1), head=dict(type='CAEHead', tokenizer_path='cae_ckpt/dalle_encoder.pth', lambd=2), base... |
# Databricks notebook source
datFileReadOptions = {"header":"true",
"delimiter":"|",
"inferSchema":"false"}
csvFileReadOptions = {"header":"true",
"delimiter":",",
"inferSchema":"false"}
# COMMAND ----------
webSalesSchema = "ws_... | dat_file_read_options = {'header': 'true', 'delimiter': '|', 'inferSchema': 'false'}
csv_file_read_options = {'header': 'true', 'delimiter': ',', 'inferSchema': 'false'}
web_sales_schema = 'ws_sold_date_sk LONG,ws_sold_time_sk LONG,ws_ship_date_sk LONG,ws_item_sk LONG,ws_bill_customer_sk LONG,ws_bill_cdemo_sk LONG,ws_b... |
VAULT_ASSETS = {
"1.6.3": {
"linux": (
"https://releases.hashicorp.com/vault/1.6.3/vault_1.6.3_linux_amd64.zip",
"844adaf632391be41f945143de7dccfa9b39c52a72e8e22a5d6bad9c32404c46",
),
"darwin": (
"https://releases.hashicorp.com/vault/1.6.3/vault_1.6.3_darw... | vault_assets = {'1.6.3': {'linux': ('https://releases.hashicorp.com/vault/1.6.3/vault_1.6.3_linux_amd64.zip', '844adaf632391be41f945143de7dccfa9b39c52a72e8e22a5d6bad9c32404c46'), 'darwin': ('https://releases.hashicorp.com/vault/1.6.3/vault_1.6.3_darwin_amd64.zip', '7250ab8c5e9aa05eb223cfdc3f07a4a437341ee258244062b2d0fd... |
pessoa = list()
pessoas = list()
maior = manor = 0
while True:
pessoa.append(str(input('Nome: ')))
pessoa.append(float(input('Peso: ')))
if len(pessoas) == 0:
maior = pessoa[1]
menor = pessoa[1]
elif pessoa[1] > maior:
maior = pessoa[1]
elif pessoa[1] < menor:
menor ... | pessoa = list()
pessoas = list()
maior = manor = 0
while True:
pessoa.append(str(input('Nome: ')))
pessoa.append(float(input('Peso: ')))
if len(pessoas) == 0:
maior = pessoa[1]
menor = pessoa[1]
elif pessoa[1] > maior:
maior = pessoa[1]
elif pessoa[1] < menor:
menor =... |
print("Nhap n:")
n = int(input())
total = 0
for num in range(n):
total = total + num
print(total) | print('Nhap n:')
n = int(input())
total = 0
for num in range(n):
total = total + num
print(total) |
#!/usr/bin/python3
def roman_to_int(roman_string):
result = 0
convert_roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500,
'M': 1000}
if roman_string is None:
return 0
if type(roman_string) is not str:
return 0
if len(roman_string) > 0:
vlr_prev... | def roman_to_int(roman_string):
result = 0
convert_roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
if roman_string is None:
return 0
if type(roman_string) is not str:
return 0
if len(roman_string) > 0:
vlr_previous = 0
for letter in roman_string:... |
# 51st week
# cofo 690 div3
# No. 1
'''
if __name__ == "__main__":
for _ in range(int(input())):
n = int(input())
l = list(map(int,input().split(' ')))
res = []
sig = 1
while len(l) > 0:
res.append(l.pop(0) if sig == 1 else l.pop(-1))
sig *= -1
... | """
if __name__ == "__main__":
for _ in range(int(input())):
n = int(input())
l = list(map(int,input().split(' ')))
res = []
sig = 1
while len(l) > 0:
res.append(l.pop(0) if sig == 1 else l.pop(-1))
sig *= -1
print(" ".join(map(str, res)))
"""
... |
cnt = 0
a = []
for i in range(100):
x = int(input())
a.append(x)
for x in a:
cnt += x
print(cnt) | cnt = 0
a = []
for i in range(100):
x = int(input())
a.append(x)
for x in a:
cnt += x
print(cnt) |
# Time: O(n), n=len(nums)
# Space: O(n)
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
imap = {}
for index, num in enumerate(nums):
if target-num in imap:
return [imap[target-num], index]
else:
imap[num] = index... | class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
imap = {}
for (index, num) in enumerate(nums):
if target - num in imap:
return [imap[target - num], index]
else:
imap[num] = index
return [None, None] |
aux = 0
k = int(input("Ingrese numero K: "))
for i in range(0,k+1):
aux = -1*i + 12*i
aux = 4*aux
print(aux) | aux = 0
k = int(input('Ingrese numero K: '))
for i in range(0, k + 1):
aux = -1 * i + 12 * i
aux = 4 * aux
print(aux) |
class SpaceValue(object):
def __init__(self, value='blank'):
self.FLAG_MODIFIER = 10
self.BLANK = 0
self.MINE = 9
self._revealed = False
self._space_value_dict = {'mine' : self.MINE,
'blank' : self.BLANK}
self.SPACE_VALUE_RANGE = r... | class Spacevalue(object):
def __init__(self, value='blank'):
self.FLAG_MODIFIER = 10
self.BLANK = 0
self.MINE = 9
self._revealed = False
self._space_value_dict = {'mine': self.MINE, 'blank': self.BLANK}
self.SPACE_VALUE_RANGE = range(10)
self.set_value(value)... |
n= 1
temp= 0
while n<97 :
temp +=n
n= n+2
print(temp)
| n = 1
temp = 0
while n < 97:
temp += n
n = n + 2
print(temp) |
array([[2.88738855, 0.72646774],
[3.16759122, 0.70478649],
[3.45517317, 0.69217863],
[3.75325158, 0.68581005],
[4.07281434, 0.68360819],
[4.50000223, 0.68376092],
[4.54999507, 0.68377879],
[5.11738115, 0.69080411],
[5.44798256, 0.7112322 ],
[5.71126558, 0.7... | array([[2.88738855, 0.72646774], [3.16759122, 0.70478649], [3.45517317, 0.69217863], [3.75325158, 0.68581005], [4.07281434, 0.68360819], [4.50000223, 0.68376092], [4.54999507, 0.68377879], [5.11738115, 0.69080411], [5.44798256, 0.7112322], [5.71126558, 0.7422347], [5.94137211, 0.78496462], [6.1491271, 0.84078035], [6.3... |
#---------------------------------------------------------------------------------------
#-------------------Author : itsjaysuthar ----------------------------------------------
#---------------------------------------------------------------------------------------
t = int(input())
i = 0
while i<t:
num = int(inp... | t = int(input())
i = 0
while i < t:
num = int(input())
if num < 10:
print('Thanks for helping Chef!')
else:
print(-1)
i += 1 |
def printDecimal(x):
print(" ", x, end='')
def printOctal(x):
print(" ", oct(x), end='')
def printHexadecimal(x):
print(" ", hex(x), end='')
def printBinario(x):
print(" ", bin(x), end='')
def imprimirTabela():
x = 0
print(" Decimal Octal Hexadecima... | def print_decimal(x):
print(' ', x, end='')
def print_octal(x):
print(' ', oct(x), end='')
def print_hexadecimal(x):
print(' ', hex(x), end='')
def print_binario(x):
print(' ', bin(x), end='')
def imprimir_tabela():
x = 0
print(' Decimal Octal H... |
class Configuration:
shop_id = None
secret_key = None
def configure(self, shop_id, secret_key):
self.shop_id = shop_id
self.secret_key = secret_key
configuration = Configuration()
| class Configuration:
shop_id = None
secret_key = None
def configure(self, shop_id, secret_key):
self.shop_id = shop_id
self.secret_key = secret_key
configuration = configuration() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.