content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def most_common(lst):
return max(lst, key=lst.count)
| def most_common(lst):
return max(lst, key=lst.count) |
# https://leetcode.com/problems/defanging-an-ip-address
class Solution:
def defangIPaddr(self, address):
if not address:
return ""
ls = address.split(".")
return "[.]".join(ls)
| class Solution:
def defang_i_paddr(self, address):
if not address:
return ''
ls = address.split('.')
return '[.]'.join(ls) |
BOT = "b"
EMPTY = "-"
DIRT = "d"
def dist(pos1, pos2):
return abs(pos1[0] - pos2[0]) + abs(pos1[1] - pos2[1])
def is_dirt(pos, board):
if min(pos) < 0:
return False
if pos[0] >= len(board):
return False
if pos[1] >= len(board[0]):
return False
if board[pos[0]][pos[1]] != ... | bot = 'b'
empty = '-'
dirt = 'd'
def dist(pos1, pos2):
return abs(pos1[0] - pos2[0]) + abs(pos1[1] - pos2[1])
def is_dirt(pos, board):
if min(pos) < 0:
return False
if pos[0] >= len(board):
return False
if pos[1] >= len(board[0]):
return False
if board[pos[0]][pos[1]] != DI... |
SMALL = 1
MEDIUM = 2
LARGE = 3
ORDER_SIZE = (
(SMALL, u'Small'),
(MEDIUM, u'Medium'),
(LARGE, u'Large')
)
MARGARITA = 1
MARINARA = 2
SALAMI = 3
ORDER_TITLE = (
(1, u'margarita'),
(2, u'marinara'),
(3, u'salami')
)
RECEIVED = 1
IN_PROCESS = 2
OUT_FOR_DELIVERY = 3
DELIVERED = 4
RETURNED = 5
ORD... | small = 1
medium = 2
large = 3
order_size = ((SMALL, u'Small'), (MEDIUM, u'Medium'), (LARGE, u'Large'))
margarita = 1
marinara = 2
salami = 3
order_title = ((1, u'margarita'), (2, u'marinara'), (3, u'salami'))
received = 1
in_process = 2
out_for_delivery = 3
delivered = 4
returned = 5
order_status = ((RECEIVED, u'Recei... |
def fatorial(n):
num = 1
while n >= 1:
num = num * n
n = n - 1
return num
digit = int(input('numero para mostra o fatorial '))
print(fatorial(digit)) | def fatorial(n):
num = 1
while n >= 1:
num = num * n
n = n - 1
return num
digit = int(input('numero para mostra o fatorial '))
print(fatorial(digit)) |
#!/usr/bin/python3
cars = ['bmw', 'audi', 'toyota', 'subaru']
cars.sort()
print(cars)
cars.sort(reverse=True)
print(cars)
print("\nHere is the sorted list:")
print(sorted(cars))
print("\nHere is the sorted list(reverse=True):")
print(sorted(cars, reverse = True))
print("\nHere is the original list:")
print(cars)
pri... | cars = ['bmw', 'audi', 'toyota', 'subaru']
cars.sort()
print(cars)
cars.sort(reverse=True)
print(cars)
print('\nHere is the sorted list:')
print(sorted(cars))
print('\nHere is the sorted list(reverse=True):')
print(sorted(cars, reverse=True))
print('\nHere is the original list:')
print(cars)
print(len(cars)) |
#
# PySNMP MIB module CISCO-CBP-TARGET-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CBP-TARGET-TC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:52:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ... |
o = c50 = c20 = c10 = r = 0
while True:
o = int(input('Quanto voce deseja sacar? '))
r = o
while r >= 50:
c50 += 1
r = r - 50
while r >= 20:
c20 += 1
r = r - 20
while r > 10:
c10 += 1
r = r - 10
if r < 10:
break
print(f'Para o valor de R$ {... | o = c50 = c20 = c10 = r = 0
while True:
o = int(input('Quanto voce deseja sacar? '))
r = o
while r >= 50:
c50 += 1
r = r - 50
while r >= 20:
c20 += 1
r = r - 20
while r > 10:
c10 += 1
r = r - 10
if r < 10:
break
print(f'Para o valor de R$ {... |
__version__ = "3.12.1"
CTX_PROFILE = "PROFILE"
CTX_DEFAULT_PROFILE = "default"
| __version__ = '3.12.1'
ctx_profile = 'PROFILE'
ctx_default_profile = 'default' |
class Query:
def __init__(self, data, res={}):
self.res = res
self.data = data
def clear(self):
self.res = {}
def get(self):
return self.res
def documentAtTime(self, query, model):
self.data.clearScore()
# pLists = {}
query = query.split()
... | class Query:
def __init__(self, data, res={}):
self.res = res
self.data = data
def clear(self):
self.res = {}
def get(self):
return self.res
def document_at_time(self, query, model):
self.data.clearScore()
query = query.split()
query_term_count... |
'''
__init__.py
ColorPy is a Python package to convert physical descriptions of light:
spectra of light intensity vs. wavelength - into RGB colors that can
be drawn on a computer screen.
It provides a nice set of attractive plots that you can make of such
spectra, and some other color related functions... | """
__init__.py
ColorPy is a Python package to convert physical descriptions of light:
spectra of light intensity vs. wavelength - into RGB colors that can
be drawn on a computer screen.
It provides a nice set of attractive plots that you can make of such
spectra, and some other color related functions... |
# run python from an operating system command prmpt
# type the following:
msg = "Hello World"
print(msg)
# write it into a file called hello.py
# open a command prompt and type "python hello.py"
# this should run the script and print "Hello World"
# vscode alternative; Run the following in a terminal
# by selecting ... | msg = 'Hello World'
print(msg) |
# Backtracking
# def totalNQueens(self, n: int) -> int:
# diag1 = set()
# diag2 = set()
# used_cols = set()
#
# return self.helper(n, diag1, diag2, used_cols, 0)
#
#
# def helper(self, n, diag1, diag2, used_cols, row):
# if row == n:
# return 1
#
# solutions = 0
#
# for col in range(... | def total_n_queens(self, n):
self.res = 0
self.dfs([-1] * n, 0)
return self.res
def dfs(self, nums, index):
if index == len(nums):
self.res += 1
return
for i in range(len(nums)):
nums[index] = i
if self.valid(nums, index):
self.dfs(nums, index + 1)
def v... |
#########################
# EECS1015: Lab 9
# Name: Mahfuz Rahman
# Student ID: 217847518
# Email: mafu@my.yorku.ca
#########################
class MinMaxList:
def __init__(self, initializeList):
self.listData = initializeList
self.listData.sort()
def insertItem(self, item, printResult=False/... | class Minmaxlist:
def __init__(self, initializeList):
self.listData = initializeList
self.listData.sort()
def insert_item(self, item, printResult=False / True):
if len(self.listData) == 0:
self.listData.append(item)
print(f'Item ({item}) inserted at location 0')... |
'''
1560. Most Visited Sector in a Circular Track
Given an integer n and an integer array rounds. We have a circular track which consists of n sectors labeled from 1 to n. A marathon will be held on this track, the marathon consists of m rounds. The ith round starts at sector rounds[i - 1] and ends at sector rounds[i... | """
1560. Most Visited Sector in a Circular Track
Given an integer n and an integer array rounds. We have a circular track which consists of n sectors labeled from 1 to n. A marathon will be held on this track, the marathon consists of m rounds. The ith round starts at sector rounds[i - 1] and ends at sector rounds[i... |
while True:
X, Y = map(int, input().split())
if X == 0 or Y == 0:
break
else:
if X > 0 and Y > 0:
print('primeiro')
elif X > 0 and Y < 0:
print('quarto')
elif X < 0 and Y < 0:
print('terceiro')
else:
print('segundo')
| while True:
(x, y) = map(int, input().split())
if X == 0 or Y == 0:
break
elif X > 0 and Y > 0:
print('primeiro')
elif X > 0 and Y < 0:
print('quarto')
elif X < 0 and Y < 0:
print('terceiro')
else:
print('segundo') |
# A Caesar cypher is a weak form on encryption:
# It involves "rotating" each letter by a number (shift it through the alphabet)
#
# Example:
# A rotated by 3 is D; Z rotated by 1 is A
# In a SF movie the computer is called HAL, which is IBM rotated by -1
#
# Our function rotate_word() uses:
# ord (char to code_numbe... | def encrypt(word, no):
rotated = ''
for i in range(len(word)):
j = ord(word[i]) + no
rotated = rotated + chr(j)
return rotated
def decrypt(word, no):
return encrypt(word, -no)
assert encrypt('abc', 3) == 'def'
assert encrypt('IBM', -1) == 'HAL'
assert decrypt('def', 3) == 'abc'
assert d... |
expected_output = {
"chassis_mac_address": "4ce1.7592.a700",
"mac_wait_time": "Indefinite",
"redun_port_type": "FIBRE",
"chassis_index": {
1: {
"role": "Active",
"mac_address": "4ce1.7592.a700",
"priority": 2,
"hw_version": "V02",
"curr... | expected_output = {'chassis_mac_address': '4ce1.7592.a700', 'mac_wait_time': 'Indefinite', 'redun_port_type': 'FIBRE', 'chassis_index': {1: {'role': 'Active', 'mac_address': '4ce1.7592.a700', 'priority': 2, 'hw_version': 'V02', 'current_state': 'Ready', 'ip_address': '169.254.138.6', 'rmi_ip': '10.8.138.6'}, 2: {'role'... |
def read_instance(f):
print(f)
file = open(f)
width = int(file.readline())
n_circuits = int(file.readline())
DX = []
DY = []
for i in range(n_circuits):
piece = file.readline()
split_piece = piece.strip().split(" ")
DX.append(int(split_piece[0]))
DY.append(int... | def read_instance(f):
print(f)
file = open(f)
width = int(file.readline())
n_circuits = int(file.readline())
dx = []
dy = []
for i in range(n_circuits):
piece = file.readline()
split_piece = piece.strip().split(' ')
DX.append(int(split_piece[0]))
DY.append(int... |
n = 1024
while n > 0:
print(n)
n //= 2
| n = 1024
while n > 0:
print(n)
n //= 2 |
#!/usr/bin/env python3
title: str = 'Lady'
name: str = 'Gaga'
# Lady Gaga is an American actress, singer and songwriter.
# String concatination at its worst
print(title + ' ' + name + ' is an American actress, singer and songwriter.')
# Legacy example
print('%s %s is an American actress, singer and songwriter.' % (... | title: str = 'Lady'
name: str = 'Gaga'
print(title + ' ' + name + ' is an American actress, singer and songwriter.')
print('%s %s is an American actress, singer and songwriter.' % (title, name))
print('{} {} is an American actress, singer and songwriter.'.format(title, name))
print('{0} {1} is an American actress, sing... |
class Solution:
def mySqrt(self, x: int) -> int:
if x == 0:
return 0
ans: float = x
tolerance = 0.00000001
while abs(ans - x/ans) > tolerance:
ans = (ans + x/ans) / 2
return int(ans)
tests = [
(
(4,),
2,
),
(
(8,... | class Solution:
def my_sqrt(self, x: int) -> int:
if x == 0:
return 0
ans: float = x
tolerance = 1e-08
while abs(ans - x / ans) > tolerance:
ans = (ans + x / ans) / 2
return int(ans)
tests = [((4,), 2), ((8,), 2)] |
if traffic_light == 'green':
pass # to implement
else:
stop()
| if traffic_light == 'green':
pass
else:
stop() |
if window.get_active_title() == "Terminal":
keyboard.send_keys("<super>+z")
else:
keyboard.send_keys("<ctrl>+z")
| if window.get_active_title() == 'Terminal':
keyboard.send_keys('<super>+z')
else:
keyboard.send_keys('<ctrl>+z') |
def naive_4() :
it = 0
def get_w() :
fan_in = 1
fan_out = 1
limit = np.sqrt(6 / (fan_in + fan_out))
return np.random.uniform(low =-limit , high = limit , size = (784 , 10))
w_init = get_w()
b_init = np,zeros(shape(10,))
last_score = 0.0
learnin_rate = 0.1
while True :
w = w_init + learning... | def naive_4():
it = 0
def get_w():
fan_in = 1
fan_out = 1
limit = np.sqrt(6 / (fan_in + fan_out))
return np.random.uniform(low=-limit, high=limit, size=(784, 10))
w_init = get_w()
b_init = (np, zeros(shape(10)))
last_score = 0.0
learnin_rate = 0.1
while True:... |
n = int(input())
for _ in range(n):
recording = input()
sounds = []
s = input()
while s != "what does the fox say?":
sounds.append(s.split(' ')[-1])
s = input()
fox_says = ""
for sound in recording.split(' '):
if sound not in sounds:
fox_says += " " + sou... | n = int(input())
for _ in range(n):
recording = input()
sounds = []
s = input()
while s != 'what does the fox say?':
sounds.append(s.split(' ')[-1])
s = input()
fox_says = ''
for sound in recording.split(' '):
if sound not in sounds:
fox_says += ' ' + sound
... |
count = 0
while count != 5:
count += 1
print(count)
print('--------')
counter = 0
while counter <= 20:
counter = counter + 3
print(counter)
print('--------')
countersito = 20
while countersito >= 0:
countersito -= 3
print(countersito) | count = 0
while count != 5:
count += 1
print(count)
print('--------')
counter = 0
while counter <= 20:
counter = counter + 3
print(counter)
print('--------')
countersito = 20
while countersito >= 0:
countersito -= 3
print(countersito) |
def netmiko_command(device, command=None, ckwargs={}, **kwargs):
if command:
output = device['nc'].send_command(command, **ckwargs)
else:
output = 'No command to run.'
return output | def netmiko_command(device, command=None, ckwargs={}, **kwargs):
if command:
output = device['nc'].send_command(command, **ckwargs)
else:
output = 'No command to run.'
return output |
# ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copyright (c) 2010-2017 University of California, Davis
#
# See COPYING for license... | __all__ = ['CoordSys', 'CSCart', 'CSGeo', 'Converter'] |
########
# PART 1
def read(filename):
with open("event2021/day25/" + filename, "r") as file:
rows = [line.strip() for line in file.readlines()]
return [ch for row in rows for ch in row], len(rows[0]), len(rows)
def draw(region_data):
region, width, height = region_data
for y in range(hei... | def read(filename):
with open('event2021/day25/' + filename, 'r') as file:
rows = [line.strip() for line in file.readlines()]
return ([ch for row in rows for ch in row], len(rows[0]), len(rows))
def draw(region_data):
(region, width, height) = region_data
for y in range(height):
for... |
# This sample tests the "reportPrivateUsage" feature.
class _TestClass(object):
pass
class TestClass(object):
def __init__(self):
self._priv1 = 1
| class _Testclass(object):
pass
class Testclass(object):
def __init__(self):
self._priv1 = 1 |
class Solution:
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
'''
min_list = []
for i in range(len(nums)):
count = 0
for j in range(len(nums)):
if nums[j] < nums[i]:
count = count + 1
min_list.append... | class Solution:
def smaller_numbers_than_current(self, nums: List[int]) -> List[int]:
"""
min_list = []
for i in range(len(nums)):
count = 0
for j in range(len(nums)):
if nums[j] < nums[i]:
count = count + 1
min_list.ap... |
# def parse_ranges(input_string):
#
# output = []
# ranges = [item.strip() for item in input_string.split(',')]
#
# for item in ranges:
# start, end = [int(i) for i in item.split('-')]
# output.extend(range(start, end + 1))
#
# return output
# def parse_ranges(input_string):
#
# ran... | def parse_ranges(input_string):
ranges = [range_.strip() for range_ in input_string.split(',')]
for item in ranges:
if '->' in item:
yield int(item.split('-')[0])
elif '-' in item:
(start, end) = [int(i) for i in item.split('-')]
yield from range(start, end + ... |
for row in range(4):
for col in range(4):
if col%3==0 and row<3 or row==3 and col>0:
print('*', end = ' ')
else:
print(' ', end = ' ')
print()
| for row in range(4):
for col in range(4):
if col % 3 == 0 and row < 3 or (row == 3 and col > 0):
print('*', end=' ')
else:
print(' ', end=' ')
print() |
def power(integer1, integer2=3):
result = 1
for i in range(integer2):
result = result * integer1
return result
print(power(3))
print(power(3,2)) | def power(integer1, integer2=3):
result = 1
for i in range(integer2):
result = result * integer1
return result
print(power(3))
print(power(3, 2)) |
#The values G,m1,m2,f and d stands for Gravitational constant, initial mass,final mass,force and distance respectively
G = 6.67 * 10 ** -11
m1 = float(input("The value of the initial mass: "))
m2 = float(input("The value of the final mass: "))
d = float(input("The distance between the bodies: "))
F = (G * m1 * m2)/(d *... | g = 6.67 * 10 ** (-11)
m1 = float(input('The value of the initial mass: '))
m2 = float(input('The value of the final mass: '))
d = float(input('The distance between the bodies: '))
f = G * m1 * m2 / d ** 2
print('The magnitude of the attractive force: ', F) |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr , n ) :
s = [ ]
j = 0
ans = 0
for i in range ( n ) :
while ( j < n and ( arr [ j ] not ... | def f_gold(arr, n):
s = []
j = 0
ans = 0
for i in range(n):
while j < n and arr[j] not in s:
s.append(arr[j])
j += 1
ans += (j - i) * (j - i + 1) // 2
s.remove(arr[i])
return ans
if __name__ == '__main__':
param = [([3, 4, 5, 6, 12, 15, 16, 17, 20,... |
var1 = 6
var2 = 3
if var1 >= 10:
print("Bigger than 10") #mind about the indent here (can be created by pressing tab button)
else:
print("Smaller or equal to 10") # all the codes written under a section wth tab belongs to that section
if var1 == var2:
print("var1 and 2 are equal")
else:
print("not eq... | var1 = 6
var2 = 3
if var1 >= 10:
print('Bigger than 10')
else:
print('Smaller or equal to 10')
if var1 == var2:
print('var1 and 2 are equal')
else:
print('not equal')
if var1 > 5 and var1 < 7:
print('Between')
elif var1 <= 5:
print('Smaller than 5')
else:
print('Bigger than or equal to 7')
i... |
class KNN():
def fit(self, X_train, y_train):
self.X_train = X_train
self.y_train = y_train
def predict(self, X_test, k=3):
predictions = np.zeros(X_test.shape[0])
for i, point in enumerate(X_test):
distances = self._get_distances(point... | class Knn:
def fit(self, X_train, y_train):
self.X_train = X_train
self.y_train = y_train
def predict(self, X_test, k=3):
predictions = np.zeros(X_test.shape[0])
for (i, point) in enumerate(X_test):
distances = self._get_distances(point)
k_nearest = self... |
__title__ = 'alpha-vantage-py'
__description__ = 'Alpha Vantage Python package.'
__url__ = 'https://github.com/wstolk/alpha-vantage'
__version__ = '0.0.4'
__build__ = 0x022501
__author__ = 'Wouter Stolk'
__author_email__ = 'stolk.wouter@gmail.com'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2021 Wouter Stolk'... | __title__ = 'alpha-vantage-py'
__description__ = 'Alpha Vantage Python package.'
__url__ = 'https://github.com/wstolk/alpha-vantage'
__version__ = '0.0.4'
__build__ = 140545
__author__ = 'Wouter Stolk'
__author_email__ = 'stolk.wouter@gmail.com'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2021 Wouter Stolk'
_... |
LANGUAGES = [
{"English": "English", "alpha2": "en"},
{"English": "Italian", "alpha2": "it"},
]
| languages = [{'English': 'English', 'alpha2': 'en'}, {'English': 'Italian', 'alpha2': 'it'}] |
def max_profit(prices) -> int:
if not prices:
return 0
minPrice = prices[0]
maxPrice = 0
for i in range(1, len(prices)):
minPrice = min(prices[i], minPrice)
maxPrice = max(prices[i],maxPrice)
return maxPrice
arr = [100, 180, 260, 310, 40, 535, 695]
print(max_profit(arr)) | def max_profit(prices) -> int:
if not prices:
return 0
min_price = prices[0]
max_price = 0
for i in range(1, len(prices)):
min_price = min(prices[i], minPrice)
max_price = max(prices[i], maxPrice)
return maxPrice
arr = [100, 180, 260, 310, 40, 535, 695]
print(max_profit(arr)) |
# Paula Daly Solution to Problem 4 March 2019
# Collatz - particular sequence always reaches 1
# Defining the function
def collatz(number):
# looping through and if number found is even divide it by 2
if number % 2 == 0:
print(number // 2)
return number // 2
# looping through and if the nu... | def collatz(number):
if number % 2 == 0:
print(number // 2)
return number // 2
elif number % 2 != 0:
result = 3 * number + 1
print(result)
return result
try:
n = input('Enter number: ')
while n != 1:
n = collatz(int(n))
except ValueError:
print('Please... |
class ConfigBase:
def __init__(self):
self.zookeeper = ""
self.brokers = ""
self.topic = ""
def __str__(self):
return str(self.zookeeper + ";" + self.brokers + ";" + self.topic)
def set_zookeeper(self, conf):
self.zookeeper = conf
def set_brokers(self, conf):
... | class Configbase:
def __init__(self):
self.zookeeper = ''
self.brokers = ''
self.topic = ''
def __str__(self):
return str(self.zookeeper + ';' + self.brokers + ';' + self.topic)
def set_zookeeper(self, conf):
self.zookeeper = conf
def set_brokers(self, conf):
... |
'''
Created on May 13, 2016
@author: david
'''
if __name__ == '__main__':
pass
| """
Created on May 13, 2016
@author: david
"""
if __name__ == '__main__':
pass |
# numbers_list = [int(x) for x in input().split(", ")]
def find_sum(numbers_list):
result = 1
for i in range(len(numbers_list)):
number = numbers_list[i]
if number <= 5:
result *= number
elif number <= 10:
result /= number
return result
print(find_sum([1,... | def find_sum(numbers_list):
result = 1
for i in range(len(numbers_list)):
number = numbers_list[i]
if number <= 5:
result *= number
elif number <= 10:
result /= number
return result
print(find_sum([1, 4, 5]), 20)
print(find_sum([4, 5, 6, 1, 3]), 20)
print(find... |
# post to the array-connections/connection-key endpoint to get a connection key
res = client.post_array_connections_connection_key()
print(res)
if type(res) == pypureclient.responses.ValidResponse:
print(list(res.items))
| res = client.post_array_connections_connection_key()
print(res)
if type(res) == pypureclient.responses.ValidResponse:
print(list(res.items)) |
BOT_CONFIG = 'default'
CONFIGS_DIR_NAME = 'configs'
BOTS_LOG_ROOT = 'bots'
LOG_FILE = 'bots.log'
LOOP_INTERVAL = 60
SETTINGS = 'settings.yml,secrets.yml'
VERBOSITY = 1
| bot_config = 'default'
configs_dir_name = 'configs'
bots_log_root = 'bots'
log_file = 'bots.log'
loop_interval = 60
settings = 'settings.yml,secrets.yml'
verbosity = 1 |
class BotLogic:
def BotExit(Nachricht):
print("Say Goodbye to the Bot")
# Beim Bot abmelden
def BotStart(Nachricht):
print("Say Hello to the Bot")
# Beim Bot anmelden | class Botlogic:
def bot_exit(Nachricht):
print('Say Goodbye to the Bot')
def bot_start(Nachricht):
print('Say Hello to the Bot') |
# class => module
MODULE_MAP = {
'ShuffleRerankPlugin': 'plugins.rerank.shuffle',
'PtTransformersRerankPlugin': 'plugins.rerank.transformers',
'PtDistilBertQAModelPlugin': 'plugins.qa.distilbert'
}
# image => directory
IMAGE_MAP = {
'alpine': '../Dockerfiles/alpine',
'pt': '../Dockerfiles/pt'
}
I... | module_map = {'ShuffleRerankPlugin': 'plugins.rerank.shuffle', 'PtTransformersRerankPlugin': 'plugins.rerank.transformers', 'PtDistilBertQAModelPlugin': 'plugins.qa.distilbert'}
image_map = {'alpine': '../Dockerfiles/alpine', 'pt': '../Dockerfiles/pt'}
indexer_map = {'ESIndexer': 'indexers.es'} |
'''
This file was used in an earlier version; geodata does not currently use
SQLAlchemy.
---
This file ensures all other files use the same SQLAlchemy session and Base.
Other files should import engine, session, and Base when needed. Use:
from initialize_sqlalchemy import Base, session, engine
'''
# # The engi... | """
This file was used in an earlier version; geodata does not currently use
SQLAlchemy.
---
This file ensures all other files use the same SQLAlchemy session and Base.
Other files should import engine, session, and Base when needed. Use:
from initialize_sqlalchemy import Base, session, engine
""" |
# The authors of this work have released all rights to it and placed it
# in the public domain under the Creative Commons CC0 1.0 waiver
# (http://creativecommons.org/publicdomain/zero/1.0/).
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRA... | """Code for creating mappings that are used to place symbols in the matrix."""
def _distance(p):
return p[0] ** 2 + p[1] ** 2
def _may_use(vu, shape):
"""Returns true if the entry v, u may be used in a conjugate symmetric matrix.
In other words, the function returns false for v, u pairs that must be
... |
class EntityForm(django.forms.ModelForm):
class Meta:
model = Entity
exclude = (u'homepage', u'image')
| class Entityform(django.forms.ModelForm):
class Meta:
model = Entity
exclude = (u'homepage', u'image') |
'''
Simpler to just do the math than iterating. Break each number from 1 to 20 into its prime components.
The find the maximum times each unique prime occurs in any of the numbers.
Include the prime that number of times.
For instance, 9 is ( 3 * 3 ) and 18 is ( 3 * 3 * 2 ), both of which are the most
number of times ... | """
Simpler to just do the math than iterating. Break each number from 1 to 20 into its prime components.
The find the maximum times each unique prime occurs in any of the numbers.
Include the prime that number of times.
For instance, 9 is ( 3 * 3 ) and 18 is ( 3 * 3 * 2 ), both of which are the most
number of times ... |
n, k = map(int, input().split())
arr = list(map(int, input().split()))
arr_find = list(map(int, input().split()))
def bin_search(arr, el):
left = -1
right = len(arr)
while right - left > 1:
mid = (right + left) // 2
if arr[mid] >= el:
right = mid
else:
lef... | (n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr_find = list(map(int, input().split()))
def bin_search(arr, el):
left = -1
right = len(arr)
while right - left > 1:
mid = (right + left) // 2
if arr[mid] >= el:
right = mid
else:
left... |
n = int(input())
current = 1
bigger = False
for i in range(1, n + 1):
for j in range(1, i + 1):
if current > n:
bigger = True
break
print(str(current) + " ", end="")
current += 1
if bigger:
break
print()
| n = int(input())
current = 1
bigger = False
for i in range(1, n + 1):
for j in range(1, i + 1):
if current > n:
bigger = True
break
print(str(current) + ' ', end='')
current += 1
if bigger:
break
print() |
n = int(input())
d = list()
for i in range(2):
k=list(map(int,input().split()))
d.append(k)
c = list(zip(*d))
p = []
for i in range(len(c)):
p.append(c[i][0] * c[i][1])
number=sum(p)/sum(d[1])
print("{:.1f}".format(number)) | n = int(input())
d = list()
for i in range(2):
k = list(map(int, input().split()))
d.append(k)
c = list(zip(*d))
p = []
for i in range(len(c)):
p.append(c[i][0] * c[i][1])
number = sum(p) / sum(d[1])
print('{:.1f}'.format(number)) |
def reader():
with open('day3/puzzle_input.txt', 'r') as f:
return f.read().splitlines()
def tree(right, down):
count = 0
index = 0
lines = reader()
for i in range(0, len(lines), down):
line = lines[i]
if line[index] == '#':
count += 1
remainder = len(li... | def reader():
with open('day3/puzzle_input.txt', 'r') as f:
return f.read().splitlines()
def tree(right, down):
count = 0
index = 0
lines = reader()
for i in range(0, len(lines), down):
line = lines[i]
if line[index] == '#':
count += 1
remainder = len(lin... |
class FPyCompare:
def __readFile(self, fileName):
with open(fileName) as f:
lines = f.read().splitlines()
return lines
def __writeFile(self, resultList, fileName):
with open(fileName, "w") as outfile:
outfile.write("\n".join(resultList))
print(fileName + ... | class Fpycompare:
def __read_file(self, fileName):
with open(fileName) as f:
lines = f.read().splitlines()
return lines
def __write_file(self, resultList, fileName):
with open(fileName, 'w') as outfile:
outfile.write('\n'.join(resultList))
print(fileName... |
print(() == ())
print(() > ())
print(() < ())
print(() == (1,))
print((1,) == ())
print(() > (1,))
print((1,) > ())
print(() < (1,))
print((1,) < ())
print(() >= (1,))
print((1,) >= ())
print(() <= (1,))
print((1,) <= ())
print((1,) == (1,))
print((1,) != (1,))
print((1,) == (2,))
print((1,) == (1, 0,))
print((1,) > ... | print(() == ())
print(() > ())
print(() < ())
print(() == (1,))
print((1,) == ())
print(() > (1,))
print((1,) > ())
print(() < (1,))
print((1,) < ())
print(() >= (1,))
print((1,) >= ())
print(() <= (1,))
print((1,) <= ())
print((1,) == (1,))
print((1,) != (1,))
print((1,) == (2,))
print((1,) == (1, 0))
print((1,) > (1,... |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'timed_decomposer_lib', 'type': 'static_library', 'sources': ['timed_decomposer_app.cc', 'timed_decomposer_app.h'], 'dependencies': ['<(src)/syzygy/pe/pe.gyp:pe_lib', '<(src)/syzygy/common/common.gyp:syzygy_version']}, {'target_name': 'timed_decomposer', '... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reverseBetween(self, head: ListNode, left: int, right: int) -> ListNode:
dummy_head = sublist_head = ListNode(0,head)
for _ in ra... | class Solution:
def reverse_between(self, head: ListNode, left: int, right: int) -> ListNode:
dummy_head = sublist_head = list_node(0, head)
for _ in range(1, left):
sublist_head = sublist_head.next
sublist_iter = sublist_head.next
for _ in range(right - left):
... |
# Height in cm --> feet and inches
# (just for ya fookin 'muricans)
cm = float(input("Enter height in cm: "))
inches = cm/2.54
ft = int(inches//12)
inches = int(round(inches % 12))
print("Height is about {}'{}\".".format(ft, inches))
| cm = float(input('Enter height in cm: '))
inches = cm / 2.54
ft = int(inches // 12)
inches = int(round(inches % 12))
print('Height is about {}\'{}".'.format(ft, inches)) |
# writing to a file :
# To write to a file you need to create file
stream = open('output.txt', 'wt')
print('\n Can I write to this file : ' + str(stream.writable()))
stream.write('H') # write a single string ...
stream.writelines(['ello',' ', 'Susan']) # write multiple strings
stream.write('\n') # write a new line
... | stream = open('output.txt', 'wt')
print('\n Can I write to this file : ' + str(stream.writable()))
stream.write('H')
stream.writelines(['ello', ' ', 'Susan'])
stream.write('\n')
names = ['Alen', 'Chris', 'Sausan']
stream.writelines(','.join(names))
stream.writelines('\n'.join(names))
stream.close() |
an_int = 2
a_float = 2.1
print(an_int + 3)
# prints 5
# Define the release and runtime integer variables below:
release_year = 15
runtime = 20
# Define the rating_out_of_10 float variable below:
rating_out_of_10 = 3.5 | an_int = 2
a_float = 2.1
print(an_int + 3)
release_year = 15
runtime = 20
rating_out_of_10 = 3.5 |
N = int(input())
s = [input() for _ in range(5)]
a = [
'.###..#..###.###.#.#.###.###.###.###.###.',
'.#.#.##....#...#.#.#.#...#.....#.#.#.#.#.',
'.#.#..#..###.###.###.###.###...#.###.###.',
'.#.#..#..#.....#...#...#.#.#...#.#.#...#.',
'.###.###.###.###...#.###.###...#.###.###.'
]
result = []
for i... | n = int(input())
s = [input() for _ in range(5)]
a = ['.###..#..###.###.#.#.###.###.###.###.###.', '.#.#.##....#...#.#.#.#...#.....#.#.#.#.#.', '.#.#..#..###.###.###.###.###...#.###.###.', '.#.#..#..#.....#...#...#.#.#...#.#.#...#.', '.###.###.###.###...#.###.###...#.###.###.']
result = []
for i in range(N):
t = [s... |
# Numpy is imported; seed is set
# Initialize all_walks (don't change this line)
all_walks = []
# Simulate random walk 10 times
for i in range(10) :
# Code from before
random_walk = [0]
for x in range(100) :
step = random_walk[-1]
dice = np.random.randint(1,7)
if di... | all_walks = []
for i in range(10):
random_walk = [0]
for x in range(100):
step = random_walk[-1]
dice = np.random.randint(1, 7)
if dice <= 2:
step = max(0, step - 1)
elif dice <= 5:
step = step + 1
else:
step = step + np.random.randint(... |
# A file to test if pyvm works from the command line.
def it_works():
print("Success!")
it_works()
| def it_works():
print('Success!')
it_works() |
n = "Hello"
# Your function here!
def string_function(s):
return s + 'world'
print(string_function(n))
| n = 'Hello'
def string_function(s):
return s + 'world'
print(string_function(n)) |
# Final Exam, Problem 4 - 2
def longestRun(L):
'''
Assumes L is a non-empty list
Returns the length of the longest monotonically increasing
'''
maxRun = 0
tempRun = 0
for i in range(len(L) - 1):
if L[i + 1] >= L[i]:
tempRun += 1
if tempRun > maxRun:
... | def longest_run(L):
"""
Assumes L is a non-empty list
Returns the length of the longest monotonically increasing
"""
max_run = 0
temp_run = 0
for i in range(len(L) - 1):
if L[i + 1] >= L[i]:
temp_run += 1
if tempRun > maxRun:
max_run = tempRun
... |
#
# @lc app=leetcode id=415 lang=python3
#
# [415] Add Strings
#
# https://leetcode.com/problems/add-strings/description/
#
# algorithms
# Easy (51.34%)
# Likes: 2772
# Dislikes: 495
# Total Accepted: 421.8K
# Total Submissions: 820.4K
# Testcase Example: '"11"\n"123"'
#
# Given two non-negative integers, num1 a... | class Solution:
def add_strings(self, num1: str, num2: str) -> str:
ans = int(num1) + int(num2)
return str(ans) |
def landscaper(f, generations):
seen_states = {}
states = []
state = f.readline().strip().split(' ')[-1]
f.readline()
rules = {}
idx = 0
prev_sum = None
for rule in f.readlines():
keys, _, res = rule.strip().split(' ')
if res == '#':
rules[keys] = True
... | def landscaper(f, generations):
seen_states = {}
states = []
state = f.readline().strip().split(' ')[-1]
f.readline()
rules = {}
idx = 0
prev_sum = None
for rule in f.readlines():
(keys, _, res) = rule.strip().split(' ')
if res == '#':
rules[keys] = True
f... |
# printing out a string
print("lol")
# printing out a space betwin them (\n)
print("Hello\nWorld")
# if you want to put a (") inside do this:
print("Hello\"World\"")
# if you want to put a (\) inside just type:
print("Hello\World")
# you can also print a variable like this;
lol = "Hello World"
print(lol)
# y... | print('lol')
print('Hello\nWorld')
print('Hello"World"')
print('Hello\\World')
lol = 'Hello World'
print(lol)
lol = 'Hello World'
print(lol + ' Hello World')
lol = 'Hello World'
print(lol.lower())
print(lol.upper())
print(lol.isupper())
print(lol.upper().isupper())
print(len(lol))
lol = 'Hello World'
print(lol[0])
prin... |
def funcao(x = 1,y = 1):
return 2*x+y
print(funcao(2,3))
print(funcao(3,2))
print(funcao(1,2)) | def funcao(x=1, y=1):
return 2 * x + y
print(funcao(2, 3))
print(funcao(3, 2))
print(funcao(1, 2)) |
'''
author: Iuri Freire
e-mail: iuricostafreire at gmail dot com
local date : 2021-01-07
local time : 20:47
'''
| """
author: Iuri Freire
e-mail: iuricostafreire at gmail dot com
local date : 2021-01-07
local time : 20:47
""" |
name = 'exit'
usage = 'EXIT'
description = 'Exits Diplomat.'
def execute(query):
return 'Exiting Diplomat.' | name = 'exit'
usage = 'EXIT'
description = 'Exits Diplomat.'
def execute(query):
return 'Exiting Diplomat.' |
success = {
"uuid": "8bf7e570-67cd-4670-a37c-0999fd07f9bf",
"action": "EventsRouter",
"result": {
"success": True
},
"tid": 1,
"type": "rpc",
"method": "detail"
}
fail = {
"uuid": "8bf7e570-67cd-4670-a37c-0999fd07f9bf",
"action": "EventsRouter",
"result": {
"msg"... | success = {'uuid': '8bf7e570-67cd-4670-a37c-0999fd07f9bf', 'action': 'EventsRouter', 'result': {'success': True}, 'tid': 1, 'type': 'rpc', 'method': 'detail'}
fail = {'uuid': '8bf7e570-67cd-4670-a37c-0999fd07f9bf', 'action': 'EventsRouter', 'result': {'msg': 'ServiceResponseError: Not Found', 'type': 'exception', 'succ... |
settings = {
# add provider-specific survey settings here
# e.g. how to abbreviate questions
}
| settings = {} |
# coding: utf-8
s = "The string ends in escape: "
s += chr(27) # add an escape character at the end of $str
print(repr(s))
| s = 'The string ends in escape: '
s += chr(27)
print(repr(s)) |
SERVICE_NAME = "org.bluez"
AGENT_IFACE = SERVICE_NAME + '.Agent1'
ADAPTER_IFACE = SERVICE_NAME + ".Adapter1"
DEVICE_IFACE = SERVICE_NAME + ".Device1"
PLAYER_IFACE = SERVICE_NAME + '.MediaPlayer1'
TRANSPORT_IFACE = SERVICE_NAME + '.MediaTransport1'
OBJECT_IFACE = "org.freedesktop.DBus.ObjectManager"
PROPERTIES_IFACE =... | service_name = 'org.bluez'
agent_iface = SERVICE_NAME + '.Agent1'
adapter_iface = SERVICE_NAME + '.Adapter1'
device_iface = SERVICE_NAME + '.Device1'
player_iface = SERVICE_NAME + '.MediaPlayer1'
transport_iface = SERVICE_NAME + '.MediaTransport1'
object_iface = 'org.freedesktop.DBus.ObjectManager'
properties_iface = '... |
class Cliente:
def __init__(self, nome):
self.__nome = nome
@property
def nome(self):
return self.__nome.title()
def get_nome(self):
print('[INFO] Getting value...')
print('[INFO] Name "{}" getted sucessfully'.format(self.__nome))
return self.__nome... | class Cliente:
def __init__(self, nome):
self.__nome = nome
@property
def nome(self):
return self.__nome.title()
def get_nome(self):
print('[INFO] Getting value...')
print('[INFO] Name "{}" getted sucessfully'.format(self.__nome))
return self.__nome.title()
... |
class ChartModel:
def score_keywords(self, dep_keywords):
#mock (@todo: update after integrating training a model)
keyword_scores = []
for kw in dep_keywords:
keyword_scores.append({
'keyword': kw,
'score': 0.7
})
... | class Chartmodel:
def score_keywords(self, dep_keywords):
keyword_scores = []
for kw in dep_keywords:
keyword_scores.append({'keyword': kw, 'score': 0.7})
return keyword_scores |
def word_permutation(s):
return word_permutation_helper(list(s))
def word_permutation_helper(input_list):
if len(input_list) ==0:
return ''
ret = []
for i in range(len(input_list)):
base = input_list[i]
remainder = input_list[:i]+input_list[i+1:]
out = word_permu... | def word_permutation(s):
return word_permutation_helper(list(s))
def word_permutation_helper(input_list):
if len(input_list) == 0:
return ''
ret = []
for i in range(len(input_list)):
base = input_list[i]
remainder = input_list[:i] + input_list[i + 1:]
out = word_permutat... |
def solution(participant, completion):
answer = ""
temp = 0
dic = {}
for p in participant:
dic[hash(p)] = p
temp += hash(p)
for c in completion:
temp -= hash(c)
return dic[temp]
| def solution(participant, completion):
answer = ''
temp = 0
dic = {}
for p in participant:
dic[hash(p)] = p
temp += hash(p)
for c in completion:
temp -= hash(c)
return dic[temp] |
class Solution:
def generateMatrix(self, n: int) -> List[List[int]]:
mat = [[0] * n for _ in range(n)]
left, top, right, bottom = 0, 0, n, n
val = 1
while left < right and top < bottom:
for i in range(left, right):
mat[top][i] = val
val += ... | class Solution:
def generate_matrix(self, n: int) -> List[List[int]]:
mat = [[0] * n for _ in range(n)]
(left, top, right, bottom) = (0, 0, n, n)
val = 1
while left < right and top < bottom:
for i in range(left, right):
mat[top][i] = val
v... |
class Solution(object):
def findCircleNum(self, M):
def dfs(node):
visited.add(node)
for person, is_friend in enumerate(M[node]):
if is_friend and person not in visited:
dfs(person)
circle = 0
visited = set()
... | class Solution(object):
def find_circle_num(self, M):
def dfs(node):
visited.add(node)
for (person, is_friend) in enumerate(M[node]):
if is_friend and person not in visited:
dfs(person)
circle = 0
visited = set()
for node ... |
a = [1,5,4,6,8,11,3,12]
even = list(filter(lambda x: (x%2 == 0), a))
print(even)
third = list(filter(lambda x: (x%3 == 0), a))
print(third)
b = [[0,1,8],[7,2,2],[5,3,10],[1,4,5]]
b.sort(key = lambda x: x[2])
print(b)
b.sort(key = lambda x: x[0]+x[1])
print(b)
| a = [1, 5, 4, 6, 8, 11, 3, 12]
even = list(filter(lambda x: x % 2 == 0, a))
print(even)
third = list(filter(lambda x: x % 3 == 0, a))
print(third)
b = [[0, 1, 8], [7, 2, 2], [5, 3, 10], [1, 4, 5]]
b.sort(key=lambda x: x[2])
print(b)
b.sort(key=lambda x: x[0] + x[1])
print(b) |
def word(str):
j=len(str)-1
for i in range(int(len(str)/2)):
if str[i]!=str[j]:
return False
j=j-1
return True
str=input("Enter the string :")
ans=word(str)
if(ans):
print("string is palindrome")
else:
print("string is not palindrome") | def word(str):
j = len(str) - 1
for i in range(int(len(str) / 2)):
if str[i] != str[j]:
return False
j = j - 1
return True
str = input('Enter the string :')
ans = word(str)
if ans:
print('string is palindrome')
else:
print('string is not palindrome') |
class RowMenuItem:
def __init__(self, widget):
# Item can have an optional id
self.id = None
# Item may specify a parent id (for rendering purposes, like display = 'with-parent,' perhaps)
self.parent_id = None
# If another item chooses to display with this item, then tha... | class Rowmenuitem:
def __init__(self, widget):
self.id = None
self.parent_id = None
self.friend_ids = []
self.item = widget
self.visibility = 'visible'
self.hidden = False
self.disabled = False
self.individual_border = False
self.shrinkwrap = ... |
nome = str(input('Digite seu nome completo: ')).strip()
print(nome.upper())
print(nome.lower())
print(len(nome))
| nome = str(input('Digite seu nome completo: ')).strip()
print(nome.upper())
print(nome.lower())
print(len(nome)) |
#!/usr/bin/env python
# encoding=utf-8
def test():
print('utils_gao, making for ml') | def test():
print('utils_gao, making for ml') |
def _gen_k8s_file(ctx):
odir = ctx.actions.declare_directory("tmp")
ctx.actions.run(
inputs = [],
outputs = [odir],
arguments = [],
progress_message = "Converting",
env = {
"CDK8S_OUTDIR": odir.path,
},
executable = ctx.executable.tool,
... | def _gen_k8s_file(ctx):
odir = ctx.actions.declare_directory('tmp')
ctx.actions.run(inputs=[], outputs=[odir], arguments=[], progress_message='Converting', env={'CDK8S_OUTDIR': odir.path}, executable=ctx.executable.tool, tools=[ctx.executable.tool])
runfiles = ctx.runfiles(files=[odir, ctx.executable._conca... |
#
# This file contains the Python code from Program 2.9 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by Bruno R. Preiss.
#
# Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm02_09.txt
#
def geometricSeries... | def geometric_series_sum(x, n):
return (power(x, n + 1) - 1) / (x - 1) |
N, K = map(int, input().split())
a_list = list(map(int, input().split()))
sum_list = []
for i in range(N):
for j in range(i, N):
sum_list.append(sum(a_list[i:j+1]))
ans = 0
count = 0
tmp = []
for i in range(40, -1, -1):
for s in sum_list:
check_num = 1 << i
logical_and = check_num & s
... | (n, k) = map(int, input().split())
a_list = list(map(int, input().split()))
sum_list = []
for i in range(N):
for j in range(i, N):
sum_list.append(sum(a_list[i:j + 1]))
ans = 0
count = 0
tmp = []
for i in range(40, -1, -1):
for s in sum_list:
check_num = 1 << i
logical_and = check_num & ... |
# Reads config/config.ini and performs sanity checks
class Config(object):
config = None
def __init__(self, path='config/config.ini'):
if not self.config:
print("[WARNING] Loading placeholder config")
# this has to be replaced by reading the actual .ini config file
... | class Config(object):
config = None
def __init__(self, path='config/config.ini'):
if not self.config:
print('[WARNING] Loading placeholder config')
with open(path, 'r') as cfg:
token = cfg.readline().rstrip()
initial_channel = cfg.readline().rstri... |
''' Set data type
lst = [varname, varname1, varname2]
dictionary = {
"key": "value",
}
'''
set = {"Item1", "Item2", "Item3"}
print(set) # {'Item1', 'Item2', 'Item3'} # Sets do not care about the order
# {'Item2', 'Item3', 'Item1'} # Sets do not care about the order
s = {"Item1", "It... | """ Set data type
lst = [varname, varname1, varname2]
dictionary = {
"key": "value",
}
"""
set = {'Item1', 'Item2', 'Item3'}
print(set)
s = {'Item1', 'Item2', 'Item2', 'Item3'}
print(s)
s.add('item 4')
print(s)
s.remove('item 4')
print(s) |
class SlidingAverage:
def __init__(self, window_size):
self.index = 0
self.values = [0] * window_size
def _previous(self):
return self.values[(self.index + len(self.values) - 1) % len(self.values)]
def update(self, value):
self.values[self.index] = self._previous() + value
... | class Slidingaverage:
def __init__(self, window_size):
self.index = 0
self.values = [0] * window_size
def _previous(self):
return self.values[(self.index + len(self.values) - 1) % len(self.values)]
def update(self, value):
self.values[self.index] = self._previous() + value... |
palavras = ('Doidera', 'Calipso', 'Yoda', 'Axt', 'Jovirone', 'Matilda', 'Schwarzenneger', 'Mustefaga', 'Instinct', 'Kobayashi', 'Ludgero', 'Salcicha', 'Scooby', 'Turtle', 'Lily', 'Toast')
for palavra in palavras:
print(f'Na palavra {palavra.upper()} temos ', end='')
for c in range(0, len(palavra)):
if p... | palavras = ('Doidera', 'Calipso', 'Yoda', 'Axt', 'Jovirone', 'Matilda', 'Schwarzenneger', 'Mustefaga', 'Instinct', 'Kobayashi', 'Ludgero', 'Salcicha', 'Scooby', 'Turtle', 'Lily', 'Toast')
for palavra in palavras:
print(f'Na palavra {palavra.upper()} temos ', end='')
for c in range(0, len(palavra)):
if p... |
def specificSummator():
counter = 0
for i in range(0, 10000):
if (i % 7) == 0:
counter += i
elif (i % 9) == 0:
counter += i
return counter
print(specificSummator()) | def specific_summator():
counter = 0
for i in range(0, 10000):
if i % 7 == 0:
counter += i
elif i % 9 == 0:
counter += i
return counter
print(specific_summator()) |
# WAP to accept a file from user and print shortest and longest line from that file.
def PrintShortestLongestLines(inputFile):
line = inputFile.readline()
maxLine = line
minLine = line
while line != "":
line = inputFile.readline()
if line == "\n" or line == "":
continue
... | def print_shortest_longest_lines(inputFile):
line = inputFile.readline()
max_line = line
min_line = line
while line != '':
line = inputFile.readline()
if line == '\n' or line == '':
continue
if len(line) < len(minLine):
min_line = line
elif len(lin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.