content
stringlengths
7
1.05M
def test(): # Here we can either check objects created in the solution code, or the # string value of the solution, available as __solution__. A helper for # printing formatted messages is available as __msg__. See the testTemplate # in the meta.json for details. # If an assertion fails, the messag...
# Brokenlinks app settings # This is just an example of what these settings look like. # You should _not_ use them—instead, copy these, put them in # your local.py & edit the keys to match your spreadsheet. # The URL is like: # https://docs.google.com/forms/d/e/{{key}}/formResponse # while the "entry.####" can be foun...
n = int(input('Enter number of lines:')) for i in range(1, n +1): for j in range(1, n+1): if i == 1 or j == 1 or i == n or j == n: print("*", end = ' ') else: print(' ', end = ' ') print()
##------------------------------------------------------------------- """ Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 ...
# Get the abuse API key from the site abuseKey = '' # Get the hybrid API key from the site hybridKey = '' # Get the malshare API key from the site malshareKey = '' # Get the urlscan key from the site urlScanKey = '' # Get the valhalla key from the site valhallaKey = '' # Get the Virustotal API key from the site vt...
"""Top-level package for DJI Android SDK to Python.""" __author__ = """Carlos Tovar""" __email__ = 'cartovarc@gmail.com' __version__ = '0.1.0'
#import sys #file = sys.stdin file = open( r".\data\listcomprehensions.txt" ) data = file.read().strip().split() #x,y,z,n = input(), input(), input(), input() x,y,z = map(eval, map(''.join, (zip(data[:3], ['+1']*3)))) n = int(data[3]) print(x,y,z,n) coords = [[a,b,c] for a in range(x) for b in range(y) for c in range...
routes_in=(('/forca/(?P<a>.*)','/\g<a>'),) default_application = 'ForCA' # ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py routes_out=(('/(?P<a>.*)','/forca/\g<a>'),)
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ """ Init signature: SissoRegressor( n_nonzero_coefs=1, n_features_per_sis_iter=1, all_l0_combinations=True, ) Docstring: A simple implementation of the SISSO algorithm (R. Ouyang, S. Curtarolo, E. Ahmetcik e...
print ("Dit is het FIZZBUZZ spel!") end = input("""\nWe gaan even na of een getal deelbaar is door 3 OF 5 .\nOf door 3 EN 5.\n Geef een geheel getal in tussen 1 en 100: """) # try-except statement: # if the code inside try fails, the program automatically goes to the except part. try: end = int(end) # convert ...
"""Define package errors.""" class WeatherbitError(Exception): """Define a base error.""" pass class InvalidApiKey(WeatherbitError): """Define an error related to invalid or missing API Key.""" pass class RequestError(WeatherbitError): """Define an error related to invalid requests.""" ...
N = int(input()) X = 0 W = 0 Y = 0 Z = 0 for i in range(N): W = Z + 1 X = W + 1 Y = X + 1 Z = Y + 1 print('{} {} {} PUM'.format(W, X, Y))
#!/usr/bin/env python3 # Write a program that prints out the position, frame, and letter of the DNA # Try coding this with a single loop # Try coding this with nested loops dna = 'ATGGCCTTT' ''' for i in range(len(dna)): frame = 0 print(i, frame, dna[i]) if frame == 2: frame = 0 else: frame +=1 #initial att...
# pylint: disable=missing-function-docstring, missing-module-docstring/ # coding: utf-8 #$ header class Parallel(public, with, openmp) #$ header method __init__(Parallel, str, str, str [:], str [:], str [:], str [:], str, str [:], str) #$ header method __del__(Parallel) #$ header method __enter__(Parallel) #$ header m...
print ('\033[1;33m{:=^40}\033[m'.format(' PROGRESSÃO ARITMÉTICA 2.0 ')) first = int(input('\033[1mEnter the first term: ')) reason = int(input('Reason:\033[m ')) term = first cont = 1 total = 0 bigger = 10 while bigger != 0: total = total + bigger while cont <= total: print ('\033[1m{} ->\033[m' .form...
class MyMetaClass(type): def __new__(cls, name, bases, ns): ns['kw_created_by_metaclass'] = lambda self, arg: arg.upper() return type.__new__(cls, name, bases, ns) def method_in_metaclass(cls): pass class MetaClassLibrary(metaclass=MyMetaClass): def greet(self, name): re...
lower_camel_case = input() snake_case = "" for char in lower_camel_case: if char.isupper(): snake_case += "_" + char.lower() else: snake_case += char print(snake_case)
''' Blind Curated 75 - Problem 12 ============================= Rotate Image ------------ Rotate an n x n two-dimensional matrix in-place. [→ LeetCode][1] [1]: https://leetcode.com/problems/rotate-image/ ''' def solution(matrix): ''' Process the matrix in squares, where each square consists of four spaces on t...
class MIFARE1k(object): SECTORS = 16 BLOCKSIZE = 4 BLOCKWITH = 16 def __init__(self, uid, data): self.uid = uid self.data = data def __str__(self): """ Get a nice printout for debugging and dev. """ ret = "Card: " for i in range(4): ...
#wap to find the numbers which are divisible by 3 a=int(input('Enter starting range ')) b=int(input('Enter ending range ')) number=int(input('Enter the number whose multiples you want to find in the range ')) print('Numbers which are divisible') for i in range(a,b+1): if i%number==0: print(i,end=' ')
ENTRY_POINT = 'get_closest_vowel' #[PROMPT] def get_closest_vowel(word): """You are given a word. Your task is to find the closest vowel that stands between two consonants from the right side of the word (case sensitive). Vowels in the beginning and ending doesn't count. Return empty string if you di...
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: ''' 92.22% // 75.79% ''' def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: slow = fast = head {(fast := fast.next) for _...
q = int(input()) for _ in range(q): n, m = map(int, input().split()) d = n // m a = [0] * 10 for i in range(10): a[i] = (m + a[i - 1]) % 10 s = sum(a) print((d // 10) * s + sum(a[: (d % 10)]))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Pieter Huycke email: pieter.huycke@ugent.be GitHub: phuycke """ #%% area = 8080464.3 # area of 48 contiguous states in km^2 volume = 22810 # volume of water in Great lakes in km^3 height = (volume / area) # km^3 / km^2 = m print('...
a = int(input("Digite o valor correspondente ao lado de um quadrado: ")) perimetro = a + a + a + a area = a ** 2 print("perímetro:",perimetro,"- área:",area)
__author__ = 'shukkkur' ''' https://codeforces.com/problemset/problem/110/A ''' i = input() n = i.count('4') + i.count('7') s = str(n) s = s.replace('4', '') s = s.replace('7', '') if s == '': print('YES') else: print('NO')
""" A package of Python modules, used to configure and test IBIS-AMI models. .. moduleauthor:: David Banas <capn.freako@gmail.com> Original Author: David Banas <capn.freako@gmail.com> Original Date: 3 July 2012 Copyright (c) 2012 by David Banas; All rights reserved World wide. """
PYTHON_PLATFORM = "python" SUPPORTED_PLATFORMS = ((PYTHON_PLATFORM, "Python"),) LOG_LEVEL_DEBUG = "debug" LOG_LEVEL_INFO = "info" LOG_LEVEL_ERROR = "error" LOG_LEVEL_FATAL = "fatal" LOG_LEVEL_SAMPLE = "sample" LOG_LEVEL_WARNING = "warning" LOG_LEVELS = ( (LOG_LEVEL_DEBUG, "Debug"), (LOG_LEVEL_INFO, "Info"), ...
""" Addition I - Numbers & Strings """ # Add the below sets of variables together without causing any Type Errors. # A) a = 0 b = 2 print(a + b) # 2 # B) c = '0' d = '2' print(c + d) # '2' # C) e = '0' f = 2 print(int(e) + f) # 2
# Copyright 2017 The Bazel Authors. 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 la...
""" Illustrates how to embed `dogpile.cache <https://dogpilecache.readthedocs.io/>`_ functionality within the :class:`.Query` object, allowing full cache control as well as the ability to pull "lazy loaded" attributes from long term cache. In this demo, the following techniques are illustrated: * Using custom subclas...
""" Дан список чисел. Выведите все элементы списка, которые больше предыдущего элемента. Формат ввода Вводится список чисел. Все числа списка находятся на одной строке. Формат вывода Выведите ответ на задачу. """ input_list = [int(i) for i in input().split()] output_list = [] for i in range(len(input_list) - 1): ...
# Largest palindrome product DIGITS = 3 def solve(): return max(p for x in range(10**(DIGITS - 1), 10**DIGITS) for y in range(x, 10**DIGITS) if str(p := x * y) == str(p)[::-1]) if __name__ == "__main__": print(solve())
#Crie um programa que leia a idade e o sexo de várias pessoas. # A cada pessoa cadastrada, o programa deverá perguntar se o usuário quer ou não continuar. # No final, mostre: # A) quantas pessoas tem mais de 18 anos. # B) quantos homens foram cadastrados. # C) quantas mulheres tem menos de 20 anos. mi = 0 homem = 0 mul...
def format_list(my_list): """ :param my_list: :type: list :return: list separated with ', ' & before the last item add the word 'and ' :rtype: list """ new_list = ', '.join(my_list[0:len(my_list)-1:2]) + " and " + my_list[len(my_list)-1] return new_list def main(): print(format_lis...
# -*- coding: utf-8 -*- """ Created on Sat Jul 3 11:20:06 2021 @author: Easin """ in1 = input() list1 = [] for elem in range(len(in1)): if in1[elem] != "+": list1.append(in1[elem]) #print(list1) list1.sort() str1 = "" for elem in range(len(list1)): str1 += list1[elem]+ "+" print...
def find_longest_palindrome(string): if is_palindrome(string): return string left = find_longest_palindrome(string[:-1]) right = find_longest_palindrome(string[1:]) middle = find_longest_palindrome(string[1:-1]) if len(left) >= len(right) and len(left) >= len(middle): return left ...
class Solution: def mySqrt(self, x: int) -> int: if x < 0 or x>(2**31): return False ans = 0 for i in range(0, x+1): if i**2<=x: ans = i else: break return ans
# Copyright 2020 The Kythe Authors. 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...
class Participant: def __init__(self, pa_name, pa_has_somebody_to_gift=False): self._name = pa_name # I don't use this property in my algorithm :P self._has_somebody_to_gift = pa_has_somebody_to_gift @property def name(self): return self._name @name.setter def name...
def trint(inthing): try: outhing = int(inthing) except: outhing = None return outhing def trfloat(inthing, scale): try: outhing = float(inthing) * scale except: outhing = None return outhing class IMMA: def __init__(self): # Standard instance obj...
class Solution: def removeDuplicates(self, nums: List[int]) -> int: count = 1 i = 0 while i <len(nums)-1: if nums[i]!=nums[i+1]: count=1 else: count+=1 if count==2: i+=1 ...
# START LAB EXERCISE 02 print('Lab Exercise 02 \n') # SETUP sandwich_string = 'chicken, bread, lettuce, onion, olives' # END SETUP # PROBLEM 1 (4 Points) sandwich_replace = sandwich_string.replace('olives', 'tomato') # PROBLEM 2 (4 Points) # Don't have heavy_cream need to replace with milk sandwich_list = sandwic...
# There are 2N people a company is planning to interview. # The cost of flying the i-th person to city A is costs[i][0], and the cost of flying the i-th person to city B is costs[i][1]. # Return the minimum cost to fly every person to a city such that exactly N people arrive in each city. # Example 1: # Input: [[10,2...
conf_nova_compute_conf = """[DEFAULT] compute_driver = libvirt.LibvirtDriver glance_api_version = 2 [libvirt] virt_type = kvm inject_password = False inject_key = False inject_partition = -2 images_type = rbd images_rbd_pool = vms images_rbd_ceph_conf = /etc/ceph/ceph.conf rbd_user = cinder rbd_secret_uuid = {{ rbd_sec...
def function(args): def inner(): print("function函数传递进来的是:{}".format(args)) return args return inner def func(): print("我是func函数哦~") if __name__ == '__main__': # 先传字符串进去 function("哈哈哈")() # function函数传递进来的是:哈哈哈 # 传个被执行了的函数进去 function(func())() # function函数传递进来的是:None ...
compilers_ = { "python": "cpython-head", "c++": "gcc-head", "cpp": "gcc-head", "c": "gcc-head", "c#": "mono-head", "javascript": "nodejs-head", "js": "nodejs-head", "coffeescript": "coffeescript-head", "cs": "coffeescript-head", "java": "openjdk-head", "haskell": "ghc-8.4.2",...
"""Contains some helper functions to display time as a nicely formatted string""" intervals = ( ('weeks', 604800), # 60 * 60 * 24 * 7 ('days', 86400), # 60 * 60 * 24 ('hours', 3600), # 60 * 60 ('minutes', 60), ('seconds', 1), ) def display_time(seconds, granularity=2): """Display ti...
class News(object): news_id: int title: str image: str def __init__(self, news_id: int, title: str, image: str): self.news_id = news_id self.title = title self.image = image class NewsContent(object): news_id: int title: str content: str def __init__(self, new...
class Error(Exception): """ Base class for exceptions in this module """ pass class InstrumentError(Error): """ Exception raised when trying to access a pyvisa instrument that is not connected Attributes ---------- _resourceAddress: str The address of the resource _r...
""" Programme additionnant une liste de nombres """ def addition(nombres): somme = 0 for nombre in nombres: somme += nombre return somme # Exemple print(addition([1, 2, 3])) # >>> 6
numbers = input() list_of_nums = numbers.split(',') tuple_of_nums = tuple(list_of_nums) print(list_of_nums) print(tuple_of_nums)
# Generated by h2py z /usr/include/sys/cdio.h CDROM_LBA = 0x01 CDROM_MSF = 0x02 CDROM_DATA_TRACK = 0x04 CDROM_LEADOUT = 0xAA CDROM_AUDIO_INVALID = 0x00 CDROM_AUDIO_PLAY = 0x11 CDROM_AUDIO_PAUSED = 0x12 CDROM_AUDIO_COMPLETED = 0x13 CDROM_AUDIO_ERROR = 0x14 CDROM_AUDIO_NO_STATUS = 0x15 CDROM_DA_NO_SUBCODE = 0x00 CDROM_DA...
age = int ( input("Please enter your age!") ) x = 19 y = 10 z = 1 if age > x: print("You are an adult!") elif age <= x and age > y: print("You are an adolescent!") elif age <= y and age >= z: print("You are a child!") else: print("You are an infant!") #According to guidance you have do...
""" A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given: 1/2 = 0.5 1/3 = 0.(3) 1/4 = 0.25 1/5 = 0.2 1/6 = 0.1(6) 1/7 = 0.(142857) 1/8 = 0.125 1/9 = 0.(1) 1/10 = 0.1 Where 0.1(6) means 0...
""" General-purpose helpers not related to the framework itself (neither to the reactor nor to the engines nor to the structs), which are used to prepare and control the runtime environment. These are things that should better be in the standard library or in the dependencies. Utilities do not depend on anything in t...
def can_build(platform): return platform != "android" def configure(env): pass
# Divide and Conquer algorithm def find_max(nums, left, right): """ find max value in list :param nums: contains elements :param left: index of first element :param right: index of last element :return: max in nums >>> nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] >>> find_max(nums, 0, len...
""" Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list. The first node is considered odd, and the second node is even, and so on. Note that the relative order inside both the even and odd groups should remain as ...
# Copyright 2014 The Bazel Authors. 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 la...
#!/bin/env python3 def gift_area(l, w, h): side_a = l*w side_b = w*h side_c = l*h return 2*side_a+2*side_b+2*side_c+min((side_a, side_b, side_c)) def gift_ribbon(l, w, h): side_a = 2*l+2*w side_b = 2*w+2*h side_c = 2*l+2*h ribbon = min((side_a, side_b, side_c)) ribbon += l*w*h r...
class C: pass def method(x): pass c = C() method(1)
tb = [54, 0,55,54,61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0,64,66,61, 0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 54, 0,55,54,61, 0,66, 0,64] expander = lambda i: [i, 300] if i > 0 else [0,0] tkm = [expander(i) for i in tb] print(tkm)
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
class MenuItem(Menu, IComponent, IDisposable): """ Represents an individual item that is displayed within a System.Windows.Forms.MainMenu or System.Windows.Forms.ContextMenu. Although System.Windows.Forms.ToolStripMenuItem replaces and adds functionality to the System.Windows.Forms.MenuItem control of previous v...
class Reflector: alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def __init__(self, permutation): """ :param permutation: string, mono-alphabetic permutation of the alphabet i.e. YRUHQSLDPXNGOKMIEBFZCWVJAT """ self.permutation = permutation def calc(self, c): """ S...
if __name__ == '__main__': with open("../R/problem_module.R") as filename: lines = filename.readlines() for line in lines: if "<- function(" in line: function_name = line.split("<-")[0] print(f"### {function_name.strip()}\n") print("#### Ma...
def maximo(numero1, numero2): """Devolve o maior número""" if numero1 >= numero2: return numero1 else: return numero2
for t in range(int(input())): word=input() ispalin=True for i in range(int(len(word)/2)): if word[i]=="*" or word[len(word)-1-i]=="*": break elif word[i]!=word[len(word)-1-i]: ispalin=False print(f"#{t+1} Not exist") break else: ...
''' Program implemented to count number of 1's in its binary number ''' def countSetBits(n): if n == 0: return 0 else: return (n&1) + countSetBits(n>>1) n = int(input()) print(countSetBits(n))
#in=42 #golden=8 n = input_int() c = 0 while (n > 1): c = c + 1 if n % 2 == 0: n = n // 2 else: n = 3 * n + 1 print(c)
#!/usr/bin/env python # -*- coding: utf-8 -*- """Supported media formats. https://kodi.wiki/view/Features_and_supported_formats Media containers: AVI, MPEG, WMV, ASF, FLV, MKV/MKA (Matroska), QuickTime, MP4, M4A, AAC, NUT, Ogg, OGM, RealMedia RAM/RM/RV/RA/RMVB, 3gp, VIVO, PVA, NUV, NSV, NSA, FLI, FLC, DVR-MS, WTV, TRP...
""" ALWAYS START WITH DOCUMENTATION! This code provides functions for calculating area of different shapes Author: Caitlin C. Bannan U.C. Irvine Mobley Group """ def area_square(length): """ Calculates the area of a square. Parameters ---------- length (float or int) length of one side of a sq...
def outer(): a = 0 b = 1 def inner(): print(a) b=4 print(b) # b += 1 # A #b = 4 # B inner() outer() for i in range(10): print(i) print(i)
#!/usr/bin/python #coding=utf-8 ''' @author: sheng @license: ''' SPELL=u'zhìyīn' CN=u'至阴' NAME=u'zhiyin41' CHANNEL='bladder' CHANNEL_FULLNAME='BladderChannelofFoot-Taiyang' SEQ='BL67' if __name__ == '__main__': pass
class MyClass: count = 0 def __init__(self, val): self.val = self.filterint(val) MyClass.count += 1 @staticmethod def filterint(value): if not isinstance(value, int): print("Entered value is not an INT, value set to 0") return 0 else: ...
syntaxPostgreErrors = [] def validateVarchar(n, val): if 0 <= len(val) and len(val) <= n: return None syntaxPostgreErrors.append("Error: 22026: Excede el limite de caracteres") return {"Type": "varchar", "Descripción": "Excede el limite de caracteres"} def validateChar(n, val): if len(val) =...
# # PySNMP MIB module RETIX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RETIX-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:47:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23...
class StudentAssignmentService: def __init__(self, student, AssignmentClass): self.assignment = AssignmentClass() self.assignment.student = student self.attempts = 0 self.correct_attempts = 0 def check(self, code): self.attempts += 1 result = self.assignment.chec...
# -*-coding:utf-8 -*- #Reference:********************************************** # @Time    : 2019-12-30 19:42 # @Author  : Fabrice LI # @File    : 20191230_98_sort_list.py # @User    : liyihao # @Software : PyCharm # @Description: Sort a linked list in O(n log n) time using constant space complexity. #Reference:***...
# get the dimension of the query location i.e. latitude and logitude # raise an exception of the given query Id not found in the input file def getDimensionsofQueryLoc(inputFile, queryLocId): with open(inputFile) as infile: header = infile.readline().strip() headerIndex={ headerName.lower...
n = int(input()) s = input().lower() output = 'YES' for letter in 'abcdefghijklmnopqrstuvwxyz': if letter not in s: output = 'NO' break print(output)
# -*- coding: utf-8 -*- { '%(GRN)s Number': 'رقم مستند الادخال %(GRN)s', '%(GRN)s Status': 'حالة %(GRN)s', '%(PO)s Number': 'رقم طلبية الشراء %(PO)s', '%(REQ)s Number': 'رقم الطلبيات %(REQ)s', '(filtered from _MAX_ total entries)': 'فلترة من _MAX_ الإدخالات', '* Required Fields': 'الحقول المطلوبة *', '1 Assessm...
num1, num2 = 5,0 try: quotient = num1/num2 message = "Quotient is" + ' ' + str(quotient) where (quotient = num1/num2) except ZeroDivisionError: message = "Cannot divide by zero" print(message)
''' Created on 30-Oct-2017 @author: Gokulraj ''' def mergesort(a,left,right): if len(right)-len(left)<=1: return(left) elif right-left>1: mid=(right+left)//2; l=a[left:mid] r=a[mid+1:right] mergesort(a,l,r) mergesort(a,l,r) merge(a,l,r) d...
# -*- coding: utf-8 -*- """ Created on Tue Mar 22 13:00:49 2022 @author: Pedro """ def manual(name1: str, name2: str, puntosp1: int, puntosp2: int, puntajes: tuple): """Funcion que ejecuta el modo manual del TeniSim Argumentos: name1 -- nombre del jugador 1 ...
class UnknownTagFormat(Exception): """ occurs when a tag's contents violate expected format """ pass class MalformedLine(Exception): """ occurs when an nbib line doesn't conform to the standard {Tag|spaces}-value format """ pass
""" keys for data from config.yml """ LIQUID = "Liquid" INVEST = "Investment" COLOR_NAME = "color_name" COLOR_INDEX = "color_index" ACCOUNTS = "accounts"
#coding=utf-8 #剔除任命中空白P24 2017.4.8 name=" jercas " print(name) print("\t"+name) print("\n\n"+name) print(name.lstrip()) print(name.rstrip()) print(name.strip())
class Enum: def __init__(self, name, value): self.name = name self.value = value def __init_subclass__(cls): cls._enum_names_ = {} cls._enum_values_ = {} for key, value in cls.__dict__.items(): if not key.startswith('_') and isinstance(value, cls._enum_type_...
class Res: logo = '../resources/images/logo.png' SH_buckler = '../resources/images/plans/SH_buckler.png' PA_diadem = '../resources/images/plans/PA_diadem.png' MW_dagger = '../resources/images/plans/MW_dagger.png' RW_autolaunch = '../resources/images/plans/RW_autolaunch.png' AR_hand = '../resourc...
# config.sample.py # Rename this file to config.py before running this application and change the database values below # LED GPIO Pin numbers - these are the default values, feel free to change them as needed LED_PINS = { 'green': 12, 'yellow': 25, 'red': 18 } EMAIL_CONFIG = { 'username':...
def selection_sort(A: list): for i in range(len(A) - 1): smallest_index = i for j in range(i + 1, len(A)): if A[i] > A[j]: smallest_index = j A[i], A[smallest_index] = A[smallest_index], A[i] A = [4, 2, 1, 5, 62, 5] B = [3, 3, 2, 4, 6, 65, 8, 5] C = [5, 4, 3, 2,...
# coding=utf-8 def bubble_sort(num_list): """ バブルソートの関数 :param num_list: ソートする数列 :return: ソートされた結果 """ # 数列の個数分ループ # バブルソートでは、左の数値(ここではi)から順番に並べ替えが完了する for i in range(len(num_list)): # range(始まりの数値, 終わりの数値, 増加する量) for j in range(len(num_list) - 1, i, -1): if...
inventory = [ {"name": "apples", "quantity": 2}, {"name": "bananas", "quantity": 0}, {"name": "cherries", "quantity": 5}, {"name": "oranges", "quantity": 10}, {"name": "berries", "quantity": 7}, ] def checkIfFruitPresent(foodlist: list, target: str): # Check if the name is present ins the list ...
""" A Trie is a special data structure used to store strings that can be visualized like a graph. It consists of nodes and edges. Each node consists of at max 26 children and edges connect each parent node to its children. These 26 pointers are nothing but pointers for each of the 26 letters of the English alphabet A...
def lds(seq, studseq, n): seq = list(map(int, seq)) studseq = list(map(int, studseq)) wrong=0 for i in range(1, n): if studseq[i - 1] < studseq[i]: min=studseq[i-1] max=studseq[i] wrong=1 # print("Non hai inserito una sequenza decrescente") ...
# The goal is divide a bill print("Let's go divide the bill in Brazil. Insert the values and insert '0' for finish") sum = 0 valor = 1 while valor != 0: valor = float(input('Enter the value here in R$: ')) sum = sum + valor p = float(input('Enter the number of payers: ')) print(input('The total was R$ {}. Getti...
#SearchEmployeeScreen BACK_BUTTON_TEXT = u"Back" CODE_TEXT = u"Code" DEPARTMENT_TEXT = u"Department" DOB_TEXT = u"DOB" DROPDOWN_DEPARTMENT_TEXT = u"Department" DROPDOWN_DOB_TEXT = u"DOB" DROPDOWN_EMPCODE_TEXT = u"Employee Code" DROPDOWN_NAME_TEXT = u"Name" DROPDOWN_SALARY_TEXT = u"Salary" GENDER_TEXT = u"Gender" HELP...
print ("Pythagorean Triplets with smaller side upto 10 -->") # form : (m^2 - n^2, 2*m*n, m^2 + n^2) # generate all (m, n) pairs such that m^2 - n^2 <= 10 # if we take (m > n), for m >= 6, m^2 - n^2 will always be greater than 10 # so m ranges from 1 to 5 and n ranges from 1 to m-1 pythTriplets = [(m*m - n*n, 2*m*n, m*m...