content
stringlengths
7
1.05M
""" Objective Today we will expand our knowledge of strings, combining it with what we have already learned about loops. Check out the Tutorial tab for learning materials and an instructional video. Task Given a string, , of length that is indexed from to , print its even-indexed and odd-indexed characters as space...
# 打印输出从文件读取的所有行的字符串(遍历的对象是文件对象) f = open('hello.txt') # 打开(文本+读取模式) for line in f: print(line, end='') f.close() # 关闭
# The sum of the squares of the first ten natural numbers is, # # 12 + 22 + ... + 102 = 385 # The square of the sum of the first ten natural numbers is, # # (1 + 2 + ... + 10)2 = 552 = 3025 # Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2...
#!/usr/bin/python """ use in format: "{RED_FG}{0}{RESET}".format(variable, **printformats.print_formats) from https://stackoverflow.com/questions/287871/print-in-terminal-with-colors """ formatting = { 'RESET' : '\033[0m', 'END' : '\033[0m', 'BOLD' : '\033[01m', 'UNDERLINE' : '\033[04m', 'REVERSE'...
#!/usr/bin/python # -*- coding: utf-8 -*- OCT_SUCCESS = 0 NOT_ENOUGH_PARAS = 1 TOO_MANY_PARAS = 2 UNACCP_PARAS = 3 XML_ERR = 4 EXEC_CMD_ERR = 5 COMMON_ERR = 6 SEGMENT_NOT_EXIST = 7 SEGMENT_ALREADY_EXIST = 8 FILE_NOT_EXIST = 9 ADDED_TO_TASK = 10 ADDED_TO_SERVER = 11 TIME_OUT = 12 CHECK_ENV_ERR = 13 SEND_MSG_FAILED = 14...
n = int(input('Digite qualquer numero:')) resultado = n % 2 if resultado == 0: print('O numero {} e´ PAR'.format(n)) else: print('O numero {} e´ IMPAR'.format(n))
# https://www.hackerrank.com/challenges/30-nested-logic/problem # Enter your code here. Read input from STDIN. Print output to STDOUT Da, Ma, Ya = map(int, input().split()) De, Me, Ye = map(int, input().split()) fine = 0 if Ya-Ye<0: fine = 0 elif Ya-Ye == 0: if Ma-Me < 0: fine = 0 elif Ma-Me == 0...
class Piece: def __init__(self, s): split = s.replace("\n", "").split(' ') self.number = int(split[0][1:]) offset = split[2][:-1].split(',') self._left_offset = int(offset[0]) self._top_offset = int(offset[1]) size = split[3].split('x') self._width = int(si...
nums1 = {1, 2, 3, 4, 5} nums2 = {4, 5, 6, 7, 8, 9} nums3 = nums2.difference(nums1) print("nums2 – nums1: ", nums3)
dev_packages = [ "karbon", "librsvg2-bin", ]
# -*- coding: utf-8 -*- """ pygsheets.exceptions ~~~~~~~~~~~~~~~~~~~~ Exceptions used in pygsheets. """ class PyGsheetsException(Exception): """A base class for pygsheets's exceptions.""" class AuthenticationError(PyGsheetsException): """An error during authentication process.""" class SpreadsheetNotFo...
s = input() c = 0 for _ in range(int(input())): if s in input() * 2: c += 1 print(c)
# encoding: utf-8 # module System.Windows.Markup calls itself Markup # from System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 # by generator 1.145 """ NamespaceTracker represent a CLS namespace. """ # no imports # no functions # classes class ValueSerializerAttribute(Attribute, _At...
# # PySNMP MIB module NETBOTZ-SNMP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETBOTZ-SNMP-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:18:38 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
class Solution(object): def findDuplicate(self, paths): """ :type paths: List[str] :rtype: List[List[str]] """ d = collections.defaultdict(list) for path in paths: l = path.split() directory = l[0] for file in l[1:]: ...
setA = {"John", "Bob", "Mary", "Serena"} setB = {"Jim", "Mary", "John", "Bob"} setA ^ setB # symmetric difference of A and B {'Jim', 'Serena'} setA - setB # elements in A that are not in B {'Serena'} setB - setA # elements in B that are not in A {'Jim'} setA | setB # elements in A or B (union) {'John', 'Bob', 'Jim', 'S...
def main(): size_of_tlb = input('Input size of TLB\n') tlb(size_of_tlb, 'execution_large.txt') def tlb(size, file): f = open(file, 'r') f1 = f.readlines() page = '' page_list = [] #reads in pages from file for line in f1: for bit in xrange(0,54): page += str(line[bi...
''' Queue - FIFO Implementtaion of a queue using python List class the end of the list = rear of the queue the begining of the list = front of the queue enqueue = O(n) dequeue = O(1) ''' class Queue: def __init__(self): self.items=[] def isEmpty(self): return self.items == [] def dequeue(self): if ...
S = input() result = 0 for c in S: if c in '0123456789': result += int(c) print(result)
if __name__ == '__main__': n = 0 p = input('input a octal number:\n') for i in range(len(p)): n = n * 8 + ord(p[i]) - ord('0') print(n) # 8 ---> 10
def max_number(number1,number2,number3): max1= max(number1,number2) max2= max(max1,number3) print(max2) max_number(5,4,3) def min_number(number1,number2,number3): min1= min(number1,number2) min2= min(min1,number3) print(min2) min_number(5,4,3)
sql_vals = {'host' : 'localhost', 'port' : 3306, 'db' : 'gaime', 'user' : 'gaimeAdmin', 'password' : 'BBEgaime3'}
# https://www.hackerrank.com/challenges/staircase/problem def staircase(size): spaces = size - 1 for i in range(size): print('{spaces}{hashes}'.format(spaces=' ' * spaces, hashes='#' * (size - spaces))) spaces -= 1 staircase(4)
# see: https://leetcode.com/problems/two-sum/ class Solution: def twoSum(self, nums: [int], target: int) -> [int]: nums_size = len(nums) complements = [] for i in range(nums_size): complement = target - nums[i] if complement in complements: return ...
class ComCompatibleVersionAttribute(Attribute,_Attribute): """ Indicates to a COM client that all classes in the current version of an assembly are compatible with classes in an earlier version of the assembly. ComCompatibleVersionAttribute(major: int,minor: int,build: int,revision: int) """ def __init__...
self.description = "Install a package from a sync db, with a filesystem conflict" sp = pmpkg("dummy") sp.files = ["bin/dummy", "usr/man/man1/dummy.1"] self.addpkg2db("sync", sp) self.filesystem = ["bin/dummy"] self.args = "-S %s" % sp.name self.addrule("PACMAN_RETCODE=1") self.addrule("!PKG_EXIST=dummy"...
# to do: pytz support class Timer(object): def __init__(self, start_time: int, end_time: int, ticker_size: int): self._start_time = start_time self._end_time = end_time self._step = ticker_size self._current_time = start_time @property def time(self): return self._...
print(""" 080) Crie um programa onde o usuário possa digitar cinco valores numéricos e cadastre-os em uma lista, já na posição correta de inserção (sem usar o sort()). No final, mostre a lista ordenada na tela. """) ### A solução final foi baseada no código postado no seguinte comentário do ### usuário João Pedro Cali...
def sanitise(item): """ Works through a given object and removes collections attributes which have None Type or empty string values :param item: Object to sanitise :return: Sanitised object """ item_to_sanitise = item.copy() if isinstance(item_to_sanitise, dict): item_to_sanitise = _...
''' Decode via autokey cipher Status: Accepted ''' ############################################################################### def main(): """Read input and print output cipher decoded with autokey""" ord_a = ord('A') ord_aa = ord_a << 1 cipher = input() key = input() length = len(key) ...
_base_config_ = ["../cse.py","../defaults.py"] dummy_anonymizer = True generator = dict( type="PixelationGenerator", pixelation_size=16 )
dict = { "AD" : "a", "ABBÁTYA" : ["abaïe", "abaie"], # " " : "adhuc", #Mot latin "ADÍDA" : "ahie", "HÁBYA" : [["aie"], 'verbe_subj'], #verbe "ADILLE" : "al", "ALÁCROS" : "alegres", "ALLMỌNAS" : "almones", "ADMÁSSAS" : ["amassez", "amassets"], "AMĘN" : "amen", "AMÍCU" : "ami", "AMÍCOS" : "amis", "AMÍCU" : "...
# Kaibara Yuzan's wise saying. def kuruma(kuruma="車"): return f"馬鹿どもに{kuruma}を与えるなっ!" def arai(arai="あらい"): return f"この{arai}を作ったのは誰だあっ!" def kubi(): return f"きさまか!きさまはクビだ、出て行けっ!" def hiyashi_chuka(hiyashi="冷やし中華"): return f"{hiyashi}だとっ!?ふざけるなあっ!" def okami(okami="女将"): return f"{okami}を呼べっ!"
class UnionFind: def __init__(self, n): # Every element is a different component. self.data = [i for i in range(n)] def find(self, i): if i != self.data[i]: self.data[i] = self.find(self.data[i]) return self.data[i] def union(self, i, j): pi,...
# Evaludate various kinds of diffs in files class FileDiff: def __init__(self): ''' initialize for diffing files '''
# Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0 # String for partition column badge PARTITION_BADGE = 'partition column'
# encoding: utf-8 def composed(*decs): """ Compose multiple decorators Example : >>> @composed(dec1, dec2) ... def some(f): ... pass """ def deco(f): for dec in reversed(decs): f = dec(f) return f return deco def order_fields(*field_list)...
#Crie um programa que leia o nome completo de uma pessoa e mostre: # - O nome com todas as letras maiúsculas e minúsculas. # - Quantas letras ao todo (sem considerar espaços). # - Quantas letras tem o primeiro nome. nome = str(input('Digite o seu nome completo: ')).strip() print(f'Seu nome completo em Maiusculas é {no...
n = int(input()) sum = 0 for i in range(0,n): num = int(input()) sum+=num print(sum)
class Group(object): def __init__(self, groupId, ownerJid, subject, subjectOwnerJid, subjectTime, creationTime): self._groupId = groupId self._ownerJid = ownerJid self._subject = subject self._subjectOwnerJid = subjectOwnerJid self._subjectTime ...
# StompMessageBroker is a proxy class of StompDaemonConnection with only a sendMessage method # This exposes a simple interface for a StompMessageController method to communicate via the broker class StompMessageBroker(): def __init__(self, stomp_daemon_connection): self.stomp_daemon_connection = stomp_daemon_connec...
###################################### # CHECK AGAIN. NOT WORKING ACCORDINGLY ###################################### class Node(object): def __init__(self, val, parent=None): self.val = val self.leftChild = None self.rightChild = None self.parent = parent def getLeftChild(self...
name = 'Amadikwa Joy N' age = '25' address = 'Owerri Imo State' print(name) print(age) print(address)
all_min = int(input()) hours = all_min // 60 minuts = all_min - hours*60 print(hours) print(minuts)
# optimizer optimizer = dict(type='Adam', lr=0.0002, weight_decay=0) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict(policy='step', step=[]) runner = dict(type='EpochBasedRunner', max_epochs=50)
n=int(input()) r="" while n>1: r+=str(n)+" " if n%2==0: n=n//2 else: n=3*n+1 r+=str(n) print(r)
#this program makes a simple calculator which can aad,subtract,multiply,divide using functions #this function adds two number def add(a,b): return a+b #this function subtracts two numbers def subtract(a,b): return a-b #this function multiplies two numbers def multiply(a,b): return a*b #this funct...
"""Basic HTML.""" def _basic_html(body_str: str): output = ( f'<!DOCTYPE html><html lang="en-GB">' f'<head>' f'<script src="https://cdn.rawgit.com/inexorabletash/polyfill/v0.1.42/polyfill.js"></script>' f'<script src="https://cdn.rawgit.com/inexorabletash/polyfill/v0.1.42/typedarra...
""" Contains exceptions for the trainers package. """ class TrainerError(Exception): """ Any error related to the trainers in the ML-Agents Toolkit. """ pass class TrainerConfigError(Exception): """ Any error related to the configuration of trainers in the ML-Agents Toolkit. """ pa...
class Config: tmp_save_dir='../../models_python' train_num_workers=6 test_num_workers=3 # train_num_workers=0 # test_num_workers=0 # data_path='../../CT_rotation_data_npy_128' # model_name='Aug3D' # lvl1_size=4 # is3d=True # train_batc...
""" Given an array of ints, return True if the array is length 1 or more, and the first element and the last element are equal. same_first_last([1, 2, 3]) → False same_first_last([1, 2, 3, 1]) → True same_first_last([1, 2, 1]) → True @author unobatbayar """ def same_first_last(nums): if len(nums) >= 1 and nums[0...
# Num = numero digita # ======================================================================== # titulo e coleta de dados print("\033[35m============[ EX 006 ]============") print(34 * "=", "\033[m") Num = int(input("Digite um \033[35mnumero\033[m: ")) print(34 * "\033[35m=", "\033[m") # =============================...
def adicao(n1, n2): soma = n1 + n2 print('A soma dos {:.2f} + {:.2f} = {:.2f}'.format(n1, n2, soma)) def subtracao(n1, n2): subtracao = n1 - n2 print('A subtração dos {:.2f} - {:.2f} = {:.2f}'.format(n1, n2, subtracao)) def divisao(n1, n2): try: divisao = n1 / n2 print('...
#!/usr/bin/env python3 inputs = list() DEBUG = False with open('input', 'r') as f: inputs = f.read().splitlines() balls = [int(ball) for ball in inputs.pop(0).split(',')] if DEBUG: print(balls) inputs.pop(0) card = 0 cards = list() cards.append(list()) while(len(inputs) > 0): line = inputs.pop(0) if len...
PANEL_DASHBOARD = 'project' PANEL_GROUP = 'default' PANEL = 'api_access' DEFAULT_PANEL = 'api_access' ADD_PANEL = \ ('openstack_dashboard.dashboards.project.api_access.panel.ApiAccess')
n, a, b = map(int, input().split()) total = 0 def sum_digits(digits): return sum(int(digit) for digit in str(digits)) for i in range(1, n + 1): if sum_digits(i) >= a and sum_digits(i) <= b: total += i print(total)
""" Write a Python program to get all strobogrammatic numbers that are of length n """ def gen_stroboggrammatic(n): result = helper(n,n) return result def helper(n, length): if n == 0: return[""] if n == 1: return["1", "0", "8"] middles = helper(n-2, length) result = [] for ...
def Justify(string: str, maxWidth: int) -> str: """Returns justified string. Keyword args: string -- string largo para que se note maxWidth -- ancho del texto final Use: print(Justify(string, maxWidth)) """ words = string.split() res, cur, num_of_letters = [], [], 0 for w in wo...
''' Created on Apr 8, 2010 @author: jose '''
class Solution: def findDisappearedNumbers(self, nums): """ :type nums: List[int] :rtype: List[int] """ nums = [0] + nums for i in range(len(nums)): index = abs(nums[i]) nums[index] = -abs(nums[index]) return [i for i in range(len(nums)...
"""CODE FOR DB STATS""" """ on guild join @client.event async def on_guild_join(guild): connect = sqlite3.connect("files/stats.db") cursor = connect.cursor() cursor.execute(f"INSERT into stats VALUES ({guild.id}, 0, 0, 0, 0)") connect.commit() connect.close() """ # enable stats ""...
""" Given an array of positive integers nums and a positive integer target, return the minimal length of a contiguous subarray [numsl, numsl+1, ..., numsr-1, numsr] of which the sum is greater than or equal to target. If there is no such subarray, return 0 instead. Example 1: Input: target = 7, nums = [2,3,1,2,4,3]...
# calculations print('plus:', 1 + 2, 'minus:', 1 - 2, 'multiple:', 4 * 5, 'division:', 7 / 5) print('share:', 7 // 5, 'rest:', 7 % 5, 'square:', 3 ** 2) # data types print('types:', type(10), type(1.0), type('a')) # variables x = 10 # initialization and substisution print('x:', x) x = 100 # substisution print('x:'...
# Practice Quiz: Object-oriented programming # 1. Let's test your knowledge of using dot notation to access methods # and attributes in an object. Let's say we have a class called Birds. # Birds has two attributes: color and number. Birds also has a # method called count() that counts the number of birds (add...
# Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original # BST is changed to the original key plus sum of all keys greater than the original key in BST. # ex # Input: The root of a Binary Search Tree like this: # 5 # / \ # 2 13 # # ...
#: Regular expression for a valid GitHub username or organization name. As of #: 2017-07-23, trying to sign up to GitHub with an invalid username or create #: an organization with an invalid name gives the message "Username may only #: contain alphanumeric characters or single hyphens, and cannot begin or end #: with ...
# test builtin abs print(abs(False)) print(abs(True)) print(abs(1)) print(abs(-1)) print("PASS")
# 1. Создать произвольный словарь # 2. Добавить новый элемент с ключом типа str и значением типа int # 3. Добавить новый элемент с ключом типа кортеж(tuple) и значением типа список(list) # 4. Получить элемент по ключу # 5. Удалить элемент по ключу # 6. Получить список ключей словаря dict_one = {'key1': 'value1', 'key2...
class Solution: def simplifyPath(self, path: str) -> str: """ Given an absolute path for a file (Unix-style), simplify it. Or in other words, convert it to the canonical path. In a UNIX-style file system, a period . refers to the current directory. Furthermore, a doub...
# full run list # shape: {number: type} (all string) # select the run numbers or types to be opened with nRunToOpen... nRun0 = {}
# https://adventofcode.com/2020/day/5 #part 1 with open("./input_day5.txt", encoding="utf-8") as input: seat_codes = input.readlines() def half(direction, low, high, lower_half): if high-low == 1: return low if direction[0] == lower_half else high if direction[0] == lower_half: high = lo...
# 1-T ismlar degan ro'yxat yarating va kamida 3 ta yaqin do'stingizning ismini kiriting ismlar = ["Anvar","Ulug'bek","Umid"] # 2- T Ro'yxatdagi har bir do'stingizga qisqa xabar yozib konsolga chiqaring: print(f"Salom {ismlar[0]},bugun choyxona bormi.\n{ismlar[1]} bugun choyxonaga boramizmi?.\n{ismlar[2]} ishingdan ch...
error_codes = { 'address_incorrect': 'Enter proxy address in correct format.', 'port_incorrect': 'Proxy port should be an integer between 0 and 65535.', 'credentials_incorrect': 'Only username or only password cannot be null.' } class Credentials: """ Class to hold the pro...
# STUB: do NOT upload to the ESP, it's used to run the tests def alloc_emergency_exception_buf(): """stub method.""" def const(self): return 20000 def heap_lock(): """stub method.""" def heap_unlock(): """stub method.""" def kbd_intr(): """stub method.""" def mem_info(): """stub method...
snake = "Python!" langth = 42 sckary = True if sckary: print("Ahhh!!!") else: print("Phew!!!") for letter in snake: print(letter) def grow(size): global langth langth = langth + size print("The python is now {}m long!".format(langth)) grow(3) class Employee: # Common base count for a...
class Solution: def reconstructMatrix(self, upper: int, lower: int, colsum: 'List[int]') -> 'List[List[int]]': if sum(colsum) != upper + lower: return [] n = len(colsum) res = [[0] * n for _ in range(2)] def solve(k, u, l): if u < 0 or l < 0: r...
class Solution: def climbStairs(self, n: int) -> int: f0 = f1 = 1 for _ in range(n): f0, f1 = f1, f0 + f1 return f0 if __name__ == "__main__": solver = Solution() print(solver.climbStairs(2)) print(solver.climbStairs(3))
class dotRebarGroup_t(object): # no doc aSpacingMultipliers = None aSpacings = None aX = None aY = None aZ = None EndHook = None EndPoint = None ExcludeType = None nPointsInPolygon = None nPolygons = None nSpacingValues = None Reinforcement = None SpacingType = No...
""" Project Euler - Problem Solution 007 Copyright (c) Justin McGettigan. All rights reserved. https://github.com/jwmcgettigan/project-euler-solutions """ def get_nth_prime(nth): limit = nth primes, composites = set(), set() num_primes = 0 while(num_primes < nth): limit *= 2 # increase the limit if there a...
class Solution: def letterCombinations(self, digits: str) -> List[str]: mapping = { "2": "abc", "3": "def", "4": "ghi", "5": "jkl", "6": "mno", "7": "pqrs", "8": "tuv", "9": "wxyz" } leng...
def get_sub_expression(expression): opening_bracket_indices = [] sub_expressons = [] for i in range(len(expression)): ch = expression[i] if ch == "(": opening_bracket_indices.append(i) elif ch == ")": start_index = opening_bracket_indices.pop() end...
# https://leetcode.com/problems/largest-odd-number-in-string/ class Solution: def largestOddNumber(self, num: str) -> str: flag = True for i in range(len(num)-1, -1, -1): if int(num[i]) % 2 != 0: return num[:i+1] else: continue ...
train_data_dir = "trainingData" test_data_dir = "testData" original_data_dir = "data/HAM10000_images_part_1" original_test_data_dir = "data/HAM10000_images_part_2" ##### HYPERPARAMETERS # NN_IMAGE_COUNT = sample_count_in_folder(train_data_dir) NN_BATCH_SIZE = 2 NN_CLASSIFIER_WIDTH = 256 NN_EPOCH_COUNT = 200 NN_FINETUN...
def threeNumberSum(array, targetSum): array.sort() results = [] init = array.pop(0) queue = [([init], init)] while array: new = array.pop(0) arr = [(q[0] + [new], q[1] + new) for q in queue] queue.append(([new], new)) for tp in arr: if len(tp[0]) < 3: ...
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "NxPO - Employee Division", "version": "14.0.1.0.0", "license": "AGPL-3", "category": "NxPO", "author": "Ecosoft", "depends": ["hr"], "data": [ "securi...
"""Helper function which holds data from unicodedata library.""" # # (C) Pywikibot team, 2018-2020 # # Distributed under the terms of the MIT license. # # A mapping of characters to their MediaWiki title-cased forms. Python, # depending on version, handles these characters differently, which causes # errors in normali...
def advance(memory, memory_pointer): memory_pointer += 1 if memory_pointer > len(memory) - 1: memory.append(0) return memory, memory_pointer def retreat(memory, memory_pointer): memory_pointer -= 1 return memory, memory_pointer def increment(memory, memory_pointer): memory[memory_pointer] += 1 ...
# 24. In calculus, the derivative of x^4 is 4x^3. The derivative of x^5 is 5x^4. The derivative of x^6 is # 6x^5. This pattern continues. Write a program that asks the user for input like x^3 or x^25 # and prints the derivative. For example, if the user enters x^3, the program should print out # 3x^2. # input: factor ...
# -*- python -*- # Copyright 2018-2019 Josh Pieper, jjp@pobox.com. # # 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 a...
# Copyright 2013 10gen Inc. # # 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...
class Solution: def maxCount(self, m, n, ops): """ :type m: int :type n: int :type ops: List[List[int]] :rtype: int """ if len(ops) == 0: return m * n minX = minY = float('inf') for op in ops: minX = min(minX, op[0]) min...
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def isCousins(self, root, x, y): """ :type root: TreeNode :type x: int :type y: int :rtype...
def chunk(list, size): n = max(1, size) return (list[i:i + n] for i in range(0, len(list), n)) def valids(sides): return sum((1 for x, y, z in sides if x + y > z and y + z > x and x + z > y)) def triangles(input): return (map(int, t.split()) for t in input) def day3(input): transposed = (chunk(x,...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # @Script: solution.py # @Author: Pradip Patil # @Contact: @pradip__patil # @Created: 2018-02-10 21:18:08 # @Last Modified By: Pradip Patil # @Last Modified: 2018-02-10 21:21:21 # @Description: https://www.hackerrank.com/challenges/python-arithmetic-operators/problem if _...
# # PySNMP MIB module RFC1315-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1315-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 16:59:09 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, 0...
""" Provides utility functions. """ def merge_dicts(source, destination): """ Recursively merges two dictionaries source and destination. The source dictionary will only be read, but the destination dictionary will be overwritten. """ for key, value in source.items(): if isinstance(value, d...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- try: f = open('D:\\PycharmProjects\\learn_python\\README.md','r', encoding='utf-8') print(f.read()) finally: if f: f.close() with open('D:\\PycharmProjects\\learn_python\\README.md','r', encoding='utf-8') as f: for line in f.readlines(): pr...
#Colors BLACK = 0x0 WHITE = 0xFFFFFF GRAY = 0x888888 BLUE = 0x0000FF GREEN = 0x006400 ICE_BLUE = 0x99FFFF RED = 0xB11A27 ORANGE = 0xFF793B YELLOW = 0xFFF325 INDIGO = 0x6F00EE VIOLET = 0x9700DE def draw_plot(): pass
# print(4>3) # print(4==4) # print(4<3) # print(4>=3) # print(3>=3) age = int(input("Age of students: ")) age_ate_school = int(input("Age of students: ")) print(age== age_ate_school)
############# ### NODES ### ############# class NumberNode: def __init__(self, num_node_token): self.num_node_token = num_node_token def __repr__(self): return f'{self.num_node_token}' class BinaryOperationNode: def __init__(self, left_node, binary_operation_token, right_node): ...