content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def foo():
'''
>>> from mod import GoodFile as bad
'''
pass
| def foo():
"""
>>> from mod import GoodFile as bad
"""
pass |
print('program1.py')
a = 100000000
for x in range(1,9):
if (x>=1 and x<=2):
b=a*0
print('laba bulanan ke-',x,':',b)
if (x>=3 and x<=4):
c=a*0.1
print('laba bulanan ke-',x,':',c)
if (x>=5 and x<=7) :
d=a*0.5
print('laba bulanan ke-',x,':',d)
if (x==8) :
e=a*0.2
print('la... | print('program1.py')
a = 100000000
for x in range(1, 9):
if x >= 1 and x <= 2:
b = a * 0
print('laba bulanan ke-', x, ':', b)
if x >= 3 and x <= 4:
c = a * 0.1
print('laba bulanan ke-', x, ':', c)
if x >= 5 and x <= 7:
d = a * 0.5
print('laba bulanan ke-', x, ... |
def return_dict(list):
dict = {}
for plate in list:
if(plate in dict):
dict[plate] = dict[plate] + 1
else:
dict[plate] = 1
return dict
def isNumber(character):
return True if(character<='9' and character>='0') else False
def isLetter(character):
return True i... | def return_dict(list):
dict = {}
for plate in list:
if plate in dict:
dict[plate] = dict[plate] + 1
else:
dict[plate] = 1
return dict
def is_number(character):
return True if character <= '9' and character >= '0' else False
def is_letter(character):
return T... |
try:
a = 4 / 0
except Exception as ex:
print(str(ex))
finally:
print('Thats all Folks')
| try:
a = 4 / 0
except Exception as ex:
print(str(ex))
finally:
print('Thats all Folks') |
def bfs(graph, init):
visited = []
queue = [init]
while queue:
current = queue.pop(0)
if current not in visited:
visited.append(current)
adj = graph[current]
for neighbor in adj:
for k in neighbor.keys():
queue.append... | def bfs(graph, init):
visited = []
queue = [init]
while queue:
current = queue.pop(0)
if current not in visited:
visited.append(current)
adj = graph[current]
for neighbor in adj:
for k in neighbor.keys():
queue.append(k)... |
del_items(0x80118770)
SetType(0x80118770, "int NumOfMonsterListLevels")
del_items(0x800A7554)
SetType(0x800A7554, "struct MonstLevel AllLevels[16]")
del_items(0x8011846C)
SetType(0x8011846C, "unsigned char NumsLEV1M1A[4]")
del_items(0x80118470)
SetType(0x80118470, "unsigned char NumsLEV1M1B[4]")
del_items(0x80118474)
S... | del_items(2148632432)
set_type(2148632432, 'int NumOfMonsterListLevels')
del_items(2148169044)
set_type(2148169044, 'struct MonstLevel AllLevels[16]')
del_items(2148631660)
set_type(2148631660, 'unsigned char NumsLEV1M1A[4]')
del_items(2148631664)
set_type(2148631664, 'unsigned char NumsLEV1M1B[4]')
del_items(214863166... |
ls = []
with open('input.txt') as fh:
for line in fh.readlines():
if not line.strip():
continue
ls.append(int(line))
for i in range(len(ls)):
for j in range(i+1, len(ls)):
if ls[i] + ls[j] == 2020:
print("part1:")
print(ls[i], ls[j])
prin... | ls = []
with open('input.txt') as fh:
for line in fh.readlines():
if not line.strip():
continue
ls.append(int(line))
for i in range(len(ls)):
for j in range(i + 1, len(ls)):
if ls[i] + ls[j] == 2020:
print('part1:')
print(ls[i], ls[j])
prin... |
# test practice of the the collatz sequence(the simplest impossible maths problem
def collatz(number):
while number != 1:
if number % 2 == 0:
number = number/2;
print(int(number))
else:
number = (number*3) + 1
print(int(number))
def main():
print("Enter number: ")
number = int(input())
colla... | def collatz(number):
while number != 1:
if number % 2 == 0:
number = number / 2
print(int(number))
else:
number = number * 3 + 1
print(int(number))
def main():
print('Enter number: ')
number = int(input())
collatz(number)
main() |
class Solution:
def countAndSay__iterative(self, n: int) -> str:
if n <= 0: return "" # EMPTY
if n == 1: return "1"
say_prev = "1"
for i in range(2, n + 1): # n included
say_curr = self.convert(say_prev)
say_prev = say_curr
return say_prev
# ... | class Solution:
def count_and_say__iterative(self, n: int) -> str:
if n <= 0:
return ''
if n == 1:
return '1'
say_prev = '1'
for i in range(2, n + 1):
say_curr = self.convert(say_prev)
say_prev = say_curr
return say_prev
d... |
count = 10
print("Hello!")
while count > 0:
print(count)
count -= 2 | count = 10
print('Hello!')
while count > 0:
print(count)
count -= 2 |
'''
Gui
___
Contains the Qt views and controllers.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
'''
| """
Gui
___
Contains the Qt views and controllers.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
""" |
numCasoTeste = int(input())
membros = ['Rolien', 'Naej', 'Elehcim', 'Odranoel']
for casoTeste in range(numCasoTeste):
numInput = int(input())
for _ in range(numInput):
recebido = int(input())
print(membros[recebido - 1]) | num_caso_teste = int(input())
membros = ['Rolien', 'Naej', 'Elehcim', 'Odranoel']
for caso_teste in range(numCasoTeste):
num_input = int(input())
for _ in range(numInput):
recebido = int(input())
print(membros[recebido - 1]) |
#
# PySNMP MIB module HP-SN-SW-L4-SWITCH-GROUP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-SN-MIBS
# Produced by pysmi-0.3.4 at Mon Apr 29 19:23:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, single_value_constraint, value_size_constraint, value_range_constraint) ... |
#!/usr/bin/env python3
# [rights] Copyright 2020 brianddk at github https://github.com/brianddk
# [license] Apache 2.0 License https://www.apache.org/licenses/LICENSE-2.0
# [repo] github.com/brianddk/reddit/blob/master/python/mining.py
# [btc] BTC-b32: bc1qwc2203uym96u0nmq04pcgqfs9ldqz9l3mz8fpj
# [tipjar] gith... | spot = 8939.9
hashrate = 110 * 10 ** 12
difficulty = float('16,104,807,485,529'.replace(',', '_'))
reward = 12.5
usd_per_day = spot * hashrate * reward * 60 * 60 * 24 / (difficulty * 2 ** 32)
print(usd_per_day) |
data = b""
data += b"\x7F\x45\x4C\x46" # ELF
data += b"\x02\x02\x02" # ELF64
data += b"\x20\x00" # ABI
data += b"\x00\x00\x00\x00\x00\x00\x00" # Pad
data += b"\x00\x00\x00\x00\x00\x00\x00\x00" # Type Machine Version
data += b"\x00\x00\x00\x00\x00\x00\x00\x00" # Start Address
data += b"\x00\x00\x00\x00\x00\x00\x00\x40"... | data = b''
data += b'\x7fELF'
data += b'\x02\x02\x02'
data += b' \x00'
data += b'\x00\x00\x00\x00\x00\x00\x00'
data += b'\x00\x00\x00\x00\x00\x00\x00\x00'
data += b'\x00\x00\x00\x00\x00\x00\x00\x00'
data += b'\x00\x00\x00\x00\x00\x00\x00@'
data += b'\x00\x00\x00\x00\x00\x00\x00x'
data += b'\x00\x00\x00\x00'
data += b'\... |
class User:
def __init__(self):
self.id = None
self.login = None
self.password = None
self.fullName = None
self.phone = None
self.email = None
self.imageUrl = ''
self.activated = False
self.langKey = 'en'
self.activationKey = None
... | class User:
def __init__(self):
self.id = None
self.login = None
self.password = None
self.fullName = None
self.phone = None
self.email = None
self.imageUrl = ''
self.activated = False
self.langKey = 'en'
self.activationKey = None
... |
row = int(input("How many rows you want? "))
column = int(input("How many columns you want? "))
if row==column:
for i in range(1,row+1):
for j in range(1,row+1):
if i==j:
print("1", end = " ")
else:
print("0", end= " ")
print("")
else:
pri... | row = int(input('How many rows you want? '))
column = int(input('How many columns you want? '))
if row == column:
for i in range(1, row + 1):
for j in range(1, row + 1):
if i == j:
print('1', end=' ')
else:
print('0', end=' ')
print('')
else:
... |
patches = [
{
"op": "remove",
"path": "/PropertyTypes/AWS::S3::StorageLens.S3BucketDestination/Properties/Encryption/Type",
},
{
"op": "add",
"path": "/PropertyTypes/AWS::S3::StorageLens.S3BucketDestination/Properties/Encryption/PrimitiveType",
"value": "Json",
},... | patches = [{'op': 'remove', 'path': '/PropertyTypes/AWS::S3::StorageLens.S3BucketDestination/Properties/Encryption/Type'}, {'op': 'add', 'path': '/PropertyTypes/AWS::S3::StorageLens.S3BucketDestination/Properties/Encryption/PrimitiveType', 'value': 'Json'}, {'op': 'move', 'from': '/PropertyTypes/AWS::S3::StorageLens.Da... |
#
# PySNMP MIB module CISCO-COMMON-MGMT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-COMMON-MGMT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:36:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
with open("input_16.txt", "r") as f:
lines = f.readlines()
names = []
restrictions = []
for line in lines:
if len(line.strip()) == 0:
break
names.append(line.strip().split(": ")[0])
values = line.strip().split(": ")[1]
ranges = values.split(" or ")
restrictions.append([
[int(x)... | with open('input_16.txt', 'r') as f:
lines = f.readlines()
names = []
restrictions = []
for line in lines:
if len(line.strip()) == 0:
break
names.append(line.strip().split(': ')[0])
values = line.strip().split(': ')[1]
ranges = values.split(' or ')
restrictions.append([[int(x) for x in r... |
#cigar_party
def cigar_party(cigars, is_weekend):
if 40<=cigars<=60:
return True
elif cigars>=60 and is_weekend:
return True
return False
#date_fashion
def date_fashion(you, date):
if you<=2 or date<=2:
return 0
elif you>=8 or date>=8:
return 2
elif 2<you<8 or 2<date<8:
r... | def cigar_party(cigars, is_weekend):
if 40 <= cigars <= 60:
return True
elif cigars >= 60 and is_weekend:
return True
return False
def date_fashion(you, date):
if you <= 2 or date <= 2:
return 0
elif you >= 8 or date >= 8:
return 2
elif 2 < you < 8 or 2 < date < ... |
#
# first solution:
#
class sample(object):
class one(object):
def __get__(self, obj, type=None):
print("computing ...")
obj.one = 1
return 1
one = one()
x=sample()
print(x.one)
print(x.one)
#
# other solution:
#
# lazy attribute descriptor
class lazyattr(objec... | class Sample(object):
class One(object):
def __get__(self, obj, type=None):
print('computing ...')
obj.one = 1
return 1
one = one()
x = sample()
print(x.one)
print(x.one)
class Lazyattr(object):
def __init__(self, fget, doc=''):
self.fget = fget
... |
class Ball(object):
color = str()
circumference = float()
brand = str()
| class Ball(object):
color = str()
circumference = float()
brand = str() |
NAME = 'converter.py'
ORIGINAL_AUTHORS = [
'Angelo Giacco'
]
ABOUT = '''
Converts currencies
'''
COMMANDS = '''
>>> .convert <<base currency code>> <<target currency code>> <<amount>>
returns the conversion: amount argument is optional with a default of 1
.convert help
shows a list of currencies supported
'''
W... | name = 'converter.py'
original_authors = ['Angelo Giacco']
about = '\nConverts currencies\n'
commands = '\n>>> .convert <<base currency code>> <<target currency code>> <<amount>>\nreturns the conversion: amount argument is optional with a default of 1\n.convert help\nshows a list of currencies supported\n'
website = '' |
class Bar:
x = 1
print(Bar.x)
| class Bar:
x = 1
print(Bar.x) |
def find_min(array, i):
if i == len(array) - 1:
return array[i]
else:
tmp_min = array[i]
i = i + 1
min_frm = find_min(array, i)
return min(tmp_min, min_frm)
a = [2, 1, 3, 10, 53, 23, -1, 2, 5, 0, 34, 8]
#a = [x for x in range(1000)]
print (find_min(a, 0))
| def find_min(array, i):
if i == len(array) - 1:
return array[i]
else:
tmp_min = array[i]
i = i + 1
min_frm = find_min(array, i)
return min(tmp_min, min_frm)
a = [2, 1, 3, 10, 53, 23, -1, 2, 5, 0, 34, 8]
print(find_min(a, 0)) |
def solve(input):
print(sum(list(map(int, input))))
with open('input.txt', 'r') as f:
input = f.read().splitlines()
solve(input)
| def solve(input):
print(sum(list(map(int, input))))
with open('input.txt', 'r') as f:
input = f.read().splitlines()
solve(input) |
# Given a linked list, determine if it has a cycle in it.
# Follow up:
# Can you solve it without using extra space?
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param head, a ListNode
# @return a boo... | class Solution:
def has_cycle(self, head):
if not head:
return False
walker = runner = head
while runner and runner.next:
walker = walker.next
runner = runner.next.next
if walker == runner:
return True
return False |
#1
# Time: O(n)
# Space: O(n)
# Given an array of integers, return indices of
# the two numbers such that they add up to a specific target.
# You may assume that each input would have exactly one solution,
# and you may not use the same element twice.
#
# Example:
# Given nums = [2, 7, 11, 15], target = 9,
# Bec... | class Hashtablesol:
def two_sum(self, nums, target):
num_idx = {}
for (idx, num) in enumerate(nums):
if target - num in num_idx:
return [num_idx[target - num], idx]
else:
num_idx[num] = idx
return [] |
def get_length(dna):
''' (str) -> int
Return the length of the DNA sequence dna.
>>> get_length('ATCGAT')
6
>>> get_length('ATCG')
4
'''
return len(dna)
def is_longer(dna1, dna2):
''' (str, str) -> bool
Return True if and only if DNA sequence dna1 is longer than DNA sequence
... | def get_length(dna):
""" (str) -> int
Return the length of the DNA sequence dna.
>>> get_length('ATCGAT')
6
>>> get_length('ATCG')
4
"""
return len(dna)
def is_longer(dna1, dna2):
""" (str, str) -> bool
Return True if and only if DNA sequence dna1 is longer than DNA sequence
... |
STREAM_ERROR_SOURCE_USER = "stream_error_source_user"
STREAM_ERROR_SOURCE_STREAM_PUMP = "stream_error_source_stream_pump"
STREAM_ERROR_SOURCE_SUBSCRIPTION_GAZE_DATA = "stream_error_source_subscription_gaze_data"
STREAM_ERROR_SOURCE_SUBSCRIPTION_USER_POSITION_GUIDE = "stream_error_source_subscription_user_position_guide... | stream_error_source_user = 'stream_error_source_user'
stream_error_source_stream_pump = 'stream_error_source_stream_pump'
stream_error_source_subscription_gaze_data = 'stream_error_source_subscription_gaze_data'
stream_error_source_subscription_user_position_guide = 'stream_error_source_subscription_user_position_guide... |
def digit_sum(num: str):
res = 0
for c in num:
res += int(c)
return res
def digit_prod(num: str):
res = 1
for c in num:
res *= int(c)
return res
def main():
memo = {}
T = int(input())
for t in range(1, T + 1):
A, B = [int(x) for x in input().split(" ")]
... | def digit_sum(num: str):
res = 0
for c in num:
res += int(c)
return res
def digit_prod(num: str):
res = 1
for c in num:
res *= int(c)
return res
def main():
memo = {}
t = int(input())
for t in range(1, T + 1):
(a, b) = [int(x) for x in input().split(' ')]
... |
BOT_TOKEN = "1910688339:AAG0t3dMaraOL9u31bkjMEbFcMPy-Pl6rA8"
RESULTS_COUNT = 4 # NOTE Number of results to show, 4 is better
SUDO_CHATS_ID = [1731097588, -1005456463651]
DRIVE_NAME = [
"Root", # folder 1 name
"Cartoon", # folder 2 name
"Course", # folder 3 name
"Movies", # ....
"Series", # .... | bot_token = '1910688339:AAG0t3dMaraOL9u31bkjMEbFcMPy-Pl6rA8'
results_count = 4
sudo_chats_id = [1731097588, -1005456463651]
drive_name = ['Root', 'Cartoon', 'Course', 'Movies', 'Series', 'Others']
drive_id = ['0AHQOFQWVW-LiUk9PVA', '0AKqQHy-eIErTUk9PVA', '0AITVP56KLmIIUk9PVA', '10_hTMK8HE8k144wOTth_3x1hC2kZL-LR', '1-oT... |
if __name__ == '__main__':
n = int(input())
i = 0
while n > 0:
print(i ** 2)
i = i + 1
n = n - 1
| if __name__ == '__main__':
n = int(input())
i = 0
while n > 0:
print(i ** 2)
i = i + 1
n = n - 1 |
#11. Find GCD of two given Numbers.
m = int(input("Enter the First Number: "))
n = int(input("Enter the Second Number: "))
r = m
while(m!=n):
if(m>n):
m=m-n
else:
n=n-m
print("G.C.D is ",m)
| m = int(input('Enter the First Number: '))
n = int(input('Enter the Second Number: '))
r = m
while m != n:
if m > n:
m = m - n
else:
n = n - m
print('G.C.D is ', m) |
#Shipping Accounts App
#Define list of users
users = ['eramom', 'footea', 'davisv', 'papinukt', 'allenj', 'eliasro']
print("Welcome to the Shipping Accounts Program.")
#Get user input
username = input("\nHello, what is your username: ").lower().strip()
#User is in list....
if username in users:
#print a price ... | users = ['eramom', 'footea', 'davisv', 'papinukt', 'allenj', 'eliasro']
print('Welcome to the Shipping Accounts Program.')
username = input('\nHello, what is your username: ').lower().strip()
if username in users:
print('\nHello ' + username + '. Welcome back to your account.')
print('Current shipping prices ar... |
# A class to represent the adjacency list of the node
class AdjNode:
def __init__(self, data):
self.vertex = data
self.next = None
class Graph:
def __init__(self, vertices):
self.V = vertices
self.graph = [None] * self.V
self.verticeslist = []
def add_edge(self, ... | class Adjnode:
def __init__(self, data):
self.vertex = data
self.next = None
class Graph:
def __init__(self, vertices):
self.V = vertices
self.graph = [None] * self.V
self.verticeslist = []
def add_edge(self, src, dest):
self.verticeslist.append(src)
... |
description = 'Vaccum sensors and temperature control'
devices = dict(
vacuum=device(
'nicos_ess.estia.devices.pfeiffer.PfeifferTPG261',
description='Pfeiffer TPG 261 vacuum gauge controller',
hostport='192.168.1.254:4002',
fmtstr='%.2E',
),
)
| description = 'Vaccum sensors and temperature control'
devices = dict(vacuum=device('nicos_ess.estia.devices.pfeiffer.PfeifferTPG261', description='Pfeiffer TPG 261 vacuum gauge controller', hostport='192.168.1.254:4002', fmtstr='%.2E')) |
SECRET_KEY = "123"
INSTALLED_APPS = [
'sr'
]
SR = {
'test1': 'Test1',
'test2': {
'test3': 'Test3',
},
'test4': {
'test4': 'Test4 {0} {1}',
},
'test5': {
'test5': "<b>foo</b>",
}
}
| secret_key = '123'
installed_apps = ['sr']
sr = {'test1': 'Test1', 'test2': {'test3': 'Test3'}, 'test4': {'test4': 'Test4 {0} {1}'}, 'test5': {'test5': '<b>foo</b>'}} |
# -*- coding: utf-8 -*-
numero_empleado = int(input())
numero_hrs_mes = int(input())
pago_por_hora = float('%.2f' % ( float(input()) ))
pago_por_mes = pago_por_hora*numero_hrs_mes
pago_por_mes = '%.2f'%(float(pago_por_mes))
print ("NUMBER = " + str(numero_empleado))
print ("SALARY = U$ " + str(pago_por_mes)) | numero_empleado = int(input())
numero_hrs_mes = int(input())
pago_por_hora = float('%.2f' % float(input()))
pago_por_mes = pago_por_hora * numero_hrs_mes
pago_por_mes = '%.2f' % float(pago_por_mes)
print('NUMBER = ' + str(numero_empleado))
print('SALARY = U$ ' + str(pago_por_mes)) |
{
"targets": [
{
"target_name": "wiringpi",
"sources": [ "wiringpi.cc" ],
"include_dirs": [ "/usr/local/include" ],
"ldflags": [ "-lwiringPi" ]
}
]
}
| {'targets': [{'target_name': 'wiringpi', 'sources': ['wiringpi.cc'], 'include_dirs': ['/usr/local/include'], 'ldflags': ['-lwiringPi']}]} |
bot_name = 'your_bot_username'
bot_token = 'your_bot_token'
redis_server = 'localhost'
redis_port = 6379
bot_master = 'your_userid_here'
| bot_name = 'your_bot_username'
bot_token = 'your_bot_token'
redis_server = 'localhost'
redis_port = 6379
bot_master = 'your_userid_here' |
class NavigationHelper:
def __init__(self, app):
self.app = app
def open_home_page(self):
wd = self.app.wd
wd.get(self.app.base_url)
def return_to_home_page(self):
wd = self.app.wd
wd.find_element_by_link_text("home").click()
| class Navigationhelper:
def __init__(self, app):
self.app = app
def open_home_page(self):
wd = self.app.wd
wd.get(self.app.base_url)
def return_to_home_page(self):
wd = self.app.wd
wd.find_element_by_link_text('home').click() |
_base_ = [
'./retina.py'
]
model= dict(
type='CustomRetinaNet',
#pretrained=None,
#backbone=dict( # Replacding R50 by OTE MV2
# _delete_=True,
# type='mobilenetv2_w1',
# out_indices=(2, 3, 4, 5),
# frozen_stages=-1,
# norm_eval=True, # False in OTE setting
# ... | _base_ = ['./retina.py']
model = dict(type='CustomRetinaNet') |
class BaseComponent(object):
def __init__(self):
self.version = self.__version__
def forward(self, tweet: str):
raise NotImplementedError
@property
def __version__(self):
raise NotImplementedError
| class Basecomponent(object):
def __init__(self):
self.version = self.__version__
def forward(self, tweet: str):
raise NotImplementedError
@property
def __version__(self):
raise NotImplementedError |
def create_spam_worker_name(user_id):
return f'user_{user_id}_spam_worker'
def create_email_worker_name(user_id):
return f'user_{user_id}_email_worker'
def create_worker_celery_name(worker_name):
return f"celery@{worker_name}"
def create_spam_worker_celery_name(user_id):
return create_worker_celer... | def create_spam_worker_name(user_id):
return f'user_{user_id}_spam_worker'
def create_email_worker_name(user_id):
return f'user_{user_id}_email_worker'
def create_worker_celery_name(worker_name):
return f'celery@{worker_name}'
def create_spam_worker_celery_name(user_id):
return create_worker_celery_n... |
def aditya():
return "aditya"
def shantanu(num):
if num>10:
return "shantanu"
else:
return "patankar" | def aditya():
return 'aditya'
def shantanu(num):
if num > 10:
return 'shantanu'
else:
return 'patankar' |
# Define a Multiplication Function
def mul(num1, num2):
return num1 * num2
| def mul(num1, num2):
return num1 * num2 |
''' Write a Python program to accept a filename from the user and print the extension of that. '''
ext = input("Enter a file name: ")
files = ext.split('.')
print(files[1])
| """ Write a Python program to accept a filename from the user and print the extension of that. """
ext = input('Enter a file name: ')
files = ext.split('.')
print(files[1]) |
def kth_largest1(arr,k):
if k > len(arr):
return None
for i in range(k-1):
arr.remove(max(arr))
return max(arr)
def kth_largest2(arr,k):
if k > len(arr):
return None
n = len(arr)
arr.sort()
return(arr[n - k])
print(kth_largest2([4,2,8,9,5,6,7],2)) | def kth_largest1(arr, k):
if k > len(arr):
return None
for i in range(k - 1):
arr.remove(max(arr))
return max(arr)
def kth_largest2(arr, k):
if k > len(arr):
return None
n = len(arr)
arr.sort()
return arr[n - k]
print(kth_largest2([4, 2, 8, 9, 5, 6, 7], 2)) |
# the way currently the code is written it is possible to change the value accidently or it can be changed accidently
class Customer:
def __init__(self, cust_id, name, age, wallet_balance):
self.cust_id = cust_id
self.name = name
self.age = age
self.wallet_balance = wallet_balance
... | class Customer:
def __init__(self, cust_id, name, age, wallet_balance):
self.cust_id = cust_id
self.name = name
self.age = age
self.wallet_balance = wallet_balance
def update_balance(self, amount):
if amount < 1000 and amount > 0:
self.wallet_balance += amou... |
def match(output_file, input_file):
block = []
blocks = []
for line in open(input_file, encoding='utf8').readlines():
if line.startswith('#'):
block.append(line)
else:
if block:
blocks.append(block)
block = []
block1 = []
blocks1 =... | def match(output_file, input_file):
block = []
blocks = []
for line in open(input_file, encoding='utf8').readlines():
if line.startswith('#'):
block.append(line)
else:
if block:
blocks.append(block)
block = []
block1 = []
blocks1 = ... |
# quicksort
def partition(arr,low,high):
i = ( low-1 ) # index of smaller element
pivot = arr[high] # pivot
for j in range(low , high):
# If current element is smaller than or
# equal to pivot
if arr[j] <= pivot:
# increment index of ... | def partition(arr, low, high):
i = low - 1
pivot = arr[high]
for j in range(low, high):
if arr[j] <= pivot:
i = i + 1
(arr[i], arr[j]) = (arr[j], arr[i])
(arr[i + 1], arr[high]) = (arr[high], arr[i + 1])
return i + 1
def quick_sort(arr, low, high):
if low < high:... |
# A mapping between model field internal datatypes and sensible
# client-friendly datatypes. In virtually all cases, client programs
# only need to differentiate between high-level types like number, string,
# and boolean. More granular separation be may desired to alter the
# allowed operators or may infer a different... | simple_types = {'auto': 'key', 'foreignkey': 'key', 'biginteger': 'number', 'decimal': 'number', 'float': 'number', 'integer': 'number', 'positiveinteger': 'number', 'positivesmallinteger': 'number', 'smallinteger': 'number', 'nullboolean': 'boolean', 'char': 'string', 'email': 'string', 'file': 'string', 'filepath': '... |
constants = {
# --- ASSETS FILE NAMES AND DELAY BETWEEN FOOTAGE
"CALIBRATION_CAMERA_STATIC_PATH": "assets/cam1 - static/calibration.mov",
"CALIBRATION_CAMERA_MOVING_PATH": "assets/cam2 - moving light/calibration.mp4",
"COIN_1_VIDEO_CAMERA_STATIC_PATH": "assets/cam1 - static/coin1.mov",
"COIN_1_VIDEO... | constants = {'CALIBRATION_CAMERA_STATIC_PATH': 'assets/cam1 - static/calibration.mov', 'CALIBRATION_CAMERA_MOVING_PATH': 'assets/cam2 - moving light/calibration.mp4', 'COIN_1_VIDEO_CAMERA_STATIC_PATH': 'assets/cam1 - static/coin1.mov', 'COIN_1_VIDEO_CAMERA_MOVING_PATH': 'assets/cam2 - moving light/coin1.mp4', 'COIN_2_V... |
def timeConversion(s):
if "P" in s:
s = s.split(":")
if s[0] == '12':
s = s.split(":")
s[2] = s[2][:2]
print(":".join(s))
else:
s[0] = str(int(s[0])+12)
s[2] = s[2][:2]
print(":".join(s))
else:
s = s.split(":... | def time_conversion(s):
if 'P' in s:
s = s.split(':')
if s[0] == '12':
s = s.split(':')
s[2] = s[2][:2]
print(':'.join(s))
else:
s[0] = str(int(s[0]) + 12)
s[2] = s[2][:2]
print(':'.join(s))
else:
s = s.split... |
def for_loop4(str, x):
result = 0
for i in str:
if i == x:
result += 1
return result
def main():
print(for_loop4('athenian', 'e'))
print(for_loop4('apples', 'a'))
print(for_loop4('hello', 'a'))
print(for_loop4('alphabet', 'h'))
print(for_loop4('aaaaa', 'b'))
if __... | def for_loop4(str, x):
result = 0
for i in str:
if i == x:
result += 1
return result
def main():
print(for_loop4('athenian', 'e'))
print(for_loop4('apples', 'a'))
print(for_loop4('hello', 'a'))
print(for_loop4('alphabet', 'h'))
print(for_loop4('aaaaa', 'b'))
if __nam... |
# Author : Nekyz
# Date : 30/06/2015
# Project Euler Challenge 3
# Largest palindrome of 2 three digit number
def is_palindrome (n):
# Reversing n to see if it's the same ! Extended slice are fun
if str(n) == (str(n))[::-1]:
return True
return False
max = 0
for i in range(999,100,-1):
fo... | def is_palindrome(n):
if str(n) == str(n)[::-1]:
return True
return False
max = 0
for i in range(999, 100, -1):
for j in range(999, 100, -1):
product = i * j
if is_palindrome(product):
if product > max:
max = product
print(i, ' * ', j, ' = ... |
# -*- coding: utf-8 -*-
def remove_duplicate_elements(check_list):
func = lambda x,y:x if y in x else x + [y]
return reduce(func, [[], ] + check_list)
| def remove_duplicate_elements(check_list):
func = lambda x, y: x if y in x else x + [y]
return reduce(func, [[]] + check_list) |
# coding: utf-8
mail_conf = {
"host": "",
"sender": "boom_run raise error",
"username": "",
"passwd": "",
"mail_postfix": "",
"recipients": [
"",
]
}
redis_conf = {
"host": "127.0.0.1",
"port": 6379,
}
| mail_conf = {'host': '', 'sender': 'boom_run raise error', 'username': '', 'passwd': '', 'mail_postfix': '', 'recipients': ['']}
redis_conf = {'host': '127.0.0.1', 'port': 6379} |
#
# PySNMP MIB module BEGEMOT-PF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BEGEMOT-PF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:37:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) ... |
# -*- coding:utf-8 -*-
p = raw_input("Escribe una frase: ")
for letras in p:
print(p.upper()) | p = raw_input('Escribe una frase: ')
for letras in p:
print(p.upper()) |
def find_words_in_phone_number():
phone_number = "3662277"
words = ["foo", "bar", "baz", "foobar", "emo", "cap", "car", "cat"]
lst = []
cmap = dict(a=2, b=2, c=2, d=3, e=3, f=3, g=4, h=4, i=4, j=5, k=5, l=5,
m=6, n=6, o=6, p=7, q=7, r=7, s=7, t=8, u=8, v=8, w=9, x=9, y=9, z=9)
for w... | def find_words_in_phone_number():
phone_number = '3662277'
words = ['foo', 'bar', 'baz', 'foobar', 'emo', 'cap', 'car', 'cat']
lst = []
cmap = dict(a=2, b=2, c=2, d=3, e=3, f=3, g=4, h=4, i=4, j=5, k=5, l=5, m=6, n=6, o=6, p=7, q=7, r=7, s=7, t=8, u=8, v=8, w=9, x=9, y=9, z=9)
for word in words:
... |
CMarketRspInfoField = {
"ErrorID": "int",
"ErrorMsg": "string",
}
CMarketReqUserLoginField = {
"UserId": "string",
"UserPwd": "string",
"UserType": "string",
"MacAddress": "string",
"ComputerName": "string",
"SoftwareName": "string",
"SoftwareVersion": "string",
"AuthorCode": "s... | c_market_rsp_info_field = {'ErrorID': 'int', 'ErrorMsg': 'string'}
c_market_req_user_login_field = {'UserId': 'string', 'UserPwd': 'string', 'UserType': 'string', 'MacAddress': 'string', 'ComputerName': 'string', 'SoftwareName': 'string', 'SoftwareVersion': 'string', 'AuthorCode': 'string', 'ErrorDescription': 'string'... |
# cook your dish here
print("137=2(2(2)+2+2(0))+2(2+2(0))+2(0)")
print("1315=2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)")
print("73=2(2(2)+2)+2(2+2(0))+2(0)")
print("136=2(2(2)+2+2(0))+2(2+2(0))")
print("255=2(2(2)+2+2(0))+2(2(2)+2)+2(2(2)+2(0))+2(2(2))+2(2+2(0))+2(2)+2+2(0)")
print("1384=2(2(2+2(0))+2)+2(2(2+2(0)... | print('137=2(2(2)+2+2(0))+2(2+2(0))+2(0)')
print('1315=2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)')
print('73=2(2(2)+2)+2(2+2(0))+2(0)')
print('136=2(2(2)+2+2(0))+2(2+2(0))')
print('255=2(2(2)+2+2(0))+2(2(2)+2)+2(2(2)+2(0))+2(2(2))+2(2+2(0))+2(2)+2+2(0)')
print('1384=2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2)+2(2(2)+2(... |
def get_current_players(current_room):
host_user = current_room['host_user']
users = current_room['game']['users']
players = [player for player in users]
players.append(host_user)
return players
| def get_current_players(current_room):
host_user = current_room['host_user']
users = current_room['game']['users']
players = [player for player in users]
players.append(host_user)
return players |
class DuckyScriptParser:
'''
This class is a parser for the DuckyScript language.
It allows to generate a sequence of frame to inject keystrokes according to the provided script.
'''
def __init__(self,content="",filename=""):
if content != "":
self.content = content
else:
self.content = open(filename,"r"... | class Duckyscriptparser:
"""
This class is a parser for the DuckyScript language.
It allows to generate a sequence of frame to inject keystrokes according to the provided script.
"""
def __init__(self, content='', filename=''):
if content != '':
self.content = content
else:
... |
def Awana_Academy(name, age): ## say to python that all the code that come after that line is going to be in d function
print("Hello " + name + "you are " + age + "years old ")
Awana_Academy("Alex " , "45")
Awana_Academy("Donald ", "12")
| def awana__academy(name, age):
print('Hello ' + name + 'you are ' + age + 'years old ')
awana__academy('Alex ', '45')
awana__academy('Donald ', '12') |
# https://www.codewars.com/kata/55d2aee99f30dbbf8b000001/
'''
Details :
A new school year is approaching, which also means students will be taking tests.
The tests in this kata are to be graded in different ways. A certain number of points will be given for each correct answer and a certain number of points will be ... | """
Details :
A new school year is approaching, which also means students will be taking tests.
The tests in this kata are to be graded in different ways. A certain number of points will be given for each correct answer and a certain number of points will be deducted for each incorrect answer. For ommitted answers, p... |
# https://open.kattis.com/problems/babybites
n = int(input())
inp = input().split()
for i in range(0, n):
if inp[i].isdigit():
if int(inp[i]) != i + 1:
print('something is fishy')
break
else:
print('makes sense')
| n = int(input())
inp = input().split()
for i in range(0, n):
if inp[i].isdigit():
if int(inp[i]) != i + 1:
print('something is fishy')
break
else:
print('makes sense') |
#Let's use tuples to store information about a file: its name,
#its type and its size in bytes.
#Fill in the gaps in this code to return the size in kilobytes (a kilobyte is 1024 bytes) up to 2 decimal places.
#Code:
def file_size(file_info):
name, type, size= file_info
return("{:.2f}".format(size / 1024))
print... | def file_size(file_info):
(name, type, size) = file_info
return '{:.2f}'.format(size / 1024)
print(file_size(('Class Assignment', 'docx', 17875)))
print(file_size(('Notes', 'txt', 496)))
print(file_size(('Program', 'py', 1239))) |
def gmaps_url_to_coords(url):
gmaps_coords = url.split('=')
coords = (0.0, 0.0) # defaults to 0,0
if len(gmaps_coords) == 2:
gmaps_coords = gmaps_coords[1]
coords = tuple(map(lambda c: float(c), gmaps_coords.split(',')))
return coords
| def gmaps_url_to_coords(url):
gmaps_coords = url.split('=')
coords = (0.0, 0.0)
if len(gmaps_coords) == 2:
gmaps_coords = gmaps_coords[1]
coords = tuple(map(lambda c: float(c), gmaps_coords.split(',')))
return coords |
# Copyright 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 filters or at
# https://developers.google.com/open-source/licenses/bsd
{
'includes': [
'../../common.gypi',
],
'targets': [
{
'target_name': 'filters',... | {'includes': ['../../common.gypi'], 'targets': [{'target_name': 'filters', 'type': '<(component)', 'sources': ['avc_decoder_configuration.cc', 'avc_decoder_configuration.h', 'decoder_configuration.cc', 'decoder_configuration.h', 'ec3_audio_util.cc', 'ec3_audio_util.h', 'h264_byte_to_unit_stream_converter.cc', 'h264_byt... |
def no_teen_sum(a, b, c):
retSum = 0
for i in [a, b, c]:
if i <= 19 and i >= 13 and i != 15 and i != 16:
continue
retSum += i
return retSum
| def no_teen_sum(a, b, c):
ret_sum = 0
for i in [a, b, c]:
if i <= 19 and i >= 13 and (i != 15) and (i != 16):
continue
ret_sum += i
return retSum |
def func():
yield 1
yield 2
yield 3
def main():
for item in func():
print(item)
# print(func()) #<generator object func at 0x7f227f3ae3b8>
obj1 = (1,2,3,)
obj = (i for i in range(10))
print (obj)
# print(obj[1]) # 'generator' object is not subscriptable
obj2 ... | def func():
yield 1
yield 2
yield 3
def main():
for item in func():
print(item)
obj1 = (1, 2, 3)
obj = (i for i in range(10))
print(obj)
obj2 = [i for i in range(10)]
print(obj2)
print(obj2[1])
mygenerator = (x * x for x in range(3))
print(mygenerator)
print(... |
def is_palindrome(str, length):
is_pali = True
length -= 1
for i in range (0, length//2):
if (str[i] != str[length - i]):
is_pali = False
break
return is_pali
str = input('please enter a string\n')
message = "Palindrome!" if is_palindrome(str, len(str)) else "not pali"
p... | def is_palindrome(str, length):
is_pali = True
length -= 1
for i in range(0, length // 2):
if str[i] != str[length - i]:
is_pali = False
break
return is_pali
str = input('please enter a string\n')
message = 'Palindrome!' if is_palindrome(str, len(str)) else 'not pali'
pri... |
# TODO -- co.api.InvalidResponse is used in (client) public code. This should
# move to private.
class ClientError(Exception):
def __init__(self, status_code, message):
Exception.__init__(self)
self.status_code = status_code
self.message = message
def to_dict(self):
return {"... | class Clienterror(Exception):
def __init__(self, status_code, message):
Exception.__init__(self)
self.status_code = status_code
self.message = message
def to_dict(self):
return {'message': self.message} |
groups_dict = {
-1001384861110: "expresses"
}
log_file = "logs.log"
database_file = "Couples.sqlite"
couples_delta = 60 * 60 * 4
| groups_dict = {-1001384861110: 'expresses'}
log_file = 'logs.log'
database_file = 'Couples.sqlite'
couples_delta = 60 * 60 * 4 |
class Solution:
def reverseStr(self, s: str, k: int) -> str:
if not s or not k or k < 0:
return ""
s = list(s)
for i in range(0, len(s), 2 * k):
s[i: i+k] = reversed(s[i:i+k])
return ''.join(s)
| class Solution:
def reverse_str(self, s: str, k: int) -> str:
if not s or not k or k < 0:
return ''
s = list(s)
for i in range(0, len(s), 2 * k):
s[i:i + k] = reversed(s[i:i + k])
return ''.join(s) |
d1, d2 = map(int, input().split())
s = d1 + d2
dic = {}
for i in range(2, s + 1):
dic[i] = 0
for i in range(1, d1 + 1):
for j in range(1, d2 + 1):
dic[i + j] += 1
top = 0
out = []
for key in dic:
if dic[key] == top:
out.append(key)
elif dic[key] > top:
top = dic[key]
out ... | (d1, d2) = map(int, input().split())
s = d1 + d2
dic = {}
for i in range(2, s + 1):
dic[i] = 0
for i in range(1, d1 + 1):
for j in range(1, d2 + 1):
dic[i + j] += 1
top = 0
out = []
for key in dic:
if dic[key] == top:
out.append(key)
elif dic[key] > top:
top = dic[key]
ou... |
'''
PARTIAL DEARRANGEMENTS
A partial dearrangement is a dearrangement where some points are
fixed. That is, given a number n and a number k, we need to find
count of all such dearrangements of n numbers, where k numbers are
fixed in their position.
'''
mod = 1000000007
def nCr(n, r, mod):
if n < r:
retur... | """
PARTIAL DEARRANGEMENTS
A partial dearrangement is a dearrangement where some points are
fixed. That is, given a number n and a number k, we need to find
count of all such dearrangements of n numbers, where k numbers are
fixed in their position.
"""
mod = 1000000007
def n_cr(n, r, mod):
if n < r:
retur... |
#!/usr/bin/env python3
class Color():
black = "\u001b[30m"
red = "\u001b[31m"
green = "\u001b[32m"
yellow = "\u001b[33m"
blue = "\u001b[34m"
magenta = "\u001b[35m"
cyan = "\u001b[36m"
white = "\u001b[37m"
reset = "\u001b[0m"
| class Color:
black = '\x1b[30m'
red = '\x1b[31m'
green = '\x1b[32m'
yellow = '\x1b[33m'
blue = '\x1b[34m'
magenta = '\x1b[35m'
cyan = '\x1b[36m'
white = '\x1b[37m'
reset = '\x1b[0m' |
# Classic crab rave text filter
def apply_filter(input_stream, overlay_text, font_file, font_color, font_size):
text_lines = overlay_text.split("\n")
text_shadow = int(font_size / 16)
# ffmpeg does not support multiline text with vertical align
if len(text_lines) >= 2:
video_stream = input_stre... | def apply_filter(input_stream, overlay_text, font_file, font_color, font_size):
text_lines = overlay_text.split('\n')
text_shadow = int(font_size / 16)
if len(text_lines) >= 2:
video_stream = input_stream.video.drawtext(x='(w-text_w)/2', y='(h-text_h)/2-text_h', text=text_lines[0], fontfile=font_fil... |
class ElementableError(Exception):
pass
class InvalidElementError(KeyError, ElementableError):
def __init__(self, msg):
msg = f"Element {msg} is not supported"
super().__init__(msg)
| class Elementableerror(Exception):
pass
class Invalidelementerror(KeyError, ElementableError):
def __init__(self, msg):
msg = f'Element {msg} is not supported'
super().__init__(msg) |
NTIPAliasFlag = {}
NTIPAliasFlag["identified"]="0x10"
NTIPAliasFlag["eth"]="0x400000"
NTIPAliasFlag["ethereal"]="0x400000"
NTIPAliasFlag["runeword"]="0x4000000"
| ntip_alias_flag = {}
NTIPAliasFlag['identified'] = '0x10'
NTIPAliasFlag['eth'] = '0x400000'
NTIPAliasFlag['ethereal'] = '0x400000'
NTIPAliasFlag['runeword'] = '0x4000000' |
for _ in range(int(input())):
word = input()
if len(word) > 10:
print(word[0]+str(len(word)-2)+word[-1])
else:
print(word) | for _ in range(int(input())):
word = input()
if len(word) > 10:
print(word[0] + str(len(word) - 2) + word[-1])
else:
print(word) |
xmin, ymin, xmax, ymax = 100, 100, 1000, 800
# Bit code (0001, 0010, 0100, 1000 and 0000)
LEFT, RIGHT, BOT, TOP = 1, 2, 4, 8
INSIDE = 0
print(f"Xmin: {xmin}\nYmin: {ymin}\nXmax: {xmax}\nYmax: {ymax}")
x1 = float(input("Enter x: "))
y1 = float(input("Enter y: "))
x2 = float(input("Enter x2: "))
y2 = float(input("... | (xmin, ymin, xmax, ymax) = (100, 100, 1000, 800)
(left, right, bot, top) = (1, 2, 4, 8)
inside = 0
print(f'Xmin: {xmin}\nYmin: {ymin}\nXmax: {xmax}\nYmax: {ymax}')
x1 = float(input('Enter x: '))
y1 = float(input('Enter y: '))
x2 = float(input('Enter x2: '))
y2 = float(input('Enter y2: '))
def compute_code(x, y):
c... |
class Solution(object):
def firstMissingPositive(self, nums):
size = len(nums)
for i in range(size):
v = nums[i]
if v<1 or v > size:
nums[i]=size+10
for i in range(size):
v = abs(nums[i])
if v >0 and v<=size and nums[v-1]>0:
... | class Solution(object):
def first_missing_positive(self, nums):
size = len(nums)
for i in range(size):
v = nums[i]
if v < 1 or v > size:
nums[i] = size + 10
for i in range(size):
v = abs(nums[i])
if v > 0 and v <= size and (num... |
{
"targets": [
{
"target_name": "index"
}
]
} | {'targets': [{'target_name': 'index'}]} |
def countingSort(array):
size = len(array)
output = [0] * size
count = [0] * 10
for i in range(0, size):
count[array[i]] += 1
for j in range(1,10):
count[j] += count[j-1]
a = size-1
while a >= 0:
output[count[array[a]]-1] = array[a]
count[arra... | def counting_sort(array):
size = len(array)
output = [0] * size
count = [0] * 10
for i in range(0, size):
count[array[i]] += 1
for j in range(1, 10):
count[j] += count[j - 1]
a = size - 1
while a >= 0:
output[count[array[a]] - 1] = array[a]
count[array[a]] -= ... |
# Uses python3
def calc_fib(n):
fib_nums = []
fib_nums.append(0)
fib_nums.append(1)
for i in range(2, n + 1):
fib_nums.append(fib_nums[i - 1] + fib_nums[i - 2])
return fib_nums[n]
n = int(input())
print(calc_fib(n))
| def calc_fib(n):
fib_nums = []
fib_nums.append(0)
fib_nums.append(1)
for i in range(2, n + 1):
fib_nums.append(fib_nums[i - 1] + fib_nums[i - 2])
return fib_nums[n]
n = int(input())
print(calc_fib(n)) |
#Narcissistic Number: (find all this kinds of number fromm 100~999)
#example: 153 = 1**3 + 5**3 + 3**3
#................method 1............................
# for x in range(100, 1000):
# digit_3 = x//100
# digit_2 = x%100//10
# digit_1 = x%10
# if x == digit_3**3 + digit_2**3 + digit_1**3:
# ... | for digit_3 in range(1, 10):
for digit_2 in range(10):
for digit_1 in range(10):
x = 100 * digit_3 + 10 * digit_2 + digit_1
if x == digit_3 ** 3 + digit_2 ** 3 + digit_1 ** 3:
print(x) |
status = True
print(status)
print(type(status))
status = False
print(status)
print(type(status))
soda = 'coke'
print(soda == 'coke')
print(soda == 'pepsi')
print(soda == 'Coke')
print(soda != 'root beer')
names = ['mike', 'john', 'mary']
mike_status = 'mike' in names
bill_status = 'bill' in names
print(mike_status)
... | status = True
print(status)
print(type(status))
status = False
print(status)
print(type(status))
soda = 'coke'
print(soda == 'coke')
print(soda == 'pepsi')
print(soda == 'Coke')
print(soda != 'root beer')
names = ['mike', 'john', 'mary']
mike_status = 'mike' in names
bill_status = 'bill' in names
print(mike_status)
pri... |
def pytest_assertrepr_compare(op, left, right):
# add one more line for "assert ..."
return (
['']
+ ['---']
+ ['> ' + _.text for _ in left]
+ ['---']
+ ['> ' + _.text for _ in right]
)
def pytest_addoption(parser):
parser.addoption('--int', type='int')
def ... | def pytest_assertrepr_compare(op, left, right):
return [''] + ['---'] + ['> ' + _.text for _ in left] + ['---'] + ['> ' + _.text for _ in right]
def pytest_addoption(parser):
parser.addoption('--int', type='int')
def pytest_generate_tests(metafunc):
if 'int_test' in metafunc.fixturenames:
tests = ... |
def solution(s):
answer = []
str_idx = 0
for cont in s:
if cont.isalpha() == True:
if str_idx % 2 == 0:
answer.append(cont.upper())
else:
answer.append(cont.lower())
str_idx = str_idx + 1
else:
... | def solution(s):
answer = []
str_idx = 0
for cont in s:
if cont.isalpha() == True:
if str_idx % 2 == 0:
answer.append(cont.upper())
else:
answer.append(cont.lower())
str_idx = str_idx + 1
else:
if cont == ' ':
... |
MAX_ROWS_DISPLAYABLE = 60
MAX_COLS_DISPLAYABLE = 80
cmap_freq = 'viridis'
cmap_grouping = 'copper' # 'Greys'
grouping_text_color = 'white'
grouping_text_color_background = 'grey'
grouping_fontweight = 'bold'
| max_rows_displayable = 60
max_cols_displayable = 80
cmap_freq = 'viridis'
cmap_grouping = 'copper'
grouping_text_color = 'white'
grouping_text_color_background = 'grey'
grouping_fontweight = 'bold' |
class AccelerationException(Exception):
def __init__(self, message='This is neither acceleration nor deceleration... Go away and program Java, BooN'):
self.message = message
super().__init__(self.message)
class NoMemberException(Exception):
def __init__(self, message='This truck is not a convoy... | class Accelerationexception(Exception):
def __init__(self, message='This is neither acceleration nor deceleration... Go away and program Java, BooN'):
self.message = message
super().__init__(self.message)
class Nomemberexception(Exception):
def __init__(self, message='This truck is not a conv... |
class InvalidValueError(Exception):
pass
class NotFoundError(Exception):
pass
| class Invalidvalueerror(Exception):
pass
class Notfounderror(Exception):
pass |
c = get_config()
c.ContentsManager.root_dir = "/root/"
c.NotebookApp.allow_root = True
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
# Comment out this line or first hash your own password
#c.NotebookApp.password = u'sha1:1234567abcdefghi'
c.ContentsManager.allow_hidden = Tru... | c = get_config()
c.ContentsManager.root_dir = '/root/'
c.NotebookApp.allow_root = True
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.ContentsManager.allow_hidden = True |
r,c=map(int,input('enter number of rows and columns of matrix: ').split())
m1=[]
m2=[]
a=[]
print('<<<<< enter element of matrix1 >>>>>')
for i in range(r):
l=[]
for j in range(c):
l.append(int(input(f"enter in m1[{i}][{j}]: ")))
m1.append(l)
print('<<<<< enter element of matrix2 >>>>>')
for i in range(r):
l=[]
... | (r, c) = map(int, input('enter number of rows and columns of matrix: ').split())
m1 = []
m2 = []
a = []
print('<<<<< enter element of matrix1 >>>>>')
for i in range(r):
l = []
for j in range(c):
l.append(int(input(f'enter in m1[{i}][{j}]: ')))
m1.append(l)
print('<<<<< enter element of matrix2 >>>>>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.