content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def find_largest_palindrome(range_start: int, range_end: int) -> int: largest: int = 0 product: int i: int for i in range(range_start, range_end): j: int for j in range(range_start, range_end): product = i * j if is_palindrome(str(product)) and product > largest...
def find_largest_palindrome(range_start: int, range_end: int) -> int: largest: int = 0 product: int i: int for i in range(range_start, range_end): j: int for j in range(range_start, range_end): product = i * j if is_palindrome(str(product)) and product > largest: ...
# SPDX-License-Identifier: MIT # Copyright (c) 2020 Akumatic # # https://adventofcode.com/2020/day/18 def read_file() -> list: with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f: return [line.strip() for line in f.readlines()] def evaluate(values: list, operators: list, precedence: bool) -> int...
def read_file() -> list: with open(f"{__file__.rstrip('code.py')}input.txt", 'r') as f: return [line.strip() for line in f.readlines()] def evaluate(values: list, operators: list, precedence: bool) -> int: if not precedence: result = int(values[0]) for i in range(len(operators)): ...
class AuthenticationError(Exception): pass class MarketClosedError(Exception): pass class MarketEmptyError(Exception): pass class InternalStateBotError(Exception): pass
class Authenticationerror(Exception): pass class Marketclosederror(Exception): pass class Marketemptyerror(Exception): pass class Internalstateboterror(Exception): pass
class Database: def __init__(self): self.stuff = {} def cleanup(self): self.stuff = {} def save(self, id, timestamp, count): self.stuff[id] = { 'timestamp': timestamp, 'count': count } def find_all(self, id): return [self.stuff[id]] ...
class Database: def __init__(self): self.stuff = {} def cleanup(self): self.stuff = {} def save(self, id, timestamp, count): self.stuff[id] = {'timestamp': timestamp, 'count': count} def find_all(self, id): return [self.stuff[id]] def count(self): return ...
def assemble_message(message: str, error: bool = False) -> str: print("Assembling Message") if error: message = "-ERR {0}".format(message) else: message = "+OK {0}".format(message) return message
def assemble_message(message: str, error: bool=False) -> str: print('Assembling Message') if error: message = '-ERR {0}'.format(message) else: message = '+OK {0}'.format(message) return message
def longest_special_subseq(_n, dist, chars): chars = tuple(ord(char) - ord("a") for char in chars) print(chars) lengths = [0] * 26 # print(lengths) for char in chars: c_from = max(char - dist, 0) c_to = min(char + dist, 25) longest = max(lengths[c_from: c_to+1]) print...
def longest_special_subseq(_n, dist, chars): chars = tuple((ord(char) - ord('a') for char in chars)) print(chars) lengths = [0] * 26 for char in chars: c_from = max(char - dist, 0) c_to = min(char + dist, 25) longest = max(lengths[c_from:c_to + 1]) print(longest) ...
numero = int(input('Digite um numero para ver sua tabuada: ')) print('---------------') print('{} x 1 = {}'.format(numero, numero * 1)) print('{} x 2 = {}'.format(numero, numero * 2)) print('{} x 3 = {}'.format(numero, numero * 3)) print('{} x 4 = {}'.format(numero, numero * 4)) print('{} x 5 = {}'.format(numero,...
numero = int(input('Digite um numero para ver sua tabuada: ')) print('---------------') print('{} x 1 = {}'.format(numero, numero * 1)) print('{} x 2 = {}'.format(numero, numero * 2)) print('{} x 3 = {}'.format(numero, numero * 3)) print('{} x 4 = {}'.format(numero, numero * 4)) print('{} x 5 = {}'.format(numero, ...
''' We want to make a row of bricks that is goal inches long. We have a number of small bricks (1 inch each) and big bricks (5 inches each). Return True if it is possible to make the goal by choosing from the given bricks. This is a little harder than it looks and can be done without any loops. ''' def make_bricks(sma...
""" We want to make a row of bricks that is goal inches long. We have a number of small bricks (1 inch each) and big bricks (5 inches each). Return True if it is possible to make the goal by choosing from the given bricks. This is a little harder than it looks and can be done without any loops. """ def make_bricks(sma...
def validacao_de_nota(): notas_validas = soma = 0 while True: if notas_validas == 2: break nota = float(input()) if 0 <= nota <= 10: soma += nota notas_validas += 1 else: print('nota invalida') media = soma / 2 print(f'media...
def validacao_de_nota(): notas_validas = soma = 0 while True: if notas_validas == 2: break nota = float(input()) if 0 <= nota <= 10: soma += nota notas_validas += 1 else: print('nota invalida') media = soma / 2 print(f'media...
# -*- coding: utf-8 -*- def main(names): def get_format(is_angy): return "{0}.My name is {1}" if is_angy else "{0}.{1} is my classmate" for i, n in enumerate(names): print(get_format(n == "Angy").format(i, n)) if __name__ == "__main__": names = ("Bill", "Anne", "Angy", "Cony", "Daniel", ...
def main(names): def get_format(is_angy): return '{0}.My name is {1}' if is_angy else '{0}.{1} is my classmate' for (i, n) in enumerate(names): print(get_format(n == 'Angy').format(i, n)) if __name__ == '__main__': names = ('Bill', 'Anne', 'Angy', 'Cony', 'Daniel', 'Occhan') main(names)
# # 6. write a function that takes an integer n and prints a square of n*n # def quadrat(n): sq=n*n print(sq) return sq quadrat(10)
def quadrat(n): sq = n * n print(sq) return sq quadrat(10)
'''test for having the file checked . if we request the channels from the file and there are no channels and when you call the channels from file .. you specify which file to call from .(which list) if the stream is already there then you dont want it to add the stream and notify the user that it already exists....
"""test for having the file checked . if we request the channels from the file and there are no channels and when you call the channels from file .. you specify which file to call from .(which list) if the stream is already there then you dont want it to add the stream and notify the user that it already exists. ...
with open("day2.txt", "rt") as file: data = file.readlines() valid = 0 valid2 = 0 for entry in data: parts = entry.split(' ') limits = parts[0].split('-') letter = parts[1].split(':')[0] password = parts[2] count = 0 for ch in password: if ch ...
with open('day2.txt', 'rt') as file: data = file.readlines() valid = 0 valid2 = 0 for entry in data: parts = entry.split(' ') limits = parts[0].split('-') letter = parts[1].split(':')[0] password = parts[2] count = 0 for ch in password: if ch =...
TRAINING_FILE_ORIG = '../input/adult.csv' TRAINING_FILE = '../input/adult_folds.csv'
training_file_orig = '../input/adult.csv' training_file = '../input/adult_folds.csv'
open_brackets = ["[","{","("] close_brackets = ["]","}",")"] def validate_brackets(string): stack = [] for i in string: if i in open_brackets: stack.append(i) elif i in close_brackets: pos = close_brackets.index(i) if ((len(stack) > 0) and (ope...
open_brackets = ['[', '{', '('] close_brackets = [']', '}', ')'] def validate_brackets(string): stack = [] for i in string: if i in open_brackets: stack.append(i) elif i in close_brackets: pos = close_brackets.index(i) if len(stack) > 0 and open_brackets[pos]...
def my_name(name): # import ipdb;ipdb.set_trace() return f"My name is: {name}" if __name__ == "__main__": my_name("bob")
def my_name(name): return f'My name is: {name}' if __name__ == '__main__': my_name('bob')
''' Created on 25 apr 2019 @author: Matteo ''' CD_RETURN_IMMEDIATELY = 1 CD_ADD_AND_CONTINUE_WAITING = 2 CD_CONTINUE_WAITING = 0 CD_ABORT_AND_RETRY = 3
""" Created on 25 apr 2019 @author: Matteo """ cd_return_immediately = 1 cd_add_and_continue_waiting = 2 cd_continue_waiting = 0 cd_abort_and_retry = 3
load("@fbcode_macros//build_defs/lib:cpp_common.bzl", "cpp_common") load("@fbcode_macros//build_defs/lib:src_and_dep_helpers.bzl", "src_and_dep_helpers") load("@fbcode_macros//build_defs/lib:string_macros.bzl", "string_macros") load("@fbcode_macros//build_defs/lib:target_utils.bzl", "target_utils") load("@fbcode_macros...
load('@fbcode_macros//build_defs/lib:cpp_common.bzl', 'cpp_common') load('@fbcode_macros//build_defs/lib:src_and_dep_helpers.bzl', 'src_and_dep_helpers') load('@fbcode_macros//build_defs/lib:string_macros.bzl', 'string_macros') load('@fbcode_macros//build_defs/lib:target_utils.bzl', 'target_utils') load('@fbcode_macros...
r''' .. _snippets-cli-tagging: Command Line Interface: Tagging =============================== This is the tested source code for the snippets used in :ref:`cli-tagging`. The config file we're using in this example can be downloaded :download:`here <../../examples/snippets/resources/datafs_mongo.yml>`. Example 1 ----...
""" .. _snippets-cli-tagging: Command Line Interface: Tagging =============================== This is the tested source code for the snippets used in :ref:`cli-tagging`. The config file we're using in this example can be downloaded :download:`here <../../examples/snippets/resources/datafs_mongo.yml>`. Example 1 -----...
class Funcionario: def __init__(self, nome, salario): self.nome=nome self.salario=float(salario) def aum_salario(self, pct): self.salario += (self.salario*pct/100) def get_salario(self): return self.salario
class Funcionario: def __init__(self, nome, salario): self.nome = nome self.salario = float(salario) def aum_salario(self, pct): self.salario += self.salario * pct / 100 def get_salario(self): return self.salario
class Node(object): def __init__(self, val=None, children=None): self.val = val self.children = children
class Node(object): def __init__(self, val=None, children=None): self.val = val self.children = children
num = int(input('digite um numero:')) if num / 1 and num/ num: print('esse numero primo') else: print('esse numerp nap e primo')
num = int(input('digite um numero:')) if num / 1 and num / num: print('esse numero primo') else: print('esse numerp nap e primo')
''' https://www.hackerrank.com/challenges/python-loops/problem Task ==== The provided code stub reads and integer, , from STDIN. For all non-negative integers , print . Example ======= The list of non-negative integers that are less than is . Print the square of each number on a sep...
""" https://www.hackerrank.com/challenges/python-loops/problem Task ==== The provided code stub reads and integer, , from STDIN. For all non-negative integers , print . Example ======= The list of non-negative integers that are less than is . Print the square of each number on a sep...
''' Created on 24.07.2019 @author: LK ''' # TODO: Inheritance of tmcl interface class Landungsbruecke(object): GP_VitalSignsErrorMask = 1 GP_DriversEnable = 2 GP_DebugMode = 3 GP_BoardAssignment = 4 GP_HWID = 5 GP_PinState = 6
""" Created on 24.07.2019 @author: LK """ class Landungsbruecke(object): gp__vital_signs_error_mask = 1 gp__drivers_enable = 2 gp__debug_mode = 3 gp__board_assignment = 4 gp_hwid = 5 gp__pin_state = 6
def strategy(history, memory): if history.shape[1] % 3 == 2: # CC return 0, None # D else: return 1, None # C
def strategy(history, memory): if history.shape[1] % 3 == 2: return (0, None) else: return (1, None)
class PixivException(Exception): pass class DownloadException(PixivException): pass class APIException(PixivException): pass class LoginPasswordError(APIException): pass class LoginTokenError(APIException): pass
class Pixivexception(Exception): pass class Downloadexception(PixivException): pass class Apiexception(PixivException): pass class Loginpassworderror(APIException): pass class Logintokenerror(APIException): pass
def createMessageForArduino(flags, device_id, datasize, data): # prepare data, datasize depends whether we are working on # strings or not and therefor calculate it again byteData, datasize = getBytesForData(data) message = b'\xff' message += bytes([flags]) message += bytes([int(device_id)])...
def create_message_for_arduino(flags, device_id, datasize, data): (byte_data, datasize) = get_bytes_for_data(data) message = b'\xff' message += bytes([flags]) message += bytes([int(device_id)]) message += bytes([datasize]) if datasize > 0: message += byteData message += b'\xfe' p...
# List is python's version of array, zero-based indexing months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] print(months[0]) print(months[2]) print(months[-1]) list_of_random_things = [1, 3.4, 'a string', True] # watch for indexing error...
months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] print(months[0]) print(months[2]) print(months[-1]) list_of_random_things = [1, 3.4, 'a string', True] list_of_random_things[len(list_of_random_things) - 1] print(list_of_random_things[len...
# --- Day 11: Seating System --- # Your plane lands with plenty of time to spare. The final leg of your journey is a ferry that goes directly to the tropical island where you can finally start your vacation. As you reach the waiting area to board the ferry, you realize you're so early, nobody else has even arrived yet!...
def file_input(): f = open(inputFile, 'r') with open(inputFile) as f: read_data = f.read().split('\n') f.close() return read_data def split_seats(data): split_data = [] for row in data: row_data = [seat for seat in row] splitData.append(rowData) return splitData def...
# WiFi credentials wifi_ssid = "YourSSID" wifi_password = "YourPassword" # Ubidots credentials ubidots_token = "YourToken"
wifi_ssid = 'YourSSID' wifi_password = 'YourPassword' ubidots_token = 'YourToken'
number_one = int(input()) number_two = int(input()) number_three = int(input()) for one in range(2, number_one + 1, 2): for two in range(2, number_two + 1): for three in range(2, number_three + 1, 2): if two == 2 or two == 3 or two == 5 or two == 7: print(f"{one} {two} {three}")
number_one = int(input()) number_two = int(input()) number_three = int(input()) for one in range(2, number_one + 1, 2): for two in range(2, number_two + 1): for three in range(2, number_three + 1, 2): if two == 2 or two == 3 or two == 5 or (two == 7): print(f'{one} {two} {three}'...
#! /usr/bin/python HOME_PATH = './' CACHE_PATH = '/var/cache/obmc/' FLASH_DOWNLOAD_PATH = "/tmp" GPIO_BASE = 320 SYSTEM_NAME = "Garrison" ## System states ## state can change to next state in 2 ways: ## - a process emits a GotoSystemState signal with state name to goto ## - objects specified in EXIT_STATE_DEPE...
home_path = './' cache_path = '/var/cache/obmc/' flash_download_path = '/tmp' gpio_base = 320 system_name = 'Garrison' system_states = ['BASE_APPS', 'BMC_STARTING', 'BMC_READY', 'HOST_POWERING_ON', 'HOST_POWERED_ON', 'HOST_BOOTING', 'HOST_BOOTED', 'HOST_POWERED_OFF'] exit_state_depend = {'BASE_APPS': {'/org/openbmc/sen...
A,B,C,D = map(float,input().split()) A = (A*2+B*3+C*4+D*1)/10 print(f'Media: {A:.1f}') if A>=7.0: print("Aluno aprovado.") elif A<5.0: print("Aluno reprovado.") elif A>=5.0 and A<7.0: print("Aluno em exame.") N = float(input()) print(f'Nota do exame: {N:.1f}') N = (A+N)/2 if N>=5.0: ...
(a, b, c, d) = map(float, input().split()) a = (A * 2 + B * 3 + C * 4 + D * 1) / 10 print(f'Media: {A:.1f}') if A >= 7.0: print('Aluno aprovado.') elif A < 5.0: print('Aluno reprovado.') elif A >= 5.0 and A < 7.0: print('Aluno em exame.') n = float(input()) print(f'Nota do exame: {N:.1f}') n = (...
# this file contains the ascii art for our equipment # HELMET # # # SHIELD ARMOR WEAPON # # # OTHER ITEMS ...... equipment = {'sword':[ ' /\ ', ' || ', ' || ', ' || ', ...
equipment = {'sword': [' /\\ ', ' || ', ' || ', ' || ', ' || ', ' || ', ' || ', ' || ', ' || ', ' || ', ' || ', ' || ', ' || ', 'o==o', ' II ', ' II ', ' II ', ' ** '], 'shield': [' | `-._/\\_.-` |', ' | || |', ' | ___o()o___ |', ' | __((<>))__ |', ' | ___o()o___ |', ' | \\/ |', ' \\ o\\/o /', ' ...
''' Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that elements beyond the length of the original array are not written. Do the above modifications to the input array in place, do not return anything from your function. Example 1:...
""" Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that elements beyond the length of the original array are not written. Do the above modifications to the input array in place, do not return anything from your function. Example 1:...
linha1 = input() linha2 = input() linha3 = input() if(linha1 == 'vertebrado'): if(linha2 == 'ave'): if(linha3 == 'carnivoro'): print('aguia') else: print('pomba') else: if(linha3 == 'onivoro'): print('homem') else: print('vaca') el...
linha1 = input() linha2 = input() linha3 = input() if linha1 == 'vertebrado': if linha2 == 'ave': if linha3 == 'carnivoro': print('aguia') else: print('pomba') elif linha3 == 'onivoro': print('homem') else: print('vaca') elif linha2 == 'inseto': if...
# 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 isUnivalTree(self, root: TreeNode) -> bool: if root: self.k=root.val sel...
class Solution: def is_unival_tree(self, root: TreeNode) -> bool: if root: self.k = root.val self.x = [] self.x.append(root.val) else: return True def abc(root): if root: if root.left: self.x.ap...
T = int(input()) for _ in range(T): M, H = map(int, input().split()) B = M//H**2 if B<=18: print(1) elif B in range(19, 25): print(2) elif B in range(25, 30): print(3) else: print(4)
t = int(input()) for _ in range(T): (m, h) = map(int, input().split()) b = M // H ** 2 if B <= 18: print(1) elif B in range(19, 25): print(2) elif B in range(25, 30): print(3) else: print(4)
ls = open('logs.txt').readlines() for line in ls: g = line.strip() g = "/d/c186/FarnettoApps/" + g print("echo loading %s"%(g)) print("java -Dserverid=farnetto -cp $CP farnetto.log4jconverter.Loader file:/%s 2>&1 | grep ERROR"%(g))
ls = open('logs.txt').readlines() for line in ls: g = line.strip() g = '/d/c186/FarnettoApps/' + g print('echo loading %s' % g) print('java -Dserverid=farnetto -cp $CP farnetto.log4jconverter.Loader file:/%s 2>&1 | grep ERROR' % g)
#Your function definition goes here def valid_date(date_str): if len(date_str) == 8: for ch in date_str: if ch == "/": return False if ch.isalpha(): return False date_str.split(".") day = int(date_str[:2]) month = int(date_str[3...
def valid_date(date_str): if len(date_str) == 8: for ch in date_str: if ch == '/': return False if ch.isalpha(): return False date_str.split('.') day = int(date_str[:2]) month = int(date_str[3:5]) year = int(date_str[-2:...
#Created with the Terminal ASCII Paint app by Michele Morelli - https://github.com/MicheleMorelli def draw_house(): print(" "*64+"\n"+" "*64+"\n"+" "*5+"_"*33+" "*26+"\n"+" "*4+"|"+"/"*4+"|"+"#"*28+" "*26+"\n"+" "*4+"|"+"/"*4+"|"+"#"*28+" "*26+"\n"+" "*4+"|"+"/"*4+"|"+"#"*2+" "*2+"|"+"/"+"|"+"#"*2+" "*3+"|"+"/"+"|...
def draw_house(): print(' ' * 64 + '\n' + ' ' * 64 + '\n' + ' ' * 5 + '_' * 33 + ' ' * 26 + '\n' + ' ' * 4 + '|' + '/' * 4 + '|' + '#' * 28 + ' ' * 26 + '\n' + ' ' * 4 + '|' + '/' * 4 + '|' + '#' * 28 + ' ' * 26 + '\n' + ' ' * 4 + '|' + '/' * 4 + '|' + '#' * 2 + ' ' * 2 + '|' + '/' + '|' + '#' * 2 + ' ' * 3 + '|' +...
class Rectangle: def __init__(self, width, height): self.width = width self.height = height def set_width(self, width): self.width = width def set_height(self, height): self.height = height def get_area(self): return self.height * self.width def get_perim...
class Rectangle: def __init__(self, width, height): self.width = width self.height = height def set_width(self, width): self.width = width def set_height(self, height): self.height = height def get_area(self): return self.height * self.width def get_perim...
def details(): name = input("What is your name? ") age = input("What is your age? ") username = input("What is your Reddit username? ") with open("python_get_details_details.txt", "a+", encoding="utf-8") as file: file.write(name + " " + age + " " + username + "\n") print("Your name is ...
def details(): name = input('What is your name? ') age = input('What is your age? ') username = input('What is your Reddit username? ') with open('python_get_details_details.txt', 'a+', encoding='utf-8') as file: file.write(name + ' ' + age + ' ' + username + '\n') print('Your name is ' + na...
def solve(n): notebook = {} for _ in range(n): student, grade = input().split(' ') if student not in notebook: notebook[student] = [] notebook[student] += [float(grade)] for st, gr in notebook.items(): print(f"{st} ->", end=' ') [print(f"{x:.2f}",...
def solve(n): notebook = {} for _ in range(n): (student, grade) = input().split(' ') if student not in notebook: notebook[student] = [] notebook[student] += [float(grade)] for (st, gr) in notebook.items(): print(f'{st} ->', end=' ') [print(f'{x:.2f}', end=...
class Element(): def __init__(self, identifier, name, symbol): self.identifier = identifier self.name = name self.symbol = symbol self.metabolites = [] def add_compound(self, compound): if compound not in self.metabolites: self.metabolites.append(compound) ...
class Element: def __init__(self, identifier, name, symbol): self.identifier = identifier self.name = name self.symbol = symbol self.metabolites = [] def add_compound(self, compound): if compound not in self.metabolites: self.metabolites.append(compound) ...
#Name Cases. Personal_Name = "joey Tribionny" print("Person's name in lower case: " + Personal_Name.lower()) print("Person's name in upper case: " + Personal_Name.upper()) print("Person's name in title case: " + Personal_Name.title())
personal__name = 'joey Tribionny' print("Person's name in lower case: " + Personal_Name.lower()) print("Person's name in upper case: " + Personal_Name.upper()) print("Person's name in title case: " + Personal_Name.title())
# 1) Function that takes a string as a paratmeter and returns true if str contains at least 3 g false otherwise. # def threeg(stri): # gsum = 0 # for letter in stri.upper(): # if letter == 'G': # gsum += 1 # while gsum < 3: # return False # print(threeg('ggg') def g_count(any_...
def g_count(any_str): gnum = 0 for char in any_str.upper(): if char == 'G': gnum += 1 if gnum >= 3: return True else: return False print(g_count('attggg'))
# import pytest class TestFormatHandler: def test_read(self): # synced assert True def test_write(self): # synced assert True def test_append(self): # synced assert True def test_read_help(self): # synced assert True def test_write_help(self): # synced ...
class Testformathandler: def test_read(self): assert True def test_write(self): assert True def test_append(self): assert True def test_read_help(self): assert True def test_write_help(self): assert True def test__ensure_format(self): assert ...
num = [] soma = 0 for i in range(11): num.append(int(input())) n = len(num) for i in num: soma = soma + i media = soma / n print(media)
num = [] soma = 0 for i in range(11): num.append(int(input())) n = len(num) for i in num: soma = soma + i media = soma / n print(media)
load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") def _pre_render_script_ops_impl(ctx): output_filename = "{}.yaml".format(ctx.attr.name) output_yaml = ctx.actions.declare_file(output_filename) outputs = [output_yaml] ctx.actions.run( in...
load('@bazel_skylib//lib:paths.bzl', 'paths') load('@bazel_tools//tools/build_defs/pkg:pkg.bzl', 'pkg_tar') def _pre_render_script_ops_impl(ctx): output_filename = '{}.yaml'.format(ctx.attr.name) output_yaml = ctx.actions.declare_file(output_filename) outputs = [output_yaml] ctx.actions.run(inputs=[ctx...
# # # # # a = 215 # # # # a = int(input("Input a")) # # # a = 9000 # # # a = 3 # # # # if True: # after : is the code block, must be indented # print("True") # print("This always runs because if statement is True") # print("Still working in if block") # # # if block has ended # print("This runs no matter w...
a = 200 a = -95 a = 10 a = -100 if 2 < 3 < 8 < a: print(f'2 < 3 < 8 < {a} is it a True statement? ', 2 < 3 < 8 < a) else: print(f'2 < 3 < 8 < {a} is it a True statement?', 2 < 3 < 8 < a)
def test1(): l = [] for i in range(1000): l = l + [i] def test2(): l = [] for i in range(1000): l.append(i) def test3(): l = [i for i in range(1000)] def test4(): l = list(range(1000))
def test1(): l = [] for i in range(1000): l = l + [i] def test2(): l = [] for i in range(1000): l.append(i) def test3(): l = [i for i in range(1000)] def test4(): l = list(range(1000))
print("Listing Primes") prime_list = [] i = 0 while i < 10000: if i % 1000 == 0: print("Processed %d primes" % i) i += 1 prime = True for n in range(i): if n != 0 and n!= 1 and n!= i: if i % n == 0: prime = False if prime == True: prime_list.append(i) for i in r...
print('Listing Primes') prime_list = [] i = 0 while i < 10000: if i % 1000 == 0: print('Processed %d primes' % i) i += 1 prime = True for n in range(i): if n != 0 and n != 1 and (n != i): if i % n == 0: prime = False if prime == True: prime_list.ap...
class Verb(object): def __init__(self, verb, subject): self.verb = verb self.subject = subject self.value = "" def format(self, context): subject = self.subject(context).value if subject.player: self.value = self.verb else: self.value = th...
class Verb(object): def __init__(self, verb, subject): self.verb = verb self.subject = subject self.value = '' def format(self, context): subject = self.subject(context).value if subject.player: self.value = self.verb else: self.value = t...
def is_valid(row, col, size): return 0 <= row < size and 0 <= col < size # returns True or False def explode(row, col, size, matrix_in): bomb = matrix[row][col] for r in range(row - 1, row + 2): for c in range(col - 1, col + 2): if is_valid(r, c, size) and matrix_in[r][c] > 0: ...
def is_valid(row, col, size): return 0 <= row < size and 0 <= col < size def explode(row, col, size, matrix_in): bomb = matrix[row][col] for r in range(row - 1, row + 2): for c in range(col - 1, col + 2): if is_valid(r, c, size) and matrix_in[r][c] > 0: matrix[r][c] -= b...
test_cases = int(input()) for i in range(test_cases): text = input() new_text = '' for l in text: if l.isalpha(): new_text += chr(ord(l) + 3) else: new_text += l new_text = new_text[::-1] half = int((len(new_text) / 2)) first_part = new_text[0:half] ...
test_cases = int(input()) for i in range(test_cases): text = input() new_text = '' for l in text: if l.isalpha(): new_text += chr(ord(l) + 3) else: new_text += l new_text = new_text[::-1] half = int(len(new_text) / 2) first_part = new_text[0:half] seco...
name = "signalfx-azure-function-python" version = "1.0.1" user_agent = f"signalfx_azure_function/{version}"
name = 'signalfx-azure-function-python' version = '1.0.1' user_agent = f'signalfx_azure_function/{version}'
# Implement the singleton pattern with a twist. First, instead of storing one # instance, store two instances. And in every even call of getInstance(), return # the first instance and in every odd call of getInstance(), return the second # instance. class Singleton(type): _instance = [] odd = True ...
class Singleton(type): _instance = [] odd = True def __call__(cls, *args, **kwargs): if len(cls._instance) < 2: instance = super(Singleton, cls).__call__(*args, **kwargs) cls._instance.append(instance) cls.odd = True if not cls.odd else False return cls._inst...
def _get_ratio(ratio): if isinstance(ratio, str): if ':' in ratio: r_w, r_h = ratio.split(':') try: ratio = float(r_w) / float(r_h) except: raise if not isinstance(ratio, float): ratio = float(ratio) return ratio def center...
def _get_ratio(ratio): if isinstance(ratio, str): if ':' in ratio: (r_w, r_h) = ratio.split(':') try: ratio = float(r_w) / float(r_h) except: raise if not isinstance(ratio, float): ratio = float(ratio) return ratio def cent...
class DefaultAlias(object): ''' unless explicitly assigned, this attribute aliases to another. ''' def __init__(self, name): self.name = name def __get__(self, inst, cls): if inst is None: # attribute accessed on class, return `self' descriptor return self ret...
class Defaultalias(object): """ unless explicitly assigned, this attribute aliases to another. """ def __init__(self, name): self.name = name def __get__(self, inst, cls): if inst is None: return self return getattr(inst, self.name) class Alias(DefaultAlias): """ t...
f1 = open("unprocessed/Cit-HepTh-dates.csv", "w") f2 = open("unprocessed/Cit-HepTh.csv", "w") with open("unprocessed/Cit-HepTh-dates.txt", "r") as file: c = 0 for line in file: if not c == 0: l = line.split() nl = l[0] + "," + l[1] + '\n' f1.write(nl) ...
f1 = open('unprocessed/Cit-HepTh-dates.csv', 'w') f2 = open('unprocessed/Cit-HepTh.csv', 'w') with open('unprocessed/Cit-HepTh-dates.txt', 'r') as file: c = 0 for line in file: if not c == 0: l = line.split() nl = l[0] + ',' + l[1] + '\n' f1.write(nl) else: ...
def color_analysis(img): # obtain the color palatte of the image palatte = defaultdict(int) for pixel in img.getdata(): palatte[pixel] += 1 # sort the colors present in the image sorted_x = sorted(palatte.items(), key=operator.itemgetter(1), reverse = True) light_shade, dark_shade, shad...
def color_analysis(img): palatte = defaultdict(int) for pixel in img.getdata(): palatte[pixel] += 1 sorted_x = sorted(palatte.items(), key=operator.itemgetter(1), reverse=True) (light_shade, dark_shade, shade_count, pixel_limit) = (0, 0, 0, 25) for (i, x) in enumerate(sorted_x[:pixel_limit])...
#Write a program using while loops that asks the user for a positive integer 'n' and prints #a triangle using numbers from 1 to 'n'. number = int(input("Give me a number: ")) count = 0 for x in range(1, number+1): count += 1 dibujar = str(x) print (dibujar*count)
number = int(input('Give me a number: ')) count = 0 for x in range(1, number + 1): count += 1 dibujar = str(x) print(dibujar * count)
{ "format_version": "1.16.0", "minecraft:entity": { "description": { "identifier": f"{namespace}:pig_{color}", "is_spawnable": true, "is_summonable": true, "is_experimental": false }, "components": { "minecraft:type_family": { "family": [ f"pig_{color}", "pig", "mob" ] }...
{'format_version': '1.16.0', 'minecraft:entity': {'description': {'identifier': f'{namespace}:pig_{color}', 'is_spawnable': true, 'is_summonable': true, 'is_experimental': false}, 'components': {'minecraft:type_family': {'family': [f'pig_{color}', 'pig', 'mob']}, 'minecraft:breathable': {'total_supply': 15, 'suffocate_...
description = 'The outside temperature on the campus' group = 'lowlevel' devices = dict( OutsideTemp = device('nicos.devices.entangle.Sensor', description = 'Outdoor air temperature', tangodevice = 'tango://ictrlfs.ictrl.frm2:10000/frm2/meteo/temp', ), )
description = 'The outside temperature on the campus' group = 'lowlevel' devices = dict(OutsideTemp=device('nicos.devices.entangle.Sensor', description='Outdoor air temperature', tangodevice='tango://ictrlfs.ictrl.frm2:10000/frm2/meteo/temp'))
#This is just a demo server file to demonstrate the working of Telopy Backend #This program consist the last line of Telopy #import time #import sys #cursor = ['|','/','-','\\'] print('Telopy Server is Live ',end="") #while True: # for i in cursor: # print(i+"\x08",end="") # sys.stdout.flush() # ...
print('Telopy Server is Live ', end='')
class VersioningError(Exception): pass class ClassNotVersioned(VersioningError): pass class ImproperlyConfigured(VersioningError): pass
class Versioningerror(Exception): pass class Classnotversioned(VersioningError): pass class Improperlyconfigured(VersioningError): pass
fig, axs = plt.subplots(1, 2, figsize=(20,5)) p1=boroughs4.plot(column='Controlled drugs',ax=axs[0],cmap='Blues',legend=True); p2=boroughs4.plot(column='Stolen goods',ax=axs[1], cmap='Reds',legend=True); axs[0].set_title('Controlled drugs', fontdict={'fontsize': '12', 'fontweight' : '5'}); axs[1].set_title('Stolen go...
(fig, axs) = plt.subplots(1, 2, figsize=(20, 5)) p1 = boroughs4.plot(column='Controlled drugs', ax=axs[0], cmap='Blues', legend=True) p2 = boroughs4.plot(column='Stolen goods', ax=axs[1], cmap='Reds', legend=True) axs[0].set_title('Controlled drugs', fontdict={'fontsize': '12', 'fontweight': '5'}) axs[1].set_title('Sto...
class Reaction: def __init__(self): pass def from_json(json): reaction = Reaction() reaction.reaction = json["reaction"].encode("unicode-escape") reaction.actor = json["actor"] return reaction def list_from_json(json): reactions = [] for child in json: reactions.append(Reaction.from_json(child)...
class Reaction: def __init__(self): pass def from_json(json): reaction = reaction() reaction.reaction = json['reaction'].encode('unicode-escape') reaction.actor = json['actor'] return reaction def list_from_json(json): reactions = [] for child in js...
class Triangulo(): def __init__(self, a, b, c): self.a = a self.b = b self.c = c def semelhantes(self, triangulo): a, b, c = triangulo.a, triangulo.b, triangulo.c if ((a % self.a) == 0 ) and ((b % self.b) == 0) and ((c % self.c) == 0): ret...
class Triangulo: def __init__(self, a, b, c): self.a = a self.b = b self.c = c def semelhantes(self, triangulo): (a, b, c) = (triangulo.a, triangulo.b, triangulo.c) if a % self.a == 0 and b % self.b == 0 and (c % self.c == 0): return True elif a // s...
age = input("Please enter your age: ") if age.isdigit(): print(age) age = int(input("Please enter your age: ")) while(True): try: age = int(input("Please enter your age: ")) except ValueError: print("Sorry, I didn't understand that.") continue else: break raise Except...
age = input('Please enter your age: ') if age.isdigit(): print(age) age = int(input('Please enter your age: ')) while True: try: age = int(input('Please enter your age: ')) except ValueError: print("Sorry, I didn't understand that.") continue else: break raise exception('...
def fasttsq(M,psi,Y,y,m,c,o,plm): #TODO raise NotImplementedError def fasttsq3d(M,psi,Y,y,m,c,o,plm): #TODO raise NotImplementedError def fasttsqp(M,psi,Y,y,m,c,o,plm): #TODO raise NotImplementedError def fastq(M,psi,Y,y,m,c,o,plm): #TODO raise NotImplementedError def fastq3d(M,psi,Y...
def fasttsq(M, psi, Y, y, m, c, o, plm): raise NotImplementedError def fasttsq3d(M, psi, Y, y, m, c, o, plm): raise NotImplementedError def fasttsqp(M, psi, Y, y, m, c, o, plm): raise NotImplementedError def fastq(M, psi, Y, y, m, c, o, plm): raise NotImplementedError def fastq3d(M, psi, Y, y, m, c,...
# Heap class Solution: def shortestPathLength(self, graph): memo, final, q = set(), (1 << len(graph)) - 1, [(0, i, 1 << i) for i in range(len(graph))] while q: steps, node, state = heapq.heappop(q) if state == final: return steps for v in graph[node]: ...
class Solution: def shortest_path_length(self, graph): (memo, final, q) = (set(), (1 << len(graph)) - 1, [(0, i, 1 << i) for i in range(len(graph))]) while q: (steps, node, state) = heapq.heappop(q) if state == final: return steps for v in graph[n...
def test_besthit(): assert False def test_get_term(): assert False def test_get_ancestors(): assert False def test_search(): assert False def test_suggest(): assert False def test_select(): assert False
def test_besthit(): assert False def test_get_term(): assert False def test_get_ancestors(): assert False def test_search(): assert False def test_suggest(): assert False def test_select(): assert False
# # PySNMP MIB module VISM-SESSION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VISM-SESSION-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:27:36 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ...
#--------------------------------- # PIPELINE RUN #--------------------------------- # The configuration settings to run the pipeline. These options are overwritten # if a new setting is specified as an argument when running the pipeline. # These settings include: # - logDir: The directory where the batch queue scripts...
pipeline = {'logDir': 'log', 'logFile': 'pipeline_commands.log', 'style': 'print', 'procs': 16, 'verbose': 2, 'end': ['fastQCSummary', 'voom', 'edgeR', 'qcSummary'], 'force': [], 'rebuild': 'fromstart', 'manager': 'slurm'} using_merri = True maximal_rebuild_mode = True analysis_name = 'analysis_v1' raw_seq_dir = '/path...
class DesignOpt: def __init__(mesh, dofManager, quadRule): self.mesh = mesh self.dofManager = dofManager self.quadRule = quadRule
class Designopt: def __init__(mesh, dofManager, quadRule): self.mesh = mesh self.dofManager = dofManager self.quadRule = quadRule
__author__ = 'rhoerbe' #2013-09-05 # Entity Categories specifying the PVP eGov Token as of "PVP2-Allgemein V2.1.0", http://www.ref.gv.at/ EGOVTOKEN = ["PVP-VERSION", "PVP-PRINCIPAL-NAME", "PVP-GIVENNAME", "PVP-BIRTHDATE", "PVP-USERID", "PVP-GID", ...
__author__ = 'rhoerbe' egovtoken = ['PVP-VERSION', 'PVP-PRINCIPAL-NAME', 'PVP-GIVENNAME', 'PVP-BIRTHDATE', 'PVP-USERID', 'PVP-GID', 'PVP-BPK', 'PVP-MAIL', 'PVP-TEL', 'PVP-PARTICIPANT-ID', 'PVP-PARTICIPANT-OKZ', 'PVP-OU-OKZ', 'PVP-OU', 'PVP-OU-GV-OU-ID', 'PVP-FUNCTION', 'PVP-ROLES'] chargeattr = ['PVP-INVOICE-RECPT-ID',...
# classes for inline and reply keyboards class InlineButton: def __init__(self, text_, callback_data_ = "", url_=""): self.text = text_ self.callback_data = callback_data_ self.url = url_ if not self.callback_data and not self.url: raise TypeError("Either callback_data ...
class Inlinebutton: def __init__(self, text_, callback_data_='', url_=''): self.text = text_ self.callback_data = callback_data_ self.url = url_ if not self.callback_data and (not self.url): raise type_error('Either callback_data or url must be given') def __str__(s...
def rank4_simple(a, b): assert a.shape == b.shape da, db, dc, dd = a.shape s = 0 for iia in range(da): for iib in range(db): for iic in range(dc): for iid in range(dd): s += a[iia, iib, iic, iid] * b[iia, iib, iic, iid] return s
def rank4_simple(a, b): assert a.shape == b.shape (da, db, dc, dd) = a.shape s = 0 for iia in range(da): for iib in range(db): for iic in range(dc): for iid in range(dd): s += a[iia, iib, iic, iid] * b[iia, iib, iic, iid] return s
# # PySNMP MIB module CNTEXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CNTEXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:25:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(cnt_ext,) = mibBuilder.importSymbols('APENT-MIB', 'cntExt') (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constra...
def get_dict_pos(lst, key, value): return next((index for (index, d) in enumerate(lst) if d[key] == value), None) def search_engine(search_term, data_key, data): a = filter(lambda search_found: search_term in search_found[data_key], data) return list(a)
def get_dict_pos(lst, key, value): return next((index for (index, d) in enumerate(lst) if d[key] == value), None) def search_engine(search_term, data_key, data): a = filter(lambda search_found: search_term in search_found[data_key], data) return list(a)
# # PySNMP MIB module F10-BPSTATS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/F10-BPSTATS-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:11:15 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- #3.1.1 => updates from 2016 to 2018 #3.1.2 => fix to pip distribution __version__ = '3.1.2'
__version__ = '3.1.2'
if __name__ == '__main__': print("{file} is main".format(file=__file__)) else: print("{file} is loaded".format(file=__file__))
if __name__ == '__main__': print('{file} is main'.format(file=__file__)) else: print('{file} is loaded'.format(file=__file__))
with open('.\\DARKCPU\\DARKCPU.bin', 'rb') as inputFile: with open('image.bin', 'wb') as outputFile: while True: bufA = inputFile.read(1) bufB = inputFile.read(1) if bufA == "" or bufB == "": break; outputFile.write(bufB) ...
with open('.\\DARKCPU\\DARKCPU.bin', 'rb') as input_file: with open('image.bin', 'wb') as output_file: while True: buf_a = inputFile.read(1) buf_b = inputFile.read(1) if bufA == '' or bufB == '': break outputFile.write(bufB) outputF...
# problem description can be added if required n = int(input()) hou = [int(i) for i in input().split()] p = int(input()) for i in range(p): a, b = [int(i) for i in input().split()] print(sum(hou[a - 1:b])) # sum was to be including both the 'a'th and 'b'th index
n = int(input()) hou = [int(i) for i in input().split()] p = int(input()) for i in range(p): (a, b) = [int(i) for i in input().split()] print(sum(hou[a - 1:b]))
''' Base Class method Proxy''' #method 1, not recommand! class A: def spam(self, x): pass def foo(self): pass class B: def __init__(self): self._a = A() def spam(self, x): # Delegate to the internal self._a instance return self._a.spam(x) def foo(self): ...
""" Base Class method Proxy""" class A: def spam(self, x): pass def foo(self): pass class B: def __init__(self): self._a = a() def spam(self, x): return self._a.spam(x) def foo(self): return self._a.foo() def bar(self): pass class A: ...
class Customer: def __init__(self, customer_id, first, last, email, address, city, state, zip_code, phone): self.id = customer_id self.first = first self.last = last self.email = email self.address = address self.city = city self.state = state self.zip...
class Customer: def __init__(self, customer_id, first, last, email, address, city, state, zip_code, phone): self.id = customer_id self.first = first self.last = last self.email = email self.address = address self.city = city self.state = state self.zi...
def solution(x): answer = True temp = 0 copy = x while copy != 0: r = copy % 10 copy //= 10 temp += r if x % temp != 0: answer = False return answer print(solution(13))
def solution(x): answer = True temp = 0 copy = x while copy != 0: r = copy % 10 copy //= 10 temp += r if x % temp != 0: answer = False return answer print(solution(13))
input = '''10 3 15 10 5 15 5 15 9 2 5 8 5 2 3 6''' memory = [int(x) for x in input.split('\t')] memory_status = [] def update_memoery(memory): highest_bank = max(memory) highest_index = memory.index(highest_bank) memory[highest_index] = 0 i = 0 while i < highest_bank: memory[(highest_inde...
input = '10\t3\t15\t10\t5\t15\t5\t15\t9\t2\t5\t8\t5\t2\t3\t6' memory = [int(x) for x in input.split('\t')] memory_status = [] def update_memoery(memory): highest_bank = max(memory) highest_index = memory.index(highest_bank) memory[highest_index] = 0 i = 0 while i < highest_bank: memory[(hig...
for _ in range(int(input())): n,x = [int(x) for x in input().split()] dp = {} s = input() dp[x] = 1 for i in s: if(i == "R"): x += 1 else:x -= 1 if(not dp.get(x)):dp[x] = 1 print(len(dp))
for _ in range(int(input())): (n, x) = [int(x) for x in input().split()] dp = {} s = input() dp[x] = 1 for i in s: if i == 'R': x += 1 else: x -= 1 if not dp.get(x): dp[x] = 1 print(len(dp))
def median(array): array = sorted(array) if len(array) % 2 == 0: return (array[(len(array) - 1) // 2] + array[len(array) // 2]) / 2 else: return array[len(array) // 2]
def median(array): array = sorted(array) if len(array) % 2 == 0: return (array[(len(array) - 1) // 2] + array[len(array) // 2]) / 2 else: return array[len(array) // 2]
# Copyright 2019 VMware, Inc. # SPDX-License-Identifier: BSD-2-Clause class PrePostProcessor(object): def pre_process(self, data): type(self) return data def post_process(self, data): type(self) return data
class Prepostprocessor(object): def pre_process(self, data): type(self) return data def post_process(self, data): type(self) return data
def find_digits(digits1, digits2, digit_quantity_to_find): print('Inputs:') print('\tdigits1 = %s' % (digits1)) print('\tdigits2 = %s' % (digits2)) print('\tdigit_quantity_to_find = %d' % (digit_quantity_to_find)) digit_count_by_input = [len(digits1), len(digits2)] positions_by_digit_input = [...
def find_digits(digits1, digits2, digit_quantity_to_find): print('Inputs:') print('\tdigits1 = %s' % digits1) print('\tdigits2 = %s' % digits2) print('\tdigit_quantity_to_find = %d' % digit_quantity_to_find) digit_count_by_input = [len(digits1), len(digits2)] positions_by_digit_input = [[[], []]...
# (c) 2012 Urban Airship and Contributors __version__ = (0, 2, 0) class RequestIPStorage(object): def __init__(self): self.ip = None def set(self, ip): self.ip = ip def get(self): return self.ip _request_ip_storage = RequestIPStorage() get_current_ip = _request_ip_storage.get s...
__version__ = (0, 2, 0) class Requestipstorage(object): def __init__(self): self.ip = None def set(self, ip): self.ip = ip def get(self): return self.ip _request_ip_storage = request_ip_storage() get_current_ip = _request_ip_storage.get set_current_ip = _request_ip_storage.set
def sum_of_squares(value): sum = 0 for _ in range(value + 1): sum = sum + _ ** 2 return sum def summed_squares(value): sum = 0 for _ in range(value + 1): sum += _ return sum ** 2 print(summed_squares(100) - sum_of_squares(100))
def sum_of_squares(value): sum = 0 for _ in range(value + 1): sum = sum + _ ** 2 return sum def summed_squares(value): sum = 0 for _ in range(value + 1): sum += _ return sum ** 2 print(summed_squares(100) - sum_of_squares(100))
# Part 1 data = data.split("\r\n\r\n") nums = list(map(int, data[0].split(","))) boards = [] for k in data[1:]: boards.append([]) for j in k.splitlines(): boards[-1].append(list(map(int, j.split()))) for num in nums: for board in boards: for row in board: for i in range(len(row...
data = data.split('\r\n\r\n') nums = list(map(int, data[0].split(','))) boards = [] for k in data[1:]: boards.append([]) for j in k.splitlines(): boards[-1].append(list(map(int, j.split()))) for num in nums: for board in boards: for row in board: for i in range(len(row)): ...
def test_000_a_test_can_pass(): print("This test should always pass!") assert True def test_001_can_see_the_internet(selenium): selenium.get('http://www.example.com')
def test_000_a_test_can_pass(): print('This test should always pass!') assert True def test_001_can_see_the_internet(selenium): selenium.get('http://www.example.com')
f = open("shaam.txt") # tell() tell the position of our f pointer # print(f.readline()) # print(f.tell()) # print(f.readline()) # print(f.tell()) # seek() point the pointer to given index f.seek(5) print(f.readline()) f.close()
f = open('shaam.txt') f.seek(5) print(f.readline()) f.close()