content
stringlengths
7
1.05M
def parse_commands(lines): commands = [] for l in lines: c, offset = l.split() commands.append([c, int(offset)]) return commands def run_command(command, idx, acc): c, offset = command if c == 'acc': acc += offset idx += 1 elif c == 'jmp': idx += offset ...
languages = ["Python", "Perl", "Ruby", "Go", "Java", "C"] lengths = [len(language) for language in languages] print(lengths) z = [x for x in range(0,101) if x%3 ==0] print(z)
class RGB: def __init__(self, r: int, g: int, b: int): self.r = r self.g = g self.b = b
N = int(input()) if N % 2 == 0: print(N) else: print(2 * N)
# Class which represents the university object and its data class University: def __init__(self, world_rank, name, national_rank, education_quality, alumni_employment, faculty_quality, publications, influence, citations, impact, patents, aggregate_rank): self.id = world_rank self....
""" 761. Smallest Subset https://www.lintcode.com/problem/smallest-subset/description first sort, then calculate prefix sum. """ class Solution: """ @param arr: an array of non-negative integers @return: minimum number of elements """ def minElements(self, arr): # write your code here ...
"""shaarli-client""" __title__ = 'shaarli_client' __brief__ = 'CLI to interact with a Shaarli instance' __version__ = '0.4.0' __author__ = 'The Shaarli Community'
''' Since 1926, the Belmont Stakes is a 1.5 mile-long race of 3-year old thoroughbred horses. Secretariat ran the fastest Belmont Stakes in history in 1973. While that was the fastest year, 1970 was the slowest because of unusually wet and sloppy conditions. With these two outliers removed from the data set, compute th...
# Test for existing rows def check_row_number(cur, tables): """ Check number of rows greater one for sql tables Args: cur (object): PostgreSQL curser object tables (list): List of string of table names """ for table in tables: cur.execute(f"SELECT COUNT(*) FROM {table}...
#if else can be done as a=int(input()) b=int(input()) c=a%2 if a>b: print("{} is greater than {}".format(a,b)) elif a==b: print("{} and {} are equal".format(a,b)) else: print("{} is greater than {}".format(b,a)) #if can be done in single line as if a>b: print("{} is greater".format(a)) print("{} is even"...
# Reading first input, not used anywhere in the program first_input = input() # Reading the input->split->parse to int->elements to set set1 = set(map(int, input().split())) # Same as second_input second_input = input() # Same as set2 set2 = set(map(int, input().split())) # Union of set1 and set2 returns the set of all...
self.description = "Remove a no longer needed package (multiple provision)" lp1 = pmpkg("pkg1") lp1.provides = ["imaginary"] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.provides = ["imaginary"] self.addpkg2db("local", lp2) lp3 = pmpkg("pkg3") lp3.depends = ["imaginary"] self.addpkg2db("local", lp3) self.ar...
k1 = float(input('digite um numero')) k2 = float(input('digite outro numero')) k3 = float(input('digite + 1 numero')) r = float(3 / ((1 / k1) + (1 / k2) + (1 / k3))) print('a media harmonica é {:.2f}'.format(r))
def multiple(first,second): return first * second * 3 def add(x,y): return x+y
config = { 'max_length' : 512, 'class_names' : ['O', 'B-C', 'B-P', 'I-C', 'I-P'], 'ft_data_folders' : ['/content/change-my-view-modes/v2.0/data/'], 'max_tree_size' : 10, 'max_labelled_users_per_tree':10, 'batch_size' : 4, 'd_model': 512, 'init_alphas': [0.0, 0.0, 0.0, -10000., -1000...
load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external") def dependencies(): import_external( name = "commons_lang_commons_lang", artifact = "commons-lang:commons-lang:2.6", jar_sha256 = "50f11b09f877c294d56f24463f47d28f929cf5044f648661c0f0cfbae9a2f49c", srcja...
reiting = [7, 5, 5, 2, 1] new_element = int(input("введите новый элемент: ")) for ind, element in enumerate(reiting): if new_element >= element: ind = ind - 1 break reiting.insert(ind + 1, new_element) print(reiting)
## Class responsible for representing a Sonobouy within Hunting the Plark class Sonobuoy(): def __init__(self, active_range): self.type = "SONOBUOY" self.col = None self.row = None self.range = active_range self.state = "COLD" self.size = 1 ## Setstate allows the change of state which will happen when...
numero1 = int(input('Primeiro número: ')) numero2 = int(input('Segundo número: ')) soma = int (numero1 + numero2) print('A soma entre {} e {} é igual a {}.'.format(numero1, numero2, soma,)) fim = input('\nCurso de Python no YouTube, canal CURSO EM VIDEO.')
def clamp(a, b): if (b < 0 and a >= b) or (b > 0 and a <= b): return a def field(a, b, then): val = clamp(a, b) if val is not None: return round(then(val), 3) def sign_and_magnitude(intg, fract): if fract > 100: return None val = (intg & 0x7F) + fract * 0.01 if int...
def countfreq(input): freq={} for i in input: freq[i]=input.count(i) for key,value in freq.items(): print("%d:%d"%(key,value)) input=[1, 1, 1, 5, 5, 3, 1, 3, 3, 1, 4, 4, 4, 2, 2, 2, 2] countfreq(input)
""" 28. How to find all the local maxima (or peaks) in a numeric series? """ """ Difficiulty Level: L3 """ """ Get the positions of peaks (values surrounded by smaller values on both sides) in ser. """ """ Input """ """ ser = pd.Series([2, 10, 3, 4, 9, 10, 2, 7, 3]) """ """ Desired output """ """ array([1, 5, 7]) """
# # @lc app=leetcode.cn id=66 lang=python3 # # [66] plus-one # None # @lc code=end
class Solution: """ @param n: a positive integer @return: An integer """ def numSquares(self, n): def issq(n): x = int(n**.5) return x * x == n if issq(n): return 1 dp = [0, 1] for i in xrange(2, n + 1): if issq(i): ...
class ZipDataLoader: """ A data loader that zips together two underlying data loaders. The data loaders must be sampling the same batch size and :code:`drop_last` must be set to `True` on data loaders that sample from a fixed-size dataset. Whenever one of the data loaders has a fixed size, this data ...
for i in range(1,5): for j in range(i,5): print(j," " ,end="") print() str1 = "ABCD" str2 = "PQR" for i in range(4): print(str1[:i+1]+str2[i:])
def new(a,b): return a - b def x(a,b): return a def y(z,t): return z(*t) def inModule2(a,b): return a+b def outerMethod(a,b): def innerMethod(a,b): if a < b: return a+b else: return a-b return innerMethod(a+2, b+4)
""" :testcase_name greet :author Sriteja Kummita :script_type Class :description __getattr__ is called when a property/method of a class is used. This class allows three functions which are not defined in the class but can be called using reflection """ class Greet: def __init__(self, name): self.name = n...
#!/usr/bin/env python3 class Observer: """ Objects that are interested in a subject should inherit from this class. """ def notify(self, sender: object): pass
# This function takes a single parameter and prints it. def print_value(x): print(x) print_value(12) print_value("dog")
__version__ = '1.3.0' __url__ = 'https://github.com/mdawar/rq-exporter' __description__ = 'Prometheus exporter for Python RQ (Redis Queue)' __author__ = 'Pierre Mdawar' __author_email__ = 'pierre@mdawar.dev' __license__ = 'MIT'
class ArgErrorType(Exception): """Raised when provided argument is of unsupported type.""" pass class UnreadableFileError(Exception): """Raised when pydicom cannot read provided file.""" pass
# All possible values that should be constant through the entire script ERR_CODE_NON_EXISTING_FILE = 404 ERR_CODE_CREATING_XML = 406 ERR_CODE_COMMAND_LINE_ARGS = 407 ERR_CODE_NON_EXISTING_DIRECTORY = 408 ERR_CODE_NON_EXISTING_W_E = 409 WARNING_CODE_INVALID_FORMAT = 405 WARNING_CODE_NO_PAIR_FOUND = 406 WARNING_NOT_A_...
''' A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? ''' ...
# -*- coding: utf-8 -*- class wcstr(str): def __new__(*args, **kwargs): return str.__new__(*args, **kwargs) def __init__(self, *args, **kwargs): self._update() def _update(self): self.bitindex = [] for i,j in zip(str(self), range(len(str(self)))): iwidth = 1 if...
def twenty_twenty(): """Come up with the most creative expression that evaluates to 2020, using only numbers and the +, *, and - operators. >>> twenty_twenty() 2020 """ return 2019+1
T = (1,) + (2,3) print(T) print(type(T)) #<class 'tuple'> T = T[0], T[1:2], T * 3 # (1, (2,), (1, 2, 3, 1, 2, 3, 1, 2, 3)) print(T) # sorting is not available T = ('aa', 'cc', 'dd', 'bb') tmp = list(T) tmp.sort() T = tuple(tmp) print(T) # or sorted(T) T = ('aa', 'cc', 'dd', 'bb') T = sorted(T) # ['aa', 'bb', 'cc...
class Solution: def exist(self, board, word): m, n, o = len(board), len(board and board[0]), len(word) def explore(i, j, k, q): for x, y in ((i - 1, j), (i, j - 1), (i + 1, j), (i, j + 1)): if k>=o or (0<=x<m and 0<=y<n and board[x][y]==word[k] and (x,y) not in q and expl...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class RHdrcde(RPackage): """Computation of highest density regions in one and two dimensions, kernel estimation o...
f=open("input.txt") Input=sorted(map(int, f.read().split("\n"))) Input = [0] + Input f.close() print(Input) combinationCounts = [1] + [0] * (len(Input) - 1) for i, value in enumerate(Input): for j, adapterValue in enumerate(Input[i+1:], start=i+1): if(adapterValue > value + 3): break c...
# coding: utf-8 country = { 'ARG': 'Argentina', 'BOL': 'Bolivia', 'CHI': 'Chile', 'COL': 'Colombia', 'COS': 'Costa Rica', 'CUB': 'Cuba', 'EQU': 'Ecuador', 'SPA': 'Spain', 'MEX': 'Mexico', 'PER': 'Peru', 'POR': 'Portugal', 'BRA': 'Brazil', 'SOU': 'South Africa', '...
class Solution: def subsets(self, nums): count = len(nums) result = [[]] for i in range(1, 2 ** count): result.append([nums[j] for j in range(count) if i & (2 ** j)]) return result
class Solution: def maximumTime(self, time: str) -> str: hour = time.split(':')[0] minite = time.split(':')[1] if hour[0] == '?': if hour[1] == '?': res_hour = '23' elif hour[1] <= '3': res_hour = str(2)+str(hour[1]) else: ...
# KATA MODULO 09 # EJERCICIO 02 Trabajo con argumentos de palabra clave # Función con un informe preciso de la misión. # Considera hora de prelanzamiento, tiempo de vuelo, destino, tanque externo y tanque interno def report_mision(time_preLaunch,time_takeoff,destiny,tank_extern,tank_intern): print ("T...
texto = 'python' for l in texto: if l == 't': l += 't'.upper() print(l,end='') else: print(l,end='')
# ------------------------------ # 722. Remove Comments # # Description: # # Too long description. Check https://leetcode.com/problems/remove-comments/description/ # # Example 2: # Input: # source = ["a/*comment", "line", "more_comment*/b"] # Output: ["ab"] # Explanation: The original source string is "a/*comment\n...
def flatten(lst_of_lst: list) -> list: return [item for sublist in lst_of_lst for item in sublist] def tests() -> None: print(flatten([[1, 2], [3, 4], [5, 6]])) print(flatten([[1, 4], [5, 4], [5, 6]])) if __name__ == "__main__": tests()
class OceanProviders: """Ocean assets class.""" def __init__(self, keeper, did_resolver, config): self._keeper = keeper self._did_resolver = did_resolver self._config = config def add(self, did, provider_address, account): return self._keeper.did_registry.add_provider(did, ...
class Solution(object): def removeOuterParentheses(self, s): """ :type s: str :rtype: str """ new_string = '' tmp_string = '' left = 0 right = 0 for s_ in s: tmp_string += s_ if s_ == '(': left += 1 ...
__version__ = "0.19.0-dev" __libnetwork_plugin_version__ = "v0.8.0-dev" __libcalico_version__ = "v0.14.0-dev" __felix_version__ = "1.4.0b1-dev"
""" Закодируй число Чип и Дейл устали от публичности. Чтобы как-то обезопасить свои персональные данные, они решили шифровать sms - сообщения. Числа они решили разворачивать. Помогите им написать программу для кодирования чисел. Формат ввода На вход подается целое число n, по модулю не превосходящее 10000. Формат вы...
# # Created on Mon Jun 14 2021 # # The MIT License (MIT) # Copyright (c) 2021 Vishnu Suresh # # 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, # including without limitation...
class Attachment(object): def __init__(self, name, data, length, content_type, origin): self.name = name self.data = data self.length = length self.content_type = content_type self.origin = origin def __str__(self): return f"[{self.length} byte; {self.content_ty...
#!/usr/bin/env python NAME = 'Wallarm (Wallarm Inc.)' def is_waf(self): if self.matchheader(('Server', r"nginx\-wallarm")): return True return False
# -*- coding: utf-8 -*- """ Solution to Project Euler problem 124 - Ordered radicals Author: Jaime Liew https://github.com/jaimeliew1/Project_Euler_Solutions Modified sieve of Eratosthenes that records the product of prime factors. This list is then sorted and the 10000ths entry is returned. """ def run(): N = ...
class Point: def __init__(self, new_x=0, new_y=0): self.x = new_x self.y = new_y def set_point(self, point): (self.x, self.y) = (point.x, point.y)
n1 = float(input("Digite um valor: ")) n2 = float(input("Digite outro valor: ")) r = 0 while r != 5: print('''O que você deseja fazer? MENU: [1] Somar. [2] Multiplicar. [3] Maior [4] Novos números. [5] Sair do programa.''') r = int(input("Opção: ")) if r == 1: s = n1 + n2 ...
# -*- coding: utf-8 -*- """ Config Created on 02/22/2016 @description: Used for @author: Wen Gu @contact: emptyset110@gmail.com """ VERSION = '0.2.0' # 路径配置 # Path Configuration PATH_DATA_ROOT = './data/' PATH_DATA_REALTIME = 'stock_realtime/' PATH_DATA_L2 = 'stock_l2/' # Mongodb连接配置 # Mongodb Configuration ...
test = { 'name': 'q7b', 'points': 1, 'suites': [ { 'cases': [ { 'code': '>>> ' "movies.head(1)['plots'][0]=='Two " 'imprisoned men bond over a ' 'number of years...
csp = { 'default-src': [ '\'self\'' ], 'script-src': [ 'https://kit.fontawesome.com/4b9ba14b0f.js', 'http://localhost:5500/livereload.js', 'https://use.fontawesome.com/releases/v5.3.1/js/all.js', 'http://localhost:5000/static/js/base.js', 'http://localhost:550...
#encoding:utf-8 subreddit = 'pics' t_channel = '@r_pics_redux' def send_post(submission, r2t): return r2t.send_simple(submission, text=False, gif=False, img='{title}\n{short_link}', album=False, other=False )
# Lesson3: while loop # source: code/while.py text = '' while text != 'stop': text = input('Tell me something:\n') print('you told me:', text) print('... and I\'m stopping')
""" 🎅🏻 --- Day 2: 1202 Program Alarm --- On the way to your gravity assist around the Moon, your ship computer beeps angrily about a "1202 program alarm". On the radio, an Elf is already explaining how to handle the situation: "Don't worry, that's perfectly norma--" The ship computer bursts into flames. You notify ...
workers = 1 worker_class = 'gevent' bind = '0.0.0.0:5000' pidfile = '/tmp/gunicorn-inspector.pid' debug = True reload = True loglevel = 'info' errorlog = '/tmp/gunicorn_inspector_error.log' accesslog = '/tmp/gunicorn_inspector_access.log' daemon = False
""" author : Ali Emre SAVAS Link : https://www.hackerrank.com/challenges/text-wrap/problem """ def wrap(string, max_width): newString = "" for i in range(0, len(string), max_width): newString += string[i:(i+max_width)] + "\n" # \n for new line. # newString = newString[:(len(newString)-1)]...
def escreva(text): tam = len(text) + 6 print(f'\33[:34m~\33[m'* (tam)) print('{:^{}}'.format(text, tam)) print(f'\33[:34m~\33[m' * (tam)) escreva('Curso em vídeo') escreva('Olá Mundo!') escreva('Miguel Abreu de Souza e Silva')
# -*- coding: utf8 -*- ######################################################################################## # This file is part of exhale. Copyright (c) 2017-2019, Stephen McDowell. # # Full BSD 3-Clause license available here: # # ...
# (User) Problem # We know / We have: 3 number: win draw lose # We need / We don't have: points for team # We must: use: 3 points for win, 1 for draw, 0 for loss # name of function must be: football_points # # Solution (Product) # function with 3 inputs def football_points(wins, draws, losses): return wins * 3 + dr...
users = [ { "id": 0, "name": "Hero" }, { "id": 1, "name": "Dunn" }, { "id": 2, "name": "Sue" }, { "id": 3, "name": "Chi" }, { "id": 4, "name": "Thor" }, { "id": 5, "name": "Clive" }, { "id": 6, "name": "Hicks" }, { "id": 7, "name": "Devin" }, { "id": 8, "name": "Kate" }, { "id": ...
print(' \033[36;40mExercício Python #071 - Simulador de Caixa Eletrônico\033[m') while True: #Iniciando variáveis unidade = dezena = centena = milhar = 0 print('=-=' * 20) valorSacado = int(input('Valor que será sacado (0 para sair): ')) print('=-=' * 20) if valorSacado < 0 or valorSacado...
# Constants Background = 'FF111111' BackgroundDark = 'FF0A0A0A' # OverlayVeryDark = GetAlpha(FF000000, 90), # OverlayDark = GetAlpha(FF000000, 70), # OverlayMed = GetAlpha(FF000000, 50), # OverlayLht = GetAlpha(FF000000, 35), Border = 'FF1F1F1F' Empty = 'FF1F1F1F' Card = 'FF1F1F1F' Button = 'FF1F1F1F' ButtonDark ...
""" Escreva um programa que receba como entrada o valor do saque realizado pelo cliente de um banco e retorne quantas notas de cada valor serão necessárias para atender ao saque com a menor quantidade de notas possível. Serão utilizadas notas de 100, 50, 20, 10, 5, 2 e 1 real. """ n1 = int(input('Digite o valor do saq...
API_KEY = "PK3OA9F3DZ47286MDM81" SECRET_KEY = "oJxGYAqcrIrhpLyXGJyIb3wsCrh2cR3xwaO662yp" HEADERS = { 'APCA-API-KEY-ID': API_KEY, 'APCA-API-SECRET-KEY': SECRET_KEY } BARS_URL = 'https://data.alpaca.markets/v1/bars'
n=int(input()) a=[int(i) for i in input().split()] d=[a[0]] for i in range(1,n): x=a[i] if x>d[-1]: d+=[x] elif d[0]>=x: d[0]=x else: l,r=0,len(d) while(r>l+1): m=(l+r)//2 if(d[m]<x): l=m else: r=m d[r]=x print(len(d)) ...
#!/usr/bin/env python3 # Write a program that prints out the position, frame, and letter of the DNA # Try coding this with a single loop # Try coding this with nested loops dna = 'ATGGCCTTT' """ 0 0 A 1 1 T 2 2 G 3 0 G 4 1 C 5 2 C 6 0 T 7 1 T 8 2 T """ #Frame is index modulo 3... print("single loop") for index in...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 26 20:22:25 2020 @author: xianbingu """ def maximum(A): #delete the following line and insert your code #the built-in max() is not allowed to use here pass ##---test---## ##You can comment out them when you write and test your code...
# Copyright 2016 Twitter. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
try: file = open("test.txt", "r") except Exception as identifier: print("Dosya açılamadı:", identifier) hepsi = file.read() print(type(file)) print(type(hepsi)) print(len(hepsi)) for v in file: print(v, end="") print() print(hepsi) file.close()
ENABLE_EXTERNAL_PATHS = False SOURCE_DEFINITION = ['Landroid/telephony/TelephonyManager;->getDeviceId(', 'Landroid/telephony/TelephonyManager;->getSubscriberId(', 'Landroid/telephony/TelephonyManager;->getSimSerialNumber(', 'Landroid/telephony/TelephonyManager;->getLine1Number('] #[ # 'Landroid/accounts/AccountMana...
weather = [] for i in range(4): x = input().split()
def sol(preorder,inorder): ret = [] def print_postorder(preorder, inorder): n = len(preorder) if n == 0: return root = preorder[0] i = inorder.index(root) print_postorder(preorder[1 : i + 1], inorder[:i]) print_postorder(preorder[i + 1 :], inorder[i ...
__version__ = '0.2.0' __pdoc__ = { '__version__': "The version of the installed nflfan module.", }
{ "targets": [ { "target_name": "math", "sources": [ "math.cc" ], "libraries": [ "<(module_root_dir)/libmath.a" ] } ] }
{ 'target_defaults': { 'default_configuration': 'Release' }, "targets": [ { 'configurations': { 'Debug': { 'cflags': ['-g3', '-O0'], 'msvs_settings': { 'VCCLCompilerTool': { 'BasicRuntimeChecks': 3, # /RTC1 'ExceptionHand...
# --- # jupyter: # jupytext: # formats: ipynb,md,py # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.4.2 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # Jonathan Date-Chong # *...
for i in range(1, 10+1): if i%3 == 0: print('hello') elif i%5 == 0: print('world') else: print(i)
def place(arr, mask, vals): # TODO(beam2d): Implement it raise NotImplementedError def put(a, ind, v, mode='raise'): # TODO(beam2d): Implement it raise NotImplementedError def putmask(a, mask, values): # TODO(beam2d): Implement it raise NotImplementedError def fill_diagonal(a, val, wrap=Fa...
# maps biome IDs to supported biomes biome_map = { "Plains": [1, 129], "Forest": [4, 18, 132], "Birch Forest": [27, 28, 155, 156], "Dark Forest": [29, 157], "Swamp": [6, 134], "Jungle": [21, 22, 23, 149, 151], "River Beach": [7, 11, 16, 25], "Taiga": [5, 19, 133, 30, 31, 158, 32, 33, 160...
def pprint(obj): return repr(obj) def to_hex_str(data): return ''.join("{0:x}".format(b) for b in data)
# -*- coding: utf-8 -*- class PluginException(Exception): pass class PluginTypeNotFound(PluginException): pass
class gr(): def __init__(self): age = 28 def stop(self): return 1+1 if __name__ == "__main__": print("hello") pass
# Kata url: https://www.codewars.com/kata/574b1916a3ebd6e4fa0012e7. def is_opposite(s1: str, s2: str) -> bool: return len(s1) and s1 == s2.swapcase()
def sectrails(domain,requests,api): print("[+] Consultando securitytrails") url = "https://api.securitytrails.com/v1/domain/"+domain+"/subdomains" querystring = {"children_only":"false","include_inactive":"true"} headers = {"Accept": "application/json","APIKEY": api} subs = [] # Insira sua chav...
""" mimetypes ~~~~~~~~~ Define some constants for different mimetypes """ CSV_MIMETYPE = 'text/csv' FILEUPLOAD_MIMETYPE = 'multipart/form-data' FORMURL_MIMETYPE = 'application/x-www-form-urlencoded' JSON_MIMETYPE = 'application/json' JSONAPI_MIMETYPE = 'application/vnd.api+json'
# -*- coding: utf-8 -*- """ idfy_rest_client.models.reminder This file was automatically generated for Idfy by APIMATIC v2.0 ( https://apimatic.io ) """ class Reminder(object): """Implementation of the 'Reminder' enum. TODO: type enum description here. Attributes: OFF: T...
class Node: def __init__(self, data): self.data = data self.right_child = None self.left_child = None
secret_number = 9 guess_count = 0 guess_limit = 3 while guess_count < guess_limit: guess = int(input("Guess any no. from 1-10: ")) guess_count+=1 if guess == secret_number: print("You won") break else: print("Better luck next time")
# Linear Search Implementation def linear_search(arr, search): # Iterate over the array for _, ele in enumerate(arr): # Check for search element if ele == search: return True return False if __name__ == "__main__": # Read input array from stdin arr = list(map(int, input().strip().split())) # Read sear...
#!/usr/bin/env python """ Copyright 2014-2020 by Taxamo 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 applic...
BASE_URL = "https://www.zhixue.com" class Url: SERVICE_URL = f"{BASE_URL}:443/ssoservice.jsp" SSO_URL = f"https://sso.zhixue.com/sso_alpha/login?service={SERVICE_URL}" TEST_PASSWORD_URL = f"{BASE_URL}/weakPwdLogin/?from=web_login" TEST_URL = f"{BASE_URL}/container/container/teacher/teacherAccountNew" ...