content
stringlengths
7
1.05M
class event_meta(object): def __init__(self): super(event_meta, self).__init__() def n_views(self): return max(self._n_views, 1) def refresh(self, meta_vec): self._n_views = len(meta_vec) self._x_min = [] self._y_min = [] self._x_max = [] self._...
def sum(a, b): return a + b a = int(input("Enter a number: ")) b = int(input("Enter another number: ")) c = sum(a, b) print("The sum of the two numbers is: ", c)
#testing_loops.py """n = 1 # while the value of n is less than 5, print n. add 1 to n each time # use while loops for infinate loops or for a set number of executions/loops while n<5: print(n) n = n + 1""" """ num = float(input("Enter a postive number:")) while num <= 0: print("That's not a positive numbe...
module_attribute = "hello!" def extension(app): """This extension will work""" return "extension loaded" def assertive_extension(app): """This extension won't work""" assert False
class Funcionario: def __init__(self, nome, cpf, salario): self.__nome = nome self.__cpf = cpf self.__salario = salario def get_nome(self): return self.__nome def get_cpf(self): return self.__cpf def get_salario(self): return self.__salario def set...
class Solution: def sortedSquares(self, nums: List[int]) -> List[int]: positives_and_zero = collections.deque() negatives = collections.deque() for x in nums: if x < 0: negatives.appendleft(x * x) else: positives_and_zero.append(x * x)...
class Solution: # @param A : list of integers # @param B : list of integers # @return an integer def computeGCD(self, x, y): if x > y: small = y else: small = x gcd = 1 for i in range(1, small + 1): if ((x % i == 0) and (y % i == 0)): ...
TVOC =2300 if TVOC <=2500 and TVOC >=2000: print("Level-5", "Unhealty") print("Hygienic Rating - Situation not acceptable") print("Recommendation - Use only if unavoidable/Intense ventilation necessary") print("Exposure Limit - Hours")
for i in range(10): print(i) i = 1 while i < 6: print(i) i += 1
'''Spiral Matrix''' # spiral :: Int -> [[Int]] def spiral(n): '''The rows of a spiral matrix of order N. ''' def go(rows, cols, x): return [list(range(x, x + cols))] + [ list(reversed(x)) for x in zip(*go(cols, rows - 1, x + cols)) ] if 0 < rows else [[]] return...
################################################## # 原始数据 # ################################################## # train.csv # 行数:8798815 (包括标题行) # 列数:3 trainCols = ['aid', 'uid', 'label'] # test1.csv # 行数:2265990 (包括标题行) # 列数:2 test1Cols = ['aid', 'uid'] # adFeatur...
""" This module contains some constants that can be reused ==================================== Copyright SSS_Says_Snek, 2021-present ==================================== """ __version__ = "2.0" __license__ = "MIT" __name__ = "hisock" __copyright__ = "SSS-Says-Snek, 2021-present" __author__ = "SSS-Says-Snek"
class Flight: def __init__(self, origin, destination, month, fare, currency, fare_type, date): self.origin = origin self.destination = destination self.month = month self.fare = fare self.currency = currency self.fare_type = fare_type self.date = date def...
""" --- Day 3: Spiral Memory --- You come across an experimental new kind of memory stored on an infinite two-dimensional grid. Each square on the grid is allocated in a spiral pattern starting at a location marked 1 and then counting up while spiraling outward. For example, the first few squares are allocated like t...
# Users to create/delete users = [ {'name': 'user1', 'password': 'passwd1', 'email': 'mail@example.com', 'tenant': 'tenant1', 'enabled': True}, {'name': 'user3', 'password': 'paafdssswd1', 'email': 'mdsail@example.com', 'tenant': 'tenant1', 'enabled': False} ] # Roles to create/delete roles = [ {...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 15 16:13:20 2018 @author: efrem """ class Coordinate(object): def __init__(self,x,y): self.x = x self.y = y def getX(self): # Getter method for a Coordinate object's x coordinate. # Getter methods are better...
# -*- coding: utf-8 -*- __title__ = 'ci_release_publisher' __description__ = 'A script for publishing Travis-CI build artifacts on GitHub Releases' __version__ = '0.2.0' __url__ = 'https://github.com/nurupo/ci-release-publisher' __author__ = 'Maxim Biro' __author_email__ = 'nurupo.contributions@gmail.com' __license__ ...
n=1260 count=0 list=[500,100,50,10] for coin in list: count += n//coin n %= coin print(count)
#Faça um Programa que leia 5 números e informe o maior. maior = 0 i = 0 while i < 5: n = float(input("Digite um número: ")) if(n > maior): maior = n i = i + 1 print("O maior número é {}".format(maior))
bms_thresholds = {'temperature': {'min': 0, 'max': 45}, 'soc': {'min': 20, 'max': 80}, 'charging_rate': {'min': 0, 'max': 0.8}} bms_system_languages = {'en': 'BMS System configured with English', 'de':'BMS-System auf Englisch konfiguriert'} bms_system_temperature_unit =...
# MEDIUM # inorder traversal using iterative # Time O(N) Space O(H) class Solution: def kthSmallest(self, root: TreeNode, k: int) -> int: return self.iterative(root,k) self.index= 1 self.result = -1 self.inOrder(root,k) return self.result def iterative(self,root,k...
def solution(N): A, B = 0, 0 mult = 1 while N > 0: q, r = divmod(N, 10) if r == 5: A, B = A + mult * 2, B + mult * 3 elif r == 0: A, B = A + mult, B + mult * 9 q -= 1 else: A, B = A + mult, B + mult * (r - 1) mult *= 10 ...
def sum_digits(n): s=0 while n: s += n % 10 n /= 10 return s def factorial(n): if n == 0: return 1 else: return n*factorial(n-1) def sum_factorial_digits(n): return sum_digits(factorial(n)) def main(): print(sum_factorial_digits(10)) print(sum_factorial_digits(100)) print(sum_factorial_digits(500...
username = input("Please enter your name: ") lastLength = 0 while True: f = open('msgbuffer.txt', 'r+') messages = f.readlines() mailboxSize = len(messages) if mailboxSize > 0 and mailboxSize > lastLength: print( messages[-1] ) lastLength = mailboxSize message = ...
def escape_reserved_characters(query): """ :param query: :return: escaped query Note: < and > can’t be escaped at all. The only way to prevent them from attempting to create a range query is to remove them from the query string entirely. """ reserved_characters = ['+', '-', '=', '&&'...
#! /usr/bin/env python # _*_ coding:utf-8 _*_ class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def isSameTree(self, p, q): if not p and not q: return True elif not p or not q: ...
class disjoint_set: def __init__(self,vertex): self.parent = self self.rank = 0 self.vertex = vertex def find(self): if self.parent != self: self.parent = self.parent.find() return self.parent def joinSets(self,otherTree): root = self.find() otherTreeRoot = otherTree.find() if root == otherTreeRoo...
def get_test_data(): return { "contact": { "name": "Paul Kempa", "company": "Baltimore Steel Factory" }, "invoice": { "items": [ { "quantity": 12, "description": "Item description No.0", "unitprice": 12000.3, "linetotal": 20 }, ...
class Node: def __init__(self, data, next=None): self.data = data self.next = next class LinkedList: def __init__(self, *args, **kwargs): self.head = Node(None) def appende(self, data): node = Node(data) node.next = self.head self.head = node # Print l...
# # PySNMP MIB module Wellfleet-NPK-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-NPK-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:34:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
def retrieveDB_data(db, option, title): data_ref = db.collection(option).document(title) docs = data_ref.get() return docs.to_dict() async def initDB(db, objectList, objectDb, firestore): if objectList is None: data = {"create": "create"} objectDb.set(data) objectDb.update({"cr...
class Board: def __init__(self, data): self.rows = data self.marked = [[0 for _ in range(0, 5)] for _ in range(0, 5)] def __str__(self): """String representation""" res = "BOARD:" for r in self.rows: res = res + "\n" + str(r) res = res + "\nMARKED:" ...
BLACK = -999 DEFAULT = 0 NORMAL = 1 PRIVATE = 10 ADMIN = 21 OWNER = 22 WHITE = 51 SUPERUSER = 999 SU = SUPERUSER
################################################# Cars = [["Lamborghini", 1000000, 2, 40000], ["Ferrari", 1500000, 2.5, 50000], ["BMW", 800000, 1.5, 20000]] ################################################# print("#"*80) print("#" + "Welcome to XYZ Car Dealership".center(78) + "#") print("#"*80 + "\n") while True: ...
n1 = 0 n2 = 0 choice = 4 high_number = n1 while choice != 5: while choice == 4: print('=' * 50) n1 = int(input('Choose a number: ')) n2 = int(input('Choose another number: ')) if n1 > n2: high_number = n1 else: high_number = n2 print('=' * 45) ...
white = { "Flour": "100", "Water": "65", "Oil": "4", "Salt": "2", "Yeast": "1.5" }
class Row: def __init__(self, title=None, columns=None, properties=None): self.title = title self.columns = columns or [] self.properties = properties or [] def __str__(self): return str(self.title) def __len__(self): return len(self.title or '') def __iter__(s...
"""6.1.5 Multiple Definition of Product Group ID For each Product Group ID (type /$defs/product_group_id_t) Product Group elements (/product_tree/product_groups[]) it must be tested that the group_id was not already defined within the same document. The relevant path for this test is: /product_tree/product_group...
#!/usr/bin/env python3 def readFile(filename): #READFILE reads a file and returns its entire contents # file_contents = READFILE(filename) reads a file and returns its entire # contents in file_contents # # Load File with open(filename) as fid: file_contents = fid.read() ...
#Entradas in json array_input = [ { '15' : 50.00 , '3' : 10.00, '5.30' : 15.50 }, { '10' : 35.00 , '7' : 14.00, '5.30' : 75.30 } ] #Código de cada peça 1 key = array_input[0] n_keys = [ n for n in key ] print("Có...
# values_only # Function which accepts a dictionary of key value pairs and returns a new flat list of only the values. # # Uses the .items() function with a for loop on the dictionary to track both the key and value of the iteration and # returns a new list by appending the values to it. Best used on 1 level-deep key:v...
# Example 1: Showing the Root Mean Squared Error (RMSE) metric. Penalises large residuals # Create the DMatrix: housing_dmatrix housing_dmatrix = xgb.DMatrix(data=X, label=y) # Create the parameter dictionary: params params = {"objective":"reg:linear", "max_depth":4} # Perform cross-validation: cv_results cv_results ...
buildcode=""" function Get-ExternalIP(){ $extern_ip_mask = @() while ($response.IPAddress -eq $null){ $response = Resolve-DnsName -Name myip.opendns.com -Server resolver1.opendns.com Start-Sleep -s 1 } $octet1, $octet2, $octet3, $octet4 = $response.IPAddress.Split(".") $extern_ip_mask += $response.IPAddress ...
# Python avançado função map def dobro(x): return x*2 valor = [1, 2, 3, 4, 5] valor_dobrado = map(dobro, valor) """ for v in valor_dobrado: print(v) """ # Convertendo em lista: valor_dobrado = list(valor_dobrado) print(valor_dobrado)
""" Constants definition """ ########################################## ## Configurable constants # AREA_WIDTH = 40.0 # width (in meters) of the drawing area CANVAS_WIDTH = 900 # width (in pixels) of the drawing area CANVAS_HEIGHT = 700 # height (in pixels) of the drawing area SCROLLABLE_CANVAS_WIDTH = 4 ...
# Author: Isabella Doyle # this is the menu def displayMenu(): print("What would you like to do?") print("\t(a) Add new student") print("\t(v) View students") print("\t(q) Quit") # strips any whitespace from the left/right of the string option = input("Please select an option (a/v/q): ").strip...
def fatorial(num, show=False): """ -> Calcula o fatorial de um número. :param num: O número a ser calculado. :param show: (opcional) Mostra ou não a conta. :return: O valor do fatorial de um número num. """ print('-' * 30) f = 1 for c in range(num, 0, -1): f *= c if ...
def my_sum(n): return sum(list(map(int, n))) def resolve(): n, a, b = list(map(int, input().split())) counter = 0 for i in range(n + 1): if a <= my_sum(str(i)) <= b: counter += i print(counter)
""" Billing tests docstring """ # from django.test import TestCase # Create your tests here.
class AllJobsTerminated(Exception): """This class is a special exception that is raised if a job assigned to a thread should be properly terminated """ def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) def signal_cleanup_handler(signum, frame): """...
""" Mergesort in Python https://en.wikipedia.org/wiki/Merge_sort """ def merge(left, right): """ Take two sorted lists and merge them into sorted list """ left_len = len(left) right_len = len(right) min_len = min(left_len, right_len) merged_lis = [] i, j = 0, 0 while i < min_len an...
def main(): n=int(input()) a=list(map(int, input().split())) mp=(None,None) d=0 for i in range(0, n-1, 2): if a[i+1] - a[i] > d: mp=(i,i+1) a[mp[0]], a[mp[1]] = a[mp[1]], a[mp[0]] print(sum(a[::2])) if __name__ == '__main__': t=int(input()) for _ in range...
#!/usr/bin/env python # -*- coding: UTF-8 -*- __all__ = ["CoordinateFrame"] class CoordinateFrame(object): """ CoordinateFrame: Base coordinate frame class. Parameters ---------- frameName : str Name of the coordinate system. coordinateRanges : dict Dictionary with coordinate ...
x = int(input('Enter an integer:')) y = int(input('Enter an integer:')) if x ^ y!=0: print(x,' and ', y, ' are different') else: print(x,' and ', y, ' are same')
#!/usr/bin/env python ####################################### # Installation module for AttackSurfaceMapper ####################################### DESCRIPTION="This module will install/update Attack Surface Mapper (ASM) by Andreas Georgiou - A tool that aim to automate the recon process" AUTHOR="Andrew Schwartz" IN...
def k_to_c(k): c = (k - 273.15) return c k = 268.0 c = k_to_c(k) print("kelvin of" + str(k) + "is" + str(c) + "in kelvin" )
# Autogenerated file for Reflected light # Add missing from ... import const _JD_SERVICE_CLASS_REFLECTED_LIGHT = const(0x126c4cb2) _JD_REFLECTED_LIGHT_VARIANT_INFRARED_DIGITAL = const(0x1) _JD_REFLECTED_LIGHT_VARIANT_INFRARED_ANALOG = const(0x2) _JD_REFLECTED_LIGHT_REG_BRIGHTNESS = const(JD_REG_READING) _JD_REFLECTED_L...
# https://leetcode.com/problems/unique-morse-code-words/ mapping = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."] class Solution: def uniqueMorseRepresentations(self, words): """ :t...
#!/bin/python3 # Designer Door Mat # https://www.hackerrank.com/challenges/designer-door-mat/problem n, m = map(int, input().split()) init = ".|." for i in range(n // 2): print(init.center(m, "-")) init = ".|." + init + ".|." print("WELCOME".center(m, "-")) for i in range(n // 2): linit = list(init) ...
# albus.exceptions class AlbusError(Exception): def __init__(self, message, inner=None, detail=None): self.message = message self.inner = inner self.detail = detail
# Created by MechAviv # Nyen Damage Skin | (2438086) if sm.addDamageSkin(2438086): sm.chat("'Nyen Damage Skin' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
# -*- coding: utf-8 -*- # # Copyright 2016 Civic Knowledge. All Rights Reserved # This software may be modified and distributed under the terms of the BSD license. # See the LICENSE file for details. def get_root(): return ['do some magic?','or don\'t'] def get_measure_root(id): return "got id {} ({}) ...
# # PySNMP MIB module CHANNEL-CHANGE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CHANNEL-CHANGE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:31:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
x1 = 2 y1 = 2 x2 = 6 y2 = 10 m2 = (y2 - y1) / (x2 - x1) print(f'Slope = {m2:.2f}') # 9
def read_delimited_lines(file_handle, delimiter='|', omit_delimiter=False, read_size=4): delimited_line = "" data = file_handle.read(read_size) while data: delimiter_index = data.find(delimiter) if delimiter_index < 0: delimited_line += data ...
""" Input: [7,1,5,3,6,4] Output: 5 Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5. Not 7-1 = 6, as selling price needs to be larger than buying price. Input: [7,6,4,3,1] Output: 0 Explanation: In this case, no transaction is done, i.e. max profit = 0. Thoughts: 1. I...
"""Posenet model benchmark case list.""" POSE_ESTIMATION_MODEL_BENCHMARK_CASES = [ # PoseNet { "benchmark_name": "BM_PoseNet_MobileNetV1_075_353_481_WithDecoder", "model_path": "posenet/posenet_mobilenet_v1_075_353_481_16_quant_decoder", }, { "benchmark_name": "BM_PoseNet_Mobile...
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations ######################################################################### ## Customize your APP title, subtitle and menus here ######################################################################### response.logo...
def cluster_it(common_pos,no_sup,low_sup): topla=[] for x in common_pos: if x in no_sup+low_sup: continue else: topla.append(x) topla.sort() cluster={} r_cluster={} c_num=1 cluster['c_'+str(c_num)]=[] for i in range (0,len(topla)-1): po...
def chipher(plaintext): alfabet = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя" chiphertext = "" for letter in plaintext: encrypted_letter = (len(alfabet) - 1 - alfabet.find(letter)) chiphertext = chiphertext + alfabet[encrypted_letter] return chiphertext print(chipher("айтигенио"))
# # PySNMP MIB module HIST-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HIST-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:31:14 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:1...
# ** CONTROL FLOW ** # IF, ELIF AND ELSE age = 21 if age >= 21: print("You can drive alone") elif age < 16: print("You are not allow to drive") else: print("You can drive with supervision") # FOR LOOPS # Iterate a List print("\nIterate a List:") my_list = [1, 2, 3, 4, 5] for item in my_list: print(...
dados = list() pessoas = list() pesados = list() leves = list() pesos = list() contador = 1 print(f'\033[1;34m{" MAIOR E MENOR PESO ":-^44}\033[m') while True: if contador == 1: while True: continuar = str(input('Deseja cadastrar alguem no sistema?[S][N]: ')) if continuar in 'SsNn...
################################### # SOLUTION ################################### def no_boring_zeros(n): j = n if j <= 0: j = -j x = list(range(0,100)) z = [] for k in x: if j/(10**k) != int(j/(10**k)): z.append((j/(10**k))*10) if n < 0: return -max(z) ...
x = [ 100, 100, 100, 100, 100 ] y = 100 s = 50 speed = [ 1, 2, 3, 4, 5 ] def setup(): size(640, 360, P2D) def draw(): global x, y, s, speed background(127) for i in range(0, len(x)): ellipse(x[i], y + (i * s), s, s) x[i] += speed[i] if x[i] > width or x[i...
n1 = int(input('Um valor: ')) n2 = int(input('Outro valor: ')) s = n1+n2 m = n1*n2 d = n1/n2 di = n1//n2 #divisão inteira e = n1**n2 #exponênciação #{} as chaves indicam as variáveis que serão inseridas. #{:.2f} indica que caso seja um número real, terá apenas 2 casas após o ponto flutuante. print('A soma é: {}, o prod...
def mph2fps(mph): return mph*5280/3600 def myhello(): print("Konchi_wa")
aux=0 aux2=0 while True: string=list(map(str,input().split())) if string[0]=="ABEND":break elif string[0]=='SALIDA': aux+=int(string[1]) aux2+=1 else: aux-=int(string[1]) aux2-=1 print(aux) print(aux2)
"""Try it yourself 9-1 """ class Restaurant(): def __init__(self,restaurant_name,cuisine_type): self.restaurant_name = restaurant_name.title() self.cuisine_type = cuisine_type def describe_restaurant(self): desc = self.restaurant_name + " nuestra comida es " + self.cuisine_type +...
class Solution: def canMakeArithmeticProgression(self, arr: List[int]) -> bool: arr.sort() l1 = arr[0:(len(arr)-1)] l2 = arr[1:] diffs = [abs(i-j) for i,j in zip(l1, l2)] if len(set(diffs)) == 1: return True return False
class Flower: """A flower.""" def __init__(self, name, petals, price): """Create a new flower instance. name the name of the flower (e.g. 'Spanish Oyster') petals the number of petals exists (e.g. 50) price price of each flower (measured in euros) """ self...
"""Ensinando como documentar funções. Quando se trata de documentar funções, a primeira linha da função precisa ser a documentação. Caso a documentação possua mais de uma linha, a mesma pode continuar a expandir, porém a primeira linha sempre precisa fazer parte da documentação. Veniam et deserunt ex consectetur aliq...
class LanguageUtility: LANGUAGES = { "C": ("h",), "Clojure": ("clj",), "C++": ("cpp", "hpp", "h++",), "Crystal": ("cr",), "C#": ("cs", "csharp",), "CSS": (), "D": (), "Go": ("golang",), "HTML": ("htm",), "Java": (), "JavaScript"...
# Recursion # Base Case: n < 2, return lst # Otherwise: # Divide list into 2, Sort each of them, Merge! def merge(left, right): # Compare first element # Take the smaller of the 2 # Repeat until no more elements results = [] while left and right: if left[0] < right[0]: results.a...
__about__ = "Maximum no in a binary tree." class Node: def __init__(self, data): self.data = data self.left = None self.right= None class Tree: @staticmethod def insert(root = None,data = None): if root is None and data is not None: root = Node(data)
E, F, C = map(int, input().split()) bottles = E + F drank = 0 while bottles >= C: # while he still has enough empty bottles to purchase more bottles -= C - 1 # used F empty bottles to buy 1 drank += 1 print(drank)
NOTES = { 'C3': 130.8, 'CS3': 138.6, 'DF3': 138.6, 'D3': 146.8, 'DS3': 155.6, 'EF3': 155.6, 'E3': 164.8, 'F3': 174.6, 'FS3': 185.0, 'GF3': 185.0, 'G3': 196.0, 'GS3': 207.7, 'AF3': 207.7, 'A3': 220.0, 'AS3': 233.1, 'BF3': 233.1, 'B3': 246.9, 'C4': ...
# -*- coding: utf-8 -*- class HelloWorldController: __defaultName = None def __init__(self): self.__defaultName = "Pip User" def configure(self, config): self.__defaultName = config.get_as_string_with_default("default_name", self.__defaultName) def greeting(self, name): retur...
edge_array = [0,100,-1,-30,130,-150,-1,-1,-1,10,10,-120,-10,160,-180,0,10,-180,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,120,-120,-100,30,-200,30,30,-200,20,30,-200,30,220,-230,40,20,-220,0,50,-30,-200,30,-30,30,30,-200,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,60,-160,-10,130,-190,0,40,-2...
class LoginResponse: def __init__( self, access_token: str, fresh_token: str, token_type: str = "bearer" ): self.access_token = access_token self.fresh_token = fresh_token self.token_type = token_type def json(self): return dict( access_...
# Iterating Through Dictionaries contacts = {"Daisy Johnson": "2468 Park Ave", "Leo Fitz": "1258 Monkey Dr"} # iterate through each key for name in contacts: print(name) # or, use keys() method for name in contacts.keys(): print(name) # using each key to print each value for name in contacts: # prints e...
to_do_list = ["0"] * 10 while True: command = input().split("-", maxsplit=1) if "End" in command: break to_do_list.insert(int(command[0]), command[1]) while "0" in to_do_list: to_do_list.remove("0") print(to_do_list)
N = int(input()) data = open("{}.txt".format(N), 'r') data = data.readline() data = [int(i) for i in data.split()] def parr(array): for i in array: print('{:4d}'.format(i), end=" ") def insertionsort(x): for i in range(1, len(x)): j = i - 1; key = x[i] while(x[j] > key and j>= 0): x[j+1] = x[j] j = j-1 ...
def resolve(): n = int(input()) for i in range(1, n + 1): if i % 3 == 0 or "3" in str(i): print(" {}".format(i), end="") print()
''' * @Author: csy * @Date: 2019-04-28 08:15:26 * @Last Modified by: csy * @Last Modified time: 2019-04-28 08:15:26 ''' def greet_users(names): '''向列表中的每个用户发出简单问候''' for name in names: msg = 'Hello,'+name.title() print(msg) usernames = ['hannah', 'try', 'margot'] greet_users(usernames)...
''' Make a 3x3 matrix and fill with numbers at the end show the matrix in a right format ''' cr = [[],[],[]] for c in range(0,3): cr[0].append(int(input(f'First line [1, {c+1}]: '))) for c in range(0,3): cr[1].append(int(input(f'Second line [2, {c+1}]: '))) for c in range(0,3): cr[2].append(int(input(f'Thir...
load( "@io_bazel_rules_dotnet//dotnet/private:context.bzl", "dotnet_context", ) load( "@io_bazel_rules_dotnet//dotnet/private:providers.bzl", "DotnetLibrary", ) load( "@io_bazel_rules_dotnet//dotnet/private:common.bzl", "paths", ) def _dotnet_nuget_impl(ctx, ...
n = int(input()) for i in range(n): x = int(input()) print(len(bin(x)) - 2)
"""NA (Non-Available) values in R.""" NA_Character = None NA_Integer = None NA_Logical = None NA_Real = None NA_Complex = None
''' The class derived from more than 1 base called as a Multiple Inheritence. Programmer_name : BALAVIGNESH.M Implemented_Date : 11-11-2018 ''' class OS: SecurityOS = "Linux" DeveloperlikeOS = "Mac OS" Most_Personal_usage_OS = "Windows" class KernerlType: SecurityOS_Kernel = "MonoLit...