content
stringlengths
7
1.05M
# Variable declaration s = 'Dany Sluijk'; split = s.split(' '); print(split[0][0]+split[1][0]);
class Sirt6BaseException(Exception): pass class InvalidLayoutError(Sirt6BaseException): pass
#!/usr/bin/python class LoadBlacklist: list = [] def loadlist(self): tmplist = [] f = open("./config/blacklist.txt","r") for counter, data in enumerate(f.readlines()): tmplist.append([]) item = data item = item.replace('\n', '') item = item.replace('\n', '') tmplist[coun...
t=int(input()) l = [] while (t>0): N,K=input().split() N,K=int(N),int(K) A=input().split() A=[int(i) for i in A] lst=[] for i in A: if (K%i==0): lst.append(i) if (len(lst)==0): l.append(-1) else: l.append(max(lst)) t-=1 for i in l: ...
broker_url = 'amqp://couchbase:couchbase@172.23.97.73:5672/broker' broker_pool_limit = None worker_hijack_root_logger = False result_backend = "amqp://" result_persistent = False result_exchange = "perf_results" accept_content = ['pickle'] result_serializer = 'pickle' task_serializer = 'pickle' task_protocol = 1 broker...
''' Classical notion of self-play. Where the opponent is ALWAYS the same as the agent that is being learnt. ''' def opponent_sampling_distribution(menagerie, training_agent): ''' :param menagerie: archive of agents selected by the curator and the potential opponents :param training_agent: AgentHook of the...
""" =========================================================== Utilities (:mod:`utilities` package) =========================================================== This package contains various classes and functions for the pipeline construction and execution. File Access (:mod:`utilities.file_access_utilities`) -------...
altura = input('Qual é a sua altura? ') massa = input('Qual é sua massa? ') imc = int(massa) / float(altura) ** 2 while imc <= 30 and imc >= 18.5: print('Seu Índice de Massa Corporal é ', imc, '.', 'O valor normal é de 18,50 a 24,99.' ) input(massa) input(altura) else: print('Seu IMC está fora do valo...
def index(): return { "message": "healthy & running" }, 200
screening_type = input() rows = int(input()) columns = int(input()) income = 0 cinema_capacity = rows * columns if screening_type == "Premiere": income = cinema_capacity * 12 elif screening_type == "Normal": income = cinema_capacity * 7.50 elif screening_type == "Discount": income = cinema_capacity * 5.00 ...
#----------------------------------------------------------------------------- class SNAP: '''Class to use snap for command line via gpt, directly from Python''' graph_amplitude = 'Preprocessing_amplitude.xml' #variable outputs: Amplitude_VV, incidence angle #pixel resolution = 100x100 m ...
#Aula 07 Operadores logicos, acho """ Ordem de precedencia aritmeticas () = parenteses vem primeiro ** = exponenciação vem em segundo *,/,//,% = multiplicação, divisão, divisão inteira e divisão do resto vem em terceiro +, - = soma e subtração são os ultimos """ ''' nome = input('Qual o seu nome?: ') print('=...
# Exercise 2 - Faulty Calculator # 45 * 3 = 555, 56+9 = 77, 56/6 = 4 # Design a calculator which will correctly solve all the problems except # the following ones: # 45 * 3 = 555, 56+9 = 77, 56/6 = 4 # Your program should take operator and the two numbers as input from the user # and then return the result # solutio...
class NotFittedError(ValueError, AttributeError): """Exception class to raise if estimator is used before fitting. This class inherits from both ValueError and AttributeError to help with exception handling and backward compatibility. Examples -------- >>> from sklearn.svm import LinearSVC ...
""" Arithmetic Operators The provided code stub reads two integers from STDIN, a and b. Add code to print three lines where: 1. The first line contains the sum of the two numbers. 2. The second line contains the difference of the two numbers (first - second). 3. The third line contains the product of the ...
__all__ = [ '__title__', '__summary__', '__uri__', '__version__', '__author__', '__email__', '__license__', '__copyright__', ] __title__ = 'TauBD' __summary__ = 'TBD: Tau Be Damned.' __uri__ = 'https://github.com/Intrinsically-Disordered/TBD' __version__ = '1.0' __author__ = 'TBD' __email__ = 'jiaweihe@uw.ed...
# labmda function that returns a test number is even or not f = lambda x: 'Even' if x%2==0 else 'Odd' print(f(int(input('Enter a number \n'))))
Mano = 0 def on_gesture_shake(): global Mano Mano = randint(1, 3) if Mano == 1: basic.show_leds(""" # # . . # # # . # . . # # . . # # . # . # # . . # """) else: if Mano == 2: basic.show_le...
title = "All my commands, peko!" description = "If you have any problems with me, feel free to contact the creator on Discord (bemxio#5847) or on Reddit (u/bemxioo) peko!" invite = "Here's my invite link peko! https://discord.com/api/oauth2/authorize?client_id=817481976797069383&permissions=116736&scope=bot" dm_check =...
print('Challenge 9: WAF to concatinate 2 string with out using +.') str1 = "Hello" str2 = "World" print("{} {}".format(str1, str2))
def _get_change_making_matrix(set_of_coins, r): m = [[0 for _ in range(r + 1)] for _ in range(len(set_of_coins) + 1)] for i in range(r + 1): m[0][i] = i return m def change_making(coins, n): """This function assumes that all coins are available infinitely. n is the number that we ...
ACCESS_TOKEN = '#####' ACCESS_TOKEN_SECRET = '########' CONSUMER_KEY = '######' CONSUMER_SERET = '#######'
FLASK_ADMIN_SWATCH = "paper" SECRET_KEY = "123456790" DATABASE_FILENAME = "example_app_01.db" SQLALCHEMY_DATABASE_URI = "sqlite:///" + DATABASE_FILENAME SQLALCHEMY_ECHO = True SQLALCHEMY_TRACK_MODIFICATIONS = False
AGG_SIG_UNSAFE = 49 AGG_SIG_ME = 50 # the conditions below reserve coin amounts and have to be accounted for in output totals CREATE_COIN = 51 RESERVE_FEE = 52 # the conditions below deal with announcements, for inter-coin communication # coin announcements CREATE_COIN_ANNOUNCEMENT = 60 ASSERT_COIN_ANNOUNCEMENT = 6...
# # PySNMP MIB module EQLREPLPARTNER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EQLREPLPARTNER-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:05:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
class GeneratorBase: __parameters__: dict __saved__: dict def __init__(self): self.reset_params() self.reset_saved() def reset_params(self): pass def reset_saved(self): self.__saved__ = {'default': self.__parameters__.copy()} def save(self, param_key: str): ...
__author__ = 'lorcan' # get int from user # get a base from user to convert int to # get BASE_X string # convert BASE_X string back to integer # get int from user myStr = input("Enter an integer to convert binary: ") myInt = int(myStr) # get a base from user to convert int to baseStr = input("\nChoose Base 2,8,16 t...
class Configurable: def __init__(self): pass def function_support(self, function: str) -> bool: pass def parameter_template(self, function: str) -> dict: pass
pokemon = ["피카츄", "라이츄", "파이리", "꼬부기", "버터플", "야도란", "피죤투", "또가스"] print(pokemon[:3]) print(pokemon[3:]) print(pokemon[::2])
#SOLUCION TALLER NO CALIFICABLE: REALIZADO POR JUAN CAMILO GONZALEZ DUQUE-UCC-ING. EN SISTEMAS #ANALISIS DEL PROBLEMA: # #VARIABLES: #Nombre del equipo PUNTOS OBTENIDOS POR EL EQUIPO #Cantidad de partidos jugados DIFERENCIAS DE GOLES #Cantidad de partidos ganados #Cantidad de partidos e...
def add_me_to_the_queue(express_queue, normal_queue, ticket_type, person_name): pass def find_his_friend(queue, friend_name): pass def add_person_with_his_friends(queue, index, person_name): pass def remove_the_mean_person(queue, person_name): pass def how_many_dopplegangers(queue, person_name): ...
#!/usr/bin/env python __author__ = "Christopher and Cody Reichert" __copyright__ = "Copyright 2015, SimplyRETS Inc. <support@simplyrets.com>" __credits__ = ["Christopher Reichert", "Cody Reichert"] __license__ = "MIT" __version__ = "0.1" __maintainer__ = "Christopher Reichert" __email__ = "christopher@simplyrets.com" ...
n = int(input()) while n > 0 : print (n) n -= 1 print ("0!!")
class Config: """Base config.""" # pylint: disable=too-few-public-methods STATIC_FOLDER = "static" CACHE_TYPE = "simple" CACHE_DEFAULT_TIMEOUT = 3600 QUIET = False class ProdConfig(Config): """Production configuration.""" # pylint: disable=too-few-public-methods FLASK_ENV = "pro...
# print(max(1, 2, 3, 4, 5, 100, -2, -2, -10)) # print(min(1, 2, 3, 4, 5, 100, -2, -2, -10)) """ Time Complexity: O(n) Space Complexity: O(n) """ n = int(input()) numbers = [x for x in range(1, n)] print(numbers) # print(max(numbers)) # print(min(numbers)) print(sum(numbers))
class Graph: def __init__(self, v): self.v = v self.graph = [] def add_edge(self, s, d, w): self.graph.append([s,d,w]) def bellman_ford(self, src): dist = [float('inf')]* self.v dist[src] = 0 # Relax v-1 for i in range(self.v - 1): fo...
__title__ = 'arbalest' __version__ = '1.6.2' __author__ = 'Fredrick Galoso' __copyright__ = 'Copyright 2015 Dwolla, Inc'
# https://leetcode.com/problems/add-two-numbers/ class ListNode: def __init__(self, val = 0, next = None): self.val = val self.next = next def __eq__(self, other): if other != None: return self.val == other.val and self.next == other.next def __add__(se...
# ------------------------------ # 54. Spiral Matrix # # Description: # Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. # # Example 1: # Input: # [ # [ 1, 2, 3 ], # [ 4, 5, 6 ], # [ 7, 8, 9 ] # ] # Output: [1,2,3,6,9,8,7,4,5] # # Example 2: # Input: # [ # ...
def main(S, W): if S > W: print('safe') else: print('unsafe') if __name__ == '__main__': S, W = list(map(int, input().split())) main(S, W)
# encoding: utf-8 """ Core exceptions """ class GozokiaError(Exception): '''raise this when there's a lookup error for my app''' pass class GozokiaNotImplemented(Exception): '''raise this when there's a lookup error for my app''' pass class ImproperlyConfigured(Exception): pass
coordinates_E0E1E1 = ((128, 117), (128, 119), (128, 121), (129, 116), (129, 124), (130, 115), (130, 117), (130, 118), (130, 119), (130, 120), (130, 121), (130, 123), (131, 114), (131, 116), (131, 123), (132, 118), (132, 119), (132, 120), (132, 121), (132, 123), (133, 113), (133, 116), (133, 123), (134, 114), (134, 12...
''' Created on Sep 30, 2018 @author: cat_t ''' class Location(object): ''' classdocs ''' def __init__(self, name = ""): ''' Constructor ''' self.name = name def __eq__(self, other): try: if self.name == other.name: retu...
class ListNode: def __init__(self, val): self.val = val self.next = None class LinkedList: def __init__(self, head=None, items=None): self.head = head # ListNode if items is not None: # should be List[ListNode] for node in items: self.append(node)...
# /* megatest texts, C-ified */ # // Copyright 2010 Kurt Hackenberg & William S. Yerazunis, each individually # // with full rights to relicense. # // # // This collection contains texts in the public domain; the copyright # // is not on the texts themselves but on their use as test texts for # // the LGPLed CRM...
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
class Solution: def isAnagram(self, s, t): ds={} dt={} for i in s: if ds.get(i): ds[i]+=1 else: ds[i]=1 for i in t: if dt.get(i): dt[i]+=1 else: dt[i]=1 if ds==dt: ...
# -*- coding: utf-8 -*- """Advent of Code 2015 - Day 1: Not Quite Lisp.""" def load_and_parse_input(input_file: str): with open(input_file) as inf: return inf.read().strip() def part_1(puzzle): # start on the ground floor floor: int = 0 for order in puzzle: if order == "(": ...
highscore = { 'alice': 123, 'bob': 234, 'claire': 345, } phonenumbers = { 'alice': '555-1234', 'bob': '555-2345', 'claire': '555-3456', } k1 = highscore.keys() print(k1) print(id(k1)) print(highscore.values()) print('-'*40) k2 = phonenumbers.keys() print(k2) print(id(k2)) print(phonenumbers.va...
def fbx_data_bindpose_element(objectsParent, key, id, count): """ Helper, since bindpose are used by both meshes shape keys and armature bones... """ # We assume bind pose for our bones are their "Editmode" pose... # All matrices are expected in global (world) space. fbx_pose = elem_data_single_...
""" entrada dinero-->float-->d salida ganancia-->str-->g """ d=int(input("digite el valor de su inversion ")) g=d*(2/100) print("la ganancia es de " + str(g) )
# coding:utf-8 ''' Created on 2013-11-27 @author: tong ''' def dictfetchall(cursor): "Returns all rows from a cursor as a dict" desc = cursor.description return [ dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall() ] # 制作一个顺序编码, lastno 上一位, prestr 前缀, dig 编码位数 d...
# Autogenerated file for Buzzer # Add missing from ... import const _JD_SERVICE_CLASS_BUZZER = const(0x1b57b1d7) _JD_BUZZER_REG_VOLUME = const(JD_REG_INTENSITY) _JD_BUZZER_CMD_PLAY_TONE = const(0x80) _JD_BUZZER_CMD_PLAY_NOTE = const(0x81)
def printStuff(): print("stuff") x = 1 y = 2 z = 3 if x == 1: print(x, y, z) print("ololo") print("stuff")
n1 = int(input('Digite um número inteiro: ')) suc = n1 + 1 ant = n1 - 1 print('O número sucessor de {} é {}, e o antecessor é {}'.format(n1, suc, ant))
def binary_array_to_number(arr): return int(''.join([str(i) for i in arr]), 2) b = [0, 1, 0, 1] print(binary_array_to_number(b))
# Tools def strQ2B(ustring): rstring = "" for uchar in ustring: inside_code = ord(uchar) if inside_code == 0x3000: inside_code = 0x0020 else: inside_code -= 0xfee0 if inside_code < 0x0020 or inside_code > 0x7e: inside_code = ord(uchar) ...
_base_ = [ '../_base_/datasets/bdd100k.py', '../_base_/models/dla34_bdd100k.py', '../_base_/schedules/bdd100k.py', '../_base_/default_runtime.py' ] find_unused_parameters = True
""" 关于朴素贝叶斯 朴素贝叶斯算法是一个直观的方法,使用每个属性归属于某个类的概率来做预测。你可以使用这种监督性学习方法,对一个预测性建模问题进行概率建模。 给定一个类,朴素贝叶斯假设每个属性归属于此类的概率独立于其余所有属性,从而简化了概率的计算。这种强假定产生了一个快速、有效的方法。 给定一个属性值,其属于某个类的概率叫做条件概率。对于一个给定的类值,将每个属性的条件概率相乘,便得到一个数据样本属于某个类的概率。 我们可以通过计算样本归属于每个类的概率,然后选择具有最高概率的类来做预测。 通常,我们使用分类数据来描述朴素贝叶斯,因为这样容易通过比率来描述、计算。一个符合我们目的、比较有用的算法需要支持数值属性,同时假设每一个...
""" iscan 的cmd实在是太多了,分一个文件出来写 create by judy 2019/06/25 iscan的stratagy和idown的不一样,是搜索条件预置,所以只取已有的 """ class Port(object): def __init__(self, port, flag='tcp'): self.port = port self.flag = flag class Scan(object): def __init__(self, scan_data: dict): self.location = scan_data.get('lo...
# -*- coding:UTF8 -*- #!/urs/bin/python #队列相关 ########################################################################################## class Queue: '''队列的数据结构的实现 列表首个元素位队尾''' def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def size(self): ...
# rotating 3d cube # based on MicroViewCube.ino by Jim Lindblom @ SparkFun Electronics # https://github.com/sparkfun/SparkFun_MicroView_Arduino_Library/blob/master/examples/MicroViewCube/MicroViewCube.ino pi = math.pi size = 700 width = display.width height = display.height d = 3 px = [-d, d, d, -d, -d, d, d, -...
# 给定一个没有重复数字的序列,返回其所有可能的全排列。 # 示例: # 输入: [1,2,3] # 输出: # [ # [1,2,3], # [1,3,2], # [2,1,3], # [2,3,1], # [3,1,2], # [3,2,1] # ] # 来源:力扣(LeetCode) # 链接:https://leetcode-cn.com/problems/permutations # 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 ## 这个是典型的回溯算法 class Solution: def permute...
XX_train = np.concatenate((X_train, np.sin(4 * X_train)), axis=1) XX_test = np.concatenate((X_test, np.sin(4 * X_test)), axis=1) regressor.fit(XX_train, y_train) y_pred_test_sine = regressor.predict(XX_test) plt.plot(X_test, y_test, 'o', label="data") plt.plot(X_test, y_pred_test_sine, 'o', label="prediction with sine...
# { 'a': 'A', # 'b': 'B', # 'c': 'C', # 'd': 'D', # 'e': 'E', # 'f': 'F', # 'g': 'G', # 'h': 'H', # 'i': 'I', # 'j': 'J', # 'k': 'K', # 'l': 'L', # 'm': 'M', # 'n': 'N', # 'o': 'O', # 'p': 'P', # 'q': 'Q', # 'r': 'R', # 's': 'S', # 't': 'T', # 'u': 'U', # '...
class BaseDriver: dbapi = None schema_class = None def __init__(self, config): self.config = config self._conn = None @property def schema(self): if self.schema_class is None: return return self.schema_class(self) def get_connect_params(self): ...
class Conta: def __init__(self, clientes, numero, saldo=0): self.saldo = saldo self.clientes = clientes self.numero = numero def resumo(self): print(f'CC numero: {self.numero} Saldo: {self.saldo:10.2f}') def saque(self, valor): if self.saldo >= valor: se...
''' Created on 2013-11-18 @author: Nich ''' class CommandExecutor(object): def execute(self, command_package): command, args = command_package command(**args)
AUTH_INCORRECT_CREDENTIALS = 'Incorrect username or password.' AUTH_EMAIL_MISSING = 'Missing required "email" parameter.' AUTH_PSSWD_MISSING = 'Missing required "password" parameter.' AUTH_USERNAME_EXISTS = 'Selected username already exists.' AUTH_NOT_FOUND = 'User {} was not found.' AUTH_SMTP_ERROR = 'Error sending em...
"""Summary.""" def test_gauss_dist(): """Summary.""" pass def test_gamma_dist(): """Summary.""" pass
""" Escreva um programa que pergunte o salário de um funcionario e calcule o valor do seu aumento. Para salários superiores a R$1.250,00 calcule um aumento de 10% Para os inferiores ou iguais, o aumento é de 15% """ salario = float(input('Informe seu sálario atual: ')) if salario <= 1250: aumento15 = (salario /...
####################################################### # # ReceiveConnectionsProcess.py # Python implementation of the Class ReceiveConnectionsProcess # Generated by Enterprise Architect # Created on: 21-May-2020 9:47:41 AM # Original author: Natha Paquette # ####################################################...
def part_1(): # we'll attempt to fit in all into memory inputs = set() with open("./01.txt", mode="r") as fp: for line in fp.readlines(): i = int(line.strip()) # since we're working with 2 numbers it's easy to figure out what number we're looking for # if we've se...
# Programar em Python #33 - Lambda # def adicao(a, b, c): # return a + b + c; adicao = (lambda a, b, c : a + b + c); print('Resultado da adição:', adicao(25, 30, 45));
# coding: utf8 # Copyright (C) 2015 Zhe Wang <0x1998@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy,...
'''Crie um programa que leia vários números inteiros pelo telcado. O programa só vai parar quando o usuario digitar o valor 999, que é a condição de parada. No final ,mostre foram digitados e qual foi a soma entre eles (desconsiderando o flag)''' n = r = 0 num = -1 # Esse método desconsireda o ultimo número whil...
class EbelgeUsers: # The target object of the parser def __init__(self): self.tax_id = "" self.is_tax_data = False self.activity_count = 0 self.is_einvoice_document = False self.is_edespatchadvice_document = False self.is_efatura_user = False self.is_eirsaliy...
# 15/15 tipping_point = int(input()) infected = int(input()) infection_rate = int(input()) iterations = 0 newly_infected = infected while infected <= tipping_point: iterations += 1 newly_infected = newly_infected * infection_rate infected += newly_infected print(iterations)
class Instruction: SET_PROPERTY = "setp" START_GAME = "start" class Update: PLAYER_JOINED = "u_join" GAME_RUNNING = "u_running" QUIT_GAME = "u_quit" CHAT_MESSAGE = "u_message" class Game: PICKUP_CARD = "g_pickup" PLACE_CARD = "g_place" SEND_DECK ...
for w in AbstractWidget.objects.filter(package='ilp'): w.package = 'rdm.wrappers' w.save()
def end_signal(): # Hey, computer, let me know when you're done! :) # NOTE: This only works for Windows winsound.Beep(440, 100) time.sleep(.05) winsound.Beep(660, 100)
class Solution: def countBits(self, num: int) -> List[int]: next_t = 1 bit_counts = [0] * (num + 1) for n in range(1, num + 1): if n == next_t: bit_counts[n] = 1 next_t *= 2 else: bit_counts[n] = bit_counts[int(next_t /...
# Estrutura if comida = "pizza" if comida == "pizza": print("Contém muitas calorias!", "\n") # Estrutura else comida = "macarrão" if comida == "feijão": print("Contém muito ferro!") else: print("Desconheço as especificações!", "\n") # Estrutura elif comida = "churrasco" if comida == "macarrão": ...
# Question: https://projecteuler.net/problem=1 N = 1000 # A: number of integers in [1, N) that are divisible by 3 # B: number of integers in [1, N) that are divisible by 5 # C: number of integers in [1, N) that are divisible by 15 = 3 * 5 A = (N - 1) // 3 B = (N - 1) // 5 C = (N - 1) // 15 # sumA: sum of integers i...
# You're working on a secret team solving coded transmissions. # Your team is scrambling to decipher a recent message, worried it's a plot to break into a major European National Cake Vault. # The message has been mostly deciphered, but all the words are backward! Your colleagues have handed off the last step to you. ...
class StubIO: """Mocks the functionality of the console IO service""" def __init__(self): self.inputs = [] self.outputs = [] def write(self, message): self.outputs.append(str(message).strip()) def read(self, prompt): """Returns a fake input from the input list""" ...
""" Exercise 3 Python provides a built-in function called len that returns the length of a string, so the value of len('allen')is 5. Write a function named right_justify that takes a string named s as a parameter and prints the string with enough leading spaces so that the last letter of the string is in colu...
# Solution to Project Euler problem 1 # Copyright (c) Nhut-Nam Le. All rights reserved. def solution0(number, a, b): if number < 0: return 0 return sum([i for i in range(number) if i % a == 0 or i % b == 0]) print(solution0(10000, 3, 5)) def solution1(number, a, b): return ((number - 1) // a)...
AGENT_1_ID = 0 AGENT_2_ID = 1 # initialize policies NUM_ACTIONS = 6 # 4 moves + 2 legal switches NULL_ACTION_ID = NUM_ACTIONS STATE_DIM = 57 NUM_MOVES = 4 SWITCH_OFFSET = 12 # env takes 16-21 as numbers corresponding to switches; CoPG distributions returns 4-5 TEAM = """ Tapu Fini @ Expert Belt Ability: Misty Sur...
# -*- coding: utf-8 DEBUG = True # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 't)c0g-tbhgoe2ybv4(iyj%!07*si)co@rg21f&ejm3v=)u^_-8' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } ROOT_URLCONF = 'bitbucket.urls' FIE...
step = 376 #1 current = 0 res = [0] for i in range(1,2018): current = ((current+step)%len(res))+1 res.insert((current), i) print(res[current+1]) #2 current = 0 lenRes = 1 res = [] for i in range(1,50000001): current = ((current+step)%lenRes)+1 lenRes+=1 if(current == 1): print('.') res.insert(0, i) print...
# -*- coding: utf-8 -*- """ Created on Wed Feb 2 01:56:42 2022 @author: ACER """ # listar los numeros primos del 1 al 100 num = 1 while num <= 100: num = num + 1 cont = 1 a = 0 while cont <= num : if num % cont == 0: a = a+1 cont = cont +1 if a==2: print(num) ...
class InjectionRequest(object): """ Represents a injection request for sending to the Injection Api. To be serialized into JSON string before sending to the Injection Api. """ def __init__(self, server_id: int, api_key: str, messages: list): """ Initializes a new instance of the Add...
a = input() if a == "a": print(-1) else: print("a")
# Definindo loop For def loopFor(): for x in range(5,10): print(x) loopFor() # Usando loop For em uma coleção def loopArray(): dias = ["Seg", "Ter", "Qua", "Qui", "Sex", "Sab", "Dom"] for d in dias: print(d) loopArray() # Função enumerate def loopEnum(): dias = ["Seg", "Ter", "Qua", ...
def init(): global session session = {}
# 就像我们生活中会产生垃圾一样,程序在运行过程当中也会产生垃圾 # 程序运行过程中产生的垃圾会影响到程序的运行的运行性能,所以这些垃圾必须被及时清理 # 没用的东西就是垃圾 # 在程序中没有被引用的对象就是垃圾,这种垃圾对象过多以后会影响到程序的运行的性能 # 所以我们必须进行及时的垃圾回收,所谓的垃圾回收就是讲垃圾对象从内存中删除 # 在Python中有自动的垃圾回收机制,它会自动将这些没有被引用的对象删除, # 所以我们不用手动处理垃圾回收 class A: def __init__(self): self.name = 'A类' # del是一个特殊方法,它...
"""A thesaurus of words the player might use, so you can easily accept synonyms of the word you want. e.g. This will recognise take, pick, get or collect:: if do[0] in weatbag.words.take: #... """ # Verbs move = {'move', 'walk', 'go', 'travel', 'cross', 'pace', 'traverse'} give = {'give', 'feed', 'present...
# import torch # # x = torch.ones(2, 2, requires_grad = True) # print(x.data) # print(x.grad) # print(x.grad_fn) # print('*' * 10) # y = x + 2 # print(y) # print(y.grad) # print(y.grad_fn) # print('*' * 10) # # z = y * y * 3 # out = z.mean() # print(z) # print(out) # print('*' * 10) # # # out.backward() # print(x.grad)...
t1 = 1, print(type(t1)) t2 = 1, 2, 3 print(t2) #<class 'tuple'> #(1, 2, 3) #truplas sao iteraveis e fatiaveis t3 = 1,2, 'Thais', 4, 5 t4 = 6, 7, 8, 9, 10 t5 = t3 + t4 print(t5) #(1, 2, 'Thais', 4, 5, 6, 7, 8, 9, 10) n1,n2,n3,n4,*n_outros,n10 = t5 print(n1, n2, n3,n4) print(*n_outros) print(n10) #1 2 Thais 4 #5 6 7...