content
stringlengths
7
1.05M
ternary = [0, 1, 2] ternary[0] = "true" ternary[1] = "maybe" ternary[2] = "false" x = 34 y = 34 if x > y: print(ternary[0]) elif x < y: print(ternary[2]) else: print(ternary[1])
# # PySNMP MIB module FDDI-SMT73-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/FDDI-SMT73-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:12:32 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52) # ...
class BeforeAutorizationHelper: def __init__(self,app): self.app = app # выбор предмета по порядку, возвращает кол-во уроков/тестов def Test_list_of_all_items(self, TEXT): driver = self.app.driver Items = driver.find_elements_by_class_name('subject-card') # кнопка списка предметов...
#/usr/bin/env python """ globifest/globitest/__init__.py - globifest Library Package Copyright 2018, Daniel Kristensen, Garmin Ltd, or its subsidiaries. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following c...
# Division print(5 / 8) # Addition print(7 + 10)
# import os # import pytest def pytest_runtest_setup(item): pass """ if "1" != os.environ.get("PKG_NSF_FACTORY_INSTALL_IN_ENV"): pytest.skip( "Should be run only from build environement. " "See `PKG_NSF_FACTORY_INSTALL_IN_ENV`.") """
# Password validation # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators AUTH_USER_MODEL = 'users.User' AUTHENTICATION_BACKENDS = [ 'pg_rest_api.backends.PGBackend', 'django.contrib.auth.backends.ModelBackend' ] AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.au...
def get_fp_addsub(f): return f["addpd"] + f["addsd"] + f["addss"] + f["addps"] + f["subpd"] + f["subsd"] + f["subss"] + f["subps"] def get_fp_muldiv(f): return f["mulpd"] + f["mulsd"] + f["mulss"] + f["mulps"] + f["divpd"] + f["divsd"] + f["divss"] + f["divps"]
#!/usr/bin/python3 ## author: jinchoiseoul@gmail.com def parse_io(inp, out): ''' io means input/output for testcases; It splitlines them and strip the elements @param inp: multi-lined str @param out: multi-lined str @return (inp::[str], out::[str]) ''' inp = [i.strip() for i...
def blue(_str): return f"\033[0;33m{_str}\033[0m" print(f""" Hello 😁 ! Use the terminal to code! 1. Start the dev server by running {blue("$ npm run start")} 2. You can find a video tutorial and explanation on the README.md file. 3. Always read the terminal output, it's your best tool for debugging! """)
N = int(input()) A = [0]*N for i in N: A[i] = int(input())
class BaseMeta(type): def __new__(cls, name, bases, namespace): return super().__new__(cls, name, bases, namespace) class MyMeta(BaseMeta): def __new__(cls, name, bases, namespace): return super().__new__(cls, name, bases, namespace)
f = open("Writetofile.txt", "a") f.write("Lipika\n") f.write("Ugain\n") f.write("Shivam\n") f.write("Sanjeev\n") print("Data written to the file using append mode") f.close()
class Solution: def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ p1 = 0 p2 = 0 cnt = 0 ret = 0 zeros = 0 while p1 <= p2 and p1 < len(nums) and p2 < len(nums): while zeros < 2 and p2 < len(n...
T = int(input()) def calc_op(l): cnt = 0 for i in range(len(l)): if l[i] % 2 == 0: cnt += l[i]//2 else: cnt += l[i]//2+1 return cnt for _ in range(T): N = int(input()) l = list(map(int, input().split()))[1:-1] if len(l) == 1: if l[0]%2 == 0: ...
''' Represents a single filter on a column. ''' class DrawRequestColumnFilter: ''' Initialize the filter with the column name, filter text, and operation (must be "=", "<=", ">=", "<", ">", or "!="). ''' def __init__(self, column_name, filter_text, operation): self.name = column_name ...
# -*- coding: utf-8 -*- __author__ = 'Jonathan Moore' __email__ = 'firstnamelastnamephd@gmail.com' __version__ = '0.1.0'
# md5 : b27c56d844ab064547d40bf4f0a96eae # sha1 : c314e447018b0d8711347ee26a5795480837b2d3 # sha256 : c045615fe1b44a6409610e4e94e70f1559325eb55ab1f805b0452e852771c0ae ord_names = { 1: b'SQLAllocConnect', 2: b'SQLAllocEnv', 3: b'SQLAllocStmt', 4: b'SQLBindCol', 5: b'SQLCancel', 6: b'SQLColAttrib...
"""Constants for Cloudflare.""" DOMAIN = "cloudflare" # Config CONF_RECORDS = "records" # Defaults DEFAULT_UPDATE_INTERVAL = 60 # in minutes # Services SERVICE_UPDATE_RECORDS = "update_records"
# part 1 def check_numbers(a,b): print (a+b) check_numbers(2,6) # part 2 def check_numbers_list(a,b): i=0 if len(a)==len(b): while i<len(a): check_numbers(a[i],b[i]) i +=1 else: print ("lists ki len barabar nahi hai") check_numbers_list([10,30,40],[40,20,21])
num = int(input()) soma2 = 0 soma3 = 0 soma4 = 0 soma5 = 0 lista = [int(i) for i in input().split()] for i in range(num): if(lista[i] % 2 == 0): soma2 = soma2 + 1 if(lista[i] % 3 == 0): soma3 = soma3 + 1 if(lista[i] % 4 == 0): soma4 = soma4 + 1 if(lista[i] % 5 == 0)...
def lambda_handler(event, context): name = event.get("name") if not name: name = "person who does not want to give their name" return { "hello": f"hello {name}"}
# print_squares_upto_limit(30) # //For limit = 30, output would be 1 4 9 16 25 # # print_cubes_upto_limit(30) # //For limit = 30, output would be 1 8 27 def print_squares_upto_limit(limit): i = 1 while i * i < limit: print(i*i, end = " ") i = i + 1 def print_cubes_upto_limit(limit): i = 1 ...
#!/usr/bin/env python print("test1 -- > 1") print("test1 -- > 2") print("test1 -- > 3")
MX_ROBOT_MAX_NB_ACCELEROMETERS = 1 MX_DEFAULT_ROBOT_IP = "192.168.0.100" MX_ROBOT_TCP_PORT_CONTROL = 10000 MX_ROBOT_TCP_PORT_FEED = 10001 MX_ROBOT_UDP_PORT_TRACE = 10002 MX_ROBOT_UDP_PORT_RT_CTRL = 10003 MX_CHECKPOINT_ID_MIN = 1 MX_CHECKPOINT_ID_MAX = 8000 MX_ACCELEROMETER_UNIT_PER_G = 16000 MX_GRAVITY_MPS2 = 9.8067 MX...
flowers = input() qty = int(input()) budget = int(input()) price = 0 Roses = 5 Dahlias = 3.8 Tulips = 2.8 Narcissus = 3 Gladiolus = 2.5 if flowers == "Roses": if qty > 80: price = Roses * qty * 0.9 else: price = Roses * qty elif flowers == "Dahlias": if qty > 90: price = Dahlias *...
def get_divisors(n): sum = 1 for i in range(2, int(n ** 0.5 + 1)): if n % i == 0: sum += i sum += n / i return sum def find_amicable_pair(): total = 0 for x in range(1, 10001): a = get_divisors(x) b = get_divisors(a) if b == x and x != a: ...
#sandwiches: def orderedsandwich(items): list_of_items = [] for item in items: list_of_items.append(item) print("This is items you ordered in your sandwich:") for item in list_of_items: print(item) orderedsandwich(['kela','aloo']) orderedsandwich(['cheese','poteto']) orderedsandwich(['...
def fatorial(num=1): f = 1 for c in range(num, 0, -1): f *= c return f print(f'O resultado é: {fatorial(int(input("Digite um valor: ")))}')
class Player: name: str hp: int mp: int skills: dict def __init__(self, name: str, hp: int, mp: int): self.name = name self.hp = hp self.mp = mp self.skills = {} self.guild = 'Unaffiliated' def add_skill(self, skill_name, mana_cost): skills = [x ...
""" CONVERSOR DE TEMPERATURAS ºC E ºF """ c = float(input('Informe a temperatura em ºC: ')) f = float(input('Informe a temperatura em ºF: ')) Tc = (f-32)/1.8 Tf = (c*1.8)+32 print('A temperatura de {:.2f}ºC Corresponde a {:.2f}ºF '.format(c,Tf)) print('A temperatura de {:.2f}ºF Corresponde a {:.2f}ºC'.format(f,Tc))...
students_number=int(input("Enter number of Students :")) per_student_kharcha=int(input("Enter per student expense :")) total_kharcha=students_number*per_student_kharcha if total_kharcha<50000: print ("Ham kharche ke andar hai ") else: print ("kharche se bahar hai ")
s = 'test' print(s[:]) # print whole string print(s[0:-1]) # print tes print(s[1]) # e print(s + "xyz") # concatination testxyz print("A"*90) #s[0] = "s" #str' object does not support item assignment S = "strawberry" L = list(S) print(L) L[0] = 'Z' print(''.join(L)) # Ztrawberry s = ''.join(L) s = s.replace('rr', 'r...
a = 1 b = 2 c = a+b print(c) d= 5 e = 6 f = 7 k = 6 h = 50 j =522022 l= 5050 你是猪
# # Language constants # WELCOME = " Welcome to arpspoofKicker!" # # Universal # SELECT_AN_OPTION = "Select an option" # # main # MENU = "\n1. ARPSpoof a single device\n" \ "2. ARPSpoof a multiple devices\n" \ "E. Exit" MENU_1 = "\n1. ARPSpoof a single device\n" \ "2. ARPSpoof a multipl...
class JackTokenizer: def __init__(self, src_file_name): self._line_index = 0 self._line_index = 0 self._lines = [] f = open(src_file_name) # First assesment of the Assembler for line in f.readlines(): strip_line = line.lstrip() # Skipping ...
jolts = [0] while True: try: a = int(input()) jolts.append(a) except: break jolts.sort() jolts.append(jolts[-1] + 3) diffs = [0, 0] for i in range(1,len(jolts)): if jolts[i] - jolts[i-1] == 1: diffs[0] += 1 elif jolts[i] - jolts[i-1] == 3: diffs[1] += 1 print(di...
def gen_serial(username): log_10 = 0 log_14 = 0 log_15 = 0 eax = '' edx = '' ecx = '' for c in username: hex_symbol = hex(ord(c)) eax = hex_symbol eax = log_15 eax = eax << 2 log_10 = log_10 + eax eax = hex_symbol edx = log_10 edx = edx - int(eax, 16) eax = 0x0fa eax = eax ^ edx log_10 = e...
def clean_t (data): # Select columns to clean df = data # Create dummies using the items in the list of 'safety&security' column ss = df['safety_security'].dropna() df_new = df.join(ss.str.join('|').str.get_dummies().add_prefix('ss_')) # Drop 'safety_security' column df_new.drop('s...
def extractDustToRust(item): """ Parser for 'Dust to Rust' """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if 'Kyuuketsu Hime' in item['tags']: return buildReleaseMessageWithType(item, 'Kyuuketsu Hime wa Barai...
#encoding=utf-8 #Manacher is to find the longest Palindrome substring #normally, the time complexity is O(n2) #In order to reduce the time complexity #It tries to use the previous palindrome data #to reduce the time complexsity to O(n) def FindLongestPalindrome(str_line): p = [1]* len(str_line) mx = 1 i...
# gunicorn config file access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" "pid=%(p)s"' raw_env = [ 'FLASK_APP=webhook', ] bind="0.0.0.0:5000" workers=5 accesslog="-"
# coding=utf-8 class NodeType: select = 'SELECT' insert = 'INSERT' delete = 'DELETE' update = 'UPDATE' train = 'TRAIN' register = 'REGISTER' load = 'LOAD' save = 'SAVE' connect = 'CONNECT' set = 'SET' alert = 'ALERT' create_table = 'CREATETABLE' drop_table = 'DROPTA...
# Name: # Date: # proj02: sum # Write a program that prompts the user to enter numbers, one per line, # ending with a line containing 0, and keep a running sum of the numbers. # Only print out the sum after all the numbers are entered # (at least in your final version). Each time you read in a number, # you can immed...
sentence='I am interested in {num}' pi=3.14 print(sentence.format(num=pi)) e=2.712 print(sentence.format(num=e))
""" File: rocket.py Name:Claire Lin ----------------------- This program should implement a console program that draws ASCII art - a rocket. The size of rocket is determined by a constant defined as SIZE at top of the file. Output format should match what is shown in the sample run in the Assignment 2 Handout....
l = [int(i) for i in input().split()] print("largest - ", max(l)) print('smallest - ', min(l)) print('2nd largest - ', sorted(l)[-2]) print('2nd smallest - ', sorted(l)[1])
"""Tier of ecosystem membership.""" # pylint: disable=too-few-public-methods class Tier: """Tiers of ecosystem membership.""" MAIN: str = "MAIN" MEMBER: str = "MEMBER" CANDIDATE: str = "CANDIDATE" COMMUNITY: str = "COMMUNITY" PROTOTYPES: str = "PROTOTYPES"
N, M = list(map(int, input().split())) # N, M = (2, 3) def simple_add(n, m): if m == 0: return n elif m > 0: return simple_add(n + m, 0) else: return simple_add(n + m, 0) print(simple_add(N, M))
qtd=int(input()) if qtd>=0 and qtd<=1000: lista=[] for a in range(0,qtd): A=int(input()) while A<0 or A>10**6: A=int(input()) lista.append(A) acessos=0 dias=0 for a in lista: acessos+=a print(a, acessos) if acessos+a<10**6: ...
class person: count=0 #class attribute def __init__(self,name="bol",age=23): #constructor self.__name=name #instance attribute self.__age=age #instance attribute person.count=person.count+1 def setname(self,name): self.__name=name def getname(self): retur...
# # PySNMP MIB module ELTEX-IP-OSPF-IF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-IP-OSPF-IF-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:45:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
# Crie um programa que vai ler vários números e colocar numa lista. # Depois disso, mostre: # A) quantos números foram digitados; # B) a lista de valores, ordenada de forma decrescente; # C) se o valor 5 foi digitado e não está ou não na lista. valores = [] cont = 0 while True: valores.append(int(input('Digite um n...
# -*- coding: utf-8 -*- def main(): s = input().split() ans = list() for si in s: if '@' in si: is_at = False string = '' for sii in si: if sii == '@': if string != '': ans.append(strin...
# move.py # handles movement in the world def toRoom(server, player, command): ''' moves player from their currentRoom to newRoom ''' newRoom = None #print "cmd:" + str(command) #print "cmd0:" + str(command[0]) #print str(player.currentRoom.orderedExits) # args = <some int> if int(command[0]) <= len(player.cu...
# -*- coding: utf-8 -*- """Top-level package for PCap Filter.""" __author__ = """Nahuel Defossé""" __email__ = "nahuel.defosse+pip@gmail.com" __version__ = "__version__ = '0.2.1'"
#!/usr/bin/env python3 # Testing apostraphes' in single quotes # if I were to: print('he's done') # error: compiler thinks the statement # is ended at the apostraphe after 'he'. # In order to print apostraphes and other # characters like it, escape them: print('he\'s done')
# Given: A protein string P of length at most 1000 aa. # # Return: The total weight of P. Consult the monoisotopic mass table. table = {} tableFile = open("mass table.txt","r") for line in tableFile: table[line[0]]=float(line[4::].strip()) aaFile = open("input.txt","r") total = float(0) for aa in aaFile.read().re...
__author__ = "xTrinch" __email__ = "mojca.rojko@gmail.com" __version__ = "0.2.21" class NotificationError(Exception): pass default_app_config = 'fcm_django.apps.FcmDjangoConfig'
''' Intuition Imagine you are writing a small compiler for your college project and one of the tasks (or say sub-tasks) for the compiler would be to detect if the parenthesis are in place or not. The algorithm we will look at in this article can be then used to process all the parenthesis in the program your compiler...
MAX_PREFIX_LEN = 60 EXCEPTION_PREFIXES = { "1. Une attestation de la maîtrise foncière sur l'emprise de ": None, "2. Un plan de l'exploitation à une échelle adaptée à la supe": None, '3. Une note succincte indiquant la nature de la substance ex': None, '4. Pour les carrières visées à la rubrique 2510-6,...
kDragAttributeFromAE = [] kIncompatibleAttribute = [] kInvalidAttribute = [] kLayer = []
DOTNETIMPL = { "mono": None, "core": None, "net": None, } DOTNETOS = { "darwin": "@bazel_tools//platforms:osx", "linux": "@bazel_tools//platforms:linux", "windows": "@bazel_tools//platforms:windows", } DOTNETARCH = { "amd64": "@bazel_tools//platforms:x86_64", } DOTNETIMPL_OS_ARCH = ( ...
def cheese_and_crackers(cheese_count, boxes_of_crackers): print("You have ", cheese_count, "cheese!") print("you have ", boxes_of_crackers," boxes of crackers!") print("Man that's enough for a party!") print("Get a blamnket.\n") print("We can just give the function numbers directly:") cheese_and_cracke...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/2/14 16:57 # @Author : Baimohan/PH # @Site : https://github.com/BaiMoHan # @File : function_return_test.py # @Software: PyCharm def get_math_func(types): # python支持在函数内定义函数为局部函数,局部函数对外隐藏 # 定义一个计算平方的局部函数 def square(n): return n ** 2...
x=100 text="python tutorial" print(x) print(text) # Assign values to multiple variables x,y,z=10,20,30 print(x) print(y) print(z)
p = [0, 4, 8, 6, 2, 10, 100000000] s=[] d = {} rem=10 for i in p: if i in d: d[i] += 1 else: d[i] = 1 for i in range(0,rem/2+1): if i in d: pair = [i, rem-i] if pair[0]==pair[1] and d[i]>=2: s.append(pair) elif pair[1] in d: s.append(pair) p...
totais = list() pares = list() impares = list() while True: r = '0' totais.append(int(input('Digite um valor'))) while r not in 'SsNn': r = str(input('Quer continuar? S/N')).strip()[0] if r in 'Nn': break for c in range(0, len(totais)): if totais[c] % 2 == 0: pares.append(tot...
class Solution(object): def wordPattern(self, pattern, str): dic = {} dic2 = {} words = str.split(" ") if len(pattern) != len(words): return False i = 0 for cha in pattern: if cha in dic.keys(): if dic[cha] != words[i]: ...
class Solution: def lastStoneWeight(self, stones: List[int]) -> int: while len(stones) > 1: stones.sort() a = stones.pop() b = stones.pop() last = a - b if last: stones.append(last) return stones[0] if stones else 0
class MyHashSet: def __init__(self): self.buckets = [] def hash(self, key: int) -> str: return chr(key) def add(self, key: int) -> None: val = self.hash(key) if val not in self.buckets: self.buckets.append(val) def remove(self, key: int) -> None: ...
def min_number(num_list): min_num = None for num in num_list: if min_num is None or min_num > num: min_num = num return min_num
# Copyright © 2019 Province of British Columbia # # 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 agr...
def pytest_addoption(parser): group = parser.getgroup("pypyjit options") group.addoption("--pypy", action="store", default=None, dest="pypy_c", help="the location of the JIT enabled pypy-c")
# @Time : 2019/6/1 23:01 # @Author : shakespere # @FileName: Sort Colors.py ''' 75. Sort Colors Medium 1623 156 Favorite Share Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and bl...
expected_output = { "interfaces": { "Port-channel20": { "description": "distacc Te1/1/1, Te2/1/1", "switchport_trunk_vlans": "9,51", "switchport_mode": "trunk", "ip_arp_inspection_trust": True, "ip_dhcp_snooping_trust": True, }, "Gi...
# -*- coding: utf-8 -*- """ Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the variable x and its coefficient. If there is no solution for the equation, return "No solution". If there are infinite solutions for the equation, return "I...
#SKill : array iteration #A UTF-8 character encoding is a variable width character encoding # that can vary from 1 to 4 bytes depending on the character. The structure of the encoding is as follows: #1 byte: 0xxxxxxx #2 bytes: 110xxxxx 10xxxxxx #3 bytes: 1110xxxx 10xxxxxx 10xxxxxx #4 bytes: 11110xxx 10xxxxxx 10xxxxxx ...
# Дано натуральное число. Выведите его последнюю цифру. num = int(input()) print(num % 10)
ES_HOST = 'localhost' ES_PORT = 9200 BULK_MAX_OPS_CNT = 1000 INDEX_NAME = 'cosc488' INDEX_SETTINGS_FP = 'properties/index_settings.json' DATA_DIR = 'data/docs' QUERIES_FP = 'data/queryfile.txt' QRELS_FP = 'data/qrel.txt' TRECEVAL_FP = 'bin/trec_eval'
prev = None def check_bst(root): if not root: return True ans = check_bst(root.left) if ans == False: return False if prev and root.value < prev: return False global prev prev = root return check_bst(root.right)
#!/usr/bin/python3.5 class MyClass: "This is a class" a = 10; def func(self): print('Hello World'); return 3; def my_function(a: MyClass): return a.func(); def other_function(b: my_function): a = MyClass(); return my_function(a); def object_function(obj: object): return 3;
### PROBLEM 1 def main(): print("Name: Shaymae Senhaji") print("Favorite Food: Brie Cheese") print("Favorite Color: Red") print("Favorite Hobby: Traveling") if __name__ == "__main__": main() #Name: Shaymae Senhaji #Favorite Food: Brie Cheese #Favorite Color: Red #Favorite Hobby: Traveling
''' Este snipet tiene como propósito dejar por escrito el uso del patrón de diseño de Visitors ''' class House(object): #The class being visited def accept(self, visitor): """Interface to accept a visitor""" visitor.visit(self) #Triggers the visiting operation! def work_on_hvac(self, hvac_specialist): pr...
corr_data = df_train[['Id', 'MSSubClass', 'LotFrontage', 'LotArea', 'OverallQual', 'OverallCond', 'YearBuilt', 'YearRemodAdd', 'MasVnrArea', 'BsmtFinSF1', 'BsmtFinSF2', 'BsmtUnfSF', 'TotalBsmtSF', '1stFlrSF', '2ndFlrSF', 'LowQualFinSF', 'GrLivArea', 'Bsm...
def getProgress(current, length): """This function formats a progress bar string for print out during a for loop execution. Currently, this uses 2% increments. Adjusting the inc variable to N will change increments to 1/N.""" inc = 50 n_bars = int(round(current*inc/length,1)) rem = ...
## Does my number look big in this? ## 6 kyu ## https://www.codewars.com/kata/5287e858c6b5a9678200083c def narcissistic(value): total = 0 for digit in str(value): total += int(digit) ** len(str(value)) return value == total
# This is the ball class that handles everything related to Balls class Ball: # The __init__ method is used to initialize class variables def __init__(self, position, velocity, acceleration): # Each ball has a position, velocity and acceleration self.position = position self.velocity = v...
# # @lc app=leetcode id=75 lang=python3 # # [75] Sort Colors # class Solution: def sortColors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ a, i, b = 0, 0, len(nums) - 1 while i <= b: n_i = nums[i] if n_i...
"""All files in this module are automatically generated by hassfest. To update, run python3 -m script.hassfest """
def hashfunction(key): sum=0 for i in key: sum+=ord(i) return sum%100 hashtable=[] def insertkey(key,value): hashkey=hashfunction(key) return hashtable[hashkey].append(value)
t = int(input()) while(t!=0): count=0 n=int(input()) if n==1: print('no') else: for i in range(2,n//2): if(n%i == 0): count+=1 if(count>=1): print('no') else: print('yes') t-=1
class Solution: def romanToInt(self, s): """ :type s: str :rtype: int """ roman_int = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000} s = [roman_int[x] for x in s] ans = 0 for n in range(len(s)-1): if s[n] >= s[n+1]: ...
#lrsclasses.py Langrenx=[]#狼人列表 Nvwux=[]#女巫列表 Yuyanjiax=[]#预言家列表 Shouweix=[]#守卫列表 Pingminx=[]#平民列表 Protected='' Alive=True Dead=False Players={} NvwuChance=1 class GetError: Error='None' IDto=0 class Langren: '狼人' global Langrenx number=0 def delete(name): if name in Langrenx: ...
class OrderDamageConfirmation: def __init__(self, content): self.system_seat_ids = content['systemSeatIds'] self.msg_id = content['msgId'] self.game_state_id = content['gameStateId'] self.result = content['orderDamageConfirmation']['result'] self.order_damage_type = content['...
"""Python implementation of a Graph Data structure.""" class Graph(object): """ Graph implementation. Graph data structure supports following methods: nodes(): return a list of all nodes in the graph. edges(): return a list of all edges in the graph. add_node(n): adds a new node 'n' to the g...
def test(): # if an assertion fails, the message will be displayed # --> must have the output in a comment assert "Mean: 5.0" in __solution__, "Did you record the correct program output as a comment?" # --> must have the correct arithmetic mean assert mean == 5.0, "Are you calculating the arithmetic...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def buildTree(self, inorder, postorder): """ :type inorder: List[int] :type postorder: List[int] :rtype: ...
MASTER_NAME = 'localhost:9090' MASTER_AUTH = ('admin', 'password') TEST_MONITOR_SVC_URLS = dict( base='http://{0}/nitestmonitor', base_sans_protocol='{0}://{1}/nitestmonitor', can_write='/v2/can-write', query_results='/v1/query-results', query_results_skip_take='/v1/query-results?skip={0}...
requested_toppings = ['mushrooms', 'extra cheese'] if 'mushrooms' in requested_toppings: print("Adding mushrooms") if 'pepperoni' in requested_toppings: print("Adding pepperoni.") if 'extra cheese' in requested_toppings: print("Adding extra cheese.") print("\nFinished making your pizza!") """TRY IT YOURS...