content
stringlengths
7
1.05M
print("What is your name?") name = input() print("How old are you?") age = int(input()) print("Where do you live?") residency = input() print("This is `{0}` \nIt is `{1}` \n(S)he live in `{2}` ".format(name, age, residency))
#!/usr/bin/env python3 class TypeCacher(): def __init__(self): self.cached_types = {} self.num_cached_types = 0 def get_cached_type_str(self, type_str): if type_str in self.cached_types: cached_type_str = 'cached_type_%d' % self.cached_types[type_str] else: ...
def txt_category_to_dict(category_str): """ Parameters ---------- category_str: str of nominal values from dataset meta information Returns ------- dict of the nominal values and their one letter encoding Example ------- "bell=b, convex=x" -> {"bell": "b", "convex": "x"} ""...
#!/usr/bin/env python # coding: utf-8 # In[172]: #Algorithm: S(A) is like a Pascal's Triangle #take string "ZY" for instance #S(A) of "ZY" can look like this: row 0 " " # row 1 Z Y # row 2 ZZ ZY YZ YY # row 3 ZZZ Z...
def Psychiatrichelp(thoughts, eyes, eye, tongue): return f""" {thoughts} ____________________ {thoughts} | | {thoughts} | PSYCHIATRIC | {thoughts} | HELP | {thoughts} |____________________| ...
# -*- coding: utf-8 #Ex. Dicionário: alunos = {} for _ in range(1, 4): nome = input('Digite o nome: ') nota = float(input('Digite a nota: ')) alunos[nome] = nota print(alunos) soma = 0 for nota in alunos.values(): #print(nota) soma += nota print('Media: ', soma / 3)
SECRET_KEY = '' DEBUG = False ALLOWED_HOSTS = [ #"example.com" ]
# Sort Alphabetically presenters=[ {'name': 'Arthur', 'age': 9}, {'name': 'Nathaniel', 'age': 11} ] presenters.sort(key=lambda item: item['name']) print('--Alphabetically--') print(presenters) # Sort by length (Shortest to longest ) presenters.sort(key=lambda item: len (item['name'])) print('-- length --') pri...
class SingletonMeta(type): _instance = {} def __call__(cls, *args, **kwargs): if cls not in cls._instance: cls._instance[cls] = super(SingletonMeta, cls).__call__(*args, **kwargs) return cls._instance[cls]
# Created by MechAviv # Full of Stars Damage Skin (30 Day) | (2436479) if sm.addDamageSkin(2436479): sm.chat("'Full of Stars Damage Skin (30 Day)' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
# -*- coding: utf-8 -*- """ Created on 2020/12/21 15:04 @author: pipazi """ def L1_1_1(a): return a + 1
FIREWALL_FORWARDING = 1 FIREWALL_INCOMING_ALLOW = 2 FIREWALL_INCOMING_BLOCK = 3 FIREWALL_OUTGOING_BLOCK = 4 FIREWALL_CFG_PATH = '/etc/clearos/firewall.conf' def getFirewall(fw_type): with open(FIREWALL_CFG_PATH,'r') as f: lines = f.readlines() lines = [line.strip('\t\r\n\\ ') for line in lines] ...
# SPDX-License-Identifier: MIT # Copyright (c) 2021 Akumatic # # https://adventofcode.com/2021/day/02 def read_file() -> list: with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f: return [(s[0], int(s[1])) for s in (line.split() for line in f.read().strip().split("\n"))] def part1(commands: list...
#!/usr/bin/env python # coding: utf-8 # #### We create a function cleanQ so we can do the cleaning and preperation of our data # #### INPUT: String # #### OUTPUT: Cleaned String def cleanQ(query): query = query.lower() tokenizer = RegexpTokenizer(r'\w+') tokens = tokenizer.tokenize(query) stemmer=[p...
#5times range print('my name i') for i in range (5): print('jimee my name ('+ str(i) +')')
class Node(): def __init__(self, val): self.val = val self.left = None self.right = None class BST(): def __init__(self): self.root = Node(None) def insert(self, new_data): if self.root is None: self.root = Node(new_data) else: if...
# https://app.codesignal.com/arcade/code-arcade/loop-tunnel/xzeZqCQjpfDJuN72S def additionWithoutCarrying(param1, param2): # Add the values of each column of each number without carrying. # Order them smaller and larger value. param1, param2 = sorted([param1, param2]) # Convert both values to strings. ...
# Author: @Iresharma # https://leetcode.com/problems/reverse-integer/ """ Runtime: 20 ms, faster than 99.38% of Python3 online submissions for Reverse Integer. Memory Usage: 14.2 MB, less than 71.79% of Python3 online submissions for Reverse Integer. """ class Solution: def reverse(self, x: int) -> int: i...
# 1137. N-th Tribonacci Number # Runtime: 32 ms, faster than 35.84% of Python3 online submissions for N-th Tribonacci Number. # Memory Usage: 14.3 MB, less than 15.94% of Python3 online submissions for N-th Tribonacci Number. class Solution: # Space Optimisation - Dynamic Programming def tribonacci(self, n:...
# Exercise2.p1 # Variables, Strings, Ints and Print Exercise # Given two variables - name and age. # Use the format() function to create a sentence that reads: # "Hi my name is Julie and I am 42 years old" # Set that equal to the variable called sentence name = "Julie" age = "42" sentence = "Hi my name is {} and i ...
#! /usr/bin/python # -*- coding:utf-8 -*- """ Author: AsherYang Email: ouyangfan1991@gmail.com Date: 2018/5/17 Desc: 网络返回分类 """ class NetCategory: def __init__(self): self._id = None self._code = None self._parent_code = None self._name = None self._logo = None ...
# -*- coding: UTF-8 -*- # author:昌维[867597730@qq.com] # github:https://github.com/cw1997 # 单页记录数(常量) record_num = 20
class Solution: def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. """ len1 = len(nums) if k == 0 or len1 == 1: return a1, b1, a2, b2 = 0, len1 - 1 - k, len1...
def ordinal(num): suffixes = {1: 'st', 2: 'nd', 3: 'rd'} if 10 <= num % 100 <= 20: suffix = 'th' else: suffix = suffixes.get(num % 10, 'th') return str(num) + suffix def num_to_text(num): texts = { 1: 'first', 2: 'second', 3: 'third', 4: 'fourth', ...
#To reverse a given number def ReverseNo(num): num = str(num) reverse = ''.join(reversed(num)) print(reverse) Num = int(input('N= ')) ReverseNo(Num)
def age_assignment(*args, **kwargs): answer = {} for arg in args: for k, v in kwargs.items(): if arg[0] == k: answer[arg] = v return answer
class Solution: def restoreString(self, s: str, indices: List[int]) -> str: answer = "" for i in range(len(indices)): answer += s[indices.index(i)] return answer
{ ".py": { "from osv import osv, fields": [regex("^from osv import osv, fields$"), "from odoo import models, fields, api"], "from osv import fields, osv": [regex("^from osv import fields, osv$"), "from odoo import models, fields, api"], "(osv.osv)": [regex("\(osv\.osv\)"), "(models.Model)"],...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findTarget(self, root: Optional[TreeNode], k: int) -> bool: nums = [] self.nodeValueExtr...
""" Define your BigQuery tables as dataclasses. """ __version__ = "0.4"
# -*- coding: utf-8 -*- """ BlueButtonFHIR_API FILE: __init__.py Created: 12/15/15 4:42 PM """ __author__ = 'Mark Scrimshire:@ekivemark'
# Encapsulation: intance variables and methods can be kept private. # Abtraction: each object should only expose a high level mechanism # for using it. It should hide internal implementation details and only # reveal operations relvant for other objects. # ex. HR dept setting salary using setter method class Software...
n, m = map(int, input().split()) student = [tuple(map(int, input().split())) for _ in range(n)] check_points = [tuple(map(int, input().split())) for _ in range(m)] for a, b in student: dst_min = float('inf') ans = float('inf') for i, (c, d) in enumerate(check_points): now = abs(a - c) + abs(b - d) ...
# # Copyright Soramitsu Co., Ltd. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # grantable = { 'can_add_my_signatory': 'kAddMySignatory', 'can_remove_my_signatory': 'kRemoveMySignatory', 'can_set_my_account_detail': 'kSetMyAccountDetail', 'can_set_my_quorum': 'kSetMyQuorum', 'can_tran...
def printName(): print("I absolutely \nlove coding \nwith Python!".format()) if __name__ == '__main__': printName()
#Solution def two_out_of_three(nums1, nums2, nums3): stored_master = {} stored_1 = {} stored_2 = {} stored_3 = {} for i in range(0, len(nums1)): if nums1[i] not in stored_1: stored_1[nums1[i]] = 1 stored_master[nums1[i]] = 1 else: pass for i in range(0, len(nums2)): ...
# Time: O(n), n is the number of cells # Space: O(n) class Solution(object): def cleanRoom(self, robot): """ :type robot: Robot :rtype: None """ directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] def goBack(robot): robot.turnLeft() robot.turnLe...
#!/bin/python3 __author__ = "Adam Karl" """The Collatz sequence is defined by: if n is even, divide it by 2 if n is odd, triple it and add 1 given N, which number less than or equal to N has the longest chain before hitting 1?""" #first line t number of test cases, then t lines of values for N #Constraints: 1 <= T <= ...
#!/usr/bin/python # -*- coding: UTF-8 -*- valor_emprestado = float(input("Entre com o valor total da dívida: ")) juros = float(input("Entre com o juros mensal da dívida: ")) parcela = float(input("Entre com o valor da parcela: ")) acumulador = valor_emprestado meses = 0 contador = True while contador: ...
""" Defaults for deployment. """ # Default work path default_work_path: str = "" # Default config var names config_const: str = "const" config_options: str = "options" config_arg: str = "arg" config_var: str = "var" config_alias: str = "alias" config_stage: str = "stage"
#6 uniform distribution p=[0.2, 0.2, 0.2, 0.2, 0.2] print(p) #7 generalized uniform distribution p=[] n=5 for i in range(n): p.append(1/n) print(p) #11 pHit and pMiss # not elegent but does the job pHit=0.6 pMiss=0.2 p[0]=p[0]*pMiss p[1]=p[1]*pHit p[2]=p[2]*pHit p[3]=p[3]*pMiss p[4]=p[4]*pMiss ...
BASE_DEPS = [ "//jflex", "//jflex:testing", "//java/jflex/testing/testsuite", "//third_party/com/google/truth", ] def jflex_testsuite(**kwargs): args = update_args(kwargs) native.java_test(**args) def update_args(kwargs): if ("deps" in kwargs): kwargs["deps"] = kwargs["deps"] + BAS...
# Time: O(m * n) # Space: O(1) class Solution(object): def isToeplitzMatrix(self, matrix): """ :type matrix: List[List[int]] :rtype: bool """ return all(i == 0 or j == 0 or matrix[i-1][j-1] == val for i, row in enumerate(matrix) ...
ISCSI_CONNECTIVITY_TYPE = "iscsi" FC_CONNECTIVITY_TYPE = "fc" SPACE_EFFICIENCY_THIN = 'thin' SPACE_EFFICIENCY_COMPRESSED = 'compressed' SPACE_EFFICIENCY_DEDUPLICATED = 'deduplicated' SPACE_EFFICIENCY_THICK = 'thick' SPACE_EFFICIENCY_NONE = 'none' # volume context CONTEXT_POOL = "pool"
bch_code_parameters = { 3:{ 1:4 }, 4:{ 1:11, 2:7, 3:5 }, 5:{ 1:26, 2:21, 3:16, 5:11, 7:6 }, 6:{ 1:57, 2:51, 3:45, 4:39, 5:36, 6:30, 7:24, 10:18, 11:...
stop = '' soma = c = maior = menor = 0 while stop != 'N': n = int(input('Digite outro numero inteiro: ')) stop = str(input('Quer outro numero [S/N]? ')).strip().upper()[0] if stop != 'S' and stop != 'N': print('\033[31mOpção inválida! Numero anterior desconsiderado.\033[m') else: soma +=...
XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX
""" A collection of update operations for TinyDB. They are used for updates like this: >>> db.update(delete('foo'), where('foo') == 2) This would delete the ``foo`` field from all documents where ``foo`` equals 2. """ def delete(field): """ Delete a given field from the document. """ def transform(...
CONFIGS = { "session": "1", "store_location": ".", "folder": "Estudiante_1", "video": True, "audio": False, "mqtt_hostname": "10.42.0.1", "mqtt_username" : "james", "mqtt_password" : "james", "mqtt_port" : 1883, "dev_id": "1", "rap_server": "10.42.0.1" } CAMERA = { "brig...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here n = int(input()) directions = list(map(int,...
def solution(A): exchange_0 = exchange_1 = pos = -1 idx = 1 while idx < len(A): if A[idx] < A[idx - 1]: if exchange_0 == -1: exchange_0 = A[idx - 1] exchange_1 = A[idx] else: return False if exchange_0 > 0: if A[idx] > exchange_0: if A[idx - 1] > exchan...
NUMBER_COUNT = 10 class Data: def __init__(self, inputs, result=None): self.inputs = inputs self.results = [-1] * NUMBER_COUNT if result is not None: self.results[result] = 1 # датасет имеет вид типа: # 111 # 001 # 001 # 001 # 001 # цифра 7 изображена как буква перевернутая "...
### WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ### ### This file MUST be edited properly and copied to settings.py in order for ### SMS functionality to work. Get set up on Twilio.com for the required API ### keys and phone number settings. ### ### WARNING WARNING WARNING WARNING WARNING WA...
# attributes are characteristics of an object defined in a "magic method" called __init__, which method is called when a new object is instantiated class User: # declare a class and give it name User def __init__(self): self.name = "Steven" self.email = "swm9220@gmail.com" self.account_bala...
# Algorithmic question ## Longest Palindromic Subsequence # Given a string S, a subsequence s is obtained by combining characters in their order of appearance in S, whatever their position. The longest palindromic subsequence could be found checking all subsequences of a string, but that would take a running time of O...
# import numpy as np # import matplotlib.pyplot as plt class TimeBlock: def __init__(self,name,level,time,percentage): self.name = name self.level = int(level) self.percentage = float(percentage) self.time = float(time) self.children = [] self.parent = [] def A...
_base_ = [ '../../_base_/models/swin/swin_small.py', '../../_base_/default_runtime.py' ] pretrained_path='pretrained/swin_small_patch244_window877_kinetics400_1k.pth' model=dict(backbone=dict(patch_size=(2,4,4), drop_path_rate=0.1, pretrained2d=False, pretrained=pretrained_path),cls_head=dict(num_classes=2),test_c...
permissions_admin = {} permissions_kigstn = {} permissions_socialist = {} # todo
# Definition for a binary tree node. """ timecomplexity = O(n) when construct the maximun tree, use a stack to protect the cur element which can be joined to the tree as its sequence for example [3,2,1,6,0,5] if cur < = stack.pop add next into stack and let cur be pop's rightnode else pop the element from stack un...
print("Python has three numeric types: int, float, and complex") myValue=1 print(myValue) print(type(myValue)) print(str(myValue) + " is of the data type " + str(type(myValue))) myValue=3.14 print(myValue) print(type(myValue)) print(str(myValue) + " is of the data type " + str(type(myValue))) myValue=5j print(myValue) ...
N=int(input("numero? ")) if N % 2 == 0: valor = False else: valor = True i=3 while valor and i <= N-1: valor=valor and (N % i != 0) i = i + 2 print(valor)
# Melhore o desafio 61 perguntando para o usuário se ele quer # mostrar mais alguns termos. O programa encerrará # quando ele disser que quer mostrar 0 termos. p = int(input('Primeiro termo: ')) r = int(input('Razão: ')) x = 10 c = 0 while x > 0: print(p, end=' > ') p += r x -= 1 c += 1 if x < 1: ...
#!/usr/bin/env python EXAMPLE = """class: 1-3 or 5-7 row: 6-11 or 33-44 seat: 13-40 or 45-50 your ticket: 7,1,14 nearby tickets: 7,3,47 40,4,50 55,2,20 38,6,12 """ def parse_input(text): """Meh >>> parse_input(EXAMPLE) ({'class': [(1, 3), (5, 7)], 'row': [(6, 11), (33, 44)], 'seat': [(13, 40), (45, 50)...
#Crie um programa que leia vários números inteiros pelo teclado. O programa só vai parar quando o usuário digitar o valor 999, que é a condição de parada. No final, mostre quantos números foram digitados e qual foi a soma entre eles (desconsiderando o flag). número = contador = soma = 0 número = int(input('Digite um nú...
NSNAM_CODE_BASE_URL = "http://code.nsnam.org/" PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen' LOCAL_PYBINDGEN_PATH = 'pybindgen' # # The last part of the path name to use to find the regression traces tarball. # path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX + TRACEBALL_SUFFIX, # e.g., ns-3-dev-ref-tr...
# データが適した状態かどうかをチェックする関数 # 対象ファミリはrate以上、それ以外のファミリが1以上検体がリストに存在するかどうかを確認 def check_more_rate(flag, rate, target, tmp_fam_list): for tmp_fam in tmp_fam_list: if tmp_fam.name == target.name: if tmp_fam.num < rate: flag = True return flag, tmp_fam_list ...
class Person: def __init__(self, person_id, name): self.person_id = person_id self.name = name self.first_page = None self.last_pages = [] class Link: def __init__(self, current_page_number, person=None, colour_id=None, image_id=None, group_id=None): self.current_page_...
#!/usr/bin/env python # Put non-encoded C# payload below. # msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.229.129 LPORT=2600 -f csharp # Put only byte payload below payload = [] def cspretty(buf_payload): """ Take in list of hex bytes and make the appropriate format for C# code. """ bu...
page_01=""" { "title": "September 27th, 2020", "children": [ { "string": "I'm exploring Roam. At present it looks like the application I have been looking for (and wanting to build) for decades!", "create-email": "romilly.cocking@gmail.com", "create-time": 1601199052228, "...
class KeyHolder(): key = "(_e0p73$co#nse*^-(3b60(f*)6h1bmaaada@kleyb)pj5=1)6" email_user = 'HuntAdminLototron' email_password = '0a4c9be34e616e91c9516fdd07bf7de2'
A = Matrix([[1, 2], [-2, 1]]) A.is_positive_definite # True A.is_positive_semidefinite # True p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
# x_2_4 # # 「a」「b」「c」「d」がそれぞれどんな値となるかを予想してください def full_name_a(first_name, last_name): a = first_name + last_name print(a) # => 山田太郎(姓名ともに引数から) def full_name_b(first_name, last_name): first_name = '山中' b = first_name + last_name print(b) # => 山中太郎(姓は関数内で上書きされたため) def full_name_c(first_name): ...
""" Morse code, as we are all aware, consists of dots and dashes. Lets define a "Morse code sequence" as simply a series of dots and dashes (and nothing else). So ".--.-.--" would be a morse code sequence, for instance. Dashes obviously take longer to transmit, that's what makes them dashes. Lets say that a dot takes ...
top_html = """<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> </head> <frameset cols="20%,*"> <frame src="tree.xml"/> <frame src="plotter.xml"/> </frameset> </html> """
def gitignore_content() -> str: return """ lib # Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generat...
# x, y: arguments x = 2 y = 3 # a, b: parameters def function(a, b): print(a, b) function(x, y) # default arguments def function2(a, b=None): if b: print(a, b) else: print(a) function2(x) function2(x, b=y) # bei default parametern immer variable= -> besser lesbar # Funktionen ohne retu...
class LogMessage: text = "EMPTY" stack = 1 # for more than one equal message in a row replaceable = False color = (200, 200, 200) def __init__(self, text, replaceable=False, color=(200, 200, 200)): self.text = text self.replaceable = replaceable self.color = color
cfiles = {"train_features":'./legacy_tests/data/class_train.features', "train_labels":'./legacy_tests/data/class_train.labels', "test_features":'./legacy_tests/data/class_test.features', "test_labels":'./legacy_tests/data/class_test.labels'} ...
class Solution: def findAnagrams(self, s: str, p: str) -> List[int]: if len(s) < len(p): return [] sl = [] ans = [] pl =[0]*26 for i in p: pl[ord(i)-97]+=1 for ix, i in enumerate(s): if not sl: ...
answer_tr = """ Soru: $input Cevap:""" completion_tr = """ İpucu: Nasa uzay üssünde yeni bir deneme Cümle: Nasa uzay üssünde yeni bir deneme yapıyormuş. Gönüllü başvuranlar arasından Temel, astronot adayı olarak seçilmiş. Ön elemede oldukça sıkı testleri geçen Temel; 3 aylik ikinci bir eğitim ile iyi bir astronot olab...
Pt = tuple[int, int] Inst = tuple[str, int] def main(): with open("inputs/day_13.txt", 'r') as f: grid, instructions = parse_inputs(f.read()) count, code = solve(grid, instructions) print(f"Part One: {count}") print(f"Part Two:\n{code}") def parse_inputs(inputs: str) -> tuple[set[Pt], list[...
#!/usr/bin/env python3 s = '{19}' print('s is:', s) n = s[2:-1] print(n) # make n=20 copies of '1': # idea: use a loop def make_N_copies_of_1(s): n = s[2:-1] # number of copies i = 0 result = '' while i < int(n): result += '1' i += 1 return result print(make_20_copies_of_1(s))
# Usage: python3 l2bin.py source = open('MCZ.PROM.78089.L', 'r') dest = open('MCZ.PROM.78089.BIN', 'wb') next = 0 for line in source: # Useful lines are like: 0013 210000 if len(line) >= 8 and line[0] != ' ' and line[7] != ' ': parts = line.split() try: address = int(parts[0], 16)...
#encoding:utf-8 subreddit = 'cyberpunkgame+LowSodiumCyberpunk' t_channel = '@r_cyberpunk2077' def send_post(submission, r2t): return r2t.send_simple(submission)
global_var = 0 def outter(): def inner(): global global_var global_var = 10 inner() outter() print(global_var)
# 0 - establish connection # 1 - service number 1 # 2 - service number 2 # 3 - service number 3 # 4 - service number 4 # 5 - non-idempotent service - check number of flights # 6 - idempotent service - give this information service a like and retrieve how many likes this system has # 11 - int # 12 - string # 13 - date-...
def f(n): max_even=len(str(n))-1 if str(n)[0]=="1": max_even-=1 for i in range(n-1, -1, -1): if i%2==0 or i%3==0: continue if count_even(i)<max_even: continue if isPrime(i): return i def isPrime(n): for i in range(2, int(n**0.5)+1): ...
# testing the num_cells computation def compute_num_cells(max_delta_x, pt0x, pt1x): """compute the number of blocks associated with the max_delta_x for the largest spatial step (combustion chamber) Args: max_delta_x (double): User defined maximum grid spacing. pt0x (double): x-coordinate of botto...
# We have to find no of numbers between range (a,b) which has consecutive set bits. # Hackerearth n, q = map(int, input().split()) arr = list(map(int, input().split())) for k in range(n): l, h = map(int, input().split()) count = 0 for i in range(l-1, h): if "11" in bin(arr[i]): count+=1 print(count)
# -*- coding: utf8 -*- # Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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...
# Twitter API Keys #Given # consumer_key = "Ed4RNulN1lp7AbOooHa9STCoU" # consumer_secret = "P7cUJlmJZq0VaCY0Jg7COliwQqzK0qYEyUF9Y0idx4ujb3ZlW5" # access_token = "839621358724198402-dzdOsx2WWHrSuBwyNUiqSEnTivHozAZ" # access_token_secret = "dCZ80uNRbFDjxdU2EckmNiSckdoATach6Q8zb7YYYE5ER" #Generated on June 21st 2018 # ...
numbers = input().split(" ") max_number = '' biggest = sorted(numbers, reverse = True) for num in biggest: max_number += num print(max_number)
########################################################################## # Author: Samuca # # brief: change and gives information about a string # # this is a list exercise available on youtube: # https://www.youtube.com/playlist?list=PLHz_AreHm4dm6wYOIW20Nyg12TAjmMGT- ##############################################...
end_line_chars = (".", ",", ";", ":", "!", "?", "-") def split_into_blocks(text, line_length, block_size): words = text.strip("\n").split() current_line = "" lines = [] blocks = [] char_counter = 0 for i, word in enumerate(words): # check every word if len(lines) < (block_size - 1): ...
#Set the request parameters url = 'https://instanceName.service-now.com/api/now/table/sys_script' #Eg. User name="username", Password="password" for this code sample. user = 'yourUserName' pwd = 'yourPassword' #Set proper headers headers = {"Content-Type":"application/json","Accept":"application/json"} # Set Business...
{ 'targets' : [{ 'variables': { 'lib_root' : '../libio', }, 'target_name' : 'fake', 'sources' : [ ], 'dependencies' : [ './export.gyp:export', ], }] }
#!/usr/bin/env python3 """Binary Search Tree.""" class Node: """Node for Binary Tree.""" def __init__(self, value, left=None, right=None, root=True): """Node for Binary Search Tree. value - Value to be stored in the tree node. left node - default value is None. right node - ...
# # PySNMP MIB module AT-PVSTPM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AT-PVSTPM-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:30:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
class ShiftCipher: def __init__(self, affineMultiplier, constantShift): self.affineMultiplier = affineMultiplier self.constantShift = constantShift def encode(self, messageInList): for i in range(len(messageInList)): if ord(messageInList[i])!=32: messageInLis...
all_nums = [] for i in range(10, 1000000): total = 0 for l in str(i): total += int(l) ** 5 if int(total) == int(i): all_nums.append(int(total)) print(sum(all_nums))