content
stringlengths
7
1.05M
projectTwitterDataFile = open("project_twitter_data.csv","r") resultingDataFile = open("resulting_data.csv","w") punctuation_chars = ["'", '"', ",", ".", "!", ":", ";", '#', '@'] # lists of words to use positive_words = [] with open("positive_words.txt") as pos_f: for lin in pos_f: if lin[0] != ';' and lin...
class Solution(object): def rob(self, nums): """ :type nums: List[int] :rtype: int """ n = len(nums) if n == 0: return 0 elif n == 1: return nums[0] elif n == 2: return max(nums) else: a, b = nums...
def sum_repeat_digits(offset): l = [] for i, c in enumerate(digits): index_to_check = int((i + offset) % len(digits)) if c == digits[index_to_check]: l.append(int(c)) return sum(l) def main(): with open('inputs/solution1.txt') as f: digits = f.read().strip() pri...
''' /* * @Author: Shawn Zhang * @Date: 2019-09-09 00:39:11 * @Last Modified by: Shawn Zhang * @Last Modified time: 2019-09-09 01:17:22 */ ''' class flaskisanException(Exception): """flaskisan抛出的异常的基本类""" pass
employees = { 'Alice': 100000, 'Bob': 98000, 'Cena': 127000, 'Dwayne': 158000, 'Frank': 88000 } # find the top earner (every one with salary greater than or equal to 1 lakh) top_earners = [] for name,salary in employees.items(): if salary >= 100000: top_earners.append((name,salary)) p...
VALID_AZURE_ENVIRONMENTS = [ 'AzurePublicCloud', 'AzureUSGovernmentCloud', 'AzureChinaCloud', 'AzureGermanCloud', ]
class Lane: def __init__(self, position, objectType, player_id): self.position = position self.object = objectType self.occupied_by_player_id = player_id
coordinates_E0E1E1 = ((123, 110), (123, 112), (123, 113), (123, 114), (123, 115), (123, 116), (123, 117), (123, 118), (123, 119), (123, 120), (123, 122), (124, 110), (124, 122), (125, 110), (125, 112), (125, 113), (125, 114), (125, 115), (125, 116), (125, 117), (125, 118), (125, 119), (125, 120), (125, 122), (126, 10...
# Faça um programa que leia um número Inteiro qualquer e mostre # na tabela a sua tabuada. num = int(input("Digite um Número: ")) print("{} * 1 = {}".format(num, num * 1)) print("{} * 2 = {}".format(num, num * 2)) print("{} * 3 = {}".format(num, num * 3)) print("{} * 4 = {}".format(num, num * 4)) print("{} * 5 = {}".f...
class Adam: def __init__(self, lr=0.001, beta1=0.9, beta2=0.999): self.lr = lr self.beta1 = beta1 self.beta2 = beta2 self.iter = 0 self.m = None self.v = None def update(self, params, grads): if self.m is None: self.m, self.v = {}, {}...
# # PySNMP MIB module HH3C-RCP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-RCP-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:29:20 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,...
#Two words are blanagrams if they are anagrams but exactly one letter has been substituted for another. #Given two words, check if they are blanagrams of each other. def checkBlanagrams(word1, word2): difference = 0 sortedWord1 = sorted(word1) sortedWord2 = sorted(word2) for a, b in zip(sortedWor...
#!/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2020/7/26 12:13 # @Author : lirixiang # @Email : 565539277@qq.com # @File : 22-generateParenthesis.py """ 数字 n 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且 有效的 括号组合。   示例: 输入:n = 3 输出:[ "((()))", "(()())", "(())()", "()(())", "()()(...
arr = [1, 2] brr = [3, 4] print(arr + brr) print([1] * 3)
def check_is_prime(n): if n == 2 or n == 3: return True if n % 2 == 0 or n < 2: return False for i in range(3, int(n**0.5)+1, 2): if n % i == 0: return False return True
if __name__ == '__main__': input = [x.strip().split('-') for x in open('input', 'r').readlines()] map = {} for path in input: if path[0] not in map: map[path[0]] = list() map[path[0]].append(path[1]) if path[1] not in map: map[path[1]] = list() map[path[1]].append(path[0]) ...
class DH_Endpoint(object): def __init__(self, public_key1, public_key2, private_key): self.public_key1 = public_key1 self.public_key2 = public_key2 self.private_key = private_key self.full_key = None def generate_partial_key(self): partial_key = self.public_key1**self.pri...
""" bitToRealHelper.py is a helper class to convert a binary representation to a real numbered representation for the purpose of the assignment. In reality, it would be much simpler to program a GA that uses real values and an interpolation method during crossover. @author Michael Allport 2021 """ class BitToReal(): ...
def make_sectional_content(data : list) -> list: sections = [] section = [] for item in data: if item == "~~~": sections.append(section) section = [] continue section.append(item) return sections def print_sectional_content(sect...
def test_find_or_create_invite(logged_rocket): rid = 'GENERAL' find_or_create_invite = logged_rocket.find_or_create_invite(rid=rid, days=7, max_uses=5).json() assert find_or_create_invite.get('success') assert find_or_create_invite.get('days') == 7 assert find_or_create_invite.get('maxUses') == 5 ...
def check_best_ways(matrix: list, row: int, col: int): direction_up = float('-inf') position_direction_up = [] up_sum = 0 for r in range(row - 1, -1, -1): if matrix[r][col] == "X": break up_sum += matrix[r][col] direction_up = up_sum position_direction_up.appe...
class Asset: def __init__(self, type, nameplate, project): self.type = type self.nameplate = nameplate self.project = project B02 = Asset("Tracker","none", "Saltwood Solar") print(B02.project)
# Faça um programa que peça dois numeros e imprima o maior deles number1 = int(input('Insira um numero: ')) number2 = int(input('Insira outro numero: ')) if (number1 == number2): print('Por favor insira numeros diferentes') elif (number1 > number2): print(f'O numero {number1} é maior que o numero {number2}')...
pokerNames = ('3','4','5','6','7','8','9','10','J','Q','K','A','2','B','R') pokerValues = ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 100,200,300) pokerDict = dict(zip(pokerNames, pokerValues)) def getCardValue(name): return pokerDict[name] if __name__ == '__main__': print(getCardValue('3')) ...
# x, y, z # caso x > y, maior = x # se não, maior = y def maior_elemento (lista): for i in range(len(lista)): primeiro = i for j in range (i+1, len(lista)): if lista[primeiro] > lista[j]: return lista[primeiro] else: return maior_elemento(lis...
# Program to find if the numbers given can add # up to a given target or not """ m = target, determines the height of the tree n = array length, determines complexity This has a O(n^m) time complexity and O(m) space complexity when solving without memoization. Memoized Solution: Time = O(m*n) Space = O(m) """ cache =...
lista = [] for a in range(0, 5): num = int(input('Digite um numero: ')) if a == 0 or num > lista[-1]: lista.insert(4, num) print('Adicionado na ultima posição') else: c = 0 while c < len(lista): if num <= lista[c]: lista.insert(c, num) ...
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 # # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and associated documentation files (the "Software"), to deal in the Software # without restriction, including without ...
""" Asked by: LinkedIn [Hard]. Given a string, return whether it represents a number. Here are the different kinds of numbers: "10", a positive integer "-10", a negative integer "10.1", a positive real number "-10.1", a negative real number "1e5", a number in scientific notation And here are examples of non-numbers: ...
""" Query PyPI from the command line ``qypi`` is a command-line client for querying & searching `PyPI <https://pypi.org>`_ for Python package information and outputting JSON (with some minor opinionated changes to the output data structures). Run ``qypi --help`` or visit <https://github.com/jwodder/qypi> for more inf...
def parse_ner_dataset_file(f): tokens = [] for i, l in enumerate(f): l_split = l.split() if len(l_split) == 0: yield tokens tokens.clear() continue if len(l_split) < 2: continue # todo: fix this else: tokens.append({'te...
config = { "-varprune":[0,int], "-recompute":[False,bool], "-sort":[False,bool], "-no-sos":[False,bool], "-no-eos":[False,bool], "-write":["./counts",str], "-gtmin":[1,int], "-gtmax":[5,int], "-ndiscount":[Fals...
class Config: # region bug configurations PROJECT_ROOT_PATH = r"/Users/ori/pergit/defects/math_1_buggy" BUG_PROJECT = 'math' BUG_ID = 1 IGNORED_CLASS_LIST = ['FastCosineTransformerTest', 'FastSineTransformerTest', 'FastMathStrictComparisonTest', 'CorrelatedRandomVectorGener...
# hint: see np.diff() inter_switch_intervals = np.diff(switch_times) # plot inter-switch intervals with plt.xkcd(): plot_interswitch_interval_histogram(inter_switch_intervals)
class Solution: def minEatingSpeed(self, piles: List[int], H: int) -> int: if len(piles)==0: return 0 l,r = 1,pow(10,9) while l<=r: m = (l+r)>>1 sum = 0 for i in piles: sum+=(...
digits = [0,1,2,3,4,5,6,7,8,9] print(digits[-1]) print(digits[-len(digits)]) print(digits[:3]) #stride mige chanta chanta beri print((digits[0:9:2])) #bayad az akhar be aval bzanim print((digits[9:0:-1])) goods = 'success,win,best_coder,elham' print(goods) l = goods.split(",") #ye string ro migire o split mikone be li...
class Holding(object): def __init__(self, name, ticker, weight=100, sector=None, news=None, link=None): self.name = name self.ticker = ticker self.weight = weight self.sector = sector self.news = news self.link = link def set_name(self, name): self.name ...
"""Top-level package for Nginx Log Analytics.""" __author__ = """Surya Sankar""" __email__ = 'suryashankar.m@gmail.com' __version__ = '0.1.0'
word = input('Введите слово: ') word_list = list(word) count = 0 unical = 0 for letter in word_list: for letter_2 in word_list: if letter == letter_2: count += 1 if count < 2: unical += 1 count = 0 else: count = 0 print('Уникальных букв в слове: ', unical)
class BulkOperationProgressInfo(object): """ Contains percent complete progress information for the bulk operation.""" def __init__(self, percent_complete=0): """ Initialize a new instance of this class. :param percent_complete: (optional) Percent complete progress information for the bulk ope...
# Question : https://www.careercup.com/question?id=5754648968298496 dishes = {"Pasta":["Tomato Sauce", "Onions", "Garlic"], "Chicken Curry":["Chicken", "Curry Sauce"], "Fried Rice":["Rice", "Onions", "Nuts"], "Salad":["Spinach", "Nuts"], "Sandwich":["Cheese", "Bread"], ...
class Funcionario: def __init__(self, nome, idade, salario): self.nome = nome self.idade = idade self.__salario = salario # atributo privado def set_salario(self, salario): if salario > 0: self.__salario = salario else: print("Valor invalido") ...
# phone numbers for countries phone_codes = {} phone_codes["DE"] = 49 phone_codes["TR"] = 90 phone_codes["PK"] = 92 phone_codes["IN"] = 91 code = phone_codes["IN"] print(code)
""" Speech constants related to determining whether the user is in Boston or not. """ GENERIC_GEOLOCATION_PERMISSON_SPEECH = """ Boston Info would like to use your location. To turn on location sharing, please go to your Alexa app and follow the instructions. Alternatively, you can provide an address whe...
# Exercício Python 094: # Crie um programa que leia nome, sexo e idade de várias pessoas, # guardando os dados de cada pessoa em um dicionário e todos os dicionários em uma lista. # No final, mostre: # A) Quantas pessoas foram cadastradas # B) A média de idade # C) Uma lista com as mulheres # D) Uma lista de pessoas co...
def hello(): return hw() def hw(): cadena = "<h1>Prueba</h1>" cadena += "<h2>Probando</h2>" cadena += "<div>Hello World.</div>" return cadena
# mysql 数据库的配置信息 config = { 'ip': '127.0.0.1', 'port': '3306', 'username': 'root', 'password': '', 'db_name': 'iot_map' } # 此处为你创建baiduAPI 的 app后的 ak, # 以下为示例,并非真实有效的ak baiduAPI_ak = 'xxxx8PHhrbovyrT5sBXz5GNHZdFcqiGj'
def test_object(store): test_store_object(store) test_events_object(store.events) test_attendees_object(store.attendees) test_attendees_object(store.waitings) test_users_object(store.users) def test_store_object(store): assert store assert store.events assert store.attendees...
''' Desenvolva uma lógica que leia o pessoa e a altura de uma pessoa. Calcule seu IMC e mostre seu status, de acordo com a tabela abaixa: - Abaixo de 18.5: Abaixo do peso - Entre 18.5 e 25: Peso ideal - 25 até 30: Sobrepeso - 30 até 40: Obesidade - Acima de 40: Obesidade Mórbida ''' peso = float(input('Digite seu pe...
# # PySNMP MIB module BAS-PBRF-OSPF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAS-PBRF-OSPF-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:34:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
# Synthetic fault scarp parameters fault_dip = 60 fault_slip = 10 fault_slip_rate = 2 fault_scarp_profile_length = 30 fault_scarp_exponential = True # True for simple fault_scarp_steps = 1 fault_scarp_step_width = 5 final_time = fault_slip / fault_slip_rate # Parameters for synthetic fault scarps and for calculating d...
class Lit_detail: def __init__(self, lit_name, lit_author): self.title = lit_name self.author = lit_author def display(self): return "Title:" + str(self.title) + " Author:" + str(self.author) class Book(Lit_detail): unique_count = 0 total_count = 0 ...
# my_string = input("Input as many values as you want separated by whitespace: ") # my_list = my_string.split(" ") # my_numbers = [int(element) for element in my_list] # print(my_numbers, sum(my_numbers), min(my_numbers), max(my_numbers)) # one liner as above but maybe a bit too dense my_nums = [int(t) for t in input(...
class Vehicle: def __init__(self, velocity, name): self.velocity = velocity self.name = name def __call__(self, velocity): self.velocity += velocity def __len__(self): # len関数 return self.velocity def __repr__(self): return 'Velocity is {}.'.format(...
#Sevda Avcılar - 170401054 def decimaltobin(a): return "{:7b}".format(a) def xor(a,b): ret="" i=0 while i<len(b): if a[i]==b[i]: ret=ret+"0" else: ret=ret+"1" i=i+1 return ret def ozet(sifre): i = 0 sayi2 = [] list...
with open('input18.txt') as f: maths = f.read().split('\n') ops = { '*':[2, 'l', 2, lambda x, y : y * x], '+':[3, 'l', 2, lambda x, y : y + x] } def solve(read): stack = [] out = [] numstack = [] funcstack = [] last = '' for t in read: if t.isspace(): contin...
def check_prime(integer): if integer == 1: return False if integer == 2: return True if integer % 2 == 0: return False for i in range(3, int(integer**(1/2))+1, 2): if integer % i == 0: return False else: return True num_primes = 0 n = 0 while num_...
n = int(input()) upper_sum , lower_sum = 0, 0 arr = [] for _ in range(n): upper, lower = [int(x) for x in input().split()] upper_sum += upper lower_sum += lower arr.append((upper, lower)) if (upper_sum % 2) == 0 and (lower_sum % 2) == 0: print("0") else: msg = "-1" for upper, lower in arr: ...
class RaisesClass(): def func_with_raise(self) -> None: """ Raises: RuntimeError: [description] ValueError: [description] IndexError: [description] """ if 2 == 3: raise RuntimeError() if 2 == 4: raise ValueError() ...
class Node: """ Basic node implementation with a single link. """ def __init__(self, val=None): self.val = val self.next = None def __str__(self): return str(self.val) class Queue: """ Queue implementation using Linked List. """ def __init__(self): ...
#!/usr/bin/env python3 # encoding: utf-8 """ @author: Medivh Xu @file: __init__.py.py @time: 2020-03-04 21:27 """
l_rate = 0.3 n_epoch = 100 loss = np.zeros(n_epoch) beta = [0.0,0.0,0.0] for epoch in range(n_epoch): sum_error = 0 for row in train: x = row[0:-1] # input features y = row[-1] # output label yhat = predict(row, beta) error = y - yhat sum_error += error**2 beta...
def fetch_data1(): return "data1" def fetch_data2(): return "data2" def process_data1(): return fetch_data1().upper() def process_data2(): return fetch_data2().upper() def process_data3(): return process_data1() + "-" + process_data2() def show_report1(): print(process_data3()) def show_re...
ficha = {} gols = [] ficha['nome'] = str(input('Nome do jogador: ')) n_partidas = int(input(f'Quantas partidas {ficha["nome"]} jogou: ')) for c in range(1, n_partidas + 1): gol_partida = int(input(f'Quantos gols na {c}º partida: ')) gols.append(gol_partida) ficha['gols'] = gols ficha['total'] = sum(gols) print(...
''' @author: Kittl ''' def exportStorageTypes(dpf, exportProfile, tables, colHeads): # Get the index in the list of worksheets if exportProfile is 2: cmpStr = "StorageType" elif exportProfile is 3: cmpStr = "" idxWs = [idx for idx,val in enumerate(tables[exportProfile-1]) if val == ...
# coding=utf-8 #============================================================= # File name: config.py # Created time: 2018年08月27日 星期一 02时22分22秒 # Copyright (C) 2018 Richado # Mail: 16231324@bjtu.edu.cn #============================================================= type_to_suffix = {'powerpoint':'.pptx','rar':'.rar','wo...
class MongoUsersUtils: def __init__(self, mongo): self.mongo = mongo self.collection_name = "users" def save(self, user): return self.mongo.db[self.collection_name].insert(user)
# -*- coding: utf-8 -*- """This module contains settings for Animerger""" archive_extensions = [".7z", ".zip", ".rar", ".tar"] video_extensions = [".mkv", ".mp4", ".avi"] audio_extensions = [".mka", ".aac", ".mp3", ".ac3"] subtitles_extensions = [".srt", ".ass", ".ssa"] fonts_extensions = [".ttf", ".otf"]
''' Para colorir no terminal você usa esse comando!! \033[style;text;backm Style : text: back: 0 : nenhum efeito(pode deixar até em branco) [] 30: branco...
def reverseBits(n: int) -> int: bin_n = list(bin(n)[2:]) bin_n.reverse() bin_n.extend(['0'] * (32 - len(bin_n))) return int(''.join(bin_n), 2) def reverseBits(n: int) -> int: rtn = 0 for i in range(32): rtn = (rtn << 1) | (n & 1) n >>= 1 return rtn def reverseBits(n: int)...
def unique_string_list(element_list, only_string=True): """ Parameters ---------- element_list : only_string : (Default value = True) Returns ------- """ if element_list: if isinstance(element_list, list): element_list = set(element_list) elif...
input = """ % true negation of terms does not make sense. %g(-a). okay(a). %f(1,-"zwei"). %:- not g(-a). :- not okay(a). %:- not f(1,-"zwei"). """ output = """ % true negation of terms does not make sense. %g(-a). okay(a). %f(1,-"zwei"). %:- not g(-a). :- not okay(a). %:- not f(1,-"zwei"). """
# copy-pasted from https://github.com/toastdriven/pylev/blob/master/pylev.py def recursive_levenshtein(string_1, string_2, len_1=None, len_2=None, offset_1=0, offset_2=0, memo=None) -> float: """ Calculates the Levenshtein distance between two strings. Usage:: >>> recursive_levenshtein('kitten', 'si...
class NoSolutionException(Exception): """ DESCRIPTION: An exception to handle where there are no terms to choose when performing inference. This exception is launched when there is no solution. """ # Methods def __init__(self): """ DESCRIPTION: Constructor of th...
def get_upstream_conduits(node_id, con_df, in_col_name="InletNode", out_col_name="OutletNode"): us_nodes = get_upstream_nodes(node_id, con_df, in_col_name, out_col_name) us_cons = con_df[(con_df[in_col_name].isin(us_nodes)) | (con_df[out_col_name].isin(us_nodes))] return us_cons.index def get_upstream_nod...
frase = str(input("Digite uma frase: ")).lower().strip() print("Em sua frase, a letra 'a' aparece {} vezes".format(frase.count('a'))) print("A letra 'a' aparece pela primeira vez na posição {}".format(frase.find('a'))) print("A letra 'a' aparece a ultima vez na posição {}".format(frase.rfind('a'))) # Pode adicionar +...
""" 建造者模式 将一个复杂对象的构建与它的表示分离 使得同样的构建过程可以创建不同的表示 """ class PersonBuilder: def __init__(self, graphics, pen): self.graphics = graphics self.pen = pen def build_head(self): pass def build_body(self): pass def build_arm_left(self): pass def bui...
#unlicense.org #in case importing the numpy/scipy libraries should be avoided: def zeros(item, quanity): return [item] * quanity def simple_matrix(item,quanity): return [item] * quanity
#!/usr/local/bin/python3 """ Demo für einen Brute-Force-Angriff auf eine Caesar-Verschlüsslung HackerSchool 2020 """ def caesar(text, schluessel): """ Verschluesselt klartext durch Verschiebung der Buchstaben um schluessel gemaess Caesaren-Verschluesselung. """ chiffre = "" alphabet = "ABCDEFG...
#!/usr/bin/env python # Copyright 2017 Google Inc. 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 require...
set_name(0x801379C4, "PreGameOnlyTestRoutine__Fv", SN_NOWARN) set_name(0x80139A88, "DRLG_PlaceDoor__Fii", SN_NOWARN) set_name(0x80139F5C, "DRLG_L1Shadows__Fv", SN_NOWARN) set_name(0x8013A374, "DRLG_PlaceMiniSet__FPCUciiiiiii", SN_NOWARN) set_name(0x8013A7E0, "DRLG_L1Floor__Fv", SN_NOWARN) set_name(0x8013A8CC, "StoreBlo...
class ValidationException(Exception): pass class RepromptException(Exception): pass
m,n=map(int,input().split()) mat=[] for i in range(m): k=list(map(int,input().split())) mat.append(k) mat count=mat[0][0] i=0 j=0 while(True): if (i==m-1 and j==n-1): break if (i<m-1 and j<n-1): if (mat[i+1][j]>mat[i][j+1]): count+=mat[i+1][j] i+=1 else: count+...
def parse_function_path_string(string): """ takes in the function string and splits it into the module path and function path. :param string: :return: """ list_ = string.split('.') module_path = '.'.join(list_[:-1]) function_path = list_[-1] return module_path, function_path
# Solution to part 2 of day 9 of AOC 2021, Smoke Basin # https://adventofcode.com/2021/day/9 def search(search_x: int, search_y: int) -> int: """Starting at x, y... return the size of the basin found.""" if (search_x, search_y) not in floor: return 0 if floor[search_x, search_y] == 9: retu...
""" The original version of the API. .. deprecated:: 0.7.4 Use ``api.v2`` instead. """
input = """ f(1). a(X) :- 1=2+x, f(X). %+(1,2,x), f(X). """ output = """ f(1). a(X) :- 1=2+x, f(X). %+(1,2,x), f(X). """
def generate_LAMMPS_potential(data): #potential_file = '# Potential file generated by aiida plugin (please check citation in the orignal file)\n' potential_file = '' for line in data['file_contents']: potential_file += '{}'.format(line) return potential_file def get_input_potential_lines(da...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"div2k_path": "00_datasets.ipynb", "div2k_train_lr_path": "00_datasets.ipynb", "div2k_train_lr_x2": "00_datasets.ipynb", "div2k_train_lr_x3": "00_datasets.ipynb", "div2k_tr...
""" Dummy module that just print out some messages""" DATE = 12092019 def hello ( name ): """ Say hello .""" return " hello " + name def ciao ( name ): """ Say ciao .""" return " Ciao " + name def bye (nom ): """ Say bye .""" return " bye " + nom
myStr = input("Enter a String: ") Str = "" for ind in range (2, len(myStr)): if ind%2 == 0: Str = Str + myStr[ind] print (myStr[0] + Str)
# Copyright (c) 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'shared', 'type': 'shared_library', 'sources': [ 'file.c' ], }, { 'target_name': 's...
""" 根据下列文字,提取变量,使用字符串格式化打印信息 湖北确诊67802人,治愈63326人,治愈率0.99 70秒是01分零10秒 """ # province=input("请输入省份:") # num_diagnose=int(input("请输入确诊人数:")) # num_cure=int(input("请输入治愈人数:")) # probability=num_cure/num_diagnose # print("%s确诊%d人,治愈%d人,治愈率%.2f"%(province,num_diagnose,num_cure,probability)) total=70 print("%d是%.2d分零%.2d秒"%(...
# Copyright 2019,2020,2021 Sony Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
data = pd.read_csv('/Users/djamillakhdar-hamina/Desktop/kavli_mdressel_combined_4col.csv') # Count edges to target edge_count=data.groupby('target').count() # Merge back to x using target-> target target_self_merge= pd.merge(data, edge_count, left_on='target', right_on='target') # Merge back to x using source -> tar...
# -*- coding: utf-8 -*- """ Created on Tue Aug 17 15:16:50 2021 @author: 2900888 """ lengde_meter_streng = input("Skriv inn lenden til rommet i meter: ") bredde_meter_streng = input("Skriv inn bredden til rommet i meter: ") lengde_meter = float(lengde_meter_streng) bredde_meter = float(bredde_meter_streng) ...
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (c) 2013 ZestyBeanz Technologies Pvt. Ltd. # (http://wwww.zbeanztech.com) # contact@zbeanztech.com # # This program is free software: you can redistribute it and/or modify # it under the...
def computarnotas(nota): if nota > 1 or nota < 0: nota = 'Nota inválida.' elif nota >= 0.9: nota = 'A' elif nota >= 0.8: nota = 'B' elif nota >= 0.7: nota = 'C' elif nota >= 0.6: nota = 'D' elif nota < 0.6: nota = 'F' return nota try: n1 = float(input(...
class Solution(object): def findMinDifference1(self, timePoints): if len(timePoints) > 1440: return 0 s = sorted(map(lambda t: int(t[:2]) * 60 + int(t[3:]), timePoints)) return min(s2 - s1 for s1,s2 in zip(s, s[1:] + [1440+s[0]])) def findMinDifference2(self, timePoints): ...
# APIs for Windows 32-bit kernel32 library. # Format: retval, rettype, callconv, exactname, arglist(type, name) # arglist type is one of ['int', 'void *'] # arglist name is one of [None, 'funcptr', 'obj', 'ptr'] api_defs = { 'kernel32.main_entry':( 'int', None, 'stdcall', 'kernel32.main_entry', ...