content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class main:
def __init__(self):
pass
def draw(self):
print("Welcome to Friend_Tracker_2.0")
print("-----------------------------")
print("Type in read if you want to read a profile,\nand write if you want to add something to the profile,\nor type in help if you need help. Type i... | class Main:
def __init__(self):
pass
def draw(self):
print('Welcome to Friend_Tracker_2.0')
print('-----------------------------')
print('Type in read if you want to read a profile,\nand write if you want to add something to the profile,\nor type in help if you need help. Type ... |
# microbit.py 15/01/2021 D.J.Whale
# Simulator for a micro:bit - will be replaced with BITIO
class Radio():
# RCNNABGRR+SS (12 chars)
# 0123456789AB
TESTDATA = (
"RC0000F99+00",
None,
None,
"RC0000F00+99",
"RC0000F99-99",
"RC0000S00+00",
"RC0000B99... | class Radio:
testdata = ('RC0000F99+00', None, None, 'RC0000F00+99', 'RC0000F99-99', 'RC0000S00+00', 'RC0000B99+00', 'RC0000B99-99', 'RC0000B99+99')
def __init__(self):
self._index = 0
def receive(self):
v = self.TESTDATA[self._index]
self._index += 1
if self._index >= len(... |
class Solution:
def pivotIndex(self, nums):
left = 0
right = 0
left_sum = 0
right_sum = sum(nums)
while right < len(nums):
right_sum -= nums[right]
right += 1
if right_sum == left_sum:
return left
else:
... | class Solution:
def pivot_index(self, nums):
left = 0
right = 0
left_sum = 0
right_sum = sum(nums)
while right < len(nums):
right_sum -= nums[right]
right += 1
if right_sum == left_sum:
return left
else:
... |
A, B = map(int, input().split())
diff = abs(A - B)
ans = diff // 10
diff %= 10
ans = ans + [0, 1, 2, 3, 2, 1, 2, 3, 3, 2][diff]
print(ans)
| (a, b) = map(int, input().split())
diff = abs(A - B)
ans = diff // 10
diff %= 10
ans = ans + [0, 1, 2, 3, 2, 1, 2, 3, 3, 2][diff]
print(ans) |
class RobotException(Exception):
pass
class UnitGuardCollision(RobotException):
def __init__(self, other_robot):
self.other_robot = other_robot
class UnitMoveCollision(RobotException):
def __init__(self, other_robots):
self.other_robots = other_robots
class UnitBlockCollision(RobotExcepti... | class Robotexception(Exception):
pass
class Unitguardcollision(RobotException):
def __init__(self, other_robot):
self.other_robot = other_robot
class Unitmovecollision(RobotException):
def __init__(self, other_robots):
self.other_robots = other_robots
class Unitblockcollision(RobotExcep... |
class Solution:
def findPairs(self, nums: List[int], k: int) -> int:
result, frequencyMap = 0, Counter(nums)
for i in frequencyMap:
if k == 0 and frequencyMap[i] > 1:
result += 1
elif k > 0 and i + k in frequencyMap:
result += 1
return ... | class Solution:
def find_pairs(self, nums: List[int], k: int) -> int:
(result, frequency_map) = (0, counter(nums))
for i in frequencyMap:
if k == 0 and frequencyMap[i] > 1:
result += 1
elif k > 0 and i + k in frequencyMap:
result += 1
... |
class Scorer(object):
def __init__(self, cards):
self.cards = cards
def flush(self):
suits = [card.suit for card in self.cards]
if len(set(suits)) == 1:
return True
return False
def straight(self):
values = [card.value for card in self.cards]
val... | class Scorer(object):
def __init__(self, cards):
self.cards = cards
def flush(self):
suits = [card.suit for card in self.cards]
if len(set(suits)) == 1:
return True
return False
def straight(self):
values = [card.value for card in self.cards]
va... |
class InvalidPhoneNumber(Exception):
def __init__(self, phone_number):
self.phone_number = phone_number
self.message = phone_number + ' is an invalid phone number'
super().__init__(self.message)
| class Invalidphonenumber(Exception):
def __init__(self, phone_number):
self.phone_number = phone_number
self.message = phone_number + ' is an invalid phone number'
super().__init__(self.message) |
def list():
'''Returns a list of streams
'''
return 'TO BE IMPLEMENTED'
def add():
'''Set an stream
'''
return 'TO BE IMPLEMENTED'
def find_by_name(name):
'''Returns the named stream
Params:
name - The name of the stream
'''
return 'TO BE IMPLEMENTED'
def delete_by_name(name):
'''D... | def list():
"""Returns a list of streams
"""
return 'TO BE IMPLEMENTED'
def add():
"""Set an stream
"""
return 'TO BE IMPLEMENTED'
def find_by_name(name):
"""Returns the named stream
Params:
name - The name of the stream
"""
return 'TO BE IMPLEMENTED'
def delete_by_name(name... |
# Count Substrings That Differ by One Character
class Solution:
def countSubstrings(self, s, t):
# brute force
slen = len(s)
tlen = len(t)
count = 0
for si in range(slen):
for ti in range(tlen):
index = 0
diffCount = 0
... | class Solution:
def count_substrings(self, s, t):
slen = len(s)
tlen = len(t)
count = 0
for si in range(slen):
for ti in range(tlen):
index = 0
diff_count = 0
while si + index < slen and ti + index < tlen:
... |
set_name(0x80122CDC, "PreGameOnlyTestRoutine__Fv", SN_NOWARN)
set_name(0x80124DA0, "DRLG_PlaceDoor__Fii", SN_NOWARN)
set_name(0x80125274, "DRLG_L1Shadows__Fv", SN_NOWARN)
set_name(0x8012568C, "DRLG_PlaceMiniSet__FPCUciiiiiii", SN_NOWARN)
set_name(0x80125AF8, "DRLG_L1Floor__Fv", SN_NOWARN)
set_name(0x80125BE4, "StoreBlo... | set_name(2148674780, 'PreGameOnlyTestRoutine__Fv', SN_NOWARN)
set_name(2148683168, 'DRLG_PlaceDoor__Fii', SN_NOWARN)
set_name(2148684404, 'DRLG_L1Shadows__Fv', SN_NOWARN)
set_name(2148685452, 'DRLG_PlaceMiniSet__FPCUciiiiiii', SN_NOWARN)
set_name(2148686584, 'DRLG_L1Floor__Fv', SN_NOWARN)
set_name(2148686820, 'StoreBlo... |
#
# PySNMP MIB module ALCATEL-IND1-AUTO-FABRIC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-AUTO-FABRIC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:01:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python vers... | (softent_ind1_auto_fabric,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'softentIND1AutoFabric')
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_cons... |
# Copyright (c) 2014, Charles Duyk
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the fo... | def dict_find(dictionary, name, exact=True):
lower_name = name.lower()
result = []
if exact:
try:
result.append(dictionary[lowerName])
except KeyError:
pass
else:
for key in dictionary:
if lowerName in key:
result.append(diction... |
AWS_DOCKER_HOST = "308535385114.dkr.ecr.us-east-1.amazonaws.com"
def gen_docker_image(container_type):
return (
"/".join([AWS_DOCKER_HOST, "pytorch", container_type]),
f"docker-{container_type}",
)
def gen_docker_image_requires(image_name):
return [f"docker-{image_name}"]
DOCKER_IMAGE_BA... | aws_docker_host = '308535385114.dkr.ecr.us-east-1.amazonaws.com'
def gen_docker_image(container_type):
return ('/'.join([AWS_DOCKER_HOST, 'pytorch', container_type]), f'docker-{container_type}')
def gen_docker_image_requires(image_name):
return [f'docker-{image_name}']
(docker_image_basic, docker_requirement_... |
#
# PySNMP MIB module DNOS-KEYING-PRIVATE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DNOS-KEYING-PRIVATE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:36:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
class QTimer:
def __init__(self, ticks_per_hour = 60, hours_per_day:int = 24):
self.ticks = 0
self.ticks_per_hour = ticks_per_hour
self.hours_per_day = hours_per_day
def tick(self, increment : int = 1):
self.ticks += increment
@property
def minutes(self):
retu... | class Qtimer:
def __init__(self, ticks_per_hour=60, hours_per_day: int=24):
self.ticks = 0
self.ticks_per_hour = ticks_per_hour
self.hours_per_day = hours_per_day
def tick(self, increment: int=1):
self.ticks += increment
@property
def minutes(self):
return self... |
# Copyright (C) 2020 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "No Default Account",
"version": "14.0.1.0.0",
"development_status": "Beta",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"maintainers": ["dreispt"],
... | {'name': 'No Default Account', 'version': '14.0.1.0.0', 'development_status': 'Beta', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'maintainers': ['dreispt'], 'summary': 'Remove default expense account for vendor bills journal', 'website': 'https://github.com/OCA/account-financial-tools', 'lic... |
def swap_even_and_odd_bits(n):
'''Swaps the even and odd bits of an unsigned, 8-bits number.
>>> swap_even_and_odd_bits(0b10101010) == 0b01010101
True
>>> swap_even_and_odd_bits(0b11100010) == 0b11010001
True
'''
assert 0 <= n <= 0xFF, 'Not an 8-bit unsigned number'
return ((n & 0b10101... | def swap_even_and_odd_bits(n):
"""Swaps the even and odd bits of an unsigned, 8-bits number.
>>> swap_even_and_odd_bits(0b10101010) == 0b01010101
True
>>> swap_even_and_odd_bits(0b11100010) == 0b11010001
True
"""
assert 0 <= n <= 255, 'Not an 8-bit unsigned number'
return (n & 170) >> 1... |
URLs = {
"ADULT_SAMPLE":[
"https://s3.amazonaws.com/fast-ai-sample/adult_sample.tgz",
968212,
"64eb9d7e23732de0b138f7372d15492f"
],
"AG_NEWS":[
"https://s3.amazonaws.com/fast-ai-nlp/ag_news_csv.tgz",
11784419,
"b86f328f4dbd072486591cb7a5644dcd"
],
"AMAZON_REVIEWS":[
... | ur_ls = {'ADULT_SAMPLE': ['https://s3.amazonaws.com/fast-ai-sample/adult_sample.tgz', 968212, '64eb9d7e23732de0b138f7372d15492f'], 'AG_NEWS': ['https://s3.amazonaws.com/fast-ai-nlp/ag_news_csv.tgz', 11784419, 'b86f328f4dbd072486591cb7a5644dcd'], 'AMAZON_REVIEWS': ['https://s3.amazonaws.com/fast-ai-nlp/amazon_review_ful... |
n = 6
k = 3
keys = [i for i in range(int(n))]
values = [0] * n
a = dict(zip(keys, values))
result = []
def recur(s, n, was, result):
if len(s) == k:
result.append(s)
return
for i in range(0, n):
if was[i] == 0:
was[i] = 1
recur(s + str(i + 1), n, was, result)
... | n = 6
k = 3
keys = [i for i in range(int(n))]
values = [0] * n
a = dict(zip(keys, values))
result = []
def recur(s, n, was, result):
if len(s) == k:
result.append(s)
return
for i in range(0, n):
if was[i] == 0:
was[i] = 1
recur(s + str(i + 1), n, was, result)
... |
#
# PySNMP MIB module DeltaUPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DeltaUPS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:43:21 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,... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ... |
with open('trenutek.txt',"r") as datoteka:
i = 1
dat2 = open('trenutek1.txt',"w")
for vrstica in datoteka:
dat2.write(str(i) +","+ vrstica)
i += 1
dat2.close()
| with open('trenutek.txt', 'r') as datoteka:
i = 1
dat2 = open('trenutek1.txt', 'w')
for vrstica in datoteka:
dat2.write(str(i) + ',' + vrstica)
i += 1
dat2.close() |
x=[1,1]
for i in range(1000):
x=x+[x[-1]+x[-2]]
#iteration 1
#x=[1,1]+[1+1]
#x=[1,1]+[2]
#x=[1,1,2]
#iteration 2
#x=[1,1,2]+[1+2]
#x=[1,1,2]+[3]
#x=[1,1,2,3]
print(x)
print(x[-1]/x[-2]) | x = [1, 1]
for i in range(1000):
x = x + [x[-1] + x[-2]]
print(x)
print(x[-1] / x[-2]) |
class Tablet :
def __init__(self,tablet_proxy):
self._tablet = tablet_proxy
def set_background(self,color):
self._tablet.setBackgroundColor(color)
def set_image(self,url):
self._tablet.showImage(url)
def load_image(self,url):
return self._table.preLoadImage(url)
| class Tablet:
def __init__(self, tablet_proxy):
self._tablet = tablet_proxy
def set_background(self, color):
self._tablet.setBackgroundColor(color)
def set_image(self, url):
self._tablet.showImage(url)
def load_image(self, url):
return self._table.preLoadImage(url) |
'''
lab 7
'''
#3.1
i = 0
while i <=5:
if i !=3:
print(i)
i = i+1
#3.2
i = 1
result = 1
while i <=5:
print()
i = i+1
print(result)
#3.3
i = 1
result = 0
while i <=5:
result = result +i
i = i+1
print(result)
#3.4
i = 3
result = 0
while i <=8:
... | """
lab 7
"""
i = 0
while i <= 5:
if i != 3:
print(i)
i = i + 1
i = 1
result = 1
while i <= 5:
print()
i = i + 1
print(result)
i = 1
result = 0
while i <= 5:
result = result + i
i = i + 1
print(result)
i = 3
result = 0
while i <= 8:
result = result + i
i = i + 1
print(result)
i =... |
lpu = "LPU"
speciality = "SPECIALLITY"
token = "TOKEN"
chat_id = "CHAT_NAME" # if u re planing to send
| lpu = 'LPU'
speciality = 'SPECIALLITY'
token = 'TOKEN'
chat_id = 'CHAT_NAME' |
def time_difference(was_hours, was_minutes, was_seconds, now_hours, now_minutes, now_seconds):
now_hours -= was_hours
now_minutes -= was_minutes
now_seconds -= was_seconds
seconds_passed = 0
now_minutes = now_minutes * 60
now_hours = now_hours * 3600
seconds_passed += now_seconds
seconds... | def time_difference(was_hours, was_minutes, was_seconds, now_hours, now_minutes, now_seconds):
now_hours -= was_hours
now_minutes -= was_minutes
now_seconds -= was_seconds
seconds_passed = 0
now_minutes = now_minutes * 60
now_hours = now_hours * 3600
seconds_passed += now_seconds
seconds... |
# Plot the raw data before setting the datetime index
df.plot()
plt.show()
# Convert the 'Date' column into a collection of datetime objects: df.Date
df.Date = pd.to_datetime(df.Date)
# Set the index to be the converted 'Date' column
df.set_index('Date', inplace=True)
# Re-plot the DataFrame to see that the axis is ... | df.plot()
plt.show()
df.Date = pd.to_datetime(df.Date)
df.set_index('Date', inplace=True)
df.plot()
plt.show() |
def binary(num):
s = ""
if num != 0:
while num >= 1:
if num % 2 == 0:
s = s + "0"
num = num/2
else:
s = s + "1"
num = num/2
else:
s="0"
return "".join(reversed(s))
print(binary(12)) | def binary(num):
s = ''
if num != 0:
while num >= 1:
if num % 2 == 0:
s = s + '0'
num = num / 2
else:
s = s + '1'
num = num / 2
else:
s = '0'
return ''.join(reversed(s))
print(binary(12)) |
numbers = [int(s) for s in input().split()]
command = input()
while command != 'end':
command = command.split()
action = command[0]
if action == 'swap':
index_1 = int(command[1])
index_2 = int(command[2])
numbers[index_1], numbers[index_2] = numbers[index_2], numbers[index_1]
e... | numbers = [int(s) for s in input().split()]
command = input()
while command != 'end':
command = command.split()
action = command[0]
if action == 'swap':
index_1 = int(command[1])
index_2 = int(command[2])
(numbers[index_1], numbers[index_2]) = (numbers[index_2], numbers[index_1])
... |
_base_ = [
'../_base_/models/stylegan/stylegan3_base.py',
'../_base_/datasets/ffhq_flip.py', '../_base_/default_runtime.py'
]
batch_size = 32
magnitude_ema_beta = 0.5**(batch_size / (20 * 1e3))
synthesis_cfg = {
'type': 'SynthesisNetwork',
'channel_base': 32768,
'channel_max': 512,
'magnitude_e... | _base_ = ['../_base_/models/stylegan/stylegan3_base.py', '../_base_/datasets/ffhq_flip.py', '../_base_/default_runtime.py']
batch_size = 32
magnitude_ema_beta = 0.5 ** (batch_size / (20 * 1000.0))
synthesis_cfg = {'type': 'SynthesisNetwork', 'channel_base': 32768, 'channel_max': 512, 'magnitude_ema_beta': 0.999}
r1_gam... |
potencia=int(input())
tempo=int(input())
calculo=(potencia/1000)*(tempo/60)
print(f'{calculo:.1f} kWh')
| potencia = int(input())
tempo = int(input())
calculo = potencia / 1000 * (tempo / 60)
print(f'{calculo:.1f} kWh') |
# Complexity O(n)
def linear_search(array: list, elem):
for index, number in enumerate(array):
if number == elem:
print(f"The elem {elem} is present ind array, on index {index}.")
return index
print(f"The elem {elem} isn't on array.")
return -1
def linear_search... | def linear_search(array: list, elem):
for (index, number) in enumerate(array):
if number == elem:
print(f'The elem {elem} is present ind array, on index {index}.')
return index
print(f"The elem {elem} isn't on array.")
return -1
def linear_search_in(array: list, elem... |
# lcs = longest_consecutive_series
# ccn = count_of_consecutive_numbers
class Solution(object): #main function
def longestConsecutive(self, values): #sub funcction
lcs = 0 # Initializing
for i in values: # Iteration the given value
if i-1 not in values: # condition check
value = i... | class Solution(object):
def longest_consecutive(self, values):
lcs = 0
for i in values:
if i - 1 not in values:
value = i
ccn = 0
while i in values:
i += 1
ccn += 1
lcs = max(lcs,... |
# Uses python3
def lcm_naive(a, b):
for l in range(1, a*b + 1):
if l % a == 0 and l % b == 0:
return l
return a*b
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
d = gcd(a, b)
return (a // d) * b
if __name__ == '__main__':
a, b = map(int, ... | def lcm_naive(a, b):
for l in range(1, a * b + 1):
if l % a == 0 and l % b == 0:
return l
return a * b
def gcd(a, b):
while b:
(a, b) = (b, a % b)
return a
def lcm(a, b):
d = gcd(a, b)
return a // d * b
if __name__ == '__main__':
(a, b) = map(int, input().split(... |
# french verb conjugation (present)
# greet the user
print('welcome to the french verb conjugator')
# user enter their word
word = str(input('please enter the word you want to conjugate: ')).lower()
# list of conjugated words
word_conjugate = []
# function (and conditional) to check word ending
def conjugate():
... | print('welcome to the french verb conjugator')
word = str(input('please enter the word you want to conjugate: ')).lower()
word_conjugate = []
def conjugate():
if word.endswith('oir'):
word_oir = ['je ' + word.replace('oir', 'ois', 1), 'tu ' + word.replace('oir', 'ois', 1), 'il ' + word.replace('oir', 'oit'... |
class payload:
def __init__(self):
self.name = "next"
self.description = "tell iTunes to play next track"
self.type = "applescript"
self.id = 121
def run(self,session,server,command):
payload = "tell application \"iTunes\" to next track"
server.sendCommand(self.n... | class Payload:
def __init__(self):
self.name = 'next'
self.description = 'tell iTunes to play next track'
self.type = 'applescript'
self.id = 121
def run(self, session, server, command):
payload = 'tell application "iTunes" to next track'
server.sendCommand(self... |
def draw_polygons(self, pipes, gaps):
BLACK = (0, 0, 0)
danger = []
# upper left of pipe[0]
a = (0, 0)
b = (pipes['upper'][0]['x'], 0)
c = (pipes['upper'][0]['x'], gaps[0]['y'])
d = (0, gaps[0]['y'])
danger.append([a, b, c, d])
# lower left of pipe... | def draw_polygons(self, pipes, gaps):
black = (0, 0, 0)
danger = []
a = (0, 0)
b = (pipes['upper'][0]['x'], 0)
c = (pipes['upper'][0]['x'], gaps[0]['y'])
d = (0, gaps[0]['y'])
danger.append([a, b, c, d])
a = (0, pipes['lower'][0]['y'])
b = (pipes['lower'][0]['x'], pipes['lower'][0]['... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
f = open('myfile.txt')
s = f.readline()
i = int(s.strip())
except OSError as err:
print("OS error: ", err)
except ValueError:
print("Could not convert data to integer.")
raise
except:
print("Unexpected error!")
raise
| try:
f = open('myfile.txt')
s = f.readline()
i = int(s.strip())
except OSError as err:
print('OS error: ', err)
except ValueError:
print('Could not convert data to integer.')
raise
except:
print('Unexpected error!')
raise |
test = { 'name': 'q1.1',
'points': 1,
'suites': [ { 'cases': [ { 'code': '>>> assert abs(P[0] - 0.003819) < .1*0.003819;\n'
'>>> assert abs(P[1] - 0.016803) < .1*0.016803;\n'
'>>> assert abs(P[2] - 0.180881) ... | test = {'name': 'q1.1', 'points': 1, 'suites': [{'cases': [{'code': '>>> assert abs(P[0] - 0.003819) < .1*0.003819;\n>>> assert abs(P[1] - 0.016803) < .1*0.016803;\n>>> assert abs(P[2] - 0.180881) < .1*0.180881;\n>>> assert abs(P[3] - 0.631248) < .1*0.631248\n', 'hidden': False, 'locked': False}], 'scored': True, 'setu... |
'''
Write a Python program to make a chain of function decorators (bold, italic, underline etc.).
'''
def make_bold(fn):
def wrapped():
return "<b>" + fn() + "</b>"
return wrapped
def make_italic(fn):
def wrapped():
return "<i>" + fn() + "</i>"
return wrapped
def make_underline(fn)... | """
Write a Python program to make a chain of function decorators (bold, italic, underline etc.).
"""
def make_bold(fn):
def wrapped():
return '<b>' + fn() + '</b>'
return wrapped
def make_italic(fn):
def wrapped():
return '<i>' + fn() + '</i>'
return wrapped
def make_underline(fn):... |
# Program to calcualte LCM of two numbers
# function to calculate LCM
def lcm(x,y):
if x > y:
greater = x
else:
greater = y
while True:
if (greater % x) == 0 and (greater % y) == 0:
lcm = greater
break
greater+=1
return lcm
a = int(input("En... | def lcm(x, y):
if x > y:
greater = x
else:
greater = y
while True:
if greater % x == 0 and greater % y == 0:
lcm = greater
break
greater += 1
return lcm
a = int(input('Enter first number:'))
b = int(input('Enter second number:'))
print('The LCM of'... |
def processRecord(RecordClass, row):
record = RecordClass('mphillips')
record.mapping('basic', 'title', row['title'],
qualifier='officialtitle')
record.mapping('agent', 'creator', row['author'],
qualifier='aut', agent_type='per', info='born somewhere')
... | def process_record(RecordClass, row):
record = record_class('mphillips')
record.mapping('basic', 'title', row['title'], qualifier='officialtitle')
record.mapping('agent', 'creator', row['author'], qualifier='aut', agent_type='per', info='born somewhere')
record.mapping('basic', 'date', row['date'], qual... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# assignment No 1 {day 3}
# In[2]:
# you all are pilots, & we have to land a plane, the altitiude required to land a plane is 1000ft. if its less than that ask the pilot to land
#if its more than 1000ft but less than 5000ft ask the pilot to reduce the altitude t... | at = int(input('inter the altitude'))
if at <= 1000:
print('its safe to land the plane')
elif at > 1000 and at < 5000:
print('reduce the altitude to 1000ft')
else:
print('try later') |
#=========================================================================
# test_timing.py
#=========================================================================
# Additional timing assertions for special paths (e.g., feedthroughs)
#
#-------------------------------------------------------------------------
# tes... | def test_clk_pass_through_arrival():
rpt = 'reports/time-clock-passthrough.rpt'
def slack(rpt):
with open(rpt) as f:
lines = [l for l in f.readlines() if 'slack' in l.lower()]
output = float(lines[0].split()[-1])
return output
def arrival(rpt):
with open(rpt) as f:
lines = [l for l... |
NAME_PREFIX_SEPARATOR = "_"
ENDPOINTS_SEPARATOR = ", "
CSI_CONTROLLER_SERVER_WORKERS = 10
# array types
ARRAY_TYPE_XIV = 'A9000'
ARRAY_TYPE_SVC = 'SVC'
ARRAY_TYPE_DS8K = 'DS8K'
| name_prefix_separator = '_'
endpoints_separator = ', '
csi_controller_server_workers = 10
array_type_xiv = 'A9000'
array_type_svc = 'SVC'
array_type_ds8_k = 'DS8K' |
# optimizer
optimizer = dict(type="SGD", lr=0.04, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(policy="step", warmup="linear", warmup_iters=100, warmup_ratio=0.001, step=[7, 11])
total_epochs = 12
| optimizer = dict(type='SGD', lr=0.04, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
lr_config = dict(policy='step', warmup='linear', warmup_iters=100, warmup_ratio=0.001, step=[7, 11])
total_epochs = 12 |
def pattern(n):
s = ''
for i in range(n):
s += str(n)
for ni in range(n-1,i,-1):
s += str(ni)
if n-1 == i:
pass
else:
s += '\n'
return s | def pattern(n):
s = ''
for i in range(n):
s += str(n)
for ni in range(n - 1, i, -1):
s += str(ni)
if n - 1 == i:
pass
else:
s += '\n'
return s |
print("/"*20)
# lol
stlist = ["qwev", "kleb", "lew", "fvb", "eivf", "igsi", "ycgbayg"]
for s in stlist:
if s.startswith("A"):
print("Found!")
break
else:
print("Not found")
print("/"*20)
answer = 42
guess = 0
while answer != guess:
guess = int(input("Guess the number: "))
else:
pass... | print('/' * 20)
stlist = ['qwev', 'kleb', 'lew', 'fvb', 'eivf', 'igsi', 'ycgbayg']
for s in stlist:
if s.startswith('A'):
print('Found!')
break
else:
print('Not found')
print('/' * 20)
answer = 42
guess = 0
while answer != guess:
guess = int(input('Guess the number: '))
else:
pass
print(... |
# coding: utf-8
class Task:
pass
| class Task:
pass |
class ProtoConverter:
@classmethod
def proto_to_dict(cls, proto_message):
proto_dict = {}
desc = proto_message.DESCRIPTOR
for field in desc.fields:
field_name = field.name
proto_dict[field_name] = getattr(proto_message, field_name)
return proto_dict | class Protoconverter:
@classmethod
def proto_to_dict(cls, proto_message):
proto_dict = {}
desc = proto_message.DESCRIPTOR
for field in desc.fields:
field_name = field.name
proto_dict[field_name] = getattr(proto_message, field_name)
return proto_dict |
report = []
with open('input') as file:
report = list(map(lambda x: x.strip(), file))
gamma = ''
epsilon = ''
for bits in zip(*report[::1]):
zero = 0
one = 0
for bit in bits:
if bit == '1':
one += 1
else:
zero += 1
if one > zero:
gamma += '1'
... | report = []
with open('input') as file:
report = list(map(lambda x: x.strip(), file))
gamma = ''
epsilon = ''
for bits in zip(*report[::1]):
zero = 0
one = 0
for bit in bits:
if bit == '1':
one += 1
else:
zero += 1
if one > zero:
gamma += '1'
e... |
# make a player object
health = 100
max_health = 100
level = 1
experience = 0
gold = 0
attack = 10
defense = 8
heal = 5 | health = 100
max_health = 100
level = 1
experience = 0
gold = 0
attack = 10
defense = 8
heal = 5 |
f_1 = open("C:/repos/voc2coco/sample/valid.txt", "r")
#f_2 = open("sample_ouput.txt", "r")
f_3 = open("C:/repos/voc2coco/sample/annpaths_list.txt", "w")
for l_1 in f_1:
result = "./sample/Annotations/" + l_1.replace("\n", "") + ".xml\n"
f_3.writelines(result)
f_1.close()
#f_2.close()
f_3.close()
| f_1 = open('C:/repos/voc2coco/sample/valid.txt', 'r')
f_3 = open('C:/repos/voc2coco/sample/annpaths_list.txt', 'w')
for l_1 in f_1:
result = './sample/Annotations/' + l_1.replace('\n', '') + '.xml\n'
f_3.writelines(result)
f_1.close()
f_3.close() |
'''
9. Write a Python program to display the examination schedule. (extract the date from exam_st_date).
exam_st_date = (11, 12, 2014)
Sample Output : The examination will start from : 11 / 12 / 2014
Tools:slicing,indexing
'''
#9
exam_st_date = (11, 12, 2014)
x = exam_st_date[0]
y = exam_st_date[1]... | """
9. Write a Python program to display the examination schedule. (extract the date from exam_st_date).
exam_st_date = (11, 12, 2014)
Sample Output : The examination will start from : 11 / 12 / 2014
Tools:slicing,indexing
"""
exam_st_date = (11, 12, 2014)
x = exam_st_date[0]
y = exam_st_date[1]
z =... |
VERSION = 1
SERVICE_URL_BASE = "/api/v" + VERSION + "/"
PG_HOST = "localhost"
PG_USER = "postgres"
PG_PASSWORD = "postgres"
PG_DB = "postgres"
PG_CONNECTION = "host=" + PG_HOST + " user=" + PG_USER + " password=" + PG_PASSWORD + " dbname=" + PG_DB | version = 1
service_url_base = '/api/v' + VERSION + '/'
pg_host = 'localhost'
pg_user = 'postgres'
pg_password = 'postgres'
pg_db = 'postgres'
pg_connection = 'host=' + PG_HOST + ' user=' + PG_USER + ' password=' + PG_PASSWORD + ' dbname=' + PG_DB |
def findAllSubset(nums):
if len(nums) == 0:
return []
results = []
cur_num = nums[0]
results.append({cur_num})
rest_set = nums[1:]
tmp = findAllSubset(rest_set)
for ele in tmp:
results.append({cur_num} | ele)
results = results + tmp
return results
def findAllSubset_... | def find_all_subset(nums):
if len(nums) == 0:
return []
results = []
cur_num = nums[0]
results.append({cur_num})
rest_set = nums[1:]
tmp = find_all_subset(rest_set)
for ele in tmp:
results.append({cur_num} | ele)
results = results + tmp
return results
def find_all_su... |
class Queue:
def __init__(self) -> None:
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
if self.size() > 0:
return self.items.pop(0)
return None
def peek(self):
if self.size() > 0:
return self.items[... | class Queue:
def __init__(self) -> None:
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
if self.size() > 0:
return self.items.pop(0)
return None
def peek(self):
if self.size() > 0:
return self.items[0]
... |
t=int(input())
while(t):
t-=1
b,s,m=map(int,input().split())
print(b+s-m) | t = int(input())
while t:
t -= 1
(b, s, m) = map(int, input().split())
print(b + s - m) |
# Example 1 - names.py: Output three names to the console.
names = ['Issac Newton', 'Marie Curie', 'Albert Einstein']
for name in names:
print(name) | names = ['Issac Newton', 'Marie Curie', 'Albert Einstein']
for name in names:
print(name) |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
def reverseList(head: ListNode) -> ListNode:
if head == None:
return
... | class Solution:
def is_palindrome(self, head: ListNode) -> bool:
def reverse_list(head: ListNode) -> ListNode:
if head == None:
return
prev = head
curr = head.next
head.next = None
while curr != None:
next_node = c... |
# Copyright 2021 Edoardo Riggio
#
# 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 agreed to in writin... | def sum_a(A, s):
return sum_r(A, s, 0, len(A) - 1)
def sum_r(A, s, b, e):
if b > e and s == 0:
return True
elif b <= e and sum_r(A, s, b + 1, e):
return True
elif b <= e and sum_r(A, s - A[b], b + 1, e):
return True
else:
return False
arr = [1, 1, 1, 1, 1, 5, 4, 8, 6... |
class My_Rectangle:
def __init__(self, region, is_white=False, model=(None, None)):
self.region = region
self.is_white = is_white
self.model = model
def is_white(self):
return self.is_white
def get_model(self):
return self.model
| class My_Rectangle:
def __init__(self, region, is_white=False, model=(None, None)):
self.region = region
self.is_white = is_white
self.model = model
def is_white(self):
return self.is_white
def get_model(self):
return self.model |
i=0
arr=[65, 0, 0, 0, 66, 0, 0, 0, 67, 0, 0, 0, 68, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 71, 0, 0, 0, 72, 0, 0, 0, 73, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 77, 0, 0, 0, 78, 0, 0, 0, 79, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 82, 0, 0, 0, 83, 0, 0, 0, 84, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 86,... | i = 0
arr = [65, 0, 0, 0, 66, 0, 0, 0, 67, 0, 0, 0, 68, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 71, 0, 0, 0, 72, 0, 0, 0, 73, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 77, 0, 0, 0, 78, 0, 0, 0, 79, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 82, 0, 0, 0, 83, 0, 0, 0, 84, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0,... |
class Hand:
# poker hand
__POINTS = {
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
'10': 10,
'J': 11,
'Q': 12,
'K': 13,
'A': 14
}
__RANKING = {
'straightflush': 9,
'qu... | class Hand:
__points = {'2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '10': 10, 'J': 11, 'Q': 12, 'K': 13, 'A': 14}
__ranking = {'straightflush': 9, 'quads': 8, 'fullhouse': 7, 'flush': 6, 'straight': 5, 'trips': 4, 'twopair': 3, 'pair': 2, 'highcard': 1}
def __init__(self, deck, players)... |
a = [1, 2, 3]
b = [*a, 4, 5, 6]
print(b)
| a = [1, 2, 3]
b = [*a, 4, 5, 6]
print(b) |
EXPECTED = {'EUTRA-InterNodeDefinitions': {'extensibility-implied': False,
'imports': {'EUTRA-RRC-Definitions': ['ARFCN-ValueEUTRA',
'AntennaInfoCommon',
... | expected = {'EUTRA-InterNodeDefinitions': {'extensibility-implied': False, 'imports': {'EUTRA-RRC-Definitions': ['ARFCN-ValueEUTRA', 'AntennaInfoCommon', 'C-RNTI', 'CellIdentity', 'DL-DCCH-Message', 'MasterInformationBlock', 'MeasConfig', 'PhysCellId', 'RadioResourceConfigDedicated', 'SecurityAlgorithmConfig', 'ShortMA... |
#!/usr/bin/python
# ==============================================================================
# Author: Tao Li (taoli@ucsd.edu)
# Date: Jul 7, 2015
# Question: 121-Best-Time-to-Buy-and-Sell-Stock
# Link: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
# ====================================... | class Solution:
def max_profit(self, prices):
size = len(prices)
if size <= 1:
return 0
dp = [0] * size
min_val = prices[0]
for i in xrange(1, size):
dp[i] = max(dp[i - 1], prices[i] - minVal)
min_val = prices[i] if prices[i] < minVal else... |
mandado=["naranja","manzana","pina"]
for fruta in mandado:
print(fruta)
i=1
while i<=15:
print(i)
i=i+1
a=-3
while a<=3:
print(a)
a=a+1
#Imprimir los primeros 20 numeros pares
iterador=0
print("Tope")
#while iterador<40:
# iterador+=2
# print(iterador)
palabra="el elefante negro"
#for ca... | mandado = ['naranja', 'manzana', 'pina']
for fruta in mandado:
print(fruta)
i = 1
while i <= 15:
print(i)
i = i + 1
a = -3
while a <= 3:
print(a)
a = a + 1
iterador = 0
print('Tope')
palabra = 'el elefante negro'
carros = ['bmw', 'mercedes', 'chevy']
saludo = 'hola'
numero = 123456
print(len(str(num... |
'''
6 kyu Convert string to camel case.py
https://www.codewars.com/kata/517abf86da9663f1d2000003/train/python
Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized only if the original word was capitalized (known as Up... | """
6 kyu Convert string to camel case.py
https://www.codewars.com/kata/517abf86da9663f1d2000003/train/python
Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized only if the original word was capitalized (known as Up... |
class FrankaArmCommException(Exception):
''' Communication failure. Usually occurs due to timeouts.
'''
def __init__(self, message, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
self.message = message
def __str__(self):
return "Communication w/ FrankaInterface ... | class Frankaarmcommexception(Exception):
""" Communication failure. Usually occurs due to timeouts.
"""
def __init__(self, message, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
self.message = message
def __str__(self):
return 'Communication w/ FrankaInterface ran... |
def created(data_json):
# A user creates an issue for a repository.
repository = data_json['repository']
# repository_scm = repository['scm']
repository_name = repository['name']
repository_link = repository['links']['html']['href']
# actor = data_json['actor']
# actor_name = actor['display... | def created(data_json):
repository = data_json['repository']
repository_name = repository['name']
repository_link = repository['links']['html']['href']
issue = data_json['issue']
issue_title = issue['title']
issue_priority = issue['priority']
if 'assignee' in issue:
if issue['assigne... |
class CheckPosture:
def __init__(self, scale=1, key_points={}):
self.key_points = key_points
self.scale = scale
self.message = ""
def set_key_points(self, key_points):
self.key_points = key_points
def get_key_points(self):
return self.key_points
def... | class Checkposture:
def __init__(self, scale=1, key_points={}):
self.key_points = key_points
self.scale = scale
self.message = ''
def set_key_points(self, key_points):
self.key_points = key_points
def get_key_points(self):
return self.key_points
def set_messag... |
#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 |
#!/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) |
#
# 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') |
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... |
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'] |
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... |
#
# 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) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.