content
stringlengths
7
1.05M
""" http://adventofcode.com/2017/day/9 """ def cleanStream(stream): streamToClean = stream[:] isCleaned = False while not isCleaned: idx = [i for i,item in enumerate(streamToClean) if item=="!"] if len(idx)<1: isCleaned = True break streamToClean = streamToClean[:idx[0]]+streamToClean[idx[0]+2:] return...
# -*- coding: utf-8 -*- """ Created on Fri Jun 14 20:08:32 2019 @author: Parikshith.H """ class Date: def __init__(self,day,month,year): self.__day=day self.__month=month self.__year=year def get_day(self): return self.__day def get_month(self): return self.__month...
class Book(): def __init__(self, name) -> None: self._name = name def get_name(self): return self._name class BookShelf(): def __init__(self) -> None: self._books: list[Book] = [] def append(self, book: Book): self._books.append(book) def get_book_at(self, index)...
''' 在一条环路上有 N 个加油站,其中第 i 个加油站有汽油gas[i],并且从第_i_个加油站前往第_i_+1个加油站需要消耗汽油cost[i]。 你有一辆油箱容量无限大的汽车,现在要从某一个加油站出发绕环路一周,一开始油箱为空。 求可环绕环路一周时出发的加油站的编号,若不存在环绕一周的方案,则返回-1。 Example 样例 1: 输入:gas[i]=[1,1,3,1],cost[i]=[2,2,1,1] 输出:2 样例 2: 输入:gas[i]=[1,1,3,1],cost[i]=[2,2,10,1] 输出:-1 Challenge O(n)时间和O(1)额外空间 Notice 数据保证答案唯一。 ''' c...
"""from random import random class TestDocTrackingMlflow: def test_doc(self): #### DOC START from dbnd import task from mlflow import start_run, end_run from mlflow import log_metric, log_param @task def calculate_alpha(): start_run() # param...
# -*- coding: utf-8 -*- def main(): s = input() k = int(input()) count = 0 for si in s: if si == '1': count += 1 else: break if s[0] != '1': print(s[0]) else: if k <= count: print(1) else: print(s[count])...
values = input("please fill value: ") previous = [] result = [] def isAEIOU(value): # value = str(value) if value.upper() == 'A': return True elif value.upper() == 'E': return True elif value.upper() == 'I': return True elif value.upper() == 'O': return True e...
'''Faça um programa que leia o sexo de uma pessoa, mas só aceite os valores 'M' ou 'F'. caso esteja errado, peça a digitação novamente até ter um valor correto.''' s = 0 r = '\nOpção inválida! Digite novamente por favor\n' while s != 'M' and s != 'F': s = str(input('Por favor informe seu sexo: [F/M]: ')).upper().s...
__author__ = 'Shane' class ClassToPass: def __init__(self, int1=int(), int2=int()): self.int1 = int1 self.int2 = int2 def gimmeTheSum(self, a, b) -> int: return a + b
"""Utility functions for the cargo rules""" load("//rust/platform:triple_mappings.bzl", "system_to_binary_ext") def _resolve_repository_template( template, abi = None, arch = None, system = None, tool = None, triple = None, vendor = None, version = None)...
N = input() N = '0' + N result = 0 carry = 0 for i in range(len(N) - 1, 0, -1): c = int(N[i]) + carry n = int(N[i - 1]) if c < 5 or (c == 5 and n < 5): result += c carry = 0 else: result += 10 - c carry = 1 result += carry print(result)
#Victor Gabriel Castão da Cruz #Lendo valor N = int(input()) #Calculando dias dias = int(N/86400) N = N % 86400 #Calculando horas horas = int(N/3600) N = N % 3600 #Calculando minutos minutos = int(N/60) N = N % 60 #Calculando segundos segundos = N #Imprimindo resposta print(dias, "dia(s),", horas, "hora(s),", min...
class Demo: def __init__(self, name): self.name = name print("Started!") def hello(self): print("Hey " + self.name + "!") def goodbye(self): print("Good-bye " + self.name + "!") m = Demo("Alexa") m.hello() m.goodbye()
assert set([1,2]) == set([1,2]) assert not set([1,2,3]) == set([1,2]) assert set([1,2,3]) >= set([1,2]) assert set([1,2]) >= set([1,2]) assert not set([1,3]) >= set([1,2]) assert set([1,2,3]).issuperset(set([1,2])) assert set([1,2]).issuperset(set([1,2])) assert not set([1,3]).issuperset(set([1,2])) assert set([1,2,...
def makeGood(s: str) -> str: stack = [] for i in range(len(s)): if stack and ((s[i].isupper() and stack[-1] == s[i].lower()) or (s[i].islower() and stack[-1] == s[i].upper())): stack.pop() else: stack.append(s[i]) return ''.join(stack)
""" # Definition for a Node. class Node(object): def __init__(self, val, children): self.val = val self.children = children """ class Solution(object): def levelOrder(self, root): """ :type root: Node :rtype: List[List[int]] """ if not root: re...
#Given a binary tree, return all root-to-leaf paths. # dfs+stack, bfs+queue, dfs recursively class Solution: def binaryTreePaths1(self, root): if not root: return [] res, stack = [], [(root, "")] while stack: node, ls = stack.pop() if not node.left and no...
class Solution: def diagonalSum(self, mat: List[List[int]]) -> int: sum = 0 n = len(mat) for i in range(n): sum += mat[i][i] if i != n - 1 - i: sum += mat[i][n - 1 - i] return sum
def courses_list(user=None): user = auth.user if not user else db(db.users.id==user).select().first() if user.type_==1: courses = db(db.registered_courses.professor==user.id).select(db.registered_courses.course_id) courses = map(lambda x: x.course_id, courses) else: courses = db(db.student_registrations....
def check_inners(rule): if target in rules[rule]: return 1 for bag in rules[rule]: if check_inners(bag): return 1 return 0 def part1(): count = 0 for rule in rules: #print(rule) if rule == target: next else: count += check_...
#practice using data structures and several algorithms #compiled all classes into one class Node: def __init__(self, data): self.data = data self.next = None class BinaryNode: def __init__(self, data): self.data = data self.left = None self.right = None self.val = data class...
valores = list() print('\033[30m-' * 50) for p in range(0, 5): valor = (int(input('Digite um valor: '))) if p == 0 or valor > max(valores): valores.append(valor) print(f'Adicionado o valor \033[34m{valor}\033[30m no ' f'\033[33mfinal\033[30m da lista...') else: for c in...
# list(map(int, input().split())) # int(input()) def main(X, Y): cand = Y // 4 for i in range(cand, -1, -1): if i * 4 + (X - i) * 2 == Y: print('Yes') exit() else: print('No') if __name__ == '__main__': X, Y = list(map(int, input().split())) main(X, Y)
class Solution: def peakIndexInMountainArray(self, arr: List[int]) -> int: count = 0 for i in range(len(arr)-1): if arr[i] < arr[i+1]: count += 1 return count
def mutate_kernel_size(kernel): return None def mutate_stride(stride): return None def mutate_padding(padding): return None def mutate_filter(filter): return None
# Check a number for prime.... a = int(input("Enter Number: ")) c = 0 for i in range(1, a+1): if a % i == 0: c += 1 if c == 2: print("Prime") else: print("Not Prime")
def readint(msg): ok = False value = 0 while True: n1 = str(input(msg)) if n1.isnumeric(): value = int(n1) ok = True else: print('\033[0;31mError! Please enter a valid number. \033[m') if ok: break return value n = readint...
""" Siguiendo el ejercicio anterior, vamos a añadirle un apartado donde nos muestra un mensaje “Seleccione la opción deseada” (sin NINGÚN SALTO DE LÍNEA) y leer mediante teclado lo que introducimos. Preguntamos mediante el operador relacional: ¿Está entre 1 y 4 (incluidos)? ¿Es igual a 5? """ print("=================...
# https://leetcode.com/problems/keys-and-rooms/ class Solution: def canVisitAllRooms(self, rooms: List[List[int]]) -> bool: return self.dfs(rooms, 0, set()) def dfs(self, rooms: List[List[int]], node: int, visited: set[int]) -> bool: if node in visited: return False vis...
# -*- coding: utf-8 -*- # El code_menu debe ser único y se configurará como un permiso del sistema MENU_DEFAULT = [ {'code_menu': 'acceso_faqs', 'texto_menu': 'Preguntas frecuentes', 'href': '', 'nivel': 1, 'tipo': 'Accesible', 'pos': 1 }, {'code_menu': 'acceso_configura_faqs', ...
c = float(input()) n = int(input()) t=0 for each in range(n): h,w = list(map(float, input().split())) t+= h*w*c print("{:.8f}".format(t))
class Dsu: def __init__(self, n, ranked): self.parents = [i for i in range(n)] self.ranked = ranked self.ranks = [0 for i in range(n)] self.messages = [0 for i in range(n)] self.read = [0 for i in range(n)] def find(self, v): if v == self.parents[v]: ...
""" Exceptions ~~~~~~~~~~ Custom exceptions raised by the phenotype service. """ class PhenotypeError(Exception): pass
''' A simple exercie sript to find out total pay by multiplying hours worked with rate per hour. ''' hr1 = input('Enter Hours: ') rate1 = input('Enter Rate: ') # made failure proof so if user inputs values other than number it won't crash # and through an error. so the program will just quit with following warning # ...
# input var = input() # process ''' 앞에서부터 하나씩 읽으면서 처리. 만약 첫번째 알파벳이 대문자면 잘못된 변수명. 중간에 대문자가 나올 경우 자바임. >> 밑줄 추가하고 소문자로 바꿔줌. 중간에 밑줄이 나올 경우 cpp임. >> 밑줄 지우고 다음 단어 대문자로 바꿈. >> 밑줄이 두 번 연속으로 나오면 잘못된 변수명. >> 마지막 글자가 밑줄이면 잘못된 변수명. 만약 자바와 cpp 조건 둘 다 만족하면 잘못된 변수명. ''' isJava = isCpp = next2Upper = False isValid = True result =...
spark = SparkSession \ .builder \ .appName("exercise_eighteen") \ .getOrCreate() (df.select("id", "first_name", "last_name", "gender", "country", "birthdate", "salary") .filter(df["country"] == "United States") .orderBy(df["gender"].asc(), df["salary"].asc()) .show()) df.select("id", "first_name", "las...
"""utils.py""" def param_dict(param_list): """param_dict""" dct = {} for param in param_list: dct[param.key] = param return dct
#personaldetails print("NAME: Jaskeerat Singh \nE-MAIL: jsing322@uwo.ca \nSLACK USERNAME: @jass \nBIOSTACK: Genomics \nTwitter Handle: @jsin") def hamming_distance(a,b): count=0 for i in range(len(a)): if a[i] != b[i]: count +=1 return count print(hamming_distance('@jass','@jsin'))
class persona: #clase que representa a una pérsona cedula = "8-123-123" nombre = "rodriguez" sexo = "I" def hablar(self, mensaje): #mostrar mensaje de persona return mensaje something = persona print("el objeto de la clase" + something._name_+","+something._doc_) ...
# autogenerated by /home/astivala/phd/ptgraph/buildversion.sh # Fri Aug 10 09:43:43 EST 2012 def get_version(): """ Return version string containing global version number and 'build' date """ return "Revision 4288:4291, Fri Aug 10 09:43:43 EST 2012"
"""Role testing files using testinfra.""" def test_lvm_package_shall_be_installed(host): assert host.package("lvm2").is_installed def test_non_persistent_volume_group_is_created(host): command = """sudo vgdisplay | grep -c 'non-persistent'""" cmd = host.run(command) assert '1' in cmd.stdout def te...
""" Get Height of Binary Tree """ class Node: def __init__(self, data, left=None, right=None): self.data = data self.left = left self.right = right def get_height(root): """ >>> assert(get_height(None) == -1) >>> root = Node(1) >>> assert(get_height(root) == 0) >>> ro...
# Time: O(logn) # Space: O(1) class Solution(object): def toHex(self, num): """ :type num: int :rtype: str """ if not num: return "0" result = [] while num and len(result) != 8: h = num & 15 if h < 10: res...
class Interface(object): def __init__(self, name, idx, addrwidth, datawidth, lite=False): self.name = name self.idx = idx self.datawidth = datawidth self.addrwidth = addrwidth self.lite = lite def __repr__(self): ret = [] ret.append('(') ret.appen...
class HierarchicalDataTemplate(DataTemplate,INameScope,ISealable,IHaveResources,IQueryAmbient): """ Represents a System.Windows.DataTemplate that supports System.Windows.Controls.HeaderedItemsControl,such as System.Windows.Controls.TreeViewItem or System.Windows.Controls.MenuItem. HierarchicalDataTemplate() ...
{ 'includes': [ 'deps/common.gypi', ], 'variables': { 'gtest%': 0, 'gtest_static_libs%': [], 'glfw%': 0, 'glfw_static_libs%': [], 'mason_platform': 'osx', }, 'targets': [ { 'target_name': 'geojsonvt', 'product_name': 'geojsonvt', 'type': 'static_library', 'standal...
print(True) print(False) print("True") print("False") print(5 == 1) print(5 != 1) print("Ham" == "Ham") print("ham " == "ham") print(5 == 5.0) print(5 < 1) print(5 >= 5) print(5 < 8 <= 7)
cidades = {'rio de janeiro': {'pais': 'brasil', 'populacao': 16718956, 'fato': 'É o terceiro estado mais populoso do Brasil'}, 'paris': {'pais': 'frança', 'populacao': 2206488, 'fato': 'É considerada uma das...
#!/usr/bin/python3 # Basic constants for constructing stuff alphabet = 'אבגדהוזחטיכלמנסעפצקרשת' salphabet = 'אבגדהוזחטיךלםןסעףץקרשת' # with sofits instead values = [1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400] sofits = 'ךםןףץ' replace_sofits = 'כמנפצ' yudheh = 'יה' heh = 'ה' yudvav = 'יו' taf = 'ת...
class Animal: def __init__(self, leg_count=4): # Constructor, initializes the new obj # Print("constructor called!") self.leg_count = leg_count self.likes_food = True def get_leg_count(self): # getter return self.leg_count def set_leg_count(self, leg_count): # setter ...
def check(x): """ Checking for password format Format::: (min)-(max) (letter): password """ count = 0 dashIndex = x.find('-') colonIndex = x.find(':') minCount = int(x[:dashIndex]) - 1 maxCount = int(x[(dashIndex + 1):(colonIndex - 2)]) - 1 letter = x[colonIndex - 1] password = x...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Exporting modules of Clastering Algorithms Benchmarking Framework algorithms/ - evaluating algorithms utils/ - evaluation utilities benchapps - evaluating algorithms executors benchevals - evaluation utilities (and measures) executors benchmark - the benchmark...
a = float(input()) b = float(input()) peso_nota_a = 3.5 peso_nota_b = 7.5 media = (a * peso_nota_a + b * peso_nota_b) / (peso_nota_a + peso_nota_b) print(f"MEDIA = {media:.5f}")
class Node(object): def __init__(self, data): self.data = data self.left = None self.right = None def __str__(self): return str(self.data) class AVL_Tree(object): def height(self,root): if not root: return -1 else: hl = self.hei...
# enter the Chocolate Rooom ownername = "Daw Hla" playerlives = 2 chocolate = 2 print("Welcome to the Chocolate Room. I am the owner of this sweet shop, my name is " + ownername) print("You must answer this question.") # add an input statement to ask the question on the next line and store the response in a variable c...
''' https://leetcode.com/contest/weekly-contest-150/problems/as-far-from-land-as-possible/ ''' diffs = [(1, 0), (0, 1), (-1, 0), (0, -1)] class Cell: def __init__(self, x, y, dist=0): self.dist = dist self.x, self.y = x, y class Solver: def __init__(self, grid): self.g = grid s...
f=str(input('Digite uma frase: ')).strip().upper() print('Tem {} A na frase.'.format(f.count('A'))) print('O primeiro A esta em {} letra.'.format(f.find('A')+1)) print('O ultimo A esta em {} letra.'.format(f.rfind('A')+1))
def start_room(): return "room1"
node = S(input, "application/json") childNode = node.prop("orderDetails") property = childNode.prop("article") value = property.stringValue()
bit_list = [19, 17, 16, 18, 26, 24, 22, 21, 23, 25] value = 5808 for bit in bit_list: new_value = value + 2 ** bit print(value, new_value-1) value = new_value
# 노드의 합 test_cases = int(input()) for t in range(1, test_cases + 1): N, M, L = map(int, input().split()) tree = [0] * (N + 1) for _ in range(M): node, value = map(int, input().split()) tree[node] = value for i in range(N - M, 0, -1): tree[i] = tree[i * 2] if i * 2 + 1 <...
nome = input("Digite o nome: ") idade = int(input("Digite a idade: ")) doenca_infectocontagiosa = input("Suspeita de doença-infectocontagiosa?").upper() if idade >= 65: print("Paciente COM prioridade") if doenca_infectocontagiosa == "SIM": print("Encaminhe o paciente para sala AMARELA") elif doenca_...
# Реши задачу Иосифа Флавия: # где n - число солдат, k - шаг (2 - каждый второй (сосед), 3 - каждый третий и т.д.) # # 1. survive(n, k) - используя массив. # 2. survive_num(n, k) - без использования массива def survive(n, k): return [] def survive_num(n, k): pos = 0 return pos
class Solution: # @return a string def minWindow(self, S, T): s = S t = T d = {} td = {} for c in t: td[c] = td.get(c, 0) + 1 left = 0 right = 0 lefts = [] rights = [] for i, c in enumerate(s): if c in td: ...
class Solution: def canJump(self, nums: List[int]) -> bool: if not nums or len(nums) == 0: return False target = len(nums) - 1 for i in range(len(nums) - 1, -1, -1): if (nums[i] + i >= target): target = i return targe...
print ("How old are you?"), age = input() print ("How tall are you?"), height = input() print ("How much do you weigh?"), weight = input() print ("So you are %r old, %r tall and %r heavy!"%(age,weight,height) )
# Crie um programa que leia quatro notas de um aluno e calcule # a sua média, mostrando uma mensagem no final, de acordo com # a média atingida: # - Média abaixo de 5.0: "Reprovado!" # - Média entre 5.0 e 6.9: "Recuperação!" # - Média 7.0 ou superior: "Aprovado!" nota1 = float(input('\033[36mNota do 1° bimestre:\033[m ...
""" Formatando valores com modificadores: :s = texto strings :d = inteiros(int) :f = numeros ponto flutuante :.(número)f - quantidade de casas decimais > - direita < - esquerda ^ - centro """ nome = 'luis' print(f'{nome:#^15}')
# 두 자연수 A와 B가 주어진다. 이때, A+B, A-B, A*B, A/B(몫), A%B(나머지)를 출력하는 프로그램을 작성하시오. (a,b) = map(int,input().split()) print(a+b) print(a-b) print(a*b) print(a//b) print(a%b) # //는 소수점 버림
a=int(input("enter number:")) b=int(input("enter number:")) c=int(input("enter number:")) d=int(input("enter number:")) total=a+b+c+d average=total/4 print("total=",total) print("average=",average)
# test decorators def dec(f): print('dec') return f def dec_arg(x): print(x) return lambda f:f # plain decorator @dec def f(): pass # decorator with arg @dec_arg('dec_arg') def g(): pass # decorator of class @dec class A: pass print("PASS")
def read_E_matrix(): # # physical distance # E = [[1, 1, 0, 0, 1, 1], # [1, 1, 1, 1, 1, 0], # [0, 1, 1, 1, 0, 0], # [0, 1, 1, 1, 0, 0], # [1, 1, 0, 0, 1, 0], # [1, 0, 0, 0, 0, 1] # ] # fully connected # E = [[1, 1, 1, 1, 1, 1], # [1, 1, 1, 1...
# Databricks notebook source # MAGIC %run ./_utility-methods $lesson="dlt_lab_82" # COMMAND ---------- # MAGIC %run ./mount-datasets # COMMAND ---------- # def print_sql(rows, sql): # displayHTML(f"""<body><textarea style="width:100%" rows={rows}> \n{sql.strip()}</textarea></body>""") # COMMAND ----------...
# color mixer print("Red, blue, and yellow are primary colors.") print() # ask user to choose two primary colors to mix color1 = input("Enter the primary color 1 (red,blue, or yellow): ") color2 = input("Enter the primary color 2 (red,blue, or yellow): ") if color1 == "red" and color2 == "blue": print("The seco...
# Non-MacOS users can change it to Chrome/Firefox. BROWSER = "Chrome" # can be Chrome/Safari/Firefox MATCH_URL = "http://www.espncricinfo.com/series/8039/commentary/1144506/afghanistan-vs-england-24th-match-icc-cricket-world-cup-2019" MESSAGE_BOX_CLASS_NAME = "_3u328" SEND_BUTTON_CLASS_NAME = "_3M-N-" # Match start ti...
# REST API server related constants USERNAME = "asdfg" PASSWORD = "asdfg" HOST = "http://127.0.0.1:8000" AUTH_URL: str = f"{HOST}/auth/" LOCATIONS_URL: str = f"{HOST}/api/locations/" PANIC_URL: str = f"{HOST}/api/panic/" # Format constants DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ" PRECISION = 6 # Job scheduling cons...
numOne = int(input("Первое число: ")) numTwo = int(input("Второе число: ")) numThree = int(input("Третье число: ")) numFour = int(input("Четвертое число: ")) res = (numOne + numTwo)/(numThree + numFour) print(f"Ваш ответ: {res}")
LOCK = False RELEASE = True VERSION = "19.99.0" VERSION_AGAIN = "19.99.0" STRICT_VERSION = "19.99.0" UNRELATED_STRING = "apple"
def dec_to_bin(dec): bin_num = '' while dec > 0: bin_num = str(dec % 2) + bin_num dec //= 2 return bin_num if __name__ == "__main__": dec_num = int(input()) print(dec_to_bin(dec_num))
#! /usr/bin/env python # -*- coding: utf-8 -*- # author: ouyangshaokun # date: print(44444444444) print("fsfasfaa") print(22222222) print("fsfasfa") print(123214) print(22222222) print(22222222) print(22222222) print(22222222) print(22222222) print(22222222) print(42342)
class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ pre = None i = 0 while i < len(nums): if pre is None: pre = nums[0] i += 1 elif nums[i] == pre: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- print('中文 English') # ord()函数获取字符的整数表示 print(ord('A')) print(ord('中')) # chr()函数把编码转换为对应的字符 print(chr(66)) print(chr(25991)) # 使用16进制表示汉字 print('16进制', '\u4e2d\u6587') # 16进制 中文 # 字符串的 encode print('bytes', b'ABC') # bytes b'ABC' print('str encode ...
"""[0 - ally ranks, 1 - enemy ranks, 2 - stun skill chance or blight damage, 3 - move distance]""" AttackSkills = { # highwayman 'wicked_slice': [[1, 2, 3], [1, 2]], 'opened_vein': [[1, 2, 3], [1, 2]], 'pistol_shot': [[2, 3, 4], [2, 3, 4]], 'duelist_advance': [[2, 3, 4], [1, 2, 3], None, 1], ...
class AbstractCredentialValidator(object): """An abstract CredentialValidator, when inherited it must validate self.user credentials agains self.action""" def __init__(self, action, user): self.action = action self.user = user def updatePDUWithUserDefaults(self, PDU): """Must u...
def add_elem(lst,ele): lst.append(ele) my_lst=[1,2,3] print(my_lst) add_elem(my_lst,5) print(my_lst)
print("Welcome to the GPA calculator") print("Please enter all your letter grades, one per line.") print("Enter a blank line to designate the end.") # map from letter grade to point value points = { 'A+': 4.0, 'A': 3.8, 'A-': 3.67, 'B+': 3.33, 'B': 3.0, 'B-': 2.67, 'C+': 2.33, 'C': 2.0,...
class Logger(object): def log(self, str): print("Log: {}".format(str)) def error(self, str): print("Error: {}".format(str)) def message(self, str): print("Message: {}".format(str))
FAIL_ON_ANY = 'any' FAIL_ON_NEW = 'new' # Identifies that a comment came from Lintly. This is used to aid in automatically # deleting old PR comments/reviews. This is valid Markdown that is hidden from # users in GitHub and GitLab. LINTLY_IDENTIFIER = '<!-- Automatically posted by Lintly -->'
# # PySNMP MIB module ADSL-LINE-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADSL-LINE-EXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:13:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
errors_find = { 'ServerError': { 'response': "Some thing went wrong. Please try after some time.", 'status': 500, }, 'BadRequest': { 'response': "Request must be valid", 'status': 400 }, } #Code to store error types based on status code.
# fml_parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'bofx eofx newline tab interpolant lce rce string\n\tstart \t: \tbofx\n\t\t\t|\tstart eofx\n\t\t\t|\tstart code\n\t\n\tcode \t: \tnewline \n\t\n\tcode \t: \ttab\n\t\n\tcode \t: \tstring\n\t...
RAW_SUBTOMOGRAMS = "volumes/raw" LABELED_SUBTOMOGRAMS = "volumes/labels/" PREDICTED_SEGMENTATION_SUBTOMOGRAMS = "volumes/predictions/" CLUSTERING_LABELS = "volumes/cluster_labels/" HDF_INTERNAL_PATH = "MDF/images/0/image"
fp=open("list-11\\readme.txt","r") sentence=fp.read() words=sentence.split() d = dict() for c in words: if c not in d: d[c] = 1 else: d[c] += 1 #dictionary values a=d.values() b=max(a) for i in d: if(d[i]==b): print("frequent word:",i,";","count:",b)
class fracao(object): def __init__(self, num, den): self.num = num self.den = den def somar_fracao(self, b): f = fracao(self.num*b.den + b.num*self.den, self.den*b.den) #f.num = #f.den = fracao.simplificar_fracao(f) return f def su...
# Day2 of my 100DaysOfCode Challenge # I was reading this article by Tim Urban - # Your Life in Weeks and realised just how little # time we actually have. # https://waitbutwhy.com/2014/05/life-weeks.html # Create a program using maths and f-Strings that tells us # how many days, weeks, months we have left if we ...
#!/usr/bin/python3 def inherits_from(obj, a_class): if isinstance(obj, a_class) and type(obj) is not a_class: return True else: return False
# # A Rangoli Generator # # Author: Jeremy Pedersen # Date: 2019-02-18 # License: "the unlicense" (Google it) # # Define letters for use in rangoli alphabet = 'a b c d e f g h i j k l m n o p q r s t u v w x y z'.split() # Read in rangoli size size = int(input("Set size of rangoli: ")) # Calculate maximum linewidth ...
calls = 0 def call(): global calls calls += 1 def reset(): global calls calls = 0
#crie um programa que tenha a funcao chamada escreva(), que receba um texto qualquer como parametro e mostre # uma mensagem com tamanho adaptavel. #Ex. escreva('Ola Mundo!') # Saida ˜˜˜˜˜˜˜˜˜˜ # Olá Mundo! # ˜˜˜˜˜˜˜˜˜ #minha resposta def escreva(msg): print('~' * (len(msg) + 4)) # pra ficar com 2 ~...
# print()函数也可以接受多个字符串,用逗号“,”隔开,就可以连成一串输出: print('You jump', 'I jump') # print()会依次打印每个字符串,遇到逗号输出一个空格 print(100 + 200) print('100 + 200 =', 100 + 200)