content
stringlengths
7
1.05M
def oneaway(x,y): # INSERT x = list(x) y = list(y) if (len(x)+1) == len(y): for k in x: if k in y: continue else: return "1 FUCK" # REMOVAL if (len(x)-1) == len(y): for k in y: if k in x: continu...
""" State machine data structure with one start state and one stop state. Source: http://www.python-course.eu/finite_state_machine.php """ class InitializationError(ValueError): pass class InputError(ValueError): pass ############################################################################### class Stat...
"""Find the smallest integer in the array, Kata in Codewars.""" def smallest(alist): """Return the smallest integer in the list. input: a list of integers output: a single integer ex: [34, 15, 88, 2] should return 34 ex: [34, -345, -1, 100] should return -345 """ res = [alist[0]] for ...
""" 백준 6810번 : ISBN """ ans = 91 a = int(input()) b = int(input()) c = int(input()) print('The 1-3-sum is {}'.format(ans + a + b*3 + c))
# Python - 3.6.0 test.describe('Example Tests') tests = ( ('John', 'Hello, John!'), ('aLIce', 'Hello, Alice!'), ('', 'Hello, World!') ) for inp, exp in tests: test.assert_equals(hello(inp), exp) test.assert_equals(hello(), 'Hello, World!')
''' Author: Ajay Mahar Lang: python3 Github: https://www.github.com/ajaymahar YT: https://www.youtube.com/ajaymaharyt ''' class Node: def __init__(self, data): """TODO: Docstring for __init__. :returns: TODO """ self.data = data self.next = None class St...
'''PROGRAM TO, FOR A GIVEN LIST OF TUPLES, WHERE EACH TUPLE TAKES PATTERN (NAME,MARKS) OF A STUDENT, DISPLAY ONLY NAMES.''' #Given list scores = [("akash", 85), ("arind", 80), ("asha",95), ('bhavana',90), ('bhavik',87)] #Seperaing names and marks sep = list(zip(*scores)) names = sep[0] #Displaying names print('\nN...
"""Sorts GO IDs or user-provided sections containing GO IDs.""" __copyright__ = "Copyright (C) 2016-2019, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" class SorterNts(object): """Handles GO IDs in user-created sections. * Get a 2-D list of sections: sections ...
# https://binarysearch.com/problems/Largest-Anagram-Group class Solution: def solve(self, words): anagrams = {} for i in range(len(words)): words[i] = "".join(sorted(list(words[i]))) if words[i] in anagrams: anagrams[words[i]]+=1 else: ...
class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: paraList = re.split('\W', paragraph.lower()) paraListAlpha = [] for item in paraList: item = ''.join([i for i in item if i.isalpha()]) paraListAlpha.append(item) countParaList ...
with open("a.txt",'r') as ifile: with open("b.txt","w") as ofile: char = ifile.read(1) while char: if char==".": ofile.write(char) ofile.write("\n") char = ifile.read(1) else: ofile.write(char) ch...
L, R = map(int, input().split()) ll = list(map(int, input().split())) rl = list(map(int, input().split())) lsize = [0]*41 rsize = [0]*41 for l in ll: lsize[l] += 1 for r in rl: rsize[r] += 1 ans = 0 for i in range(10, 41): ans += min(lsize[i], rsize[i]) print(ans)
SIZE = 32 class Tile(): def __init__(self, collision=False, image=None, action_index=None): self.collision = collision self.image = image self.action_index = action_index
A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] B = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20] C = [21, 22, 23, 24, 25, 26, 27, 28, 29, 30] intercalada = [] contador = 0 for i in range(10): intercalada.append(A[contador]) intercalada.append(B[contador]) intercalada.append(C[contador]) contador += 1 print(in...
# Python program to demonstrate working of # Set in Python # Creating two sets set1 = set() set2 = set() # Adding elements to set1 for i in range(1, 6): set1.add(i) # Adding elements to set2 for i in range(3, 8): set2.add(i) set1.add(1) print("Set1 = ", set1) print("Set2 = ", set2) print("\n") #...
''' Copyright 2011 Acknack Ltd 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 agreed to in writing, software dis...
# This is your Application's Configuration File. # Make sure not to upload this file! # Flask App Secret. Used for "session". flaskSecret = "<generateKey>" # Register your V1 app at https://portal.azure.com. # Sign-On URL as <domain>/customer/login/authorized i.e. http://localhost:5000/customer/login/authorized # Mak...
""" This package contains definitions for the geometric primitives in use in ``phantomas``. """ __all__ = ['fiber', 'models', 'utils', 'rois']
def min4(*args): min_ = args[0] for item in args: if item < min_: min_ = item return min_ a, b, c, d = int(input()), int(input()), int(input()), int(input()) print(min4(a, b, c, d))
class Contender: def __init__(self, names, values): self.names = names self.values = values def __repr__(self): strings = tuple(str(v.id()) for v in self.values) return str(strings) + " contender" def __lt__(self, other): return self.values < other.values def ...
def non_repeat(line): ls = [line[i:j] for i in range(len(line)) for j in range(i+1, len(line)+1) if len(set(line[i:j])) == j - i] return max(ls, key=len, default='')
first_number = int(input("Enter the first number(divisor): ")) second_number = int(input("Enter the second number(boundary): ")) for number in range(second_number, 0, -1): if number % first_number == 0: print(number) break
n = int(input()) last = 1 lastlast = 0 print('0 1 ', end="") for i in range(n-2): now = last+lastlast if i == n-3: print('{}'.format(now)) else: print('{} '.format(now), end="") lastlast = last last = now
""" In the Code tab is a function which is meant to return how many uppercase letters there are in a list of various words. Fix the list comprehension so that the code functions normally! Examples count_uppercase(["SOLO", "hello", "Tea", "wHat"]) ➞ 6 count_uppercase(["little", "lower", "down"]) ➞ 0 count_uppercase(...
# -*- coding: utf-8 -*- def main(): n = int(input()) dishes = list() ans = 0 # See: # https://poporix.hatenablog.com/entry/2019/01/28/222905 # https://misteer.hatenablog.com/entry/NIKKEI2019qual?_ga=2.121425408.962332021.1548821392-1201012407.1527836447 for i in range(n): ...
class Cell: def __init__(self, x, y, entity = None, agent = None, dirty = False): self.x = x self.y = y self.entity = entity self.agent = agent self.dirty = dirty def set_entity(self, entity): self.entity = entity self.entity.x = self.x self.entit...
# Ann watched a TV program about health and learned that it is # recommended to sleep at least A hours per day, but # oversleeping is also not healthy, and you should not sleep more # than B hours. Now Ann sleeps H hours per day. If Ann's sleep # schedule complies with the requirements of that TV program - # print "Nor...
numeros = [[], []] for i in range(1, 8): num = int(input(f'Digite o {i}° valor: ')) if num % 2 == 0: numeros[0].append(num) else: numeros[1].append(num) numeros[0].sort() numeros[1].sort() print('-=' * 30) print(f'Pares: {numeros[0]}\nImpares: {numeros[1]}')
# your_name = input(f'Please enter name: ') # back_name = your_name[::-1] # print(f'{your_name} -> {(back_name.capitalize())} , pamatigs juceklis vai ne {your_name[0].upper()}?') name = input("Enter the name:") name = name.capitalize() name_rev = name[::-1].capitalize() print(f"{name_rev}, pamatīgs juceklis, vai n...
def menu(): simulation_name = "listWithOptionsOptimized" use_existing = True save_results = False print("This project is made to train agents to fight each other\nThere is three types of agents\n-dummy : don't do anything\n-runner : just moving\n-killer : move and shoot\nWe are only using dummies and runners ...
my_set = {4, 2, 8, 5, 10, 11, 10} # seturile sunt neordonate my_set2 = {9, 5, 77, 22, 98, 11, 10} print(my_set) # print(my_set[0:]) #nu se poate lst = (11, 12, 12, 14, 15, 13, 14) print(set(lst)) #eliminam duplicatele din lista prin transformarea in set print(my_set.difference(my_set2)) print(my_set.intersection(my_...
def make_weights_for_balanced_classes(images, nclasses): count = [0] * nclasses for item in images: count[item[1]] += 1 ...
''' You own a Goal Parser that can interpret a string command. The command consists of an alphabet of "G", "()" and/or "(al)" in some order. The Goal Parser will interpret "G" as the string "G", "()" as the string "o", and "(al)" as the string "al". The interpreted strings are then concaten...
def sequencia(): i = 0 j = 1 while i <= 2: for aux in range(3): if int(i) == i: print(f'I={int(i)} J={int(j)}') else: print(f'I={i:.1f} J={j:.1f}') j += 1 j = round(j - 3 + 0.2, 1) i = round(i + 0.2, 1) sequencia()...
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: longest = 0 """ @param root: the root of binary tree @return: the length of the longest consecutive sequence path """ def longestConse...
def twoSum( nums, target: int): #Vaule = {}.fromkeys for i in range(len(nums)): a = target - nums[i] for j in range(i+1,len(nums),1): if a == nums[j]: return [i,j] findSum = twoSum(nums = [1,2,3,4,5,6,8],target=14) print(findSum)
#!/usr/bin/python # -*- coding: utf-8 -*- """ MIT License Copyright (c) 2013-2016 Frantisek Uhrecky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, includ...
""" 1764 : 듣보잡 URL : https://www.acmicpc.net/problem/1764 Input : 3 4 ohhenrie charlie baesangwook obama baesangwook ohhenrie clinton Output : 2 baesangwook ohhenrie """ n, m = map(int, input().split()) d = set() f...
# Events for actors to send __all__ = [ "NodeEvent", "AuthPingEvent", "TagEvent", "UntagEvent", "DetagEvent", "RawMsgEvent", "PingEvent", "GoodNodeEvent", "RecoverEvent", "SetupEvent", ] class NodeEvent: pass class AuthPingEvent(NodeEvent): """ Superclass for tag...
# Tot's reward lv 50 sm.completeQuest(5522) # Lv. 50 Equipment box sm.giveItem(2430450, 1) sm.dispose()
""" Inner module for card utilities. """ def is_location(card): """ Return true if `card` is a location card, false otherwise. """ return card.kind is not None and card.color is not None def is_door(card): """ Return true if `card` is a door card, false otherwise. """ return card.kind...
class Board: def __init__(self): self.board = [0] * 9 def __getitem__(self, n): return self.board[n] def __setitem__(self, n, value): self.board[n] = value def __str__(self): return "\n".join([ "".join([[" ", "o", "x"][j] for j in self.board[3*i:3*i+3]]) ...
line = input() words = line.split() for word in words: line = line.replace(word, word.capitalize()) print(line)
"""Leetcode 9. Palindrome Number Easy URL: https://leetcode.com/problems/palindrome-number/ Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, i...
expected_output = { 'jid': {1: {'index': {1: {'data': 344, 'dynamic': 0, 'jid': 1, 'process': 'init', 'stack': 136, 'text': 296}}}, 51: {'index': {1: {'data': 1027776, 'd...
#!/usr/bin/env python # # Copyright 2014 Tuenti Technologies S.L. # # 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 app...
def primefactor(n): for i in range(2,n+1): if n%i==0: isprime=1 for j in range(2,int(i/2+1)): if i%j==0: isprime=0 break if isprime: print(i) n=315 primefactor(n) ...
# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ '../../../build/common.gypi', ], 'variables': { 'common_sources': [ ], }, 'targets' : [ { 'target_name':...
def is_leap(year): if ( year >= 1900 and year <=100000): leap = False if ( (year % 4 == 0) and (year % 400 == 0 or year % 100 != 0) ): leap = True return leap year = int(input()) print(is_leap(year))
# Copyright 2014 The Johns Hopkins University Applied Physics Laboratory # # 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 ...
# -*- coding: utf-8 -*- def count_days(y, m, d): return (365 * y + (y // 4) - (y // 100) + (y // 400) + ((306 * (m + 1)) // 10) + d - 429) def main(): y = int(input()) m = int(input()) d = int(input()) if m == 1 or m == 2: m += 12 y -= 1 print(count_days(201...
class CausalFactor: def __init__(self, id_: int, name: str, description: str): self.id_ = id_ self.name = name self.description = description class VehicleCausalFactor: def __init__(self): self.cf_driver = [] self.cf_fellow_passenger = [] self.cf_vehicle = [] ...
class Account: """ Class that generates new instances of account credentials to be stored. """ def __init__(self, acc_nm, acc_uname, acc_pass): self.acc_nm=acc_nm self.acc_uname=acc_uname self.acc_pass=acc_pass
class Solution: def numJewelsInStones(self, J: str, S: str) -> int: result = 0 for i in set(J): result += S.count(i) return result
int16gid = lambda n: '-'.join(['{:04x}'.format(n >> (i << 4) & 0xFFFF) for i in range(0, 1)[::-1]]) int32gid = lambda n: '-'.join(['{:04x}'.format(n >> (i << 4) & 0xFFFF) for i in range(0, 2)[::-1]]) int48gid = lambda n: '-'.join(['{:04x}'.format(n >> (i << 4) & 0xFFFF) for i in range(0, 3)[::-1]]) int64gid = lambda n:...
######################################################## # Copyright (c) 2015-2017 by European Commission. # # All Rights Reserved. # ######################################################## extends("BaseKPI.py") """ Welfare (euro) --------------- Indexed by * scope * delivery ...
class Indent: def __init__(self, left: int = None, top: int = None, right: int = None, bottom: int = None): self.left = left self.top = top self.right = right self.bottom = bottom
"""Top-level package for Indonesia Name and Address Preprocessing.""" __author__ = """Esha Indra""" __email__ = 'esha.indra@gmail.com' __version__ = '0.2.7'
drink = input() sugar = input() drinks_count = int(input()) if drink == "Espresso": if sugar == "Without": price = 0.90 elif sugar == "Normal": price = 1 elif sugar == "Extra": price = 1.20 elif drink == "Cappuccino": if sugar == "Without": price = 1 elif sugar == "N...
n = int(input()) arr = [int(e) for e in input().split()] ans = 0 for i in arr: if i % 2 == 0: ans += i / 4 else: ans += i * 3 print("{:.1f}".format(ans))
def aumento(preco=0, taxa=0): r = preco + (preco * taxa/100) return r def diminuir(preco=0, taxa=0): r = preco - (preco * taxa/100) return r def dobro(preco=0): r = preco * 2 return r def metade(preco=0): r = preco / 2 return r def moeda(preço, moeda='R$'): return f'{moeda}{p...
# Copyright 2019 Nicholas Kroeker # # 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 agreed to in writ...
# This exercise should be done in the interpreter # Create a variable and assign it the string value of your first name, # assign your age to another variable (you are free to lie!), print out a message saying how old you are name = "John" age = 21 print("my name is", name, "and I am", age, "years old.") # Use the ...
""" 三切分快速排序 """ def swap(src, i, j): src[i], src[j] = src[j], src[i] def three_quick_sort(src, low, high): if low >= high: return lt = low gt = high val = src[low] i = low + 1 while i <= gt: if src[i] == val: i += 1 elif src[i] < val: swap...
def divide(num1, num2): try: num1 / num2 except Exception as e: print(e) divide(1, 0)
class Automation(object): def __init__(self, productivity, cost,numberOfAutomations, lifeSpan): # self.annualHours = annualHours self.productivity = float(productivity) self.cost = float(cost) self.lifeSpan = float(lifeSpan) self.numberOfAutomations = float(numberOfAutomation...
# coding=utf-8 DBcsvName = 'houseinfo_readable_withXY' with open(DBcsvName + '.csv', 'r', encoding='UTF-8') as f: lines = f.readlines() print(lines[0]) with open(DBcsvName + '_correct.csv', 'w', encoding='UTF-8') as fw: fw.write( "houseID" + "," + "title" + "," + "link" + "," + "community" + "," ...
class Node(): def __init__(self, val, left, right): self.val = val self.left = left self.right = right def collect(node, data, depth = 0): if not node: return None if depth not in data: data[depth] = [] data[depth].append(node.val) collect(node.left, data, depth + 1) collect(node.rig...
ques=input('Do you wish to find the Volume of Cube by 2D Method or via Side Method? Please enter either 2D or Side') if ques=='2D': print ('OK.') ba=int(input('Enter the Base Area of the Cube')) Height=int(input('Enter a Height measure')) v=ba*Height print ('Volume of the Cube is', v) elif qu...
#!/usr/bin/env python3 class Solution: def fizzBuzz(self, n: int): res = [] for i in range(1, n+1): if i % 15 == 0: res.append('FizzBuzz') elif i % 3 == 0: res.append('Fizz') elif i % 5 == 0: res.append('Buzz') ...
#!/usr/bin/python3 accesses = {} with open('download.log') as f: for line in f: splitted_line = line.split(',') if len(splitted_line) != 2: continue [file_path, ip_addr] = splitted_line if file_path not in accesses: accesses[file_path] = [] ...
''' This module contains all the configurations needed by the modules in the etl package ''' # import os # from definitions import ROOT_DIR TRANSFORMED_DATA_DB_CONFIG = { 'user': 'root', 'password': 'xxxxxxxxxxxx', 'host': '35.244.x.xxx', 'port': 3306, 'database': 'transformed_data' #...
file_name = input('Enter file name: ') fn = open(file_name) count = 0 for line in fn: words = line.strip().split() try: if words[0] == 'From': print(words[1]) count += 1 except IndexError: pass print(f'There were {count} lines in the file with From as the first word')...
# -*- coding: utf-8 -*- class GeneratorRegister(object): def __init__(self): self.generators = [] def register(self, obj): self.generators.append(obj) def generate(self, command=None): for generator in self.generators: if command is not None and command.verbosity > 1: command.stdout.write('\nGeneratin...
class CoOccurrence: def __init__(self, entity: str, score: float, entity_type: str = None): self.entity = entity self.score = score self.entity_type = entity_type def __repr__(self): return f'{self.entity} - {self.entity_type} ({self.score})' def as_dict(self): d = ...
year = int(input()) if year % 4 == 0 and not (year % 100 == 0): print("Leap") else: if year % 400 == 0: print("Leap") else: print("Ordinary")
class ChatRoom: def __init__(self): self.people = [] def broadcast(self, source, message): for p in self.people: if p.name != source: p.receive(source, message) def join(self, person): join_msg = f'{person.name} joins the chat' self.broadcast('ro...
class LinkedList: def __init__(self): self.head = None def insert(self, value): self.head = Node(value, self.head) def append(self, value): new_node = Node(value) current = self.head if current == None: self.head = new_node elif current...
# # Explore # - The Adventure Interpreter # # Copyright (C) 2006 Joe Peterson # class ItemContainer: def __init__(self): self.items = [] self.item_limit = None def has_no_items(self): return len(self.items) == 0 def has_item(self, item): return item in self...
#!/usr/bin/python3 a = sum(range(100)) print(a)
WINDOW_TITLE = "ElectriPy" HEIGHT = 750 WIDTH = 750 RESIZABLE = True FPS = 40 DEFAULT_FORCE_VECTOR_SCALE_FACTOR = 22e32 DEFAULT_EF_VECTOR_SCALE_FACTOR = 2e14 DEFAULT_EF_BRIGHTNESS = 105 DEFAULT_SPACE_BETWEEN_EF_VECTORS = 20 MINIMUM_FORCE_VECTOR_NORM = 10 MINIMUM_ELECTRIC_FIELD_VECTOR_NORM = 15 KEYS = { "clear_scre...
# Copyright (c) 2016-2022 Kirill 'Kolyat' Kiselnikov # This file is the part of chainsyn, released under modified MIT license # See the file LICENSE.txt included in this distribution """Module with various processing patterns""" # DNA patterns dna = 'ATCG' dna_to_dna = { 'A': 'T', 'T': 'A', 'C': 'G', ...
""" The present module contains functions meant to help handling file paths, which must be provided as pathlib.Path objects. Library Pathlib represents file extensions as lists of suffixes starting with a '.' and it defines a file stem as a file name without the last suffix. In this module, however, a stem is a file n...
# coding: utf-8 GROUP_RESPONSE = { "result": [ { "poll_type": "group_message", "value": { "content": [ [ "font", { "color": "000000...
# Multiples of 3 and 5 # Problem 1 # If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. # The sum of these multiples is 23. # Find the sum of all the multiples of 3 or 5 below 1000 def solution(limit): s = 0 for x in range(1, limit): if x % 3 == 0: ...
""" This question was asked by Zillow. You are given a 2-d matrix where each cell represents number of coins in that cell. Assuming we start at matrix[0][0], and can only move right or down, find the maximum number of coins you can collect by the bottom right corner. For example, in this matrix 0 3 1 1 2 0 0 4 1 5 3...
class Index: def set_index(self, index_name): self.index = index_name def mapping(self): return { self.doc_type:{ "properties":self.properties() } } def analysis(self): return { 'filter':{ 'spanish_stop'...
""" A dictionary for enumering all stages of sleep """ SLEEP_STAGES = { 'LIGHT': 'LIGHT', 'DEEP': 'DEEP', 'REM': 'REM' } """ A dictionary for setting the mimimum known duration for the sleep stages """ MIN_STAGE_DURATION = { 'LIGHT': 15, 'DEEP': 30, 'REM': 8 } """ Topics we are subscribing/pu...
''' Encontrar el valor repetido de ''' lista =[1,2,2,3,1,5,6,1] for number in lista: if lista.count(number) > 1: i = lista.index(number) print(i) lista_dos = ["a", "b", "a", "c", "c"] mylist = list(dict.fromkeys(lista_dos)) print(mylist) print("*"*10)
# 969. Pancake Sorting class Solution: def pancakeSort2(self, A): ans, n = [], len(A) B = sorted(range(1, n+1), key=lambda i: -A[i-1]) for i in B: for f in ans: if i <= f: i = f + 1 - i ans.extend([i, n]) n -= 1...
## Logging logging_config = { 'console_log_enabled': True, 'console_log_level': 25, # SPECIAL 'console_fmt': '[%(asctime)s] %(message)s', 'console_datefmt': '%y-%m-%d %H:%M:%S', ## 'file_log_enabled': True, 'file_log_level': 15, # VERBOSE 'file_fmt': '%(asctime)s %(levelname)-8s %(nam...
# coding:utf-8 ''' @Copyright:LintCode @Author: taoleetju @Problem: http://www.lintcode.com/problem/find-minimum-in-rotated-sorted-array @Language: Python @Datetime: 15-12-14 03:26 ''' class Solution: # @param num: a rotated sorted array # @return: the minimum number in the array def findMin(self, nu...
nume1 = (input("Digite um numero")) nume2 = (input("Digite um numero")) nume3 = (input("Digite um numero")) nume4 = (input("Digite um numero")) nume5 = (input("Digite um numero")) lista_nova =[nume1,nume2,nume3,nume4,nume5] print("Sua lista ordenada numérica: ", sorted(lista_nova))
"""Kata: Fibonacci's FizzBuzz - return a list of the fibonacci sequence with the words 'Fizz', 'Buzz', and 'FizzBuzz' replacing certain integers. #1 Best Practices Solution by damjan. def fibs_fizz_buzz(n): a, b, out = 0, 1, [] for i in range(n): s = "Fizz"*(b % 3 == 0) + "Buzz"*(b % 5 == 0) ...
# These constants are all possible fields in a message. ADDRESS_FAMILY = 'address_family' ADDRESS_FAMILY_IPv4 = 'ipv4' ADDRESS_FAMILY_IPv6 = 'ipv6' CITY = 'city' COUNTRY = 'country' RESPONSE_FORMAT = 'format' FORMAT_HTML = 'html' FORMAT_JSON = 'json' FORMAT_MAP = 'map' FORMAT_REDIRECT = 'redirect' FORMAT_BT = 'bt' VA...
def f(): x = 5 def g(y): print (x + y) g(1) x = 6 g(1) x = 7 g(1) f()
# Python program to insert, delete and search in binary search tree using linked lists # A Binary Tree Node class Node: # Constructor to create a new node def __init__(self, key): self.key = key self.left = None self.right = None # A utility function to do inorder traversal of BST ...
def keyword_argument_example(your_age, **kwargs): return your_age, kwargs ### Write your code below this line ### about_me = "Replace this string with the correct function call." ### Write your code above this line ### print(about_me)
s = 'Python is the most powerful language' words = s.split() print(words) # numbers = input().split() # 1 2 3 4 5 # for i in range(len(numbers)): # numbers[i] = int(numbers[i]) # print(numbers) ip = '192.168.1.24' numbers = ip.split('.') # указываем явно разделитель print(numbers) words = ['Python', 'is', 'the'...
""" Version management system. """ class Version: clsPrev = None #`Version` class that represents the previous version of `self`, or `None` if there is no previous `Version`. def __init__(self): pass def _initialize(self, obj): """ Initializes `obj` to match this version from scratch. `obj` may be modi...