content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#HERE IS WHERE YOU CHANGE THE URL TO YOUR MOODLE SERVER
#MAKE SURE ALL THE PHP FILES ARE IN THE API FOLDER FOR THIS TO WORK
#CAN CHANGE THE API KEY HERE AS WELL
loginAPIcall = 'http://157.245.126.159/api/login.php'
getPointsAPIcall = 'http://157.245.126.159/api/get_user_points.php'
removePointsAPIcall = 'http://157.24... | login_ap_icall = 'http://157.245.126.159/api/login.php'
get_points_ap_icall = 'http://157.245.126.159/api/get_user_points.php'
remove_points_ap_icall = 'http://157.245.126.159/api/cut_user_points.php'
transactions_ap_icall = 'http://157.245.126.159/api/get_user_pointlist.php'
change_nickname_ap_icall = 'http://157.245.... |
#
# PySNMP MIB module DELL-NETWORKING-FIB-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DELL-NETWORKING-FIB-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:37:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
if l1 is None:
return l2
elif l2 is None:
return l... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode:
if l1 is None:
return l2
elif l2 is None:
return l1
head = ph = list_node(-1... |
def fib(n):
f1 = 1
f2 = 2
s = 2
while f2 < n:
nxt = f1 + f2
f1 = f2
f2 = nxt
if nxt & 1 == 0:
s += nxt
return s
print(fib(4000000))
| def fib(n):
f1 = 1
f2 = 2
s = 2
while f2 < n:
nxt = f1 + f2
f1 = f2
f2 = nxt
if nxt & 1 == 0:
s += nxt
return s
print(fib(4000000)) |
num1=100
num2=200
num3=300
| num1 = 100
num2 = 200
num3 = 300 |
class FieldType:
def __init__(self):
pass
Invalid = 0
Integer = 1
Text = 2
Note = 3
DateTime = 4
Counter = 5
Choice = 6
Lookup = 7
Boolean = 8
Number = 9
Currency = 10
URL = 11
Computed = 12
Threading = 13
Guid = 14
MultiChoice = 15
GridCh... | class Fieldtype:
def __init__(self):
pass
invalid = 0
integer = 1
text = 2
note = 3
date_time = 4
counter = 5
choice = 6
lookup = 7
boolean = 8
number = 9
currency = 10
url = 11
computed = 12
threading = 13
guid = 14
multi_choice = 15
grid... |
'''Challenges Set 1 Challenge 3 Single-byte XOR cipher'''
# http://www.data-compression.com/english.html
CHARACTER_FREQ = {
'a': 0.0651738, 'b': 0.0124248, 'c': 0.0217339, 'd': 0.0349835, 'e': 0.1041442, 'f': 0.0197881, 'g': 0.0158610,
'h': 0.0492888, 'i': 0.0558094, 'j': 0.0009033, 'k': 0.0050529, 'l':... | """Challenges Set 1 Challenge 3 Single-byte XOR cipher"""
character_freq = {'a': 0.0651738, 'b': 0.0124248, 'c': 0.0217339, 'd': 0.0349835, 'e': 0.1041442, 'f': 0.0197881, 'g': 0.015861, 'h': 0.0492888, 'i': 0.0558094, 'j': 0.0009033, 'k': 0.0050529, 'l': 0.033149, 'm': 0.0202124, 'n': 0.0564513, 'o': 0.0596302,... |
bids_schema = {
# BIDS identification bits
'modality': {
'type': 'string',
'required': True
},
'subject_id': {
'type': 'string',
'required': True
},
'session_id': {'type': 'string'},
'run_id': {'type': 'string'},
'acq_id': {'type': 'string'},
'task_id... | bids_schema = {'modality': {'type': 'string', 'required': True}, 'subject_id': {'type': 'string', 'required': True}, 'session_id': {'type': 'string'}, 'run_id': {'type': 'string'}, 'acq_id': {'type': 'string'}, 'task_id': {'type': 'string'}, 'run_id': {'type': 'string'}, 'AccelNumReferenceLines': {'type': 'integer'}, '... |
# Python - 2.7.6
class Ship:
def __init__(self, draft, crew):
self.draft = draft
self.crew = crew
def is_worth_it(self):
return (self.draft - self.crew * 1.5) > 20
| class Ship:
def __init__(self, draft, crew):
self.draft = draft
self.crew = crew
def is_worth_it(self):
return self.draft - self.crew * 1.5 > 20 |
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | load('//go/private:providers.bzl', 'GoStdLib')
def _pure_transition_impl(settings, attr):
return {'//go/config:pure': True}
pure_transition = transition(implementation=_pure_transition_impl, inputs=['//go/config:pure'], outputs=['//go/config:pure'])
def _stdlib_files_impl(ctx):
libs = ctx.attr._stdlib[0][GoSt... |
def is_palindrome(word: str) -> bool:
word = word.replace(' ','').lower() #Take out every space and convert to lowercase the entire string
assert len(word) > 0 , 'Error: Cannot process empty words'
return word == word[::-1]
def main():
word: str = input('Write a word: ')
if is_palindrome(word):
... | def is_palindrome(word: str) -> bool:
word = word.replace(' ', '').lower()
assert len(word) > 0, 'Error: Cannot process empty words'
return word == word[::-1]
def main():
word: str = input('Write a word: ')
if is_palindrome(word):
print(f'{word} is a palindrome!')
else:
print(f'... |
# Python allows you to assign values to multiple variables in one line:
x, y, z = "Orange", "Banana", "Cherry"
print(x)
print(y)
print(z)
# And you can assign the same value to multiple variables in one line:
x = y = z = "Orange"
print(x)
print(y)
print(z)
| (x, y, z) = ('Orange', 'Banana', 'Cherry')
print(x)
print(y)
print(z)
x = y = z = 'Orange'
print(x)
print(y)
print(z) |
frogs = input().split()
while True:
line = input()
tokens = line.split()
command = tokens[0]
if command == 'Join':
name = tokens[1]
frogs.append(name)
elif command == 'Jump':
name = tokens[1]
index = int(tokens[2])
if 0 <= index < len(frogs):
... | frogs = input().split()
while True:
line = input()
tokens = line.split()
command = tokens[0]
if command == 'Join':
name = tokens[1]
frogs.append(name)
elif command == 'Jump':
name = tokens[1]
index = int(tokens[2])
if 0 <= index < len(frogs):
frogs... |
print('===== DESAFIO 065 =====')
op = ''
count = 0
media = 0
maior = menor = 0
while op != 'n':
num = int(input('digite um valor: '))
count += 1
media += num
if count == 1:
maior = num
menor = num
else:
if num > maior:
maior = num
if num < menor:
... | print('===== DESAFIO 065 =====')
op = ''
count = 0
media = 0
maior = menor = 0
while op != 'n':
num = int(input('digite um valor: '))
count += 1
media += num
if count == 1:
maior = num
menor = num
else:
if num > maior:
maior = num
if num < menor:
... |
def max_sub_array_of_size_k(k, arr):
# TODO: Write your code here
if not arr:
return -1
curSum = 0
i = 0
j = len(arr) -1
while i < j:
subarr = arr[i:k]
print(subarr)
total = 0
for num in subarr:
total += num
if total > curSum:
... | def max_sub_array_of_size_k(k, arr):
if not arr:
return -1
cur_sum = 0
i = 0
j = len(arr) - 1
while i < j:
subarr = arr[i:k]
print(subarr)
total = 0
for num in subarr:
total += num
if total > curSum:
cur_sum = total
... |
string = "Hello world"
for char in string:
print(char)
length = len(string)
print(length)
| string = 'Hello world'
for char in string:
print(char)
length = len(string)
print(length) |
expected_output = {
'vrf': {
'HIPTV': {
'address_family': {
'ipv4': {
'routes': {
'172.25.254.37/32': {
'known_via': 'bgp 7992',
'ip': '172.25.254.3... | expected_output = {'vrf': {'HIPTV': {'address_family': {'ipv4': {'routes': {'172.25.254.37/32': {'known_via': 'bgp 7992', 'ip': '172.25.254.37', 'metric': 0, 'installed': {'date': 'Feb 6 13:12:22.999', 'for': '10w6d'}, 'next_hop': {'next_hop_list': {1: {'index': 1, 'metric': 0, 'next_hop': '172.25.253.121', 'from': '17... |
class Search:
def __init__(self):
pass
def execute(self):
pass
def __repr__(self):
pass
def __str__(self):
pass
class QueryBuilder:
pass
class Query:
pass
| class Search:
def __init__(self):
pass
def execute(self):
pass
def __repr__(self):
pass
def __str__(self):
pass
class Querybuilder:
pass
class Query:
pass |
'''
You are given an integer n, the number of teams in a tournament
that has strange rules:
- If the current number of teams is even, each team gets
paired with another team. A total of n / 2 matches are
played, and n / 2 teams advance to the next round.
- If the current ... | """
You are given an integer n, the number of teams in a tournament
that has strange rules:
- If the current number of teams is even, each team gets
paired with another team. A total of n / 2 matches are
played, and n / 2 teams advance to the next round.
- If the current ... |
def day23P1():
pullzle = "463528179"
#pullzle = "389125467"
cups = [int(x) for x in list(pullzle)]
l = len(cups)
startIdx = 0
for i in range(100):
p1 = (startIdx + 1) % l
p2 = (startIdx + 2) % l
p3 = (startIdx + 3) % l
p4 = (startIdx + 4) % l
pickup = [cu... | def day23_p1():
pullzle = '463528179'
cups = [int(x) for x in list(pullzle)]
l = len(cups)
start_idx = 0
for i in range(100):
p1 = (startIdx + 1) % l
p2 = (startIdx + 2) % l
p3 = (startIdx + 3) % l
p4 = (startIdx + 4) % l
pickup = [cups[p1], cups[p2], cups[p3]... |
#!/bin/python3
[n,k] = [int(x) for x in input().split()]
k -= 1
factorial = [1 for _ in range(n+1)]
for i in range(1,n+1):
factorial[i] = factorial[i-1] * i
ans = []
perm = [0]
used = [False for _ in range(n)]
for i in range(n-1):
possible = []
for j in range(1,n):
if not used[j]:
po... | [n, k] = [int(x) for x in input().split()]
k -= 1
factorial = [1 for _ in range(n + 1)]
for i in range(1, n + 1):
factorial[i] = factorial[i - 1] * i
ans = []
perm = [0]
used = [False for _ in range(n)]
for i in range(n - 1):
possible = []
for j in range(1, n):
if not used[j]:
possible.a... |
class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
start_i = 0
end_i = len(nums) - 1
while start_i <= end_i:
index = (start_i + end_i) // 2
if nums[index] == target:
return index
elif nums[index] > target:... | class Solution:
def search_insert(self, nums: List[int], target: int) -> int:
start_i = 0
end_i = len(nums) - 1
while start_i <= end_i:
index = (start_i + end_i) // 2
if nums[index] == target:
return index
elif nums[index] > target:
... |
##
# IO Events
##
CONNECT = 'connect'
CONNECT_ERROR = 'connect_error'
DISCONNECT = 'disconnect'
###
# Client Events
###
CLIENT_DATA = 'client_data'
REGISTER_PLAYER = 'register_player'
PLAYER_MOVE = 'player_move'
###
# Server Events
###
REQUEST_REGISTER = 'register_player_request'
... | connect = 'connect'
connect_error = 'connect_error'
disconnect = 'disconnect'
client_data = 'client_data'
register_player = 'register_player'
player_move = 'player_move'
request_register = 'register_player_request'
server_data = 'server_data'
request_move = 'request_move'
move_result = 'move_result'
board_state = 'boar... |
class Product:
def __init__(self, name, description, seller, price, availability):
self.name = name
self.description = description
self.seller = seller
self.reviews = []
self.price = price
self.availability = availability
def __str__(self):
return f"Produ... | class Product:
def __init__(self, name, description, seller, price, availability):
self.name = name
self.description = description
self.seller = seller
self.reviews = []
self.price = price
self.availability = availability
def __str__(self):
return f'Prod... |
class AuthFailed(Exception):
pass
class SearchFailed(Exception):
pass
| class Authfailed(Exception):
pass
class Searchfailed(Exception):
pass |
tilt_id = "a495bb30c5b14b44b5121370f02d74de"
tilt_sg_adjust = 0
read_interval = 15
dropbox_token = ""
dropbox_folder = "data"
brewfatherCustomStreamURL = "" | tilt_id = 'a495bb30c5b14b44b5121370f02d74de'
tilt_sg_adjust = 0
read_interval = 15
dropbox_token = ''
dropbox_folder = 'data'
brewfather_custom_stream_url = '' |
str = "moam"
str=str.casefold()
#for case sensitive string
str1=reversed(str)
#reversed the string
if list(str)==list(str1):
print("it is palindrome string")
else:
print("It is not palindrome String") | str = 'moam'
str = str.casefold()
str1 = reversed(str)
if list(str) == list(str1):
print('it is palindrome string')
else:
print('It is not palindrome String') |
input = "input1.txt"
depthReadings = []
changes = [] # 1 = increase, 0 = no change, -1 = decrease
with open(input) as f:
for l in f:
depthReadings.append(int(l.strip()))
i = 1
changes.append(0)
while i < len(depthReadings):
if depthReadings[i] < depthReadings[i-1]:
changes.append(-1)
... | input = 'input1.txt'
depth_readings = []
changes = []
with open(input) as f:
for l in f:
depthReadings.append(int(l.strip()))
i = 1
changes.append(0)
while i < len(depthReadings):
if depthReadings[i] < depthReadings[i - 1]:
changes.append(-1)
if depthReadings[i] > depthReadings[i - 1]:
... |
ans = {}
for i in range(10):
n = int(input()) % 42
ans[n] = 1;
print(len(ans)) | ans = {}
for i in range(10):
n = int(input()) % 42
ans[n] = 1
print(len(ans)) |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Find Factors Down to Limit
#Problem level: 8 kyu
def factors(integer, limit):
return [x for x in range(limit,(integer//2)+1) if not integer%x] + ([integer] if integer>=limit else [])
| def factors(integer, limit):
return [x for x in range(limit, integer // 2 + 1) if not integer % x] + ([integer] if integer >= limit else []) |
# File: signalfx_consts.py
# Copyright (c) 2021 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
# Define your constants here
# exception handling
ERR_CODE_MSG = "Error code unavailable"
ERR_MSG_UNAVAILABLE = "Error message unavailable. Please check the asset configuration ... | err_code_msg = 'Error code unavailable'
err_msg_unavailable = 'Error message unavailable. Please check the asset configuration and|or action parameters'
parse_err_msg = 'Unable to parse the error message. Please check the asset configuration and|or action parameters'
valid_integer_msg = 'Please provide a valid integer ... |
# # For loops
# emails = ["email1@email.com", "email2@gmail.com", "email3@email.com"]
#
# for email in emails:
# print(email)
# pass
# # For loops advance
# emails = ["email1@email.com", "email2@gmail.com", "email3@email.com"]
# for email in emails:
# if 'gmail' in email:
# print(email)
# # el... | names = ['james\n', 'jhon\n', 'jack\n']
print(names)
names = [i.replace('\n', '') for i in names]
print(names) |
# Copyright 2012-2020 James Geboski <jgeboski@gmail.com>
#
# 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,... | caution_base64 = 'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw1AUhU/TSkUqgnYQ6ZChOlkQFXGUKhbBQmkrtOpg8tI/aNKQpLg4Cq4FB38Wqw4uzro6uAqC4A+Ik6OToouUeF9SaBHjhcf7OO+ew3v3AUKzylQzMAGommWkE3Exl18Vg68IQIAPg4hIzNSTmcUsPOvrnjqp7mI8y7vvz+pXCiYDfCLxHNMNi3iDeGbT0jnvE4dZWVKIz4nHDbog8SPXZZffOJccFn... |
#!/usr/bin/python3
fo = open("1/input.txt", "r")
input = []
for line in fo.readlines():
line = line.strip()
input.append(int(line))
def part1():
#init
prev = input[0]
counter = 0
#calc
for line in input[1:]:
if line > prev:
counter += 1
prev = li... | fo = open('1/input.txt', 'r')
input = []
for line in fo.readlines():
line = line.strip()
input.append(int(line))
def part1():
prev = input[0]
counter = 0
for line in input[1:]:
if line > prev:
counter += 1
prev = line
print(counter)
def part2():
measures = input... |
# -*- coding: utf-8 -*-
def get_autosuggest_url(tag_type, language, geography):
base_url = "https://" + geography + ".openfoodfacts.org"
autosuggest = base_url + "/cgi/suggest.pl?lc=" + language
autosuggest += "&tagtype=" + tag_type
return autosuggest
| def get_autosuggest_url(tag_type, language, geography):
base_url = 'https://' + geography + '.openfoodfacts.org'
autosuggest = base_url + '/cgi/suggest.pl?lc=' + language
autosuggest += '&tagtype=' + tag_type
return autosuggest |
class Metrics:
received_packets: int = 0
sent_packets: int = 0
forward_key_set: int = 0
forward_key_del: int = 0
lost_packet_count: int = 0
out_of_order_count: int = 0
delete_unknown_key_count: int = 0
| class Metrics:
received_packets: int = 0
sent_packets: int = 0
forward_key_set: int = 0
forward_key_del: int = 0
lost_packet_count: int = 0
out_of_order_count: int = 0
delete_unknown_key_count: int = 0 |
alcohol_cases = None
with open('../static/alcohol_cases.txt', 'r') as f:
alcohol_cases = f.readlines()
smoke_cases = None
with open('../static/smoke_cases.txt', 'r') as f:
smoke_cases = f.readlines()
with open('../static/alcohol_and_cig_cases.txt', 'w') as f:
for i in smoke_cases:
if i in alcohol_... | alcohol_cases = None
with open('../static/alcohol_cases.txt', 'r') as f:
alcohol_cases = f.readlines()
smoke_cases = None
with open('../static/smoke_cases.txt', 'r') as f:
smoke_cases = f.readlines()
with open('../static/alcohol_and_cig_cases.txt', 'w') as f:
for i in smoke_cases:
if i in alcohol_ca... |
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style licence that can be
# found in the LICENSE file.
{
'variables': {
'custom_ld_target%': '',
'custom_ld_host%': '',
},
'conditions': [
['"<(custom_ld_target)"!=""', {
'make_global_settings':... | {'variables': {'custom_ld_target%': '', 'custom_ld_host%': ''}, 'conditions': [['"<(custom_ld_target)"!=""', {'make_global_settings': [['LD', '<(custom_ld_target)']]}], ['"<(custom_ld_host)"!=""', {'make_global_settings': [['LD.host', '<(custom_ld_host)']]}]], 'targets': [{'target_name': 'make_global_settings_ld_test',... |
class Chess:
tag = 0
camp = 0
x = 0
y = 0
| class Chess:
tag = 0
camp = 0
x = 0
y = 0 |
def test_even():
for i in range(0, 6):
yield is_even, i
def is_even(i):
assert i % 2 == 0
| def test_even():
for i in range(0, 6):
yield (is_even, i)
def is_even(i):
assert i % 2 == 0 |
#
# PySNMP MIB module HP-SN-MPLS-TE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-SN-MIBS
# Produced by pysmi-0.3.4 at Mon Apr 29 19:23:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 20... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, single_value_constraint, value_size_constraint, value_range_constraint) ... |
contacts = {}
while True:
tokens = input()
if 'Over' == tokens:
break
[first_value, second_value] = tokens.split(' : ')
if second_value.isdigit():
contacts[first_value] = second_value
else:
contacts[second_value] = first_value
print(("\n".join([f'{key} -> {value}' for key... | contacts = {}
while True:
tokens = input()
if 'Over' == tokens:
break
[first_value, second_value] = tokens.split(' : ')
if second_value.isdigit():
contacts[first_value] = second_value
else:
contacts[second_value] = first_value
print('\n'.join([f'{key} -> {value}' for (key, va... |
# Params change with every run of the application and will be changed by the UI
MEASUREMENT_ID = ''
COMMENT = 'preliminary data'
SONDE_NAME = '2015083012lin.txt'
OVL_FILES = ['15083000_607.dat']
POLLY_FILES = ['2015_05_01_Fri_DWD_00_03_31.nc']
| measurement_id = ''
comment = 'preliminary data'
sonde_name = '2015083012lin.txt'
ovl_files = ['15083000_607.dat']
polly_files = ['2015_05_01_Fri_DWD_00_03_31.nc'] |
class LightSupport:
EFFECT = 4
FLASH = 8
TRANSITION = 32
| class Lightsupport:
effect = 4
flash = 8
transition = 32 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def pruneTree(self, root: TreeNode) -> TreeNode:
if not root:
return None
root.... | class Solution:
def prune_tree(self, root: TreeNode) -> TreeNode:
if not root:
return None
root.left = self.pruneTree(root.left)
root.right = self.pruneTree(root.right)
if root.left is None and root.right is None and (root.val == 0):
return None
retur... |
class Node(object):
def __init__(self, data = None):
self.left = None
self.right = None
self.data = data
def setLeft(self, node):
self.left = node
def setRight(self, node):
self.right = node
def getLeft(self):
return self.left
def getRight(self):
... | class Node(object):
def __init__(self, data=None):
self.left = None
self.right = None
self.data = data
def set_left(self, node):
self.left = node
def set_right(self, node):
self.right = node
def get_left(self):
return self.left
def get_right(self)... |
load("//rust:rust_proto_compile.bzl", "rust_proto_compile")
load("//rust:rust_proto_lib.bzl", "rust_proto_lib")
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library")
def rust_proto_library(**kwargs):
# Compile protos
name_pb = kwargs.get("name") + "_pb"
name_lib = kwargs.get("name") + "_lib"
rust... | load('//rust:rust_proto_compile.bzl', 'rust_proto_compile')
load('//rust:rust_proto_lib.bzl', 'rust_proto_lib')
load('@io_bazel_rules_rust//rust:rust.bzl', 'rust_library')
def rust_proto_library(**kwargs):
name_pb = kwargs.get('name') + '_pb'
name_lib = kwargs.get('name') + '_lib'
rust_proto_compile(name=n... |
message = "Hello charm"
print(message)
# called string methods
print(message.title())
print(message.upper())
print(message.lower())
myint1 = 7
myint2 = 20
print(myint1 + myint2)
myfloat1 = 1.5
myfloat2 = 2.5
print(myfloat1 + myfloat2)
#convert int to str
print("Happy " + str(myint2) + " birthday") | message = 'Hello charm'
print(message)
print(message.title())
print(message.upper())
print(message.lower())
myint1 = 7
myint2 = 20
print(myint1 + myint2)
myfloat1 = 1.5
myfloat2 = 2.5
print(myfloat1 + myfloat2)
print('Happy ' + str(myint2) + ' birthday') |
# Copyright (c) 2015 Joshua Coady
# 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... | class Card:
"""a single card in the deck"""
__val = 0
__symbol = ''
__suit = ''
__visible = False
def __init__(self, val, symbol, suit):
self.__val = val
self.__symbol = symbol
self.__suit = suit
def get_value(self):
"""getter for value"""
return sel... |
def iterSects(activeOnly=True):
for sect in sections:
options = {}
if type(sect) is tuple:
sect, options = sect
try:
active = options['active']
except KeyError:
active = True
if active or not activeOnly:
yield ... | def iter_sects(activeOnly=True):
for sect in sections:
options = {}
if type(sect) is tuple:
(sect, options) = sect
try:
active = options['active']
except KeyError:
active = True
if active or not activeOnly:
yield (sect, options) |
name = "Manish"
age = 30
print("This is hello world!!!")
print(name)
print(float(age))
age = "31"
print(age)
print("this", "is", "cool", "and", "awesome!")
| name = 'Manish'
age = 30
print('This is hello world!!!')
print(name)
print(float(age))
age = '31'
print(age)
print('this', 'is', 'cool', 'and', 'awesome!') |
def ficha(nome='desconhecido', gols=0 ):
print(f'O jogador {nome} marcou {gols} no campeonato.')
jogador = str(input('Nome do jogador: '))
golos = str(input('Quantos golos marcados: '))
if golos.isnumeric():
golos = int(golos)
else:
golos = 0
if jogador.strip() == '':
ficha(gols=golos)
els... | def ficha(nome='desconhecido', gols=0):
print(f'O jogador {nome} marcou {gols} no campeonato.')
jogador = str(input('Nome do jogador: '))
golos = str(input('Quantos golos marcados: '))
if golos.isnumeric():
golos = int(golos)
else:
golos = 0
if jogador.strip() == '':
ficha(gols=golos)
else:
... |
try:
x=int(input())
y=int(input())
if(x>y):
print(x)
else :
print(y)
except : # if error occurse then except will work
print("Bokachoda")
else : # else will run if no error occur
print("All Done")
finally : # finally will work if it has error or not
print("D")
# cant use... | try:
x = int(input())
y = int(input())
if x > y:
print(x)
else:
print(y)
except:
print('Bokachoda')
else:
print('All Done')
finally:
print('D') |
#
# PySNMP MIB module CASA-802-TAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CASA-802-TAP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:29:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint) ... |
#
# PySNMP MIB module DOCS-IETF-CABLE-DEVICE-NOTIFICATION-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/DOCS-IETF-CABLE-DEVICE-NOTIFICATION-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:09:52 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_intersection, constraints_union, value_size_constraint) ... |
#
# PySNMP MIB module MY-VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MY-VLAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:16:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, single_value_constraint, constraints_intersection) ... |
name, age = "ansan p", 18
username = "ansanpsam710*"
print ('Hello!')
print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
| (name, age) = ('ansan p', 18)
username = 'ansanpsam710*'
print('Hello!')
print('Name: {}\nAge: {}\nUsername: {}'.format(name, age, username)) |
class Stack:
def __init__(self):
self.items = []
def is_empty(self):
return self.items == []
def push(self, data):
self.items.append(data)
def pop(self):
return self.items.pop()
def display(self):
for data in reversed(self.items):
print(data)... | class Stack:
def __init__(self):
self.items = []
def is_empty(self):
return self.items == []
def push(self, data):
self.items.append(data)
def pop(self):
return self.items.pop()
def display(self):
for data in reversed(self.items):
print(data)
... |
class BotError(RuntimeError):
def __init__(self, message = "An unexpected error occurred with the bot!"):
self.message = message
class DataError(RuntimeError):
def __init__(self, message = "An unexpected error occurred when accessing/saving data!"):
self.message = message | class Boterror(RuntimeError):
def __init__(self, message='An unexpected error occurred with the bot!'):
self.message = message
class Dataerror(RuntimeError):
def __init__(self, message='An unexpected error occurred when accessing/saving data!'):
self.message = message |
print('='*8,'Tinta para Pintar Parede','='*8)
l = float(input('Qual a largura da parede em metros?'))
a = float(input('Qual a altura da parede em metros?'))
a2 = a*l
qt = a2/2
print('''As dimensoes dessa parede sao de {}x{}.
A area desta parede equivale a {} metros quadrados.
Para pinta-la serao necessarios cerca de {}... | print('=' * 8, 'Tinta para Pintar Parede', '=' * 8)
l = float(input('Qual a largura da parede em metros?'))
a = float(input('Qual a altura da parede em metros?'))
a2 = a * l
qt = a2 / 2
print('As dimensoes dessa parede sao de {}x{}.\nA area desta parede equivale a {} metros quadrados.\nPara pinta-la serao necessarios c... |
# File: terraformcloud_consts.py
# Copyright (c) 2020 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
TERRAFORM_DEFAULT_URL = "https://app.terraform.io"
TERRAFORM_BASE_API_ENDPOINT = "/api/v2"
TERRAFORM_ENDPOINT_WORKSPACES = "/organizations/{organization_name}/workspaces"
T... | terraform_default_url = 'https://app.terraform.io'
terraform_base_api_endpoint = '/api/v2'
terraform_endpoint_workspaces = '/organizations/{organization_name}/workspaces'
terraform_endpoint_get_workspace_by_id = '/workspaces/{id}'
terraform_endpoint_runs = '/runs'
terraform_endpoint_list_runs = '/workspaces/{id}/runs'
... |
# This problem was recently asked by Uber:
# Imagine you are building a compiler. Before running any code, the compiler must check that the parentheses in the program are balanced. Every opening bracket must have a corresponding closing bracket. We can approximate this using strings.
# Given a string containing just... | class Solution:
def is_valid(self, s):
stack = []
open_list = ['[', '{', '(']
close_list = [']', '}', ')']
for i in s:
if i in open_list:
stack.append(i)
elif i in close_list:
pos = close_list.index(i)
if len(st... |
fin = open('Assignment-2-data.txt', 'r')
data = fin.readlines()
for n in range(len(data)):
data[n] = data[n].split()
fin.close()
fout = open('Assignment-2-table.txt', 'w')
for n in range(1, 75):
fout.write(str(n) + ' & ' + data[n - 1][0] + ' & ' + data[n - 1][1] + ' & \\includegraphics[width=.3\\columnwidth]{... | fin = open('Assignment-2-data.txt', 'r')
data = fin.readlines()
for n in range(len(data)):
data[n] = data[n].split()
fin.close()
fout = open('Assignment-2-table.txt', 'w')
for n in range(1, 75):
fout.write(str(n) + ' & ' + data[n - 1][0] + ' & ' + data[n - 1][1] + ' & \\includegraphics[width=.3\\columnwidth]{As... |
def test_e1():
x: i32
s: str
x = 0
s = 's'
print(x+s)
| def test_e1():
x: i32
s: str
x = 0
s = 's'
print(x + s) |
def func():
print("func")
func() # $ resolved=func
class MyBase:
def base_method(self):
print("base_method", self)
class MyClass(MyBase):
def method1(self):
print("method1", self)
@classmethod
def cls_method(cls):
print("cls_method", cls)
@staticmethod
def stat... | def func():
print('func')
func()
class Mybase:
def base_method(self):
print('base_method', self)
class Myclass(MyBase):
def method1(self):
print('method1', self)
@classmethod
def cls_method(cls):
print('cls_method', cls)
@staticmethod
def static():
print... |
frase =[]
maiuscula= ''
def maiusculas(frase):
maiuscula= ''
for i in frase:
letra = i
if letra.isalpha():
letra_m = letra.upper()
if letra_m == letra.upper():
if letra == letra_m:
maiuscula += letra
print(maiuscula)
return maiusc... | frase = []
maiuscula = ''
def maiusculas(frase):
maiuscula = ''
for i in frase:
letra = i
if letra.isalpha():
letra_m = letra.upper()
if letra_m == letra.upper():
if letra == letra_m:
maiuscula += letra
print(maiuscula)
return maiuscula
ma... |
'''
Leetcode problem No 859 Buddy Strings
Solution written by Xuqiang Fang on 24 June, 2018
'''
class Solution(object):
def buddyStrings(self, A, B):
if len(A) != len(B):
return False
dica = {}
dicb = {}
c = 0
for i in range(len(A)):
a = A[i]
... | """
Leetcode problem No 859 Buddy Strings
Solution written by Xuqiang Fang on 24 June, 2018
"""
class Solution(object):
def buddy_strings(self, A, B):
if len(A) != len(B):
return False
dica = {}
dicb = {}
c = 0
for i in range(len(A)):
a = A[i]
... |
nin=input()
x=[]
for i in range(len(nin)):
x.append(int(nin[i]))
list_of_numbers=[]
status='qualified'
majority=0
for i in range(len(x)):
status='qualified'
if i==0:
list_of_numbers.append([])
list_of_numbers[i].append(x[i])
else:
for j in range(len(list_of_numbers)):
... | nin = input()
x = []
for i in range(len(nin)):
x.append(int(nin[i]))
list_of_numbers = []
status = 'qualified'
majority = 0
for i in range(len(x)):
status = 'qualified'
if i == 0:
list_of_numbers.append([])
list_of_numbers[i].append(x[i])
else:
for j in range(len(list_of_numbers)... |
def index():
images = team_db().select(team_db.image.ALL, orderby=team_db.image.category_id)
categories = team_db().select(team_db.category.ALL, orderby=team_db.category.priority)
return dict(images=images, categories=categories)
def download():
return response.download(request, team_db)
| def index():
images = team_db().select(team_db.image.ALL, orderby=team_db.image.category_id)
categories = team_db().select(team_db.category.ALL, orderby=team_db.category.priority)
return dict(images=images, categories=categories)
def download():
return response.download(request, team_db) |
# -*- coding: utf-8 -*-
value1 = input()
value2 = input()
prod = value1+value2
print("SOMA = " + str(prod))
| value1 = input()
value2 = input()
prod = value1 + value2
print('SOMA = ' + str(prod)) |
class Solution:
def minimumSize(self, nums: List[int], maxOperations: int) -> int:
lo, hi = 1, 1_000_000_000
while lo < hi:
mid = lo + hi >> 1
if sum((x-1)//mid for x in nums) <= maxOperations: hi = mid
else: lo = mid + 1
return lo | class Solution:
def minimum_size(self, nums: List[int], maxOperations: int) -> int:
(lo, hi) = (1, 1000000000)
while lo < hi:
mid = lo + hi >> 1
if sum(((x - 1) // mid for x in nums)) <= maxOperations:
hi = mid
else:
lo = mid + 1
... |
BINDIR = '/usr/local/bin'
BLOCK_MESSAGE_KEYS = []
BUILD_TYPE = 'app'
BUNDLE_NAME = 'pebble.pbw'
DEFINES = ['RELEASE']
LIBDIR = '/usr/local/lib'
LIB_DIR = 'node_modules'
LIB_JSON = []
MESSAGE_KEYS = {}
MESSAGE_KEYS_HEADER = '/mnt/files/scripts/pebble/pebble-navigation/pebble/build/include/message_keys.auto.h'
NODE_PATH ... | bindir = '/usr/local/bin'
block_message_keys = []
build_type = 'app'
bundle_name = 'pebble.pbw'
defines = ['RELEASE']
libdir = '/usr/local/lib'
lib_dir = 'node_modules'
lib_json = []
message_keys = {}
message_keys_header = '/mnt/files/scripts/pebble/pebble-navigation/pebble/build/include/message_keys.auto.h'
node_path ... |
test = dict(
batch_size=8,
num_workers=2,
eval_func="default_test",
clip_range=None,
tta=dict( # based on the ttach lib
enable=False,
reducation="mean", # 'mean', 'gmean', 'sum', 'max', 'min', 'tsharpen'
cfg=dict(
HorizontalFlip=dict(),
VerticalFlip=... | test = dict(batch_size=8, num_workers=2, eval_func='default_test', clip_range=None, tta=dict(enable=False, reducation='mean', cfg=dict(HorizontalFlip=dict(), VerticalFlip=dict(), Rotate90=dict(angles=[0, 90, 180, 270]), Scale=dict(scales=[0.75, 1, 1.5], interpolation='bilinear', align_corners=False), Add=dict(values=[0... |
# Latihan menampilkan deret fibonacci dengan fungsi rekursif
def fibonacci(n):
if n == 0 or n == 1:
return n
else:
return (fibonacci(n-1) + fibonacci(n-2))
input_nilai = 6
for i in range(input_nilai):
print(fibonacci(i), end=' ') | def fibonacci(n):
if n == 0 or n == 1:
return n
else:
return fibonacci(n - 1) + fibonacci(n - 2)
input_nilai = 6
for i in range(input_nilai):
print(fibonacci(i), end=' ') |
# Auth Constants
TOKEN_HEADER = {"alg": "RS256", "typ": "JWT", "kid": "flask-jwt-oidc-test-client"}
BASE_AUTH_CLAIMS = {
"iss": "test_issuer",
"sub": "43e6a245-0bf7-4ccf-9bd0-e7fb85fd18cc",
"aud": "test_audience",
"exp": 21531718745,
"iat": 1531718745,
"jti": "flask-jwt-oidc-test-support",
... | token_header = {'alg': 'RS256', 'typ': 'JWT', 'kid': 'flask-jwt-oidc-test-client'}
base_auth_claims = {'iss': 'test_issuer', 'sub': '43e6a245-0bf7-4ccf-9bd0-e7fb85fd18cc', 'aud': 'test_audience', 'exp': 21531718745, 'iat': 1531718745, 'jti': 'flask-jwt-oidc-test-support', 'typ': 'Bearer', 'username': 'test-user', 'real... |
# Works from Zero til One Thousand!
def InWords(num):
# We must define all unique numbers
TillFifteen = {0: "zero", 1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight",
9: "nine", 10: "ten", 11: "eleven", 12: "twelve", 13: "thirteen", 15: "fifteen"}
# Mul... | def in_words(num):
till_fifteen = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 15: 'fifteen'}
multiples_of_ten = {20: 'twenty', 30: 'thirty', 40: 'forty', 50: 'fifty', 60: 'sixty', 70: 'seven... |
#
# PySNMP MIB module MBG-SNMP-LT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MBG-SNMP-LT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:00:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ... |
class Request(dict):
def __init__(self, server_port=None, server_name=None, remote_addr=None,
uri=None, query_string=None, script_name=None, scheme=None,
method=None, headers={}, body=None):
super().__init__({
"server_port": server_port,
"server_nam... | class Request(dict):
def __init__(self, server_port=None, server_name=None, remote_addr=None, uri=None, query_string=None, script_name=None, scheme=None, method=None, headers={}, body=None):
super().__init__({'server_port': server_port, 'server_name': server_name, 'remote_addr': remote_addr, 'uri': uri, 's... |
def factorial(n):
if n == 0:
return 1
return factorial(n-1) * n
| def factorial(n):
if n == 0:
return 1
return factorial(n - 1) * n |
def getalpha(schedule, step):
alpha = 0.0
for (point, alpha_) in schedule:
if step >= point:
alpha = alpha_
else:
break
return alpha
step_stage_0 = 0
step_stage_1 = 5e4
step_stage_2 = 7e4
step_stage_3 = 1e5
step_stage_4 = 2.5e5
step_stages = [step_stage_0, step_sta... | def getalpha(schedule, step):
alpha = 0.0
for (point, alpha_) in schedule:
if step >= point:
alpha = alpha_
else:
break
return alpha
step_stage_0 = 0
step_stage_1 = 50000.0
step_stage_2 = 70000.0
step_stage_3 = 100000.0
step_stage_4 = 250000.0
step_stages = [step_stag... |
def nome_no_formulario():
nome = input()
tamanho_de_caracteres = len(nome)
if tamanho_de_caracteres > 80:
print('NO')
else:
print('YES')
nome_no_formulario()
| def nome_no_formulario():
nome = input()
tamanho_de_caracteres = len(nome)
if tamanho_de_caracteres > 80:
print('NO')
else:
print('YES')
nome_no_formulario() |
class Fib:
def __init__(self,nn):
print("inicjujemy")
self.__n=nn
self.__i=0
self.__p1=self.__p2=1
def __iter__(self):
print('iter')
return self
def __next__(self):
print('next')
self.__i+=1
if self.__i>self.__n:
... | class Fib:
def __init__(self, nn):
print('inicjujemy')
self.__n = nn
self.__i = 0
self.__p1 = self.__p2 = 1
def __iter__(self):
print('iter')
return self
def __next__(self):
print('next')
self.__i += 1
if self.__i > self.__n:
... |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
CORE_GAUGES = {
'system.disk.total': 5,
'system.disk.used': 4,
'system.disk.free': 1,
'system.disk.in_use': .80,
}
CORE_RATES = {
'system.disk.write_time_pct': 9.0,
'system.disk.read_time_p... | core_gauges = {'system.disk.total': 5, 'system.disk.used': 4, 'system.disk.free': 1, 'system.disk.in_use': 0.8}
core_rates = {'system.disk.write_time_pct': 9.0, 'system.disk.read_time_pct': 5.0}
unix_gauges = {'system.fs.inodes.total': 10, 'system.fs.inodes.used': 1, 'system.fs.inodes.free': 9, 'system.fs.inodes.in_use... |
# by Kami Bigdely
# Replace magic numbers with named constanst
def calculation(charge1, charge2, distance):
constant = 8.9875517923*1e9
return constant * charge1 * charge2 / (distance**2)
# First Section
# Given two point charges, calcualte the electric force exerted on them.
q1 = int(input('Enter ... | def calculation(charge1, charge2, distance):
constant = 8.9875517923 * 1000000000.0
return constant * charge1 * charge2 / distance ** 2
q1 = int(input('Enter a value of charge q1: '))
q2 = int(input('Enter a value of charge q2: '))
distance = int(input('Enter the distance be10tween two charges: '))
print('Elect... |
class IDataset(object):
def __init__(self):
pass
def train(self):
raise RuntimeError("No implementation found!")
def val(self):
raise RuntimeError("No implementation found!")
def test(self):
raise RuntimeError("No implementation found!")
| class Idataset(object):
def __init__(self):
pass
def train(self):
raise runtime_error('No implementation found!')
def val(self):
raise runtime_error('No implementation found!')
def test(self):
raise runtime_error('No implementation found!') |
class A:
def z(self):
return self
def y(self, t):
return len(t)
#Funcion que abriremos desde el archivo main.py
def main_puzzle():
a = A
y = a.z
print(y(a)) #Muestra por pantalla <class '__main__.A'> ya que la funcion z devuelve self
aa = a()
print(aa is a()) #Impri... | class A:
def z(self):
return self
def y(self, t):
return len(t)
def main_puzzle():
a = A
y = a.z
print(y(a))
aa = a()
print(aa is a())
z = aa.y
print(z(()))
print(a().y((a,)))
print(A.y(aa, (a, z)))
print(aa.y((z, 1, 'z'))) |
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
class solution:
def maxProfit(prices:list[int])->int:
pricesSize = len(prices)
dp_sell_out = []
dp_sell_with = []
dp_buy = []
#current action is not selling, next step cou... | class Solution:
def max_profit(prices: list[int]) -> int:
prices_size = len(prices)
dp_sell_out = []
dp_sell_with = []
dp_buy = []
dp_sell_out.append(0)
dp_sell_with.append(0)
dp_buy.append(-prices[0])
for i in range(1, pricesSize):
dp_sel... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def partition(self, head: ListNode, x: int) -> ListNode:
curr_node = head
curr_new = new_head = ListNode(0)
prev = None
wh... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def partition(self, head: ListNode, x: int) -> ListNode:
curr_node = head
curr_new = new_head = list_node(0)
prev = None
while curr_node:
if curr_n... |
# This program subtracts one number from another
# Author: Isabella Doyle
first = int(input("Enter the first number:")) # requests input of integer from user
second = int(input("Enter the second number:")) # requests input of integer from user
# prints sum below
print(first - second) | first = int(input('Enter the first number:'))
second = int(input('Enter the second number:'))
print(first - second) |
def test_get_uptimez(client):
response = client.get("/uptimez/")
assert response.status_code == 200
def test_get_healthz(client):
response = client.get("/healthz/")
assert response.status_code == 200
| def test_get_uptimez(client):
response = client.get('/uptimez/')
assert response.status_code == 200
def test_get_healthz(client):
response = client.get('/healthz/')
assert response.status_code == 200 |
print("Hello world")
print("Adios")
def suma(a,b):
return a+b
print(suma(2,3))
print("Esto es una feature") | print('Hello world')
print('Adios')
def suma(a, b):
return a + b
print(suma(2, 3))
print('Esto es una feature') |
t = int(input())
for _ in range(t) :
n, k = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
if(k > arr[0]) :
print(abs(k-arr[0]))
else :
print(0) | t = int(input())
for _ in range(t):
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
if k > arr[0]:
print(abs(k - arr[0]))
else:
print(0) |
a = int(input("Enter the First Number: "))# Inputing the first number
b = int(input("Enter the seconf Number: "))#inputing the second number
if(a>=b):#cheking if the first
print(a, "is greater")
else:
print(b, "is greater")
| a = int(input('Enter the First Number: '))
b = int(input('Enter the seconf Number: '))
if a >= b:
print(a, 'is greater')
else:
print(b, 'is greater') |
#returns the set of reachable vertices assuming G is represented via adjacency lists.
# Assumes that the graph is a dictionary and each adjacency list is a set.
def reachable(G,v):
rset = set()
def dfs(w):
rset.add(w)
for ngh in G[w]:
if not (ngh in rset):
dfs(ngh)
return
dfs(v)
return(rset)
G = {}
G... | def reachable(G, v):
rset = set()
def dfs(w):
rset.add(w)
for ngh in G[w]:
if not ngh in rset:
dfs(ngh)
return
dfs(v)
return rset
g = {}
G[0] = {1, 2, 3}
G[1] = {0, 3}
G[2] = {}
G[3] = {1, 4, 2}
G[4] = {5, 6}
G[5] = {4}
G[7] = {5, 6}
G[6] = {5, 7}
pri... |
#
# PySNMP MIB module ADSL-LINE-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADSL-LINE-EXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:58:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (adsl_atuc_perf_data_entry, adsl_atur_interval_entry, adsl_atuc_interval_entry, adsl_line_alarm_conf_profile_entry, adsl_line_entry, adsl_line_conf_profile_entry, adsl_atur_perf_data_entry, adsl_mib) = mibBuilder.importSymbols('ADSL-LINE-MIB', 'adslAtucPerfDataEntry', 'adslAturIntervalEntry', 'adslAtucIntervalEntry', '... |
def fahrenheit_to_celsius(F):
C = 0
# Your code goes here: calculate the temperature in Celsius,
# store in a variable (we called it C), and return it.
return C
| def fahrenheit_to_celsius(F):
c = 0
return C |
base_datapath = '/Work19/2020/lijunjie/LRS3/AV_model_database/'
with open(base_datapath+'pretrain_dataset.txt', 'r') as tr:
lines = tr.readlines()
for line in lines:
info = line.strip().split('.')
num1 = info[0].strip().split('-')[1]
num2 = info[0].strip().split('-')[2]
new_lin... | base_datapath = '/Work19/2020/lijunjie/LRS3/AV_model_database/'
with open(base_datapath + 'pretrain_dataset.txt', 'r') as tr:
lines = tr.readlines()
for line in lines:
info = line.strip().split('.')
num1 = info[0].strip().split('-')[1]
num2 = info[0].strip().split('-')[2]
new_lin... |
def entry(**kwargs):
return '\n'.join([
"Welcome to SAMi",
"What would you like? REPLY",
"1 = Resources",
"2 = Talk to a friend",
"3 = Charge your phone",
])
def resources_1(**kwargs):
return '\n'.join([
"Welcome to resources: TEXT",
"1 = Food",
... | def entry(**kwargs):
return '\n'.join(['Welcome to SAMi', 'What would you like? REPLY', '1 = Resources', '2 = Talk to a friend', '3 = Charge your phone'])
def resources_1(**kwargs):
return '\n'.join(['Welcome to resources: TEXT', '1 = Food', '2 = Shelters', '3 = Bathroom/Showers'])
def resources_shelters_1(**... |
def aumentar(preco=0, taxa=0, formatado=False):
res = preco + (preco * taxa / 100)
return res if formatado is False else moeda(res)
def diminuir(preco=0, taxa=0, formatado=False):
res = preco - (preco * taxa / 100)
return res if formatado is False else moeda(res)
def dobro(preco=0, formatado=False):... | def aumentar(preco=0, taxa=0, formatado=False):
res = preco + preco * taxa / 100
return res if formatado is False else moeda(res)
def diminuir(preco=0, taxa=0, formatado=False):
res = preco - preco * taxa / 100
return res if formatado is False else moeda(res)
def dobro(preco=0, formatado=False):
r... |
class Queue:
def __init__(self, initial_size = 10):
self.arr = [0 for _ in range(initial_size)]
self.next_index = 0;
self.front_index = -1;
self.queue_size = 0;
def enqueue(self, value):
if(self.queue_size) == len(self.arr):
self.handle_queue_capacity_full();
self.arr[self.next_index... | class Queue:
def __init__(self, initial_size=10):
self.arr = [0 for _ in range(initial_size)]
self.next_index = 0
self.front_index = -1
self.queue_size = 0
def enqueue(self, value):
if self.queue_size == len(self.arr):
self.handle_queue_capacity_full()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.