content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# coding: UTF-8
# Coder for Japanese iarea grid code.
# NTT DoCoMo's Open iArea in Japan use a gridcode which is very similar to
# JIS X 0410, but absolutely different in detail.
def _encode_i2c(lat,lon,basebits):
t=[]
for i in range(basebits-3):
t.append((lat&1)*2 + (lon&1))
lat = lat>>1
lon = lon>>... | def _encode_i2c(lat, lon, basebits):
t = []
for i in range(basebits - 3):
t.append((lat & 1) * 2 + (lon & 1))
lat = lat >> 1
lon = lon >> 1
if basebits >= 3:
t.append(lon & 7)
t.append(lat & 7)
lat = lat >> 3
lon = lon >> 3
t.append(lon)
t.appe... |
class Solution(object):
def addBinary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
if len(a) >= len(b):
n1 = list(a[::-1])
n2 = list(b[::-1])
else:
n1 = list(b[::-1])
n2 = list(a[::-1])
n1 = [int(num) for num in n1]
n2 = [int(num) for num in n... | class Solution(object):
def add_binary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
if len(a) >= len(b):
n1 = list(a[::-1])
n2 = list(b[::-1])
else:
n1 = list(b[::-1])
n2 = list(a[::-1])
n1 = [int(num) for... |
'''
Created on Feb 22, 2016
@author: dj
'''
def fibonacci():
numbers = []
while True:
if len(numbers) < 2:
numbers.append(1)
else:
numbers.append(sum(numbers))
numbers.pop(0)
yield numbers[-1]
def main():
print("-" * 40)
... | """
Created on Feb 22, 2016
@author: dj
"""
def fibonacci():
numbers = []
while True:
if len(numbers) < 2:
numbers.append(1)
else:
numbers.append(sum(numbers))
numbers.pop(0)
yield numbers[-1]
def main():
print('-' * 40)
for n in fibonacci()... |
"""A collection of functions for working with cities."""
def city_state(city, state, population=0):
"""Return a string representing a city-state pair."""
output_string = city.title() + ", " + state.title()
if population:
output_string += ' - population ' + str(population)
return output... | """A collection of functions for working with cities."""
def city_state(city, state, population=0):
"""Return a string representing a city-state pair."""
output_string = city.title() + ', ' + state.title()
if population:
output_string += ' - population ' + str(population)
return output_string |
x=19
y=20.35
print(x);
print(y);
print(x+y);
| x = 19
y = 20.35
print(x)
print(y)
print(x + y) |
# Author: Gaurav Pande
# find the lowest common ancestor for a given 2 nodes in a binary search tree
# link: https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/description/
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# sel... | class Solution:
def lowest_common_ancestor(self, root, p, q):
"""
:type root: TreeNode
:type p: TreeNode
:type q: TreeNode
:rtype: TreeNode
"""
while (root.val - p.val) * (root.val - q.val) > 0:
if p.val < root.val:
root = root.lef... |
#!/usr/bin/python
# Copyright 2021 Gregory Ditzler
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modi... | def jaccard(a, b):
"""
Jaccard stability index
"""
(a, b) = (set(a), set(b))
return 1.0 * len(a.intersection(b)) / len(a.union(b))
def kuncheva(a, b, K):
"""
Kuncheva stability index
"""
(a, b) = (set(a), set(b))
r = 1.0 * len(a.intersection(b))
k = 1.0 * len(a)
return ... |
# -*- Mode: Python; tab-width: 2; indent-tabs-mode:nil; -*-
# vim: set ts=2 et sw=2 tw=80:
#
# Copyright (c) 2013 The MathJax Consortium
#
# 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
#
# ht... | copyright = 'Copyright (c) 2013 The MathJax Consortium'
font_splitting = [['Main', (0, 127), 160, 163, 165, 167, 168, 172, 174, (175, 177), 180, 181, 183, 215, 240, 247, 295, 305, 567, (710, 711), (713, 715), (728, 730), 732, (768, 772), (774, 776), (778, 780), 824, (880, 893), (895, 899), (913, 937), (945, 969), (975,... |
astr = input("Zadej retezec")
prvni = astr[0].lower()
if prvni == "a" or \
prvni == "e" or \
prvni == "o" or \
prvni == "u" or \
prvni == "i" or \
prvni == "y":
print("Zacina samohlaskou")
else:
print("Zacina souhlaskou")
| astr = input('Zadej retezec')
prvni = astr[0].lower()
if prvni == 'a' or prvni == 'e' or prvni == 'o' or (prvni == 'u') or (prvni == 'i') or (prvni == 'y'):
print('Zacina samohlaskou')
else:
print('Zacina souhlaskou') |
#!/usr/bin/env python3
"""
:problem: https://www.hackerrank.com/challenges/minimum-swaps-2/problem
"""
def main():
n = int(input())
arr = [int(x) for x in input().split()]
sorted_arr = sorted(arr)
swaps = 0
expected_indicies = {val: i for i, val in enumerate(sorted_arr)}
for i, (val, expected_... | """
:problem: https://www.hackerrank.com/challenges/minimum-swaps-2/problem
"""
def main():
n = int(input())
arr = [int(x) for x in input().split()]
sorted_arr = sorted(arr)
swaps = 0
expected_indicies = {val: i for (i, val) in enumerate(sorted_arr)}
for (i, (val, expected_val)) in enumerate(zi... |
class Solution:
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
dict = {"I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000}
nums = []
for e in s:
nums.append(dict[e])
max = 0
result = 0
print(nums)
fo... | class Solution:
def roman_to_int(self, s):
"""
:type s: str
:rtype: int
"""
dict = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
nums = []
for e in s:
nums.append(dict[e])
max = 0
result = 0
print(nums)
... |
def _extractPoints(line):
points = line.split(" through ")
startPoint = points[0].split(",")
startPoint = (int(startPoint[0]), int(startPoint[1]))
endPoint = points[1].split(",")
endPoint = (int(endPoint[0]), int(endPoint[1]))
return startPoint, endPoint
def _extactInfo(line):
if "turn on" ... | def _extract_points(line):
points = line.split(' through ')
start_point = points[0].split(',')
start_point = (int(startPoint[0]), int(startPoint[1]))
end_point = points[1].split(',')
end_point = (int(endPoint[0]), int(endPoint[1]))
return (startPoint, endPoint)
def _extact_info(line):
if 't... |
#-----------------------------------------------------------------------------
# Name: File Writing (fileWriting - simple.py)
# Purpose: To provide examples of how to read from files.
# Example from http://openbookproject.net/thinkcs/python/english3e/files.html
#
# Author: Mr. Brooks
# Crea... | string = 'This will be written to a file'
file = open('output.txt', 'a')
file.write(string)
file.close() |
"""Color palette used througt the app. Makes easier to change."""
BACKGROUND = '#ecf0f1',
LIGHT_GRAY = '#34495e'
DARK_GRAY = '#2c3e50'
ORANGE = '#e67e22'
VIOLET = '#9b59b6'
WHITE = '#FFFFFF'
BLACK = '#000000' | """Color palette used througt the app. Makes easier to change."""
background = ('#ecf0f1',)
light_gray = '#34495e'
dark_gray = '#2c3e50'
orange = '#e67e22'
violet = '#9b59b6'
white = '#FFFFFF'
black = '#000000' |
#!/usr/bin/env python
NAME = 'Safedog'
def is_waf(self):
if self.matchcookie('^safedog-flow-item='):
return True
if self.matchheader(('server', '^Safedog')):
return True
for attack in self.attacks:
r = attack(self)
if r is None:
return
_, responsebody ... | name = 'Safedog'
def is_waf(self):
if self.matchcookie('^safedog-flow-item='):
return True
if self.matchheader(('server', '^Safedog')):
return True
for attack in self.attacks:
r = attack(self)
if r is None:
return
(_, responsebody) = r
if any((i i... |
n = int(input())
l = list(map(int, input().split(" ")))
sum = 0.0
for i in range(0,n):
sum = sum + (1 / l[i])
sum = 1 / sum
print(sum) | n = int(input())
l = list(map(int, input().split(' ')))
sum = 0.0
for i in range(0, n):
sum = sum + 1 / l[i]
sum = 1 / sum
print(sum) |
alien = Actor('alien', anchor=('middle', 'bottom'))
TITLE = "Alien walk"
WIDTH = 500
HEIGHT = alien.height + 100
GROUND = HEIGHT - 10
# The initial position of the alien
alien.left = 0
alien.y = GROUND
def draw():
"""Clear the screen and draw the alien."""
screen.fill((0, 0, 0))
alien.draw()
def update():
... | alien = actor('alien', anchor=('middle', 'bottom'))
title = 'Alien walk'
width = 500
height = alien.height + 100
ground = HEIGHT - 10
alien.left = 0
alien.y = GROUND
def draw():
"""Clear the screen and draw the alien."""
screen.fill((0, 0, 0))
alien.draw()
def update():
"""Move the alien around using ... |
class NamedEntityRecognition:
def extract(self, text, merge=False):
"""
text: unicode
text
merge: bool
merge multiword entities into single list of terms
returns: list
list of terms (in case merge = False)
or list of list of terms (wh... | class Namedentityrecognition:
def extract(self, text, merge=False):
"""
text: unicode
text
merge: bool
merge multiword entities into single list of terms
returns: list
list of terms (in case merge = False)
or list of list of terms (wh... |
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'actions-test',
'type': 'none',
'actions': [
{
'action_name': 'first action (f... | {'targets': [{'target_name': 'actions-test', 'type': 'none', 'actions': [{'action_name': 'first action (fails)', 'inputs': ['action_fail.py'], 'outputs': ['ALWAYS_OUT_OF_DATE'], 'action': ['python', '<@(_inputs)'], 'msvs_cygwin_shell': 0}, {'action_name': 'second action (succeeds)', 'inputs': ['action_succeed.py'], 'ou... |
property_value_alias_bc_short_to_long = {
"AL": "Arabic_Letter",
"AN": "Arabic_Number",
"B": "Paragraph_Separator",
"BN": "Boundary_Neutral",
"CS": "Common_Separator",
"EN": "European_Number",
"ES": "European_Separator",
"ET": "European_Terminator",
"FSI": "First_Strong_Isolate",
... | property_value_alias_bc_short_to_long = {'AL': 'Arabic_Letter', 'AN': 'Arabic_Number', 'B': 'Paragraph_Separator', 'BN': 'Boundary_Neutral', 'CS': 'Common_Separator', 'EN': 'European_Number', 'ES': 'European_Separator', 'ET': 'European_Terminator', 'FSI': 'First_Strong_Isolate', 'L': 'Left_To_Right', 'LRE': 'Left_To_Ri... |
# Copyright (c) 2010, Mats Kindahl, Charles Bell, and Lars Thalmann
# 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
# ... | """
Module holding all the exceptions of the Replicant package.
"""
class Error(Exception):
"""
Base class for all exceptions in this package
"""
pass
class Emptyrowerror(Error):
"""
Class to handle attempts to fetch a key from an empty row.
"""
pass
class Nooptionerror(Error):
""... |
class Solution(object):
def runningSum(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
counter = 0
list = []
for i in nums:
counter = i + counter
list.append(counter)
return(list) | class Solution(object):
def running_sum(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
counter = 0
list = []
for i in nums:
counter = i + counter
list.append(counter)
return list |
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
h = {}
for x in range(len(nums)):
h[nums[x]] = x
for x in range(len(nums)):
if target - nums[x] in h:
if h[target - nums[x]] == x:
print()
... | class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
h = {}
for x in range(len(nums)):
h[nums[x]] = x
for x in range(len(nums)):
if target - nums[x] in h:
if h[target - nums[x]] == x:
print()
... |
# OS4 Shuttle Driving License | (2430135)
if sm.getSkillByItem() == 0:# Check whether item has an vehicleID stored, 0 if false.
sm.chat("An Error occurred whilst trying to find the mount.")
elif sm.hasSkill(sm.getSkillByItem()):
sm.chat("You already have the 'OS4 Shuttle' mount.")
else:
sm.consumeItem()
... | if sm.getSkillByItem() == 0:
sm.chat('An Error occurred whilst trying to find the mount.')
elif sm.hasSkill(sm.getSkillByItem()):
sm.chat("You already have the 'OS4 Shuttle' mount.")
else:
sm.consumeItem()
sm.giveSkill(sm.getSkillByItem())
sm.chat("Successfully added the 'OS4 Shuttle' mount.")
sm.di... |
UNIQUE_TEAMS = "SELECT DISTINCT winner FROM matchups;"
WINS_COUNT = "SELECT COUNT(*) FROM matchups WHERE winner = ?"
LOSS_COUNT = "SELECT COUNT(*) FROM matchups WHERE loser = ?"
POINT_SCORED = "SELECT winner, loser, winner_score, loser_score FROM MATCHUPS"
LOWEST_5 = "SELECT year, week, loser, loser_score FROM matchups... | unique_teams = 'SELECT DISTINCT winner FROM matchups;'
wins_count = 'SELECT COUNT(*) FROM matchups WHERE winner = ?'
loss_count = 'SELECT COUNT(*) FROM matchups WHERE loser = ?'
point_scored = 'SELECT winner, loser, winner_score, loser_score FROM MATCHUPS'
lowest_5 = 'SELECT year, week, loser, loser_score FROM matchups... |
# BST Implementation
class Tree:
# constructor sets three attrs data, left subtree and right subtree
def __init__(self, data, left = None, right = None):
self.data = data
self.left = left
self.right = right
# inserts a new subtreeinto the proper location
def insert(self, data):
if self.data... | class Tree:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
def insert(self, data):
if self.data == data:
return False
elif self.data > data:
if self.left is not None:
return s... |
"""test_cases_timex.py
GUTime test cases have at least 4 elements:
1. the name of the test
2. the sentence
3. begin offset of the time expression
4. end offset of the time expression
These cases test for the presence of an TIMEX3 tag in the Tarsqi output. To test
for the absence of a time expression, simply add None... | """test_cases_timex.py
GUTime test cases have at least 4 elements:
1. the name of the test
2. the sentence
3. begin offset of the time expression
4. end offset of the time expression
These cases test for the presence of an TIMEX3 tag in the Tarsqi output. To test
for the absence of a time expression, simply add None... |
class Solution:
def peakIndexInMountainArray(self, arr: List[int]) -> int:
lo,hi = 0,len(arr)-1
while lo<hi:
mi = (lo+hi)//2
if arr[mi]<arr[mi+1]:
lo = mi + 1
else:
hi = mi
return lo
... | class Solution:
def peak_index_in_mountain_array(self, arr: List[int]) -> int:
(lo, hi) = (0, len(arr) - 1)
while lo < hi:
mi = (lo + hi) // 2
if arr[mi] < arr[mi + 1]:
lo = mi + 1
else:
hi = mi
return lo
' \n ... |
DEBUG = True
# to generate a new key, execute this command:
# function django_secret() { python -c "import random,string;print(''.join([random.SystemRandom().choice(\"{}{}{}\".format(string.ascii_letters, string.digits, string.punctuation)) for i in range(63)]).replace('\\'','\\'\"\\'\"\\''))"; }
# echo "DJANGO_SECRET_... | debug = True
secret_key = 'yoursecret'
installed_apps = []
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'sqlite3.db', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': ''}} |
# Properties that are used for generating the documentation.
# To generate the documentation, say "./doc/build.py".
# The directory of the main project.
# There should be "doc" directory inside this directory.
mainProject = 'flipsta'
# The directory of subprojects, i.e. projects that the main project depends on.
# E... | main_project = 'flipsta'
sub_projects = ['math', 'parse_ll', 'range', 'rime', 'utility', 'meta']
main_project_name = 'Flipsta library'
copyright = '2014-2015 Rogier van Dalen'
version = '0.1'
release = '0.1 alpha'
target_path = 'doc-build' |
"""
This is a spark implementation of the keras model. It currently fails due to memory error
on GCP Dataproc with e2-standard-4 (4 vCPUs, 16 GB memory) cluster.
"""
# import argparse
# import time
#
# import numpy as np
# import matplotlib.pyplot as plt
# import tensorflow as tf
#
# from tqdm import tqdm
# from skima... | """
This is a spark implementation of the keras model. It currently fails due to memory error
on GCP Dataproc with e2-standard-4 (4 vCPUs, 16 GB memory) cluster.
""" |
mock_season = {
1: {
"season": 1,
"airing": False,
"time_of_year": "WIN",
"year": 2020,
"name_of_season": "mock_season",
"episode_count": 23,
},
2: {
"season": 2,
"airing": True,
"time_of_year": "WIN",
"year": 2021,
"nam... | mock_season = {1: {'season': 1, 'airing': False, 'time_of_year': 'WIN', 'year': 2020, 'name_of_season': 'mock_season', 'episode_count': 23}, 2: {'season': 2, 'airing': True, 'time_of_year': 'WIN', 'year': 2021, 'name_of_season': 'mock_season', 'episode_count': 23}}
def get_mock_season(no: int, anime):
"""Return an... |
def test_delete_first_group(app): # parametr "app" zapuskaet fixturu
app.session.login(username="admin", password="secret")
# sozdaem obekt tipa Group i peredaem perametri v ego konstruktor
app.group.delete_first_group()
app.session.logout()
| def test_delete_first_group(app):
app.session.login(username='admin', password='secret')
app.group.delete_first_group()
app.session.logout() |
# T = int(input())
# for i in range(T):
# N, M = map(int,input().split(' '))
# # create a list of N size
# C = [n for n in range(N)]
# print(C)
C, M = map(int,input().split(' '))
# C, M = map(int,input().split(' '))
print(C)
print(M)
| (c, m) = map(int, input().split(' '))
print(C)
print(M) |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 10 19:56:32 2019
@author: Parikshith.H
"""
class A:
def __init__(self,val1,val2):
self.__a=val1
self.__b=val2
def display(self):
print(self.__a,self.__b)
class B(A):
def __init__(self,v1,v2,v3):
super().__init__(v1,v... | """
Created on Mon Jun 10 19:56:32 2019
@author: Parikshith.H
"""
class A:
def __init__(self, val1, val2):
self.__a = val1
self.__b = val2
def display(self):
print(self.__a, self.__b)
class B(A):
def __init__(self, v1, v2, v3):
super().__init__(v1, v2)
self.__c ... |
"""
Module containing TypedPriorityArray
"""
class TypedPriorityArray(object):
"""
Typed data structure that keeps elements in order.
"""
def __init__(self, *args, **kwargs):
self.arg = list(args)
self.kwarg = kwargs
#self.my_list = list(self.arg)
#raise NotImplementedE... | """
Module containing TypedPriorityArray
"""
class Typedpriorityarray(object):
"""
Typed data structure that keeps elements in order.
"""
def __init__(self, *args, **kwargs):
self.arg = list(args)
self.kwarg = kwargs
@property
def length(self):
return self.__len__()
... |
class Pet():
def __init__(self, _type: str, _name: str):
self.type = _type # cat or dog
self.name = _name
class PetNode():
def __init__(self, pet: Pet, count: int):
self.pet = pet
self.count = count
class CatDogQueue():
def __init__(self):
self.cat_queue = []
... | class Pet:
def __init__(self, _type: str, _name: str):
self.type = _type
self.name = _name
class Petnode:
def __init__(self, pet: Pet, count: int):
self.pet = pet
self.count = count
class Catdogqueue:
def __init__(self):
self.cat_queue = []
self.dog_queue... |
'''
'''
__all__ = ('JobType', 'DevType', 'ProtocolType',)
class JobType(object):
worker = 'worker'
ps = 'ps' # parameter-server
class DevType(object):
cpu = 'cpu'
gpu = 'gpu'
class ProtocolType(object):
'''
:cvar grpc: 'grpc' default in Tensorflow
:cvar verbs: 'verbs' # RDMA Infiniba... | """
"""
__all__ = ('JobType', 'DevType', 'ProtocolType')
class Jobtype(object):
worker = 'worker'
ps = 'ps'
class Devtype(object):
cpu = 'cpu'
gpu = 'gpu'
class Protocoltype(object):
"""
:cvar grpc: 'grpc' default in Tensorflow
:cvar verbs: 'verbs' # RDMA Infiniband usually
:cvar gdr:... |
algorithm = "fourier"
potential = "quadratic"
T = 12
dt = 0.01
eps = 0.1
f = 2.0
ngn = 4096
basis_size = 4
P = 1.0j
Q = 1.0
S = 0.0
parameters = [ (P, Q, S, 0.0, 1.0) ]
coefficients = [[(0, 1.0)]]
write_nth = 2
| algorithm = 'fourier'
potential = 'quadratic'
t = 12
dt = 0.01
eps = 0.1
f = 2.0
ngn = 4096
basis_size = 4
p = 1j
q = 1.0
s = 0.0
parameters = [(P, Q, S, 0.0, 1.0)]
coefficients = [[(0, 1.0)]]
write_nth = 2 |
STEP = 'step'
RESET = 'reset'
START = 'start'
CLOSE = 'close'
ACTION_SPACE = 'action_space'
OBSERVATION_SPACE = 'observation_space'
REWARD_RANGE = 'reward_range'
METADATA = 'metadata'
CHANGE_CAMERAS = 'change_cameras'
| step = 'step'
reset = 'reset'
start = 'start'
close = 'close'
action_space = 'action_space'
observation_space = 'observation_space'
reward_range = 'reward_range'
metadata = 'metadata'
change_cameras = 'change_cameras' |
r, c = int(input()), int(input())
rows = [0] * r
columns = [0] * c
for _ in range(int(input())):
rc, i = input().split()
if rc == 'R':
rows[int(i) - 1] += 1
else:
columns[int(i) - 1] += 1
n = 0
for q in rows:
for w in columns:
n += 1 if (w + q) % 2 else 0
p... | (r, c) = (int(input()), int(input()))
rows = [0] * r
columns = [0] * c
for _ in range(int(input())):
(rc, i) = input().split()
if rc == 'R':
rows[int(i) - 1] += 1
else:
columns[int(i) - 1] += 1
n = 0
for q in rows:
for w in columns:
n += 1 if (w + q) % 2 else 0
print(n) |
# 1111
# 2222
# 3333
# 4444
print()
n=int(input("Enter the value n "))
i=1
while i<=n:
j=1
while j<=n:
print(i,end="")
j=j+1
print()
i=i+1 | print()
n = int(input('Enter the value n '))
i = 1
while i <= n:
j = 1
while j <= n:
print(i, end='')
j = j + 1
print()
i = i + 1 |
class Move:
def __init__(self, move_id=-1, response_type="", template=[], blanks=[], blank_index=[], type_num=-1, subject=None):
self.move_id = move_id
self.type = type
self.template = template
self.blanks = blanks
self.response_type = response_type
self.blank_index ... | class Move:
def __init__(self, move_id=-1, response_type='', template=[], blanks=[], blank_index=[], type_num=-1, subject=None):
self.move_id = move_id
self.type = type
self.template = template
self.blanks = blanks
self.response_type = response_type
self.blank_index ... |
admin = """
<!doctype html>
<html lang="en">
<head>
<title>Library Registry</title>
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<link href=\"/static/registry-admin.css\" rel="stylesheet" />
</head>
<body>
<script src=\"/static/registry-admin.js\"></script>
<script>
var registryAdmin... | admin = '\n<!doctype html>\n<html lang="en">\n<head>\n<title>Library Registry</title>\n<meta name="viewport" content="width=device-width, initial-scale=1">\n<link href="/static/registry-admin.css" rel="stylesheet" />\n</head>\n<body>\n <script src="/static/registry-admin.js"></script>\n <script>\n var registryAdmi... |
# print subset/powerset
# sample output:
# 123
# 12
# 13
# 1
# 23
# 2
# 3
def subset(s, index, holder):
if index == len(s):
print(holder)
return
subset(s, index+1, holder + s[index])
subset(s, index+1, holder)
s= "123"
holder=""
index = 0
subset(s, index, holder) | def subset(s, index, holder):
if index == len(s):
print(holder)
return
subset(s, index + 1, holder + s[index])
subset(s, index + 1, holder)
s = '123'
holder = ''
index = 0
subset(s, index, holder) |
''' Module that stores the constants for the program '''
NPE_REWARDS = {
'npe_rewards_login_v1_step1': {'database_name': 'day_1_status'},
'npe_rewards_login_v1_step2': {'database_name': 'day_2_status'},
'npe_rewards_login_v1_step3': {'database_name': 'day_3_status'},
'npe_rewards_login_v1_step4': {'dat... | """ Module that stores the constants for the program """
npe_rewards = {'npe_rewards_login_v1_step1': {'database_name': 'day_1_status'}, 'npe_rewards_login_v1_step2': {'database_name': 'day_2_status'}, 'npe_rewards_login_v1_step3': {'database_name': 'day_3_status'}, 'npe_rewards_login_v1_step4': {'database_name': 'day_... |
def foo(a, b):
pass
foo(2, 1)
foo(2, b=1)
| def foo(a, b):
pass
foo(2, 1)
foo(2, b=1) |
add = 0
index = 1
while True: # fist the program need check is condicion is true#
insert = int(input(" calc the average that Number's %d press 0 for exit ."%index))
if insert == 0:
break
add = add + insert
index = index + 1
print (" Average (%d)" % (add/index))
''' this joker %d
show's t... | add = 0
index = 1
while True:
insert = int(input(" calc the average that Number's %d press 0 for exit ." % index))
if insert == 0:
break
add = add + insert
index = index + 1
print(' Average (%d)' % (add / index))
" this joker %d\nshow's the variable inserted on same lime mirror by % this help's... |
class LabelSettings(object):
@property
def INSTALLED_APPS(self):
return super().INSTALLED_APPS + ['labels']
default = LabelSettings
| class Labelsettings(object):
@property
def installed_apps(self):
return super().INSTALLED_APPS + ['labels']
default = LabelSettings |
class Solution:
# @paramn n: An integer
# @return: An integer
def numTrees(self, n):
# write your code here
count = [0] * (n+1)
count[0] = 1
count[1] = 1
for i in xrange(2, n+1):
for j in xrange(i):
count[i] += count[j] * count[i-j-1]
return... | class Solution:
def num_trees(self, n):
count = [0] * (n + 1)
count[0] = 1
count[1] = 1
for i in xrange(2, n + 1):
for j in xrange(i):
count[i] += count[j] * count[i - j - 1]
return count[n] |
x = 9
y = 3
# Arithmetic Operators
print(x+y) #Addition
print(x-y) #Subtraction
print(x*y) #Multiplication
print(x/y) #Division
print(x%y) #Modulus
print(x**y) #Exponentiation
x = 9.191823
print(x//y) #Floor division -- floor rounds
#*down* to the nearest whole number
# Assignment Operators
x = 9 # set x = 9
x +=... | x = 9
y = 3
print(x + y)
print(x - y)
print(x * y)
print(x / y)
print(x % y)
print(x ** y)
x = 9.191823
print(x // y)
x = 9
x += 3
print(x)
x = 9
x -= 3
print(x)
x *= 3
print(x)
x /= 3
print(x)
x **= 3
print(x)
x = 9
y = 3
print(x == y)
print(x != y)
print(x > y)
print(x < y)
print(x >= y)
print(x <= y) |
def info():
return 'Modul menghitung rumus tentang persegi panjang'
def hitung_luas_persegi_panjang(panjang, lebar):
return panjang * lebar | def info():
return 'Modul menghitung rumus tentang persegi panjang'
def hitung_luas_persegi_panjang(panjang, lebar):
return panjang * lebar |
class LateralProfile(object):
def __init__(self):
self._superelevations = []
self._crossfalls = []
self._shapes = []
@property
def superelevations(self):
return self._superelevations
@superelevations.setter
def superelevations(self, value):
if not isinstan... | class Lateralprofile(object):
def __init__(self):
self._superelevations = []
self._crossfalls = []
self._shapes = []
@property
def superelevations(self):
return self._superelevations
@superelevations.setter
def superelevations(self, value):
if not isinstanc... |
# Using Dijkstra's algorithm for finding the shortest paths between nodes in a graph
# https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
def get_puzzle_input():
grid = []
with open("input.txt", mode="r", encoding="utf-8") as file:
for row in file:
numbers = [int(x) for x in row.strip()]
... | def get_puzzle_input():
grid = []
with open('input.txt', mode='r', encoding='utf-8') as file:
for row in file:
numbers = [int(x) for x in row.strip()]
grid.append(numbers)
return grid
def expand_grid(grid):
new_grid = []
orig_size = len(grid)
size = orig_size * 5... |
def create_cast_list(filename):
"""
create a list of the actors who appeared in the television programme Monty Python's Flying Circus.
Write a function called create_cast_list that takes a filename as input and returns a list of actors' names. It will be run on the file flying_circus_cast.txt (this informa... | def create_cast_list(filename):
"""
create a list of the actors who appeared in the television programme Monty Python's Flying Circus.
Write a function called create_cast_list that takes a filename as input and returns a list of actors' names. It will be run on the file flying_circus_cast.txt (this informa... |
class OptimisticDict(dict):
def __init__(self, factory_func):
self.factory_func = factory_func
super(OptimisticDict, self).__init__()
def __missing__(self, key):
self[key] = self.factory_func(key)
return self.factory_func(key)
| class Optimisticdict(dict):
def __init__(self, factory_func):
self.factory_func = factory_func
super(OptimisticDict, self).__init__()
def __missing__(self, key):
self[key] = self.factory_func(key)
return self.factory_func(key) |
# TRACK STATS
class Tracker:
def __init__(self):
self.att_count = 0
self.email_count = 0
self.regulars = 0
self.reappears = 0
self.unidentified = 0
def print(self):
print()
print(f'Downloaded {self.att_count} attachments from {self.email_count} emails')
print()
print(f'{self.regulars} Regulars')
... | class Tracker:
def __init__(self):
self.att_count = 0
self.email_count = 0
self.regulars = 0
self.reappears = 0
self.unidentified = 0
def print(self):
print()
print(f'Downloaded {self.att_count} attachments from {self.email_count} emails')
print(... |
# Read pairs of numbers, and print the odd numbers between these numbers. Read the pairs until input == o, o
def check_odd_numbers(x, y):
odd_numbers = []
for i in range(x, y + 1):
if i % 2 != 0:
odd_numbers.append(i)
return odd_numbers
def main():
# Pairs separated by a comma
... | def check_odd_numbers(x, y):
odd_numbers = []
for i in range(x, y + 1):
if i % 2 != 0:
odd_numbers.append(i)
return odd_numbers
def main():
while 1:
(number1, number2) = input('Pairs >>> ').split(',')
x = int(number1)
y = int(number2)
if x == 0 and y ... |
def count_items(list):
if len(list) < 2:
return 1
else:
return 1 + count_items(list[1:])
print(count_items([2, 4, 6]))
| def count_items(list):
if len(list) < 2:
return 1
else:
return 1 + count_items(list[1:])
print(count_items([2, 4, 6])) |
def f():
return None, None
print(f())
if f():
print('aaa')
else:
print('bbb')
a = f()
print(*a)
| def f():
return (None, None)
print(f())
if f():
print('aaa')
else:
print('bbb')
a = f()
print(*a) |
class DockerContainerEntity:
def __init__(self):
self.image = None
self.environment = dict()
def set_environments(self, state: dict):
for k, v in state.items():
self.environment[k] = v
| class Dockercontainerentity:
def __init__(self):
self.image = None
self.environment = dict()
def set_environments(self, state: dict):
for (k, v) in state.items():
self.environment[k] = v |
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
def convert(ss):
d = {}
return [d.setdefault(c, len(d)) for c in ss]
return convert(s) == convert(t)
| class Solution:
def is_isomorphic(self, s: str, t: str) -> bool:
def convert(ss):
d = {}
return [d.setdefault(c, len(d)) for c in ss]
return convert(s) == convert(t) |
def comp_mass_magnet_id(self, index):
"""Compute the mass of the hole magnet of the corresponding index
Parameters
----------
self : HoleMag
A HoleMag object
index : int
Index of the magnet to compute the surface
Returns
-------
Mmag: float
Mass of the Magnet [m... | def comp_mass_magnet_id(self, index):
"""Compute the mass of the hole magnet of the corresponding index
Parameters
----------
self : HoleMag
A HoleMag object
index : int
Index of the magnet to compute the surface
Returns
-------
Mmag: float
Mass of the Magnet [m... |
# https://edabit.com/challenge/FQyaaJx7orS7tiwz8
# Write a function that takes an integer minutes and converts it to seconds.
def minute_to_seconds(minutes: float) -> int:
seconds = (minutes * 60)
return int(seconds)
print(minute_to_seconds(3.2))
| def minute_to_seconds(minutes: float) -> int:
seconds = minutes * 60
return int(seconds)
print(minute_to_seconds(3.2)) |
#pvaluethon
f1=open("plot_t1.out","r")
f2=open("plot_t2.out","r")
f3=open("plot_t3.out","r")
f4=open("plot_t4.out","r")
f5=open("plot_t5.out","r")
f6=open("speedup.out","w")
f7=open("app.out","r")
l1=[]
l2=[]
l3=[]
l4=[]
l5=[]
li=[]
tmp1=[]
tmp2=[]
tmp3=[]
tmp4=[]
tmp5=[]
for line in f1.readlines():
for value in li... | f1 = open('plot_t1.out', 'r')
f2 = open('plot_t2.out', 'r')
f3 = open('plot_t3.out', 'r')
f4 = open('plot_t4.out', 'r')
f5 = open('plot_t5.out', 'r')
f6 = open('speedup.out', 'w')
f7 = open('app.out', 'r')
l1 = []
l2 = []
l3 = []
l4 = []
l5 = []
li = []
tmp1 = []
tmp2 = []
tmp3 = []
tmp4 = []
tmp5 = []
for line in f1.r... |
pares = input()
for i in range (0, pares):
a, b = input()
print("%d %d %d %d %d" % ((a+b), (a-b), (a*b), (a//b), (a%b)))
print("---")
| pares = input()
for i in range(0, pares):
(a, b) = input()
print('%d %d %d %d %d' % (a + b, a - b, a * b, a // b, a % b))
print('---') |
def genreg_via_cycles(n, k, g, adjacency_lists=None, nj_stack=None, additional_edge_predicates=None):
"""
Generates and returns the first regular graph of n, k, g found via cycle generation
see http://www.mathe2.uni-bayreuth.de/markus/reggraphs.html
Implementation Notes:
could be modified to retur... | def genreg_via_cycles(n, k, g, adjacency_lists=None, nj_stack=None, additional_edge_predicates=None):
"""
Generates and returns the first regular graph of n, k, g found via cycle generation
see http://www.mathe2.uni-bayreuth.de/markus/reggraphs.html
Implementation Notes:
could be modified to retur... |
EVENT_MEET_GUIDE = 64
EVENT_DESOLATED_CABIN = 65
EVENT_TRAINER_K1_PRE_1 = 66
EVENT_ITEMBALL_K1_PRE_1 = 67
EVENT_TRAINER_K1_PRE_2 = 68
EVENT_TRAINER_K1_PRE_3 = 69
EVENT_TRAINER_K1_PRE_4 = 70
EVENT_TUTORIAL_WILLOW = 71
EVENT_K1_PRE_COMPLETE = 72
EVENT_ITEMBALL_K1_POST_1 = 73
EVENT_SHOWED_METAPOD = 74
EVENT_TRAINER_K1_POS... | event_meet_guide = 64
event_desolated_cabin = 65
event_trainer_k1_pre_1 = 66
event_itemball_k1_pre_1 = 67
event_trainer_k1_pre_2 = 68
event_trainer_k1_pre_3 = 69
event_trainer_k1_pre_4 = 70
event_tutorial_willow = 71
event_k1_pre_complete = 72
event_itemball_k1_post_1 = 73
event_showed_metapod = 74
event_trainer_k1_pos... |
class DropMessageSIPEntityException(Exception):
def __init__(self, description_string='SIP Entity Exception - dropping message'):
self.description = description_string
def __str__(self):
return self.description
class DropMessageAndDropConnectionSIPEntityException(Exception):
def __init__... | class Dropmessagesipentityexception(Exception):
def __init__(self, description_string='SIP Entity Exception - dropping message'):
self.description = description_string
def __str__(self):
return self.description
class Dropmessageanddropconnectionsipentityexception(Exception):
def __init__... |
class PathResolutionException(Exception):
"""
Raised when a path given to a template tag contained variables that could
not be resolved.
"""
| class Pathresolutionexception(Exception):
"""
Raised when a path given to a template tag contained variables that could
not be resolved.
""" |
def test_index_page(client):
result = client.get('/')
assert b'appengine_flask_security_auth' in result.data
| def test_index_page(client):
result = client.get('/')
assert b'appengine_flask_security_auth' in result.data |
class Solution:
def numberOfSubarrays(self, nums: List[int], k: int) -> int:
# subarray
seen = [0] * (len(nums) + 1)
seen[0] = 1
acc = 0
ans = 0
for num in nums:
acc += num % 2
ans += seen[acc - k]
seen[acc] += 1
return ans
| class Solution:
def number_of_subarrays(self, nums: List[int], k: int) -> int:
seen = [0] * (len(nums) + 1)
seen[0] = 1
acc = 0
ans = 0
for num in nums:
acc += num % 2
ans += seen[acc - k]
seen[acc] += 1
return ans |
# can_code = True
# if can_code == True:
# #Do a thing
# print("You can code!")
# else:
# #Do Something Else
# print("You don't know how to code yet!")
# teacher = "Kalob Taulien"
# if teacher == "Kalob Taulien":
# print("Show the teacher portal")
# else:
# print("You are a student. Welc... | age = input('What is your age?')
age = int(age)
if age > 20:
print('You can drink in the USA')
elif age == 16:
print('You can get your learners licence!')
elif age >= 18:
print('You can Vote')
elif age < 18:
print('You can not vote') |
#N, M = [int(n) for n in input().split()]
#N = int(input())
S = input()
ans = 0
r = 0
for c in S:
if c == 'R':
r += 1
ans = r
else:
ans = max(ans, r)
r = 0
print(ans)
| s = input()
ans = 0
r = 0
for c in S:
if c == 'R':
r += 1
ans = r
else:
ans = max(ans, r)
r = 0
print(ans) |
# Formatting configuration for locale is
languages={'is': u'\xedslenska'}
countries={'IS': u'\xcdsland'}
months=[u'jan\xfaar', u'febr\xfaar', 'mars', u'apr\xedl', u'ma\xed', u'j\xfan\xed', u'j\xfal\xed', u'\xe1g\xfast', 'september', u'okt\xf3ber', u'n\xf3vember', 'desember']
abbrMonths=['jan', 'feb', 'mar', 'apr', ... | languages = {'is': u'íslenska'}
countries = {'IS': u'Ísland'}
months = [u'janúar', u'febrúar', 'mars', u'apríl', u'maí', u'júní', u'júlí', u'ágúst', 'september', u'október', u'nóvember', 'desember']
abbr_months = ['jan', 'feb', 'mar', 'apr', u'maí', u'jún', u'júl', u'ágú', 'sep', 'okt', u'nóv', 'des']
days = [u'mánudag... |
def radix_sort(inpt_list, base=10):
"""This sort takes in a list of positive numbers and returns the list sorted in place.
Arguments:
inpt_list {[list]} -- [Unsorted List]
Keyword Arguments:
base {int} -- [description] (default: {10})
Returns:
[list] -- [Sorted List]
"""... | def radix_sort(inpt_list, base=10):
"""This sort takes in a list of positive numbers and returns the list sorted in place.
Arguments:
inpt_list {[list]} -- [Unsorted List]
Keyword Arguments:
base {int} -- [description] (default: {10})
Returns:
[list] -- [Sorted List]
"""... |
## Generate Pascal's Triangle upto numRows rows
class Solution:
def generate(self, numRows: int) -> List[List[int]]:
if numRows==0:
return 0
pascal_tri = [[1]]
for i in range(2,numRows+1):
cur_level_nums = []
last_level_len = le... | class Solution:
def generate(self, numRows: int) -> List[List[int]]:
if numRows == 0:
return 0
pascal_tri = [[1]]
for i in range(2, numRows + 1):
cur_level_nums = []
last_level_len = len(pascal_tri[-1])
for j in range(last_level_len + 1):
... |
def solve(str1: str, str2: str) -> list[list[int]]:
dp = [[0 for _ in range(len(str2) + 1)] for _ in range(len(str1) + 1)]
for i in range(len(dp[0])):
dp[0][i] = i
for i, d in zip(range(len(dp)), dp):
d[0] = i
for i in range(1, len(str1) + 1):
for j in range(1, len(str2) + 1):... | def solve(str1: str, str2: str) -> list[list[int]]:
dp = [[0 for _ in range(len(str2) + 1)] for _ in range(len(str1) + 1)]
for i in range(len(dp[0])):
dp[0][i] = i
for (i, d) in zip(range(len(dp)), dp):
d[0] = i
for i in range(1, len(str1) + 1):
for j in range(1, len(str2) + 1):
... |
class Solution:
def __init__(self, radius: float, x_center: float, y_center: float):
self.radius = radius
self.x = x_center
self.y = y_center
def randPoint(self) -> List[float]:
# x = r * cos(theta) + x0
# y = r * sin(theta) + y0
# r: 0 ~ raduis
# th... | class Solution:
def __init__(self, radius: float, x_center: float, y_center: float):
self.radius = radius
self.x = x_center
self.y = y_center
def rand_point(self) -> List[float]:
r = math.sqrt(random.random()) * self.radius
theta = random.uniform(0, 360) / (2 * math.pi)... |
"""
Author: CaptCorpMURICA
Project: 100DaysPython
File: module1_day12_augAssign.py
Creation Date: 6/2/2019, 8:55 AM
Description: Learn about augmented assignments in python.
"""
| """
Author: CaptCorpMURICA
Project: 100DaysPython
File: module1_day12_augAssign.py
Creation Date: 6/2/2019, 8:55 AM
Description: Learn about augmented assignments in python.
""" |
f = plt.figure(figsize=(10,4))
ax = plt.gca()
ax.set_aspect('equal')
is_weird = lmos.p_sim <= (.05/len(pres))
pres.plot(color='lightgrey', ax=ax)
pres.assign(quads=lmos.q)[is_weird].plot('quads',
legend=True,
k=4, categorical=True,
... | f = plt.figure(figsize=(10, 4))
ax = plt.gca()
ax.set_aspect('equal')
is_weird = lmos.p_sim <= 0.05 / len(pres)
pres.plot(color='lightgrey', ax=ax)
pres.assign(quads=lmos.q)[is_weird].plot('quads', legend=True, k=4, categorical=True, cmap='bwr_r', ax=ax) |
year=int(input("Enter the year:\n"))
if(year%4==0 and year%100!=0 or year%400==0):
print("leap year")
else:
print("not a leap year")
| year = int(input('Enter the year:\n'))
if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
print('leap year')
else:
print('not a leap year') |
#!/usr/bin/env python3
# inputs
num = int(input("Enter a number: "))
# processing
if num > 0:
result = "Positive"
elif num < 0:
result = "Negative"
else:
result = "Zero"
# outputs
print("You entered", result, "number")
| num = int(input('Enter a number: '))
if num > 0:
result = 'Positive'
elif num < 0:
result = 'Negative'
else:
result = 'Zero'
print('You entered', result, 'number') |
class Component(object):
def operation(self):
print("Component instance has been created")
class ConcreteComponent(Component):
def operation(self):
print("ConcreteComponent instance has been created")
class Decorator(Component):
def __init__(self, component):
self._component = co... | class Component(object):
def operation(self):
print('Component instance has been created')
class Concretecomponent(Component):
def operation(self):
print('ConcreteComponent instance has been created')
class Decorator(Component):
def __init__(self, component):
self._component = c... |
class IllegalCarError(Exception):
"""Raised when the attributes of Car class are wrong"""
pass
class Car:
def __init__(self, pax_count, car_mass, gear_count, ):
self.__pax_count = pax_count
self.pax_count_validation()
self.__car_mass = car_mass
self.car_mass_validation()... | class Illegalcarerror(Exception):
"""Raised when the attributes of Car class are wrong"""
pass
class Car:
def __init__(self, pax_count, car_mass, gear_count):
self.__pax_count = pax_count
self.pax_count_validation()
self.__car_mass = car_mass
self.car_mass_validation()
... |
'''
This script gets the alias from README
and add them to bashrc to see if it throws an error or not.
'''
README = open("README.md")
ALIAS = ""
FOUND = False
for line in README:
if FOUND:
if line.strip() == "```":
print(ALIAS)
FOUND = False
else:
ALIAS += line
... | """
This script gets the alias from README
and add them to bashrc to see if it throws an error or not.
"""
readme = open('README.md')
alias = ''
found = False
for line in README:
if FOUND:
if line.strip() == '```':
print(ALIAS)
found = False
else:
alias += line
... |
class Rectangle:
def __init__(self, length, width):
self.length = length
self.width = width
def area(self):
return self.length * self.width
# An example for Super for parent construction.
class Square(Rectangle):
def __init__(self, length):
super(Square, self).__init__(len... | class Rectangle:
def __init__(self, length, width):
self.length = length
self.width = width
def area(self):
return self.length * self.width
class Square(Rectangle):
def __init__(self, length):
super(Square, self).__init__(length, length)
class Volumemixin:
@property... |
#
## https://leetcode.com/problems/two-sum/
#
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
for idx, val in enumerate(nums):
if target - val in nums[idx + 1 : len(nums)]:
return [idx, nums[idx + 1 : len(n... | class Solution(object):
def two_sum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
for (idx, val) in enumerate(nums):
if target - val in nums[idx + 1:len(nums)]:
return [idx, nums[idx + 1:len(nums)].index(target - v... |
"""
Extend `django-admin startapp` to create testing structure for the new app
under the global `tests` directory.
"""
| """
Extend `django-admin startapp` to create testing structure for the new app
under the global `tests` directory.
""" |
#
# PySNMP MIB module HP-ICF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF
# Produced by pysmi-0.3.4 at Wed May 1 13:33:17 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, 09:23:15)
... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ... |
class ConfigKeys:
AGENT_SOCKET = "agent_socket"
LOGGING = "logging"
SAMPLER = "sampler"
PARAM = "param"
| class Configkeys:
agent_socket = 'agent_socket'
logging = 'logging'
sampler = 'sampler'
param = 'param' |
"""
Scope
"""
value = "Global Scope"
def write_v1():
value = "Inner Scope"
print(value)
def write_v2(value): # 1) by Value, 2) Overloading is not allowed
print("Param. Value: " + value)
Value = "Inner Scope"
print(Value)
def write_v3():
global value
print("Value: " + val... | """
Scope
"""
value = 'Global Scope'
def write_v1():
value = 'Inner Scope'
print(value)
def write_v2(value):
print('Param. Value: ' + value)
value = 'Inner Scope'
print(Value)
def write_v3():
global value
print('Value: ' + value)
value = 'Inner Scope'
print(value)
def outer():
... |
# -*- coding: utf-8 -*-
# tente algo como
#@cache.action(time_expire=300, cache_model=cache.ram, quick='P')
@auth.requires_login()
def show_contact():
a = auth.user
rows = db(db.contact.created_by == auth.user).select()
return locals()
def create_contact():
form = SQLFORM(db.contact).process()
if f... | @auth.requires_login()
def show_contact():
a = auth.user
rows = db(db.contact.created_by == auth.user).select()
return locals()
def create_contact():
form = sqlform(db.contact).process()
if form.accepted:
response.flash = 'accepted form'
redirect(url('show_contact'))
elif form.e... |
#
# Copyright (c) 2018, 2021 Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Universal Permissive License v 1.0 as shown at
# https://oss.oracle.com/licenses/upl/
#
# Parameters used by example code -- Cloud Simulator Configuration
#
# This file is configured for the examples to be run again... | endpoint = 'localhost:8080'
server_type = 'cloudsim' |
class Solution:
def findDiagonalOrder(self,mat):
m=len(mat)-1
n=len(mat[0])-1
direct=0 #1: up 0:down
isChanging=1 # if changing direction
res=[mat[0][0]]
i,j=0,0
while 1:
if i==m and j==n:
break
#current direction is U... | class Solution:
def find_diagonal_order(self, mat):
m = len(mat) - 1
n = len(mat[0]) - 1
direct = 0
is_changing = 1
res = [mat[0][0]]
(i, j) = (0, 0)
while 1:
if i == m and j == n:
break
if direct == 1:
... |
# Configuration file for the Sphinx documentation builder.
#
# Full list of options can be found in the Sphinx documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
#
# -- Project information -----------------------------------------------------
#
project = "sphinx-autobuild"
copyright = "201... | project = 'sphinx-autobuild'
copyright = '2013, Jonathan Stoppani'
extensions = ['sphinx.ext.autodoc']
templates_path = ['_templates']
html_theme = 'alabaster'
html_static_path = ['_static'] |
###############################################################################
# Author: Sebastien Parent-Charette (support@robotshop.com)
# Version: 1.0.0
# Licence: LGPL-3.0 (GNU Lesser General Public License version 3)
#
# Desscription: A library that makes using the LSS simple.
# Offers support for most Py... | lss__default_baud = 115200
lss__max_total_command_length = 30 + 1
lss__timeout = 100
lss__command_start = '#'
lss__command_reply_start = '*'
lss__command_end = '\r'
lss__first_position_disabled = 'DIS'
lss_id__default = 0
lss_id__min = 0
lss_id__max = 250
lss__mode255_id = 255
lss__broadcast_id = 254
lss__comm_status__... |
def myPi(n):
denominator = 1
addto = 1
for i in range(n):
denominator = denominator + 2
addto = addto - (1/denominator)
denominator = denominator + 2
addto = addto + (1/denominator)
pi = addto * 4
return(pi)
print(myPi(1000000)) | def my_pi(n):
denominator = 1
addto = 1
for i in range(n):
denominator = denominator + 2
addto = addto - 1 / denominator
denominator = denominator + 2
addto = addto + 1 / denominator
pi = addto * 4
return pi
print(my_pi(1000000)) |
n = int(input())
s = str(input())
t = str(input())
cnt = 0
for i in range(n):
if s[i] != t[i]:
cnt += 1
print(cnt)
| n = int(input())
s = str(input())
t = str(input())
cnt = 0
for i in range(n):
if s[i] != t[i]:
cnt += 1
print(cnt) |
for number in range(1, 1001):
if number % 10 == 7:
print(number)
for i in range(7, 1000, 10):
print(i) | for number in range(1, 1001):
if number % 10 == 7:
print(number)
for i in range(7, 1000, 10):
print(i) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.