content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
'''Function'''
def read_input(path: str):
"""
Read game board file from path.
Return list of str.
>>> read_input("check.txt")
['***21**', '412453*', '423145*', '*543215', '*35214*', '*41532*', '*2*1***']
"""
field = ''
with open(path, 'r') as input_f:
for line in input_f:
... | """Function"""
def read_input(path: str):
"""
Read game board file from path.
Return list of str.
>>> read_input("check.txt")
['***21**', '412453*', '423145*', '*543215', '*35214*', '*41532*', '*2*1***']
"""
field = ''
with open(path, 'r') as input_f:
for line in input_f:
... |
#python OrderedDict
class LRUCache:
def __init__(self, capacity: int):
self.cache = collections.OrderedDict()
self.capacity = capacity
def get(self, key: int) -> int:
if key not in self.cache:
return -1
val = self.cache.pop[key]
self.cache[key] = val
... | class Lrucache:
def __init__(self, capacity: int):
self.cache = collections.OrderedDict()
self.capacity = capacity
def get(self, key: int) -> int:
if key not in self.cache:
return -1
val = self.cache.pop[key]
self.cache[key] = val
return val
def... |
# CENG 487 Assignment6 by
# Arif Burak Demiray
# December 2021
class Scene:
def __init__(self):
self.nodes = []
def add(self, node):
self.nodes.append(node)
| class Scene:
def __init__(self):
self.nodes = []
def add(self, node):
self.nodes.append(node) |
CONSUMER_KEY = 'CHANGE_ME'
CONSUMER_SECRET = 'CHANGE_ME'
ACCESS_TOKEN = 'CHANGE_ME'
ACCESS_TOKEN_SECRET = 'CHANGE_ME'
| consumer_key = 'CHANGE_ME'
consumer_secret = 'CHANGE_ME'
access_token = 'CHANGE_ME'
access_token_secret = 'CHANGE_ME' |
li = list(map(int, input().split()))
li.sort()
print(li[0]+li[1])
| li = list(map(int, input().split()))
li.sort()
print(li[0] + li[1]) |
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if not needle:
return 0
if not haystack:
return 0 if not needle else -1
for i in range(len(haystack)):
for j in range(len(needle)):
if i+j > len(haystack)-1:
... | class Solution:
def str_str(self, haystack: str, needle: str) -> int:
if not needle:
return 0
if not haystack:
return 0 if not needle else -1
for i in range(len(haystack)):
for j in range(len(needle)):
if i + j > len(haystack) - 1:
... |
{
"targets": [
{
"target_name": "daqhats",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": [
"./lib/cJSON.c",
"./lib/gpio.c",
"./lib/mcc118.c",
"./lib/mcc128.c",
"./lib/mcc134_adc.c",
"./lib/mcc134.c",
... | {'targets': [{'target_name': 'daqhats', 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'sources': ['./lib/cJSON.c', './lib/gpio.c', './lib/mcc118.c', './lib/mcc128.c', './lib/mcc134_adc.c', './lib/mcc134.c', './lib/mcc152_dac.c', './lib/mcc152_dio.c', './lib/mcc152.c', './lib/mcc172.c', './lib/nist.... |
#IMPORTANT: This syntax will create an empty dictionary and not an empty set
a = {}
print(type(a))
#An empty set can be created using the below syntax:
b = set()
print(type(b))
b.add(4)
b.add(5) | a = {}
print(type(a))
b = set()
print(type(b))
b.add(4)
b.add(5) |
######################################################
# dom
SCROLL_BAR_WIDTH = getScrollBarWidth()
def ce(tag):
return document.createElement(tag)
def ge(id):
return document.getElementById(id)
def addEventListener(object, kind, callback):
object.addEventListener(kind, callback, False)
class e:
def... | scroll_bar_width = get_scroll_bar_width()
def ce(tag):
return document.createElement(tag)
def ge(id):
return document.getElementById(id)
def add_event_listener(object, kind, callback):
object.addEventListener(kind, callback, False)
class E:
def __init__(self, tag):
self.e = ce(tag)
def... |
N = int(input())
s_list = [input() for _ in range(N)]
M = int(input())
t_list = [input() for _ in range(M)]
tmp = s_list.copy()
tmp.append("fdsfsdfsfs")
s_set = list(set(tmp))
result = []
for s in s_set:
r = 0
for i in s_list:
if i == s:
r += 1
for j in t_list:
if j == s:
... | n = int(input())
s_list = [input() for _ in range(N)]
m = int(input())
t_list = [input() for _ in range(M)]
tmp = s_list.copy()
tmp.append('fdsfsdfsfs')
s_set = list(set(tmp))
result = []
for s in s_set:
r = 0
for i in s_list:
if i == s:
r += 1
for j in t_list:
if j == s:
... |
class Residuals:
def __init__(self, resnet_layer):
resnet_layer.register_forward_hook(self.hook)
def hook(self, module, input, output):
self.features = output
| class Residuals:
def __init__(self, resnet_layer):
resnet_layer.register_forward_hook(self.hook)
def hook(self, module, input, output):
self.features = output |
'''
(c) Copyright 2013 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.
The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and conditions
stipulated in t... | """
(c) Copyright 2013 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.
The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and conditions
stipulated in t... |
class Enum:
"""Create an enumerated type, then add var/value pairs to it.
The constructor and the method .ints(names) take a list of variable names,
and assign them consecutive integers as values. The method .strs(names)
assigns each variable name to itself (that is variable 'v' has value 'v').
... | class Enum:
"""Create an enumerated type, then add var/value pairs to it.
The constructor and the method .ints(names) take a list of variable names,
and assign them consecutive integers as values. The method .strs(names)
assigns each variable name to itself (that is variable 'v' has value 'v').
T... |
class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
prev = 1
curr = 1
for i in range(1, n):
prev, curr = curr, prev + curr
return curr
| class Solution(object):
def climb_stairs(self, n):
"""
:type n: int
:rtype: int
"""
prev = 1
curr = 1
for i in range(1, n):
(prev, curr) = (curr, prev + curr)
return curr |
#!/usr/bin/env python
# Copyright Singapore-MIT Alliance for Research and Technology
class Road:
def __init__(self, name):
self.name = name
self.sections = list()
| class Road:
def __init__(self, name):
self.name = name
self.sections = list() |
#!/usr/bin/env python
# encoding: utf-8
'''
@author: Jason Lee
@license: (C) Copyright @ Jason Lee
@contact: jiansenll@163.com
@file: 238.py
@time: 2019/5/16 23:33
@desc:
'''
class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
if len(nums) <= 1:
return 0
... | """
@author: Jason Lee
@license: (C) Copyright @ Jason Lee
@contact: jiansenll@163.com
@file: 238.py
@time: 2019/5/16 23:33
@desc:
"""
class Solution:
def product_except_self(self, nums: List[int]) -> List[int]:
if len(nums) <= 1:
return 0
res = [1 for i in range(len(nums))]
... |
def func():
a = int(input("enter the 1st value"))
b = int(input("enter the 2nd value"))
c = int(input("enter the 3rd value"))
if (a >= b) and (a >= c):
print(f"{a} is greatest")
elif (b >= a) and (b >= c):
print(f"{b} is greatest")
else:
print(f"greatest value is {c}")
func()
| def func():
a = int(input('enter the 1st value'))
b = int(input('enter the 2nd value'))
c = int(input('enter the 3rd value'))
if a >= b and a >= c:
print(f'{a} is greatest')
elif b >= a and b >= c:
print(f'{b} is greatest')
else:
print(f'greatest value is {c}')
func() |
def factorial(x):
if x == 1 or x == 0:
return 1
else:
return x * factorial(x-1)
x = factorial(5)
print("el factorial es:",x)
| def factorial(x):
if x == 1 or x == 0:
return 1
else:
return x * factorial(x - 1)
x = factorial(5)
print('el factorial es:', x) |
"""
function best_sum(target_sum, numbers) takes target_sum
and an array of positive or zero numbers as arguments.
The function should return the minimum length combination of elements that
add up to exactly the target_sum. Only one combination is returned.
If no combination is found the return value is None.
"""
d... | """
function best_sum(target_sum, numbers) takes target_sum
and an array of positive or zero numbers as arguments.
The function should return the minimum length combination of elements that
add up to exactly the target_sum. Only one combination is returned.
If no combination is found the return value is None.
"""
de... |
# https://leetcode.com/problems/first-bad-version/
# @param version, an integer
# @return an integer
# def isBadVersion(version):
class Solution:
def firstBadVersion(self, n):
"""
:type n: int
:rtype: int
"""
i = 1
j = n
while i < j:
k = (i+j)//2
... | class Solution:
def first_bad_version(self, n):
"""
:type n: int
:rtype: int
"""
i = 1
j = n
while i < j:
k = (i + j) // 2
if is_bad_version(k):
j = k
else:
i = k + 1
return i |
#
# PySNMP MIB module HP-ICF-MVRP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-MVRP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:34:47 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')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
n=int(input("Enter the number"))
for i in range(2,n):
if n%i ==0:
print("Not Prime number")
break
else:
print("Prime Number")
| n = int(input('Enter the number'))
for i in range(2, n):
if n % i == 0:
print('Not Prime number')
break
else:
print('Prime Number') |
# 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... | """Unit tests for new_sets.bzl."""
load('//:lib.bzl', 'new_sets', 'asserts', 'unittest')
def _is_equal_test(ctx):
"""Unit tests for new_sets.is_equal.
Note that if this test fails, the results for the other `sets` tests will be
inconclusive because they use `asserts.new_set_equals`, which in turn calls
`new... |
class Node:
def __init__(self, item: int, prev=None):
self.item = item
self.prev = prev
class Stack:
def __init__(self):
self.last = None
def push(self, item):
self.last = Node(item, self.last)
def pop(self):
item = self.last.item
self.last = self.last.... | class Node:
def __init__(self, item: int, prev=None):
self.item = item
self.prev = prev
class Stack:
def __init__(self):
self.last = None
def push(self, item):
self.last = node(item, self.last)
def pop(self):
item = self.last.item
self.last = self.las... |
def sonarqube_coverage_generator_binary():
deps = ["@remote_coverage_tools//:all_lcov_merger_lib"]
native.java_binary(
name = "SonarQubeCoverageGenerator",
srcs = [
"src/main/java/com/google/devtools/coverageoutputgenerator/SonarQubeCoverageGenerator.java",
"src/main/jav... | def sonarqube_coverage_generator_binary():
deps = ['@remote_coverage_tools//:all_lcov_merger_lib']
native.java_binary(name='SonarQubeCoverageGenerator', srcs=['src/main/java/com/google/devtools/coverageoutputgenerator/SonarQubeCoverageGenerator.java', 'src/main/java/com/google/devtools/coverageoutputgenerator/S... |
class Stack:
__stack = None
def __init__(self):
self.__stack = []
def push(self, val):
self.__stack.append(val)
def peek(self):
if len(self.__stack) != 0:
return self.__stack[len(self.__stack) - 1]
def pop(self):
if len(self.__stack) != 0... | class Stack:
__stack = None
def __init__(self):
self.__stack = []
def push(self, val):
self.__stack.append(val)
def peek(self):
if len(self.__stack) != 0:
return self.__stack[len(self.__stack) - 1]
def pop(self):
if len(self.__stack) != 0:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
SECRET_KEY = 'hunter2'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
},
]
INSTALLED_APPS = [
'octicons.apps.OcticonsConfig'
]
| secret_key = 'hunter2'
templates = [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'APP_DIRS': True}]
installed_apps = ['octicons.apps.OcticonsConfig'] |
# Copyright (C) 2017 Verizon. All Rights Reserved.
#
# File: exceptions.py
# Author: John Hickey, Phil Chandler
# Date: 2017-02-17
#
# 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 th... | """
Exceptions for this project
"""
class Pydcimexception(Exception):
""" Parent exception for all exceptions from this library """
class Pydcimnotsupported(PyDCIMException):
""" For calls that reference DCIM objects we do not know about """
class Wsmanclientexception(PyDCIMException):
""" Base exception... |
STATE_WAIT = 0b000001
STATE_START = 0b000010
STATE_COMPLETE = 0b000100
STATE_CANCEL = 0b001000
STATE_REJECT = 0b010000
STATE_VIOLATE = 0b100000
COMPLETE_BY_CANCEL = STATE_COMPLETE | STATE_CANCEL
COMPLETE_BY_REJECT = STATE_COMPLETE | STATE_REJECT
COMPLETE_BY_VIOLATE = STATE_COMPLETE | STATE_VIOLATE
def isWait(s):
... | state_wait = 1
state_start = 2
state_complete = 4
state_cancel = 8
state_reject = 16
state_violate = 32
complete_by_cancel = STATE_COMPLETE | STATE_CANCEL
complete_by_reject = STATE_COMPLETE | STATE_REJECT
complete_by_violate = STATE_COMPLETE | STATE_VIOLATE
def is_wait(s):
return bool(s & STATE_WAIT)
def is_star... |
class Node:
def __init__(self):
self.out = 0.0
self.last_out = 0.0
self.incoming_connections = []
self.has_output = False
| class Node:
def __init__(self):
self.out = 0.0
self.last_out = 0.0
self.incoming_connections = []
self.has_output = False |
# This for loop only prints 0 through 4 and 6 through 9.
for i in range(10):
if i == 5:
continue
print(i) | for i in range(10):
if i == 5:
continue
print(i) |
# Python List | SGVP386100 | 18:00 21F19
# https://www.geeksforgeeks.org/python-list/
List = []
print("Initial blank List: ")
print(List)
# Creating a List with the use of a String
List = ['GeeksForGeeks']
print("\nList with the use of String: ")
print(List)
# 18:51 26F19
# Creating a List with the use of mulitple ... | list = []
print('Initial blank List: ')
print(List)
list = ['GeeksForGeeks']
print('\nList with the use of String: ')
print(List)
list = ['Geeks', 'For', 'Geeks']
print('\nList containing multiple values: ')
print(List[0])
print(List[2])
list = [['Geeks', 'For'], ['Geeks']]
print('\nMulti-Dimensional List: ')
print(Lis... |
REGISTRATION_MAIL_TEMPLATE = """
Hello {username},
this mail is auto generated by the bot on TUM Heilbronn Discord server.
Please send the message below in the #registration channel to register yourself as a student.
/register {register_code}
If you have any problem regarding to this registering process, please cont... | registration_mail_template = '\nHello {username},\n\nthis mail is auto generated by the bot on TUM Heilbronn Discord server.\nPlease send the message below in the #registration channel to register yourself as a student.\n\n/register {register_code}\n\nIf you have any problem regarding to this registering process, pleas... |
class Variable:
"""A config variable
"""
def __init__(self, name, default, description, type, is_list=False, possible_values=None):
# Variable name, used as key in yaml, or to get variable via command line and env varaibles
self.name = name
# Description of the variable, used for -... | class Variable:
"""A config variable
"""
def __init__(self, name, default, description, type, is_list=False, possible_values=None):
self.name = name
self.description = description
self.type = type
self.is_list = is_list
self._value = None
self._possible_value... |
#
# PySNMP MIB module Unisphere-Data-OSPF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-OSPF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:32:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection, constraints_union) ... |
Student=[]
for i in range(1,11):
names=input("enter names=")
Student.append(names)
print(Student)
for j in range(1,11):
subjects = input("enter subjects=")
Student.append(subjects)
print("list=",Student)
#removes the element at index 1
Student.remove(Student[1])
print("Elemet at index 1 is removed=",Stu... | student = []
for i in range(1, 11):
names = input('enter names=')
Student.append(names)
print(Student)
for j in range(1, 11):
subjects = input('enter subjects=')
Student.append(subjects)
print('list=', Student)
Student.remove(Student[1])
print('Elemet at index 1 is removed=', Student)
Student.remove(Stu... |
# Returns the settings config for an experiment
#
class Settings():
def __init__(self, client):
self.client = client
# Return the settings corresponding to the experiment.
# '/alpha/settings/' GET
#
# experiment - Experiment id to filter by.
def get(self, experiment, options = {}):
body = options['query'] i... | class Settings:
def __init__(self, client):
self.client = client
def get(self, experiment, options={}):
body = options['query'] if 'query' in options else {}
body['experiment'] = experiment
response = self.client.get('/alpha/settings/', body, options)
return response |
def print_formatted(number):
length = len(format(number, 'b'))
for i in range(1, number + 1):
print(f'{i:{length}d} {i:{length}o} {i:{length}X} {i:{length}b}')
if __name__ == '__main__':
n = 20
print_formatted(n)
| def print_formatted(number):
length = len(format(number, 'b'))
for i in range(1, number + 1):
print(f'{i:{length}d} {i:{length}o} {i:{length}X} {i:{length}b}')
if __name__ == '__main__':
n = 20
print_formatted(n) |
# author: brian dillmann
# for rscs
class State:
def __init__(self, name):
if not isinstance(name, basestring):
raise TypeError('State name must be a string')
if not len(name):
raise ValueError('Cannot create State with empty name')
self.name = name
self.transitions = []
self.outputs = {}
def addO... | class State:
def __init__(self, name):
if not isinstance(name, basestring):
raise type_error('State name must be a string')
if not len(name):
raise value_error('Cannot create State with empty name')
self.name = name
self.transitions = []
self.outputs ... |
ids = dict()
for line in open('feature/fluidin.csv'):
id=line.split(',')[1]
ids[id] = ids.get(id, 0) + 1
print(ids)
| ids = dict()
for line in open('feature/fluidin.csv'):
id = line.split(',')[1]
ids[id] = ids.get(id, 0) + 1
print(ids) |
"""
Relation Extraction.
"""
__version__ = 0.3
| """
Relation Extraction.
"""
__version__ = 0.3 |
# Written by Matheus Violaro Bellini
########################################
# This is a quick tool to visualize the values
# that a half floating point can achieve
#
# To use this code, simply input the index
# of the binary you wa... | def interpret_float(num):
result = 0
base = 0
is_negative = 0
if num[0] == 1:
is_negative = 1
is_zero = num[2] == num[3] == num[4] == num[5] == num[6] == 0
is_one = num[2] == num[3] == num[4] == num[5] == num[6] == 1
if is_zero:
return 0
elif is_one and is_negative:
... |
def sum_fibs(n):
fibo = []
a, b = 0, 1
even_sum = 0
for i in range(2, n+1):
a, b = b, a+b
fibo.append(b)
for x in fibo:
if x % 2 == 0:
even_sum = even_sum + x
return even_sum
print(sum_fibs(9)) | def sum_fibs(n):
fibo = []
(a, b) = (0, 1)
even_sum = 0
for i in range(2, n + 1):
(a, b) = (b, a + b)
fibo.append(b)
for x in fibo:
if x % 2 == 0:
even_sum = even_sum + x
return even_sum
print(sum_fibs(9)) |
# Recursion needs two things:
# 1: A base case (if x then y)
# 2: A Recursive (inductive) case
# a way to simplify the problem after simple ops.
# 1: factorial
def factorial(fact):
if fact <= 1: # Base Case: x=1
return 1
else:
return fact * factorial(fact-1)
print(factorial(6))
def... | def factorial(fact):
if fact <= 1:
return 1
else:
return fact * factorial(fact - 1)
print(factorial(6))
def exponential(b, n):
if n == 1:
return b
else:
return b * exponential(b, n - 1)
print(exponential(2, 5))
def palindrome(strPalindrome):
if len(strPalindrome) <=... |
# Subset rows from India, Hyderabad to Iraq, Baghdad
print(temperatures_srt.loc[("India", "Hyderabad"):("Iraq", "Baghdad")])
# Subset columns from date to avg_temp_c
print(temperatures_srt.loc[:, "date":"avg_temp_c"])
# Subset in both directions at once
print(temperatures_srt.loc[("India", "Hyderabad"):("Iraq"... | print(temperatures_srt.loc[('India', 'Hyderabad'):('Iraq', 'Baghdad')])
print(temperatures_srt.loc[:, 'date':'avg_temp_c'])
print(temperatures_srt.loc[('India', 'Hyderabad'):('Iraq', 'Baghdad'), 'date':'avg_temp_c']) |
class CronMonth(int):
"""
Job Manager cron scheduling month. -1 represents all months and
only supported for cron schedule create and modify.
Range : [-1..11].
"""
@staticmethod
def get_api_name():
return "cron-month"
| class Cronmonth(int):
"""
Job Manager cron scheduling month. -1 represents all months and
only supported for cron schedule create and modify.
Range : [-1..11].
"""
@staticmethod
def get_api_name():
return 'cron-month' |
# 15/15
number_of_lines = int(input())
compressed_messages = []
for _ in range(number_of_lines):
decompressed = input()
compressed = ""
symbol = ""
count = 0
for character in decompressed:
if not symbol:
symbol = character
count = 1
continue
... | number_of_lines = int(input())
compressed_messages = []
for _ in range(number_of_lines):
decompressed = input()
compressed = ''
symbol = ''
count = 0
for character in decompressed:
if not symbol:
symbol = character
count = 1
continue
if character =... |
class Score:
def __init__(self):
self._score = 0
def get_score(self):
return self._score
def add_score(self, score):
self._score += score | class Score:
def __init__(self):
self._score = 0
def get_score(self):
return self._score
def add_score(self, score):
self._score += score |
# -*- coding: utf-8 -*-
"""
step9.data.version1.BeaconV1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BeaconV1 class
:copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
class BeaconV1(dict):
def __init__(self, id, si... | """
step9.data.version1.BeaconV1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BeaconV1 class
:copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
class Beaconv1(dict):
def __init__(self, id, site_id, type, udi, label,... |
# coding: utf-8
password_livechan = 'annacookie'
url = 'https://kotchan.org'
kotch_url = 'http://0.0.0.0:8888'
| password_livechan = 'annacookie'
url = 'https://kotchan.org'
kotch_url = 'http://0.0.0.0:8888' |
"""Familytable module."""
def add_inst(client, instance, file_=None):
"""Add a new instance to a family table.
Creates a family table if one does not exist.
Args:
client (obj):
creopyson Client.
instance (str):
New instance name.
`file_` (str, optional):
... | """Familytable module."""
def add_inst(client, instance, file_=None):
"""Add a new instance to a family table.
Creates a family table if one does not exist.
Args:
client (obj):
creopyson Client.
instance (str):
New instance name.
`file_` (str, optional):
... |
a=input()
k = -1
for i in range(len(a)):
if a[i] == '(':
k=i
print(a[:k].count('@='),a[k+5:].count('=@')) | a = input()
k = -1
for i in range(len(a)):
if a[i] == '(':
k = i
print(a[:k].count('@='), a[k + 5:].count('=@')) |
# -*- coding: utf-8 -*-
def main():
s = input()
k = int(input())
one_count = 0
for si in s:
if si == '1':
one_count += 1
else:
break
if s[0] == '1':
if k == 1:
print(s[0])
elif one_count >= k:
print... | def main():
s = input()
k = int(input())
one_count = 0
for si in s:
if si == '1':
one_count += 1
else:
break
if s[0] == '1':
if k == 1:
print(s[0])
elif one_count >= k:
print(1)
elif one_count < k:
pr... |
# Huu Hung Nguyen
# 09/19/2021
# windchill.py
# The program prompts the user for the temperature in Celsius,
# and the wind velocity in kilometers per hour.
# It then calculates the wind chill temperature and prints the result.
# Prompt user for temperature in Celsius
temp = float(input('Enter temperature in d... | temp = float(input('Enter temperature in degrees Celsius: '))
wind_velocity = float(input('Enter wind velocity in kilometers/hour: '))
wind_chill_temp = 13.12 + 0.6215 * temp - 11.37 * wind_velocity ** 0.16 + 0.3965 * temp * wind_velocity ** 0.16
print(f'The wind chill temperature in degrees Celsius is {wind_chill_temp... |
def read_next(*args, **kwargs):
for arg in args:
for elem in arg:
yield elem
for item in kwargs.keys():
yield item
for item in read_next("string", (2,), {"d": 1, "I": 2, "c": 3, "t": 4}):
print(item, end='')
for i in read_next("Need", (2, 3), ["words", "."]):
print(i)
| def read_next(*args, **kwargs):
for arg in args:
for elem in arg:
yield elem
for item in kwargs.keys():
yield item
for item in read_next('string', (2,), {'d': 1, 'I': 2, 'c': 3, 't': 4}):
print(item, end='')
for i in read_next('Need', (2, 3), ['words', '.']):
print(i) |
class Enrollment:
def __init__(self, eid, s, c, g):
self.enroll_id = eid
self.course = c
self.student = s
self.grade = g
| class Enrollment:
def __init__(self, eid, s, c, g):
self.enroll_id = eid
self.course = c
self.student = s
self.grade = g |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
cl = headA
cr = headB
cc = {}
while cl != None:
... | class Solution:
def get_intersection_node(self, headA: ListNode, headB: ListNode) -> ListNode:
cl = headA
cr = headB
cc = {}
while cl != None:
cc[cl] = 1
cl = cl.next
while cr != None:
if cr in cc:
return cr
els... |
class Light:
def __init__(self, always_on: bool, timeout: int):
self.always_on = always_on
self.timeout = timeout | class Light:
def __init__(self, always_on: bool, timeout: int):
self.always_on = always_on
self.timeout = timeout |
class PrimeNumbers:
def getAllPrimes(self, n):
sieves = [True] * (n + 1)
for i in range(2, n + 1):
if i * i > n:
break
if sieves[i]:
for j in range(i + i, n + 1, i):
sieves[j] = False
for i in range(2, n + 1):
... | class Primenumbers:
def get_all_primes(self, n):
sieves = [True] * (n + 1)
for i in range(2, n + 1):
if i * i > n:
break
if sieves[i]:
for j in range(i + i, n + 1, i):
sieves[j] = False
for i in range(2, n + 1):
... |
"""
Data for testing
"""
POP_ACTIVITY = """
$===================================================
$ Carbon activity data in the fcc phase
$===================================================
CREATE_NEW_EQUILIBRIUM 1 1
CHANGE_STATUS PHASE FCC_A1=FIX 1
CHANGE_STATUS PHASE GRAPHITE=D
SET_REFERENCE_STATE C GRAPHITE,,,,
SET... | """
Data for testing
"""
pop_activity = '\n$===================================================\n$ Carbon activity data in the fcc phase\n$===================================================\nCREATE_NEW_EQUILIBRIUM 1 1\nCHANGE_STATUS PHASE FCC_A1=FIX 1\nCHANGE_STATUS PHASE GRAPHITE=D\nSET_REFERENCE_STATE C GRAPHITE,,,,... |
for i in range(int(input())):
s = input()
prev = s[0]
cnt = 1
for i in range(1,len(s)):
if prev == s[i]:
cnt+=1
else:
print("{}{}".format(cnt,prev),end="")
prev = s[i]
cnt =1
print("{}{}".format(cnt,prev)) | for i in range(int(input())):
s = input()
prev = s[0]
cnt = 1
for i in range(1, len(s)):
if prev == s[i]:
cnt += 1
else:
print('{}{}'.format(cnt, prev), end='')
prev = s[i]
cnt = 1
print('{}{}'.format(cnt, prev)) |
"""
Reto: Imprimir todos los numeros enteros (opuestos a naturales tambien) pares e impares dependiendo del valor n
que escoja el usuario.
Le he sumado varios grados de complejidad al enunciado del problema.
Curso: Pensamiento computacional.
Plataforma: Platzi.
Profesor: David Aroesti.
Alumno: @edinsonrequena.
"""
... | """
Reto: Imprimir todos los numeros enteros (opuestos a naturales tambien) pares e impares dependiendo del valor n
que escoja el usuario.
Le he sumado varios grados de complejidad al enunciado del problema.
Curso: Pensamiento computacional.
Plataforma: Platzi.
Profesor: David Aroesti.
Alumno: @edinsonrequena.
"""
... |
#!/usr/bin/python3
if __name__ == "__main__":
# open text file to read
file = open('write_file.txt', 'w')
# read a line from the file
file.write('I am excited to learn Python using Raspberry Pi Zero\n')
file.close()
file = open('write_file.txt', 'r')
data = file.read()
print(data)
file.close() | if __name__ == '__main__':
file = open('write_file.txt', 'w')
file.write('I am excited to learn Python using Raspberry Pi Zero\n')
file.close()
file = open('write_file.txt', 'r')
data = file.read()
print(data)
file.close() |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Frame:
def __init__(self, control):
self.control=control
self.player=[]
self.timer=self.control.timer
self.weapons=self.control.rocket_types
self.any_key=True
def draw(self):
self.player=self.control.world... | class Frame:
def __init__(self, control):
self.control = control
self.player = []
self.timer = self.control.timer
self.weapons = self.control.rocket_types
self.any_key = True
def draw(self):
self.player = self.control.world.gamers[self.control.worm_no]
h... |
class UndergroundSystem:
def __init__(self):
self.inMap = {}
self.outMap = {}
def checkIn(self, id: int, stationName: str, t: int) -> None:
self.inMap[id] = (stationName, t)
def checkOut(self, id: int, stationName: str, t: int) -> None:
start = self.i... | class Undergroundsystem:
def __init__(self):
self.inMap = {}
self.outMap = {}
def check_in(self, id: int, stationName: str, t: int) -> None:
self.inMap[id] = (stationName, t)
def check_out(self, id: int, stationName: str, t: int) -> None:
start = self.inMap[id][1]
... |
class Hangman:
text = [
'''\
____
| |
| o
| /|\\
| |
| / \\
_|_
| |______
| |
|__________|\
''',
'''\
____
| |
| o
| /|\\
| |
| /
_|_
| |______
| |
|__________|\
''',
'''\
____
| |
| o
| /|\\
| |
|
_|_
| |_____... | class Hangman:
text = [' ____\n | |\n | o\n | /|\\\n | |\n | / \\\n _|_\n| |______\n| |\n|__________|', ' ____\n | |\n | o\n | /|\\\n | |\n | /\n _|_\n| |______\n| |\n|__________|', ' ____\n | |\n | o\n | /|\\\n | |\n |\n _|_\n| |____... |
# Reverse bits of a given 32 bits unsigned integer.
# For example, given input 43261596 (represented in binary as 00000010100101000001111010011100),
# return 964176192 (represented in binary as 00111001011110000010100101000000).
#
# Follow up:
# If this function is called many times, how would you optimize it?
# https... | def reverse_bits(d, bits_to_fill=32):
print('{0:b}'.format(d))
n = d.bit_length()
rev_d = 0
need_to_shift = 0
for shift in range(n):
need_to_shift += 1
print('{0:b}'.format(d >> shift))
if d & 1 << shift:
rev_d = rev_d << need_to_shift | 1
need_to_shif... |
print("Welcome to Civil War Predictor, which predicts whether your country will get in Civil War 100% Correctly.\nUnless It Doesn't.")
country = input("What country would you like to predict Civil War for? ")
if 'America' in country: #note that this does not include the middle east or literally any-fucking-where else, ... | print("Welcome to Civil War Predictor, which predicts whether your country will get in Civil War 100% Correctly.\nUnless It Doesn't.")
country = input('What country would you like to predict Civil War for? ')
if 'America' in country:
print('Your country will have a civil war soon!')
else:
print('Your country wi... |
class CUFS:
START: str = "/{SYMBOL}/Account/LogOn?ReturnUrl=%2F{SYMBOL}%2FFS%2FLS%3Fwa%3Dwsignin1.0%26wtrealm%3D{REALM}"
LOGOUT: str = "/{SYMBOL}/FS/LS?wa=wsignout1.0"
class UONETPLUS:
START: str = "/{SYMBOL}/LoginEndpoint.aspx"
GETKIDSLUCKYNUMBERS: str = "/{SYMBOL}/Start.mvc/GetKidsLuckyNumbers"
... | class Cufs:
start: str = '/{SYMBOL}/Account/LogOn?ReturnUrl=%2F{SYMBOL}%2FFS%2FLS%3Fwa%3Dwsignin1.0%26wtrealm%3D{REALM}'
logout: str = '/{SYMBOL}/FS/LS?wa=wsignout1.0'
class Uonetplus:
start: str = '/{SYMBOL}/LoginEndpoint.aspx'
getkidsluckynumbers: str = '/{SYMBOL}/Start.mvc/GetKidsLuckyNumbers'
g... |
"""
from flask_restplus import Api
from log import log
from config import api_restplus_config as config
api = Api(version=config.VERSION,
title=config.TITLE,
description=config.DESCRIPTION,
prefix=config.PREFIX,
doc=config.DOC
)
@api.errorhandler
def default_error_h... | """
from flask_restplus import Api
from log import log
from config import api_restplus_config as config
api = Api(version=config.VERSION,
title=config.TITLE,
description=config.DESCRIPTION,
prefix=config.PREFIX,
doc=config.DOC
)
@api.errorhandler
def default_error_h... |
# Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can redistribute it and/or modify
# it under the... | def merge(S1, S2, S):
"""Merge two sorted Python lists S1 and S2 into properly sized list S."""
i = j = 0
while i + j < len(S):
if j == len(S2) or (i < len(S1) and S1[i] < S2[j]):
S[i + j] = S1[i]
i += 1
else:
S[i + j] = S2[j]
j += 1
def merge... |
class Solution:
def minimumDeletions(self, s: str) -> int:
answer=sys.maxsize
hasa=0
hasb=0
numa=[0]*len(s)
numb=[0]*len(s)
for i in range(len(s)):
numb[i]=hasb
if s[i]=='b':
hasb+=1
for i in range(len(s)-1,-1... | class Solution:
def minimum_deletions(self, s: str) -> int:
answer = sys.maxsize
hasa = 0
hasb = 0
numa = [0] * len(s)
numb = [0] * len(s)
for i in range(len(s)):
numb[i] = hasb
if s[i] == 'b':
hasb += 1
for i in range(... |
def fibona(n):
a = 0
b = 1
for _ in range(n):
a, b = b, a + b
yield a
def main():
for i in fibona(10):
print(i)
if __name__ == "__main__":
main()
| def fibona(n):
a = 0
b = 1
for _ in range(n):
(a, b) = (b, a + b)
yield a
def main():
for i in fibona(10):
print(i)
if __name__ == '__main__':
main() |
def is_palindrome(s):
for i in range(len(s)):
if not (s[i] == s[::-1][i]):
return False
return True
def longest_palindrome(s):
candidates = []
for i in range(len(s)):
st = s[i:]
while st:
if is_palindrome(st):
candidates.append(st)
... | def is_palindrome(s):
for i in range(len(s)):
if not s[i] == s[::-1][i]:
return False
return True
def longest_palindrome(s):
candidates = []
for i in range(len(s)):
st = s[i:]
while st:
if is_palindrome(st):
candidates.append(st)
... |
a = 23
b = 143
c = a + b
d = 1000
e = d + c
F = 300
print(a)
print(b)
print(d)
print(e)
| a = 23
b = 143
c = a + b
d = 1000
e = d + c
f = 300
print(a)
print(b)
print(d)
print(e) |
# Copyright 2017 Google Inc. 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 law or a... | airports = {u'ABQ': u'Albuquerque International Sunport Airport', u'ACA': u'General Juan N Alvarez International Airport', u'ADW': u'Andrews Air Force Base', u'AFW': u'Fort Worth Alliance Airport', u'AGS': u'Augusta Regional At Bush Field', u'AMA': u'Rick Husband Amarillo International Airport', u'ANC': u'Ted Stevens A... |
# The [Hu] system
# The similar philosophy but different approach of GAN.
# A revivable self-supervised Learning system
# The theory contains two:
# 1. The Hu system consists of two agents: the first agent try to provide a good initial solution for the second
# to optimize until the solution meets the specified req... | class Hu(object):
def __init__(self):
self.layers = [] |
# 15/15
games = [input() for i in range(6)]
wins = games.count("W")
if wins >= 5:
print(1)
elif wins >= 3:
print(2)
elif wins >= 1:
print(3)
else:
print(-1)
| games = [input() for i in range(6)]
wins = games.count('W')
if wins >= 5:
print(1)
elif wins >= 3:
print(2)
elif wins >= 1:
print(3)
else:
print(-1) |
N = int(input())
qnt_copos = 0
for i in range(1, N + 1):
L, C = map(int, input().split())
if L > C:
qnt_copos += C
print(qnt_copos) | n = int(input())
qnt_copos = 0
for i in range(1, N + 1):
(l, c) = map(int, input().split())
if L > C:
qnt_copos += C
print(qnt_copos) |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
# coding=UTF-8
#------------------------------------------------------------------------------
# Copyright (c) 2007-2021, Acoular Development Team.
#------------------------------------------------------------------------------
# separate file to find out about version without importing the acoular lib
__author_... | __author__ = 'Acoular Development Team'
__date__ = '5 May 2021'
__version__ = '21.05' |
# CHeck if running from inside jupyter
# From https://stackoverflow.com/questions/47211324/check-if-module-is-running-in-jupyter-or-not
def type_of_script():
try:
ipy_str = str(type(get_ipython()))
if 'zmqshell' in ipy_str:
return 'jupyter'
if 'terminal' in ipy_str:
r... | def type_of_script():
try:
ipy_str = str(type(get_ipython()))
if 'zmqshell' in ipy_str:
return 'jupyter'
if 'terminal' in ipy_str:
return 'ipython'
except:
return 'terminal' |
def test_status(client):
resp = client.get('/status')
assert resp.status_code == 200
def test_get_eval(client):
resp = client.get('/evaluate')
assert resp.status_code == 405
def test_eval_post(client, eval_dict):
resp = client.post('/evaluate', data=eval_dict)
assert resp.status_code == 20... | def test_status(client):
resp = client.get('/status')
assert resp.status_code == 200
def test_get_eval(client):
resp = client.get('/evaluate')
assert resp.status_code == 405
def test_eval_post(client, eval_dict):
resp = client.post('/evaluate', data=eval_dict)
assert resp.status_code == 200
d... |
# A Tuple is a collection which is ordered and unchangeable. Allows duplicate members.
# Create tuple
fruits = ('Apples', 'Oranges', 'Grapes')
# Using a constructor
# fruits2 = tuple(('Apples', 'Oranges', 'Grapes'))
# Single value needs trailing comma
fruits2 = ('Apples',)
# Get value
print(fruits[1])
# Can't chan... | fruits = ('Apples', 'Oranges', 'Grapes')
fruits2 = ('Apples',)
print(fruits[1])
fruits[0] = 'Pears'
del fruits2
print(len(fruits))
fruits_set = {'Apples', 'Oranges', 'Mango'}
print('Apples' in fruits_set)
fruits_set.add('Grape')
fruits_set.remove('Grape')
fruits_set.add('Apples')
fruits_set.clear()
del fruits_set
print... |
n = int(__import__('sys').stdin.readline())
a = [int(_) for _ in __import__('sys').stdin.readline().split()]
res = [-1] * n
for i in range(n):
for j in range(n):
if a[j] > i:
continue
c = 0
for front in range(i):
if res[front] > j:
c += 1
if c ... | n = int(__import__('sys').stdin.readline())
a = [int(_) for _ in __import__('sys').stdin.readline().split()]
res = [-1] * n
for i in range(n):
for j in range(n):
if a[j] > i:
continue
c = 0
for front in range(i):
if res[front] > j:
c += 1
if c ... |
# demonstrates how to get data out of a closure
# on way is to use nonlocal keyword
# nonlocal Py3 only, makes it clear when data is being assigned out of a
# closure into another scope. CAUTION
def sort_priority(numbers, group):
""" Python scope is determined by LEGB
- local
- enclosing
-... | def sort_priority(numbers, group):
""" Python scope is determined by LEGB
- local
- enclosing
- global
- built-in scope
"""
found = False
def helper(x):
nonlocal found
if x in group:
found = True
return (0, x)
return (1, x)... |
"""Result - Data structure for a team."""
class Team:
"""Result - Data structure for a team."""
def __init__(self, team_name, goals_for=0, goals_against=0, home_games=0, away_games=0, points=0):
"""Construct a Team object."""
self._team_name = team_name
self._goals_for = goals_for
... | """Result - Data structure for a team."""
class Team:
"""Result - Data structure for a team."""
def __init__(self, team_name, goals_for=0, goals_against=0, home_games=0, away_games=0, points=0):
"""Construct a Team object."""
self._team_name = team_name
self._goals_for = goals_for
... |
"""Set Union
You are given two sets of student roll numbers. One set has subscribed to the English newspaper, and the other set is
subscribed to the French newspaper. The same student could be in both sets. Your task is to find the total number of
students who have subscribed to at least one newspaper.
The first line... | """Set Union
You are given two sets of student roll numbers. One set has subscribed to the English newspaper, and the other set is
subscribed to the French newspaper. The same student could be in both sets. Your task is to find the total number of
students who have subscribed to at least one newspaper.
The first line... |
# coding=utf-8
region_name = ""
access_key = ""
access_secret = ""
endpoint = None
app_id = ""
acl_ak = ""
acl_access_secret = ""
| region_name = ''
access_key = ''
access_secret = ''
endpoint = None
app_id = ''
acl_ak = ''
acl_access_secret = '' |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Script to calculate Basic Statistics"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Equation for the mean: $\\mu_x = \\sum_{i=1}^{N}\\frac{x_i}{N}$\n",
"\n",
"### Equation for the sta... | {'cells': [{'cell_type': 'markdown', 'metadata': {}, 'source': ['## Script to calculate Basic Statistics']}, {'cell_type': 'markdown', 'metadata': {}, 'source': ['### Equation for the mean: $\\mu_x = \\sum_{i=1}^{N}\\frac{x_i}{N}$\n', '\n', '### Equation for the standard deviation: $\\sigma_x = \\sqrt{\\sum_{i=1}^{N... |
#
# PySNMP MIB module ALVARION-TOOLS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-TOOLS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:22:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (alvarion_mgmt_v2,) = mibBuilder.importSymbols('ALVARION-SMI', 'alvarionMgmtV2')
(alvarion_notification_enable,) = mibBuilder.importSymbols('ALVARION-TC', 'AlvarionNotificationEnable')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_valu... |
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
INSTALL_PACKAGE_CMD = 'Add-WindowsPackage'
INSTALL_PACKAGE_SCRIPT = 'Add-WindowsPackage.ps1'
INSTALL_PACKAGE_PATH = '-PackagePath {}'
INSTALL_PACKAGE_ROOT = ... | install_package_cmd = 'Add-WindowsPackage'
install_package_script = 'Add-WindowsPackage.ps1'
install_package_path = '-PackagePath {}'
install_package_root = '-Path {}'
install_package_log_path = '-LogPath "{}"'
install_package_log_level = '-LogLevel {}'
def install_package(powershell, scripts, awp, package, mnt_dir, l... |
# TODO - Update THINGS value with your things. These are the SNAP MACs for your devices, ex: "abc123"
# Addresses should not have any separators (no "." Or ":", etc.). The hexadecimal digits a-f must be entered in lower case.
THINGS = ["XXXXXX"]
PROFILE_NAME = "default"
CERTIFICATE_CERT = "certs/certificate_cert.pem"
C... | things = ['XXXXXX']
profile_name = 'default'
certificate_cert = 'certs/certificate_cert.pem'
certificate_key = 'certs/certificate_key.pem'
cafile = 'certs/demo.pem' |
RUN_TEST = False
TEST_SOLUTION = 739785
TEST_INPUT_FILE = "test_input_day_21.txt"
INPUT_FILE = "input_day_21.txt"
ARGS = []
def game_over(scores):
return scores[0] >= 1000 or scores[1] >= 1000
def losing_player_score(scores):
return scores[0] if scores[0] < scores[1] else scores[1]
def main_part1(
in... | run_test = False
test_solution = 739785
test_input_file = 'test_input_day_21.txt'
input_file = 'input_day_21.txt'
args = []
def game_over(scores):
return scores[0] >= 1000 or scores[1] >= 1000
def losing_player_score(scores):
return scores[0] if scores[0] < scores[1] else scores[1]
def main_part1(input_file)... |
class dotRebarEndDetailStrip_t(object):
# no doc
RebarHookData=None
RebarStrip=None
RebarThreading=None
| class Dotrebarenddetailstrip_T(object):
rebar_hook_data = None
rebar_strip = None
rebar_threading = None |
x = 1
if x == 1:
print("x is 1")
else:
print("x is not 1")
| x = 1
if x == 1:
print('x is 1')
else:
print('x is not 1') |
# lextab.py. This file automatically created by PLY (version 3.4). Don't edit!
_tabversion = "3.4"
_lextokens = {
"SHORT": 1,
"BOOLCONSTANT": 1,
"USHORT": 1,
"UBYTE": 1,
"DUBCONSTANT": 1,
"FILE_IDENTIFIER": 1,
"ULONG": 1,
"FILE_EXTENSION": 1,
"LONG": 1,
"UNION": 1,
"TABLE": 1... | _tabversion = '3.4'
_lextokens = {'SHORT': 1, 'BOOLCONSTANT': 1, 'USHORT': 1, 'UBYTE': 1, 'DUBCONSTANT': 1, 'FILE_IDENTIFIER': 1, 'ULONG': 1, 'FILE_EXTENSION': 1, 'LONG': 1, 'UNION': 1, 'TABLE': 1, 'IDENTIFIER': 1, 'STRING': 1, 'INTCONSTANT': 1, 'ENUM': 1, 'NAMESPACE': 1, 'LITERAL': 1, 'UINT': 1, 'BYTE': 1, 'INCLUDE': ... |
#
# Copyright (c) 2017 Amit Green. All rights reserved.
#
@gem('Gem.Core')
def gem():
@export
def execute(f):
f()
return execute
#
# intern_arrange
#
@built_in
def intern_arrange(format, *arguments):
return intern_string(format % arguments)
#
# lin... | @gem('Gem.Core')
def gem():
@export
def execute(f):
f()
return execute
@built_in
def intern_arrange(format, *arguments):
return intern_string(format % arguments)
flush_standard_output = PythonSystem.stdout.flush
write_standard_output = PythonSystem.stdout.write
@bu... |
set_name(0x8013923C, "PreGameOnlyTestRoutine__Fv", SN_NOWARN)
set_name(0x8013B300, "DRLG_PlaceDoor__Fii", SN_NOWARN)
set_name(0x8013B7D4, "DRLG_L1Shadows__Fv", SN_NOWARN)
set_name(0x8013BBEC, "DRLG_PlaceMiniSet__FPCUciiiiiii", SN_NOWARN)
set_name(0x8013C058, "DRLG_L1Floor__Fv", SN_NOWARN)
set_name(0x8013C144, "StoreBlo... | set_name(2148766268, 'PreGameOnlyTestRoutine__Fv', SN_NOWARN)
set_name(2148774656, 'DRLG_PlaceDoor__Fii', SN_NOWARN)
set_name(2148775892, 'DRLG_L1Shadows__Fv', SN_NOWARN)
set_name(2148776940, 'DRLG_PlaceMiniSet__FPCUciiiiiii', SN_NOWARN)
set_name(2148778072, 'DRLG_L1Floor__Fv', SN_NOWARN)
set_name(2148778308, 'StoreBlo... |
#!/usr/bin/env python3
#############################################################################
# #
# Program purpose: Test whether a number is within 100 of 1000 or #
# 2000. ... | def check_num(some_num):
return abs(1000 - some_num) <= 100 or abs(2000 - some_num) <= 100
if __name__ == '__main__':
user_int = int(input('Enter a number near a {}: '.format(1000)))
if check_num(user_int):
print('TRUE')
else:
print('False') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.