content
stringlengths
7
1.05M
#It’s...not really an adventure game...#Ver 1.0 #Your village is being attacked by 'a germanic tribe' and you need to run to the stores and get the right things to save your village, and probably some good looking girl or boy you want to marry. All prices in gold pieces excl. VAT... chop chop!! ze germanz are coming! #...
# Гена def flipflop(n): if n % 5 == 0 and n % 7 == 0: return "FlipFlop" if n % 5 == 0: return "Flip" if n % 7 == 0: return "Flop" return "%s" % n class FlippaFloppa: def __init__(self, a1, a2): self.a1 = a1 self.a2 = a2 def test(se...
# Medium # https://leetcode.com/problems/jump-game-ii/ # Time Complexity: O(n) # Space Complexity: O(1) class Solution: def jump(self, nums: List[int]) -> int: ''' Approach: 1) For every element in the array, Find the index at which it can reach by taking the longest jump (i.e ...
#!/usr/bin/env python def filter(new_values, values=[]): for new_value in new_values: if new_value > 0: values.append(new_value) return values if __name__ == '__main__': value_list = [ [1, -3, 5], [13, 33, -15], ] for values in value_list: print(f'filter...
N_SEGMENTS = 5 FEDERATED_AGGREGATOR_HOST = "http://cte_federated_aggregator:8080" ETA = 1.5 REGISTRATION_ENABLE = True ACTIVE_ENCRYPTION = True DATASETS_DIR = "./dataset" KEY_LENGTH = 1024 DB_ENGINE = 'sqlite:////app/db/data_owner.db'
matrix = [] with open('input') as f: for row in f: row_matrix = [x for x in row.split()] matrix.append(row_matrix) # print(matrix) counter = 0 abc_list = [] total = [] for row in matrix: # Empty line if not row: total.append(len(abc_list)) # print(len(abc_list)) ab...
print ("Enter temperature value in Celcius:") celcius = input() fcelcius = float (celcius) fahrenheit = (fcelcius * 9) / 5 + 32 print(fahrenheit,"deg F")
""" 4.6 – Números ímpares: Use o terceiro argumento da função range() para criar uma lista de números ímpares de 1 a 20. Utilize um laço for para exibir todos os números. """ numeros_impares = list(range(1, 20, 2)) for numero in numeros_impares: print(numero)
# # PySNMP MIB module RIPv2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RIPv2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:03:31 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:23...
class Solution(object): def singleNumber(self, nums): """ :type nums: List[int] :rtype: List[int] """ diff = 0 for num in nums: diff ^= num diff &= -diff res = [0, 0] for num in nums: if diff & num == 0: ...
# class MyAdaptorEditInline(object): # @classmethod # def can_edit(cls, adaptor_field): # user = adaptor_field.request.user # obj = adaptor_field.obj # can_edit = False # if user.is_anonymous(): # pass # elif user.is_superuser: # can_edit = True #...
# TODO: Implement input interupts if needed class PCF8574: def __init__(self, i2c, address): self._i2c = i2c self._address = address self._input = 0 # Buffers the result of read in memory self._input_mask = 0 # Mask specifying which pins are set as input self._output = 0 #...
options = { 1: "All", 2: "Arrays and Strings", 3: "Linked Lists", 4: "Stacks and Queues", 5: "Trees and Graphs", 6: "Bit Manipulation", 7: "Math and Logic", 8: "Recursion and Dynamic Programming", 9: "Sorting and Searching", 10: "System Design and Scalability", 11: "Object-Oriented Design", 12: "Testing", ...
"""Tests for the HTTP REST API base.""" def test_access_index_url_returning_200_status_code(client): """ GIVEN a Flask application WHEN the '/' URL is requested (GET) THEN check the response is valid """ response = client.get('/') assert response.status_code == 200 assert response.dat...
nome=str(input('Qual é o seu nome: ')) idade=int(input('Qual é a sua idade: ')) if (nome=='sergio' and idade<=18): print('{}, seu nome é muito bonito e sua idade é perfeita que configura a:'.format(nome, idade)) elif (nome=='Ana Carolina' or nome=='ana carolina'): print('{}, seu nome é muito lindo igual a voc...
main_input = input() robot_count = int(main_input.split(" ")[0]) max_height = int(main_input.split(" ")[1]) robot_height = 0 for specific_robot in range(robot_count): robot_power = int(input()) if robot_power <= max_height and robot_power > robot_height: robot_height = robot_power print(robot_he...
"""Changes associated with version Honeybee schema version 1.43.2.""" UPDATED_CONSTRUCTS = ('OpaqueConstructionAbridged', 'WindowConstructionAbridged') def version_1_43_2(model_dict): """Implement changes in a Model dict to make it compatible with version 1.43.2.""" if 'energy' in model_dict['properties']: ...
class ___concatenate_HELPER_KeyGenerator___: """""" def __init__(self, vectors): self.vectors = vectors self._check_repeated_ = True self._IS_CT_ = False self._IS_NC_ = False self._CT_ = '>CT<' self._NC_ = '>NC<' def __call__(self, i): """""" ...
''' Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once in a word. Example: Input: ...
def fontgen(ctx, output, input): """create a new XML font file from a source font""" raise NotImplementedError
# coding: utf-8 # In[1]: class Solution: def fourSum(self, nums, target): nums.sort() results = [] self.findNsum(nums, target, 4, [], results) return results #算法思路: #step1:sort整个数列 #step2:利用recusive函数的方法,将N-sum最终变为2-sum #step3:从左往右找到sort后的数列中可能会成为和数的数字,从数列中删除这个数字,降低N,再次调用函数 #step...
Y,X,d = [int(x) for x in input().split()] arr = [] for _ in range(Y): xs = [int(x) for x in input().split()] arr.extend(xs) arr.sort() hi = max(arr) for i in range(Y*X): arr[i] -= hi if all(map(lambda x: x % d == 0, arr)): total = 0 med = arr[(Y*X) // 2] # print(med) for x in arr: ...
# # PySNMP MIB module REDSTONE-PPP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/REDSTONE-PPP-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:55:45 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
my_stuff = {'apple': "I am apples!"} print(my_stuff['apple']) def apple(): print("i am apples") tangerine = "Living reflection of a dream" print(apple()) class MyStuff(object): def __init__(self, var1): self.tangerine = "And now a thousand years between" self.tiger = var1 def apple(s...
# Faça um programa que tenha uma função chamada escreva(), que receba um texto qualquer como parâmetro e mostre uma mensagem com tamanho adaptável. # Ex: # escreva('Olá, Mundo!') # Saída: # ~~~~~~~~~ # Olá, Mundo! # ~~~~~~~~~ def escreva(frase): print('~' * (len(frase) + 4)) print(f'{frase: ^{len(frase) + 4}}...
# self explanatory sample = r'This is a example of a sentence containing multiple words' def spinWords(sentence): wordList = sentence.split() counter = 0 longWords = {} for word in wordList: if len(word) >= 5: flip = word[::-1] longWords[counter] = word co...
{ "cells": [ { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "5d377b45d1af4c17ab25e85b0cc47c0e", "version_major": 2, "version_minor": 0 }, "text/plain": [ ...
# ---------------------------------------------------------------------------- # Name: pln.py (Planning.py) # Purpose: This module contains variables for the construction # of a planning dataset. This module is to be used in # conjunction with create-Base-DataSet/main.py. #...
items = ['One', 'Two', 'Three', 'Four','Five'] for item in items: if item == 'Two': continue # Completely skip 'Two' print(item) # One # Three # Four # Five for item in items: if item == 'Two' or item == 'Four': continue # Completely skip 'Two' print(item) # One ...
__debug_flag__ = {'enabled': False} def is_debug_enabled(): r"""Returns :obj:`True`, if the debug mode is enabled.""" return __debug_flag__['enabled'] def set_debug_enabled(mode): __debug_flag__['enabled'] = mode class debug: r"""Context-manager that enables the debug mode to help track down error...
# Check if a tag needs to be removed def check_remove(s): # print(s) l = s.split() for j in range(len(l)): l[j] = nltk.word_tokenize(l[j]) [(a,b)] = nltk.pos_tag(l[j]) l[j] = b # print(l) adj = l.count('JJ') + l.count('JJR') + l.count('JJS') adv = l.count('RB') + l.count('RBR') + l.count('RBS')...
# Crie um programa onde o usuário possa digitar sete valores numéricos e cadastre-os em uma # lista única que mantenha separados os valores pares e ímpares. No final, mostre os valores # pares e ímpares em ordem crescente. list_ = [[], []] for count in range(1, 8): number = int(input(f'Digite o {count}º número: '...
# Copyright 2018-2019 Google LLC. # SPDX-License-Identifier: Apache-2.0 # Please keep deps in alphabetical order THIRD_PARTY_ARTIFACTS = [ "com.google.guava:guava:28.1-jre", "com.google.truth:truth:1.0", ]
""" Created on Wed Jul 28 10:03:48 2021 Python Implementation NPTEL Getting Started with Competitive Programming Week 1 Mod 1 Reversort https://www.craft.do/s/AcEMNb4NLdHlQo/b/66FE59A3-D17C-45C9-9C2A-A1C4C76A99E9/Module_1._Reversort by https://rajkumargalaxy.github.io/profile Submission successful at https://coding...
def simple(): """ A docstring. """ pass
#!/usr/bin/env python3 m = [] i = 1 while len(m) < 10001: i += 1 not_prime = 0 for j in range(2, i): if i%j == 0: not_prime = 1 break if not_prime == 0: m.append(i) print(len(m)) print(m[-1])
def bubblesort(list): # Swap the elements to arrange in order for iter_num in range(len(list) - 1, 0, -1): for idx in range(iter_num): if list[idx] > list[idx + 1]: temp = list[idx] list[idx] = list[idx + 1] list[idx + 1] = temp list = [19, ...
"""Controls Jiachang Light devices. """ class JcLight: def __init__(self, JcDirector, item_id): """Creates a Jiachang Light object. Parameters: `JcDirector` - A `jcapi.director.JcDirector` object that corresponds to the Jiachang Director that the light is connected to. `i...
class Graph: class Node: def __init__(self, n=''): self.name = n self.edges = list() def to_string(self): strepr = self.name strepr += ' [ ' strepr += ', '.join([e.name for e in self.edges]) strepr += ' ] ' return ...
with open('data/captions.csv', 'r', encoding='utf8') as f1, open('data/Flickr30k/captions.txt', 'w') as f2: f2.write('image,caption') line = f1.readline() while True: line = f1.readline() if not line: break image, caption = line.strip().split('| ')[::2] capti...
''' Add together any number of matrices and provide a positional sum matrix. Written for Python Morsels Exercise/Assignment #1 "add" Functions: add(*matrices: list[list[int|float]]) -> list[list[int|float] - Returns a matrix (list of lists) of given matrix values added positionally. ''' def add(*...
#096_Funcao_que_calcula_area.py def area(l, c): print("-" * 30) print(f"{'Controle de terreno':^30}") print("-" * 30) A = l * c print(f"{l}m x {c}m = {A}m2") print("-" * 30) x = int(input("Largura: ")) y = int(input("Comprimento: ")) area(x, y)
def map_efo(trait_2_efo_dict, name_list): """ Function accepts a dict with mappings from clinvar trait names to tuples containing ontology ids and labels, and a list with clinvar trait names for one trait. Returns the clinvar trait name (in lowercase) that is earliest in the list and has a mapping in th...
class Solution(object): def generateParenthesis(self, n): """ :type n: int :rtype: List[str] """ combinations = [] def combination(ans, openP, closeP): if closeP == n: combinations.append(ans) return if openP >...
# %% [893. Groups of Special-Equivalent Strings](https://leetcode.com/problems/groups-of-special-equivalent-strings/) # 問題:偶数番目同士または奇数番目同士を交換し一致すれば同一グループ。グループ数を返せ # 解法:奇数番目を大文字に変えcollections.Counterを用いる class Solution: def numSpecialEquivGroups(self, A: List[str]) -> int: cc = [collections.Counter(i[::2].up...
# weightとheightを定義しよう bmi = weight / (height * height) print(bmi)
""" PASSENGERS """ numPassengers = 4249 passenger_arriving = ( (2, 15, 5, 3, 2, 0, 9, 9, 8, 5, 1, 0), # 0 (4, 9, 10, 3, 3, 0, 12, 10, 7, 10, 3, 0), # 1 (2, 6, 7, 2, 2, 0, 3, 17, 5, 7, 3, 0), # 2 (6, 13, 7, 7, 4, 0, 7, 14, 5, 7, 2, 0), # 3 (5, 12, 9, 3, 3, 0, 12, 10, 9, 9, 3, 0), # 4 (4, 13, 14, 5, 0, 0, 4...
# [기초-입출력] 정수 2개 입력받아 그대로 출력하기(설명) # minso.jeong@daum.net ''' 문제링크 : https://www.codeup.kr/problem.php?id=1013 참고 : https://dojang.io/mod/page/view.php?id=1220 ''' # num1, num2 = input().split() num1, num2 = map(int, input().split()) print('{} {}'.format(num1, num2))
#!/usr/bin/env python # Copyright Contributors to the Open Shading Language project. # SPDX-License-Identifier: BSD-3-Clause # https://github.com/AcademySoftwareFoundation/OpenShadingLanguage # We will take the liberty of assuming point, vector, and normal all take # the identical code path # compassign u index u f...
#!/usr/bin/env python # Created by Bruce yuan on 18-2-13. class Solution: def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ if len(s) != len(t): return False s_arr = [0] * len(s) t_arr = [0] * len(s) s_d...
def parseCaptions(filename): retVal = [] with open(filename, 'r') as f: for line in f.read().split("\n"): if ("Captions for image" in line): image = line[19:-1] #print("\""+image+"\"") if (" 0)" in line): best = line[5:-13] ...
primeiro = int(input('Digite o primeiro termo da PA: ')) razao = int(input('Digite a razão da PA: ')) cont = 1 termo = primeiro while cont <= 10: print('{} - '.format(termo), end='') termo += razao cont += 1 print('Fim')
''' Criar um programa que gera 3 listas de acordo com a necessidade logo abaixo: Lista1 = Funcionários que tem carro e trabalham a noite Lista2 = Funcionários que tem carro e trabalham durante o dia Lista3 = Funcionários que não tem carro ''' funcionarios = ['Ana','Marcos','Alice','Pedro','Sophia','Bruno'...
''' Pattern Enter number of rows: 5 54321 5432 543 54 5 ''' print('Number pattern: ') number_rows=int(input('Enter number of rows: ')) for row in range(1,number_rows+1): for column in range(number_rows,row,-1): if column < 10: print(f'0{column}',end=' ') else: print(column,end=' ') print(...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def msbuild_rules_dependencies(): maybe( http_archive, name = "platforms", strip_prefix =...
""" Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = [1,2,3], a solution is: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] """ class Solution(object): ...
# -*- coding:UTF-8 -*- # Author:Tiny Snow # Date: Wed, 17 Feb 2021, 03:16 # Project Euler # 023 Non-abundant sums #==================================================================================================================================Solution maxn = 28123 p_list = [] sumd_list = [0 for i in range(maxn + 1)]...
# Key-value pair, mutable, unordered my_dict = {"name": "Jawad", "age": 27, "email": "abc@xyz.com"} print(my_dict["name"]) # Adding items my_dict["lastname"] = "Sonalkar" print(my_dict) # Modify my_dict["age"] = 28 print(my_dict) # Deleting del my_dict["email"] print(my_dict) # Pop my_dict.pop("age") print(my_dict) # ...
def words_list(): '''gets words to use''' words = {} # storing the words in a dictionary with open('/usr/share/dict/words') as f: for line in f: word = line.strip() words[word] = 1 return words def anagram_dict(words): ''' splitting words into a list and...
# -*- coding: utf-8 -*- thrift_client_timeout = 1 bind = ["0.0.0.0:8002", ]
# # Copyright (c) 2017-2018 Joy Diamond. All rights reserved. # @gem('Sapphire.Parse1From') def gem(): require_gem('Sapphire.BookcaseKeywordDualStatement') def parse1_statement_from_module(index): s = qs() # #<name1> # m1 = name_match(s, index) if m1 is non...
_lookup_overhead = { 'c': 0.55, 'c++': 0.63, 'cpp': 0.63, 'matlab': 10.85, 'python': 1.43} def calculate_speedup(src_lang, dst_lang, nloops, tinitA, t1A, t2A, t3A, tfinalA, tinitB, t1B, t2B, t3B, tfinalB, t_comm=None, T_overhead=Non...
compra = ['Mouse Logitech g403', 'Teclado Redragon Swich Blue'] print(compra) print("Adicionando mais dois itens...") compra.append("Gabinete Cooler Master") compra.append("placa de video GeForce RTX 2080Ti") print (compra) print ("Valor fora do orçamento ... Removendo itens !!!") del compra[0] del compra[0] print(com...
""" """ __all__ = \ [ 'classproperty' , '_call_with_frames_removed' ] class _ClassPropertyDescriptor(object): def __init__(self, fget=None, fset=None): self.fget = fget self.fset = fset def __get__(self, obj, cls=None): if not self.fget: rai...
'''Find the largest palindrome made from the product of two 3-digit numbers.''' def is_palindrome(n): return str(n) == str(n)[::-1] print(max((i*j, i, j) for i in range(100,1000) for j in range(100,1000) if is_palindrome(i*j)))
line1=input(); line2=input(); line3=input() gameField=[[],[],[]] k=0; j=0; i=0 while k<len(line1): num="" if line1[k]!=" ": for b in range(k,len(line1)): if line1[b]!=" ": num=line1[b] k+=1 else: k+=1 bre...
class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ memo = dict() res = list() for ni in nums1: if ni in memo: memo[ni] += 1 else: ...
class ScoreBoard: MIN_THRESHOLD = 1000 FINISH_THRESHOLD = 10000 def __init__(self, players): # Set the score board up with starting scores of zero self.scores = dict() for player in players: self.scores[player] = 0 def __str__(self): return "Scoreboard: %s" ...
RODENSTOCK_SERIAL_NUMBERS = ((1910, 50000), (1920, 200000), (1930, 400000), (1935, 700000), (1938, 900000), (1940, 950000), (1945, 2000000), ...
def find_multiples(inputdata): multiples = [] for x in range(1, inputdata): if x % 3 == 0 or x % 5 == 0: multiples.append(x) return sum(multiples) sum_of_multiples = find_multiples(1000) print(sum_of_multiples)
class Solution(object): def isPalindrome(self, s): """ :type s: str :rtype: bool """ s = [ch.lower() for ch in s if ch.isalnum()] return s == s[::-1]
# # PySNMP MIB module TIARA-NETWORKS-CONFIG-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIARA-NETWORKS-CONFIG-MGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:09:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ...
#variables vetor = [] #soma = 0 #input + process for(i) in range(0, 20): num = int(input("Digite um número para o vetor {0}/20: ".format(i + 1))) vetor.append(num) #soma += num print(sum(vetor)) #soma
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ UTILITIES - util.py This file provides useful methods that don't relate to any specific class """ class Util: """Provides different utility methods""" @staticmethod def get_num_range(range_string, fill=False): """Creates a integer lis...
class Solution: def rob(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 0: return 0 if len(nums) <= 2: return max(nums) cache = [ 0 for _ in nums] cache[0] = nums[0] cache[1] = m...
class Error(Exception): """Base class for exceptions.""" pass class ResponseError(Error): """Exception raised for errors in the request response.""" def __init__(self, message): self.message = message
def array_previous_less(items): less = [-1 for _ in items] for i in range(len(items)): for j in range(i-1, -1, -1): if items[i] > items[j]: less[i] = items[j] break return less if __name__ == '__main__': items = [3, 5, 2, 4, 5] print(array_previou...
""" 200 / 200 test cases passed. Runtime: 40 ms Memory Usage: 15.9 MB """ class Solution: def maxProfit(self, prices: List[int]) -> int: ans = 0 for i in range(1, len(prices)): if prices[i] > prices[i - 1]: ans += prices[i] - prices[i - 1] return ans
""" Given the head of a LinkedList and two positions ‘p’ and ‘q’, reverse the LinkedList from position ‘p’ to ‘q’. """ class Node: def __init__(self, value, next=None): self.value = value self.next = next def print_list(self): temp = self while temp is not None: pri...
def add_stacking_base_pairs(graph_list=None): for g in graph_list: # iterate over nodes for n, d in g.nodes_iter(data=True): if d.get('position', False) == 0 or d.get('position', False) is not False: pos = d['position'] # identify stacking neigbors ...
'''vjudge_UVA-254 - Towers of Hanoi We define a recursive formula as seen below. Essentially we see if the biggest piece has been moved. In each case, modify the initial, destination and intermediate pegs. Time: O(n), Space: O(1) ''' while True: n, m = map(int, input().split()) if (n == 0 and m == 0): break ...
class HTTPError(Exception): def __init__(self, status_code, message=""): """ Raise this exception to return an http response indicating an error. This is a boilerplate exception that was originally from Crane project. :param status_code: HTTP status code. It's a good idea to get th...
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def increasingBST(self, root): """ :type root: TreeNode :rtype: TreeNode """ head = TreeN...
# BASE PATHS base_path = "DataBase/Queries/{query}" # Credentials credential = open(base_path.format(query="credential.sql"), 'r').read() # Descriptors descriptors = open(base_path.format(query="descriptors.sql"), 'r').read() # Mapper dictionary = open(base_path.format(query="dictionary.sql"), 'r').read()
# -*- coding: utf-8 -*- """ Created on Mon Mar 14 14:40:53 2016 @author: kurner """ def Primes(): """generate successive prime numbers (trial by division)""" candidate = 1 _primes_so_far = [2] # first prime, only even prime yield _primes_so_far[-1] while True: candidate += 2 # ch...
class DjangoAdminMixin: """A mixin to add django-admin utilities to a browser. """ def click_save(self): return self(xpath="//input[@name='_save']").click() def click_save_cont(self): return self(xpath="//input[@name='_continue']").click() def click_save_add(self): return ...
def on_button_pressed_a(): global fred fred += 1 def on_button_pressed_b(): global fred fred += -1 fred = 0 def on_forever(): basic.show_number(fred) basic.forever(on_forever)
# Values in meters LANE_OFFSET = 2 # Distance to which each lane is going to be moved LANE_OFFSET_LENGTH_REDUCTION = 0.5 # Distance reduction of each offsetted segment. # The further the lane is - the shorter it is INTERSECTION_OFFSET = 3 # Shorten segment which neighbors an intersection by this length NODES_POSIT...
def divide(a, b): return a // b def multiply(a, b): return a * b
def cases(): numeroCasos=int(input()) i=0 while i<numeroCasos: run() i=i+1 def run(): ciudades=insertCities() costoPorEntrada= insertTravel(ciudades[1]) insertQueries(costoPorEntrada) costoPorEntrada=addCities(costoPorEntrada) def insertTravel(entrada): entrada=int(en...
x = float(raw_input("Enter one number: ")) epsilon = 0.01 num = 0 #the number of cycle low = 0 high = x ans = (low+high)/2.0 while abs(ans**2 - x) >= epsilon: print('low = ' + str(low) + ' high = '+str(high) + ' ans = '+str(ans)) num += 1 if ans**2 > x: high = ans else: low = ans ...
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at # McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/) # # 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...
#!/usr/bin/env python3 """ Module description """ class Blocker: def __init__(self): self.keys = [] def fit(self, data=None): raise NotImplementedError("Please call child class method") def transform(self): raise NotImplementedError("Please call child class method") def get...
## # Copyright (c) 2007-2013 Cyrus Daboo. 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 ...
""" Problem Name: pokemon_presentation You’re a teacher giving a presentation on the types (https://pokemon.fandom.com/wiki/Types) of pokemons (https://www.pokemon.com/us/pokedex/). You have a list pokemons_list, and you have another list types_list(this has the types of the pokemons in pokemons_lists in the same order...
#! /usr/bin/python3 data = [] with open('texts-data.txt','r') as file: for line in file: data.append(line) print(data)
""" Conf file for base_url """ base_url = "https://www.codecademy.com/"
n=int(input("Enter the number of strings:")) lst=[] tc=0 for i in range(n): x=input("Enter a string:") lst.append(x) overall_lst = ''.join(lst) uniq_elems= set(overall_lst) for ch in uniq_elems: c=0 for l in lst: if ch in l: c = c+1 if c == len(lst): tc = tc+1 print(tc)
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified). __all__ = ['double', 'triple', 'power'] # Cell def double(x): """Doubles an input number >>> double(2) 4 """ return x * 2 # Cell def triple(x): """ Triples an input number >>> triple(3) 9 "...
if __name__ == '__main__': command = 62 hex_command = '0x08' print(hex(command)) print(int(hex_command, 0))