content
stringlengths
7
1.05M
def counter(start, stop): x=start if start>stop: return_string = "Counting down: " while x != stop: return_string += str(x) if x!=stop: return_string += "," else: return_string = "Counting up: " while x !=stop: return_string += str(x) ...
number = 9 print(type(number)) # print type of variable "number" float_number = 9.0 print(float_number) print(int(float_number))
""" This file contains temporary hard-coded holiday overrides that are not in Workalendar. It is only intended to be temporary, and Workalendar should be updated to hold the "correct" dates as the source of truth. """ OVERRIDES = {}
# https://www.codechef.com/problems/FLOW005 for T in range(int(input())): a,n,s = [100,50,10,5,2,1],int(input()),0 for i in a: s,n = s+(n//i),n%i print(s)
def fibonacci(num): if num < 0: print("Make it a positive number") elif num == 1: return 0 elif num == 2: return 1 else: return fibonacci(num-1)+fibonacci(num-2)
def close2zero(t): try: i,j = sorted(map(int, set(t.split())), key = lambda x: abs(int(x)))[:2] return max(i,j) if abs(i)==abs(j) else i except: return 0
styleDict = { 'clear': f'\033[0m', 'bold': f'\033[1m', 'dim': f'\033[2m', 'italic': f'\033[3m', 'underline': f'\033[4m', 'blinking': f'\033[5m', 'anarch': f'\033[38;2;255;106;51m', 'criminal': f'\033[38;2;65;105;255m', 'shaper': f'\033[38;2;50;205;50m', 'haas-bioroid': f'\033[3...
DB_HOST = 'localhost' DB_PORT = 5432 DB_USER = 'platappform' DB_PASSWORD = 'development' DB_DATABASE = 'platappform_dev' DB_POOL_MIN_SIZE = 5 #default DB_POOL_MAX_SIZE = 10 #default
# Определение приложений INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.redirects', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.sites', 'django.contrib.staticfiles...
""" 200. Number of Islands Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Example 1: Input: 11110 11010 1100...
############################################################################################### # 前序遍历一次即可,只不过需要注意要在递归左儿子前记录下自己的右儿子,不然会被覆盖 ########### # 时间复杂度:O(n),每个节点遍历一次 # 空间复杂度:O(n),最坏情况可能是一根链 ############################################################################################### class Solution: ...
class Component: def __init__(self, position): self.position = position self.dirty = True self.focus = False def update(self, screen): if self.dirty: screen.blit(self.surface, self.position) self.dirty = False
# # THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS # FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS. # # get the configuration propertie...
cities_BL_coordinates = {'Aleksandrów Łódzki': (51.8196533, 19.3035375), 'Augustów': (53.8437331, 22.9802357), 'Bełchatów': (51.3650175, 19.3691833), 'Bełżyce': (51.175063, 22.2749995), 'Białogard': (54.0064367, 15.9870974), 'Białopole': (50.9847276, 23.7331781), 'Białystok': (53.127505049999996, 23.147050870161...
title = ' MULTIPLICATION TABLES ' line = len(title) * '-' print('{}\n{}'.format(title, line)) for x in range(1,13): for i in range(1,13): f = i i = i * x print(' {} x {} = {}'.format(x,f,i)) print('')
def list_view(tree): print("Listing\n") movies = tree.list_by_name() if movies: print("Every movie in tree:") for movie in movies: print(movie) else: print("Empty tree.") input("ENTER to continue")
class GameObject: def __init__(self, id, bounds_offsets, width, height, pos_x, pos_y, speed): self.id = id self.bounds_offsets = bounds_offsets self.bounds = [] for offset_array in bounds_offsets: self.bounds.append({}) self.width = width # In meters ...
# # Copyright (c) 2017-2018 Joy Diamond. All rights reserved. # @gem('Sapphire.UnaryExpression') def gem(): require_gem('Sapphire.Tree') @share class UnaryExpression(SapphireTrunk): __slots__ = (( 'a', # Expression )) class_order = ...
class Retangulo: # definindo a classe def __init__(self, base, altura): # inicializando self.la1 = base # passando minha base pra váriavel self.la2 = altura #passando minha altura pra váriavel self.area = 0 # iniciando minha area sem valor self.perimetro = 0 # iniciando minha area...
list_of_lists = [['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']] string = '' for l in list_of_lists: max_i = len(l) for i in range(len(l)): if i < max_i - 1: string += l[i]+',' else: string += l[i]+'\n' print(string)
# encoding: utf-8 # module _functools # from (built-in) # by generator 1.145 """ Tools that operate on functions. """ # no imports # functions def cmp_to_key(*args, **kwargs): # real signature unknown """ Convert a cmp= function into a key= function. """ pass def reduce(function, sequence, initial=None): # r...
quant = int(input()) for c in range(quant): num_estudantes = int(input()) nomes = input().split(' ') registro = input().split(' ') reprovados = [] contador = 0 for frequencia in registro: media = 0 tam = len(frequencia) for letra in frequencia: if letra == "P"...
#aula-25-09-19 num1 = int(input("Digite o primeiro numero: ")) num2 = int(input("Digite o ultimo numero: ")) soma = 0 total = 0 while (num1 <= num2): if (num1 % 2) == 1: soma = soma + 1 num1 = num1 + 1 print(f" A soma dos números impares é: {soma} números impares.")
# -*- coding: utf8 -*- # Copyright (c) 2020 Nicholas de Jong __title__ = "arpwitch" __author__ = "Nicholas de Jong <contact@nicholasdejong.com>" __version__ = '0.3.9' __license__ = "BSD2" __logger_default_level__ = 'info' __sniff_batch_size__ = 16 __sniff_batch_timeout__ = 2 __save_data_interval__default__ = 30 __nm...
category_dict_icml15 = { "Bandit Learning" : [["Bandits"]], "Bayesian Nonparametrics" : [["Baysian Nonparametrics"]], "Bayesian Optimization" : [["Optimization"], ["Baysian Optimization"]], "Causality" : [["Causality"]], "Clustering" : [["Clustering"]], "Computational Advertising And Social Scie...
class Solution: def subsets(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ result = [] ln = len(nums) selectors = [0] * ln for time in range(2 ** ln): # Append new Item result_item = [] for index,...
# -------------------------------------- # CSCI 127, Lab 4 # May 29, 2020 # Your Name # -------------------------------------- def process_season(season, games_played, points_earned): print("Season: " + str(season) + ", Games Played: " + str(games_played) + ", Points earned: " + str(points_earned...
# Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def rob(self, root: TreeNode) -> int: def helper(root): if root...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# Made by Wallee#8314/Red-exe-Engineer # Thanks @Bigjango helping :p Block = { "Air": [0, 0], "Stone": [1, 0], "Grass": [2, 0], "Dirt": [3, 0], "Cobblestone": [4, 0], "Wooden Planks": [5, 0], "Saplin":[6, 0], "Oak Saplin": [6, 0], "Spruce Saplin": [6, 1], "Birch Saplin": [6, 2],...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 15 15:31:15 2017 @author: Nadiar """ # 1 a = 2 while (a <= 10): print(a) a += 2 print("Goodbye!") # 2 print("Hello!") a = 10 while(a >= 2): print(a) a -= 2 # 3 temp = 0 inc = 1 end = 21 while (end >= inc): temp += ...
CONFIG_BINDIR="<CONFIG_BINDIR>" CONFIG_LIBDIR="<CONFIG_LIBDIR>" CONFIG_LOCALSTATEDIR="<CONFIG_LOCALSTATEDIR>" CONFIG_SYSCONFDIR="<CONFIG_SYSCONFDIR>" CONFIG_SYSCONFDIR_DSC="<CONFIG_SYSCONFDIR_DSC>" CONFIG_OAAS_CERTPATH="<OAAS_CERTPATH>" OMI_LIB_SCRIPTS="<OMI_LIB_SCRIPTS>" PYTHON_PID_DIR="<PYTHON_PID_DIR>" DSC_NAMESPACE...
h, m = map(int, input().split()) fullMin = (h * 60) + m hour = (fullMin - 45) // 60 minu = (fullMin - 45) % 60 if hour == -1: hour = 23 print(f'{hour} {minu}') else: print(f'{hour} {minu}')
def get_attribute_or_key(obj, name): if isinstance(obj, dict): return obj.get(name) return getattr(obj, name, None)
# # PySNMP MIB module FASTPATH-QOS-AUTOVOIP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-QOS-AUTOVOIP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:58:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
{ "midi_fname": "sample_music/effrhy_131.mid", "video_fname": "tests/test_out/start_size.mp4", "note_start_height": 0.0, # "note_end_height": 0.0, }
par = list() impar = list() num = list() for i in range(1, 8): num.append(int(input(f'Digite o {i} numero: '))) for a in num: if a % 2 == 0: par.append(a) else: impar.append(a) print(num) print(par) print(impar)
class Solution: def scheduleCourse(self, courses: List[List[int]]) -> int: time = 0 maxHeap = [] for duration, lastDay in sorted(courses, key=lambda x: x[1]): heapq.heappush(maxHeap, -duration) time += duration # if current course could not be taken, check if it's able to swap with a ...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"get_data": "01_core.ipynb", "Dataset": "01_core.ipynb", "DataBunch": "01_core.ipynb", "Learner": "01_core.ipynb", "get_dls": "01_core.ipynb", "get_model": "01_cor...
#function that allows user to filter photos based on ranking def filterPhotos(photoAlbum, userchoice): if userchoice: #display photos in ascending order return; else: #display photos in descending order return; return;
def test_about_should_return_200(client): rv = client.get('/about') assert rv.status_code == 200 assert rv.headers['Content-type'] == 'text/html; charset=utf-8'
#-*- coding:utf-8 -*- title = """""" text = """""".replace("\n", r"\n") template = """\t*-*"title": "{}", "content": "{}"-*-""" complete_text = template.format(title, text).replace("*-*", "{").replace("-*-", "}") file = open("aktar.txt", "a", encoding="utf-8") file.write(complete_text+",\n") file.close()
# dfs class Solution: def numIslands(self, grid: 'List[List[str]]') -> 'int': if grid == []: return 0 def dfs(i, j, n, m): if i < 0 or j < 0 or i >= n or j >= m or grid[i][j] == "0" or grid[i][j] == "-1": return grid[i][j] = "-1" dfs(i + 1, j, n, m) d...
# Relative path to the database text file DATABASE_PATH = "resources/anime.txt" def add_anime(anime_name, episodes, current_episode_=0): """ Function to add a new anime to the database /resources/anime.txt Args: anime_name (str): Name of the anime. episodes (int): Total episodes in the an...
# Definitions EXECUTING = 'executing' QUEUED = 'queued' PLEDGED = 'pledged' IGNORE = 'ignore' class Node(object): def __init__(self): self.children = [] def add_child(self, node): self.children.append(node) def get_leaves(self, leaves=[]): # If the node has no leaves, return th...
def tema(msg): tam = len(msg) + 4 print('~'*tam) print(f' {msg}') print('~'*tam) # programa principal tema('Olá mundo') tema('Controle de Números') tema('Gerador de Cartelas')
# # Copyright (c) 2017 Joy Diamond. All rights reserved. # @gem('Topaz.Cache') def gem(): require_gem('Gem.Cache2') require_gem('Topaz.Core') require_gem('Topaz.CacheSupport') # # Specific instances # eight = conjure_number('eight', 8) five = conjure_number('five', 5) four ...
""" Author: Resul Emre AYGAN """ """ Project Description: Sum of positive You get an array of numbers, return the sum of all of the positives ones. Example [1,-4,7,12] => 1 + 7 + 12 = 20 Note: if there is nothing to sum, the sum is default to 0. """ def positive_sum(arr): return sum([i for i in arr if i > 0])...
# -*- coding: utf-8 -*- """ Created on Fri Jan 5 16:03:43 2018 @author: James Jiang """ all_lines = [line.rstrip('\n') for line in open('Data.txt')] del all_lines[-2] original_molecule = all_lines[-1] capital_letters = [i for i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'] count_elements = 0 for letter in original_molecule: ...
ENV = 'directory that defines e.g. the boxes' WORKSPACE = 'workspace directory' BEAD_REF = ''' bead to load data from - either an archive file name or a bead name ''' INPUT_NICK = ( 'name of input,' + ' its workspace relative location is "input/%(metavar)s"') BOX = 'Name of box to store bead'
a = [] assert a[:] == [] assert a[:2**100] == [] assert a[-2**100:] == [] assert a[::2**100] == [] assert a[10:20] == [] assert a[-20:-10] == [] b = [1, 2] assert b[:] == [1, 2] assert b[:2**100] == [1, 2] assert b[-2**100:] == [1, 2] assert b[2**100:] == [] assert b[::2**100] == [1] assert b[-10:1] == [1] assert b[...
class Class: __students_count = 22 def __init__(self, name): self.name = name self.students = [] self.grades = [] def add_student(self, name, grade): if self.__students_count != 0: self.students.append(name) self.grades.append(float(grade)) ...
#!/usr/bin/env python3 #p3_180824_2354.py # Search synonym #2 # Format: # Number_of_lines # Key (space) Value # Key_word def main(): num = input() myDictionary = getDictionary(num) word = input() #wordToSearch = getKeySearchWord(myDictionary) checkDictionary(myDictionary, word) # Fill dictionary w...
__title__ = 'cli_command_parser' __description__ = 'CLI Command Parser' __url__ = 'https://github.com/dskrypa/cli_command_parser' __version__ = '2022.06.06' __author__ = 'Doug Skrypa' __author_email__ = 'dskrypa@gmail.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2022 Doug Skrypa'
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2020 Evgenii sopov <mrseakg@gmail.com> # pylint: disable=relative-beyond-top-level,missing-function-docstring """cpplint list of errors""" def error_line_too_long(parsed_line): print("error(00001): Line too long {}:{}".format( parsed_line...
# Based and improved from https://github.com/piratecrew/rez-python name = "python" version = "2.7.16" authors = [ "Guido van Rossum" ] description = \ """ The Python programming language. """ requires = [ "cmake-3+", "gcc-6+" ] variants = [ ["platform-linux"] ] tools = [ "2to3", ...
def sda_to_rgb(im_sda, I_0): """Transform input SDA image or matrix `im_sda` into RGB space. This is the inverse of `rgb_to_sda` with respect to the first parameter Parameters ---------- im_sda : array_like Image (MxNx3) or matrix (3xN) of pixels I_0 : float or array_like Back...
altitude=int(input("enter the current altitude : ")) if altitude<=1000: print(" SAFE to land") elif altitude>1000 and altitude<=5000: print("bring it down to 1000ft") else: print("turn around")
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def hasCycle(self, head: Optional[ListNode]) -> bool: cs = head cf = head if head == None: return False if cf.next == Non...
# *************************************** # ******** Manual Configurations ******** # *************************************** # ---------------------------------------------------------------- # -------- Part 1, meta-network generation settings -----...
sbox0 = [ 0X3e, 0x72, 0x5b, 0x47, 0xca, 0xe0, 0x00, 0x33, 0x04, 0xd1, 0x54, 0x98, 0x09, 0xb9, 0x6d, 0xcb, 0X7b, 0x1b, 0xf9, 0x32, 0xaf, 0x9d, 0x6a, 0xa5, 0xb8, 0x2d, 0xfc, 0x1d, 0x08, 0x53, 0x03, 0x90, 0X4d, 0x4e, 0x84, 0x99, 0xe4, 0xce, 0xd9, 0x91, 0xdd, 0xb6, 0x85, 0x48, 0x8b, 0x29, 0x6e, 0xac, 0Xcd, ...
# Description: Raw Strings if __name__ == '__main__': # Escape characters are honoured a_string = "this is\na string split\t\tand tabbed" print(a_string) # Raw string is printed as it is without interpreting the escape characters. # This is used a lot in regular expressions raw_string = r"this...
number = list() while True: number.append(int(input('Digite um numero: '))) if number.count(number[-1]) == 2: print('\033[31mNumeros duplicados não serão adicionados.\033[m') number.pop() decision = str(input('\033[37mDeseja continuar? \033[m')).strip().lower() if decision[0] in 'n': ...
class BaseLangDetect: """ Container for what a language detection module should take as input and should return as output """ def get(self, text): """ Uses the language detection module to detect a language Parameters ---------- text : str The r...
class Board(): def __init__(self, matrix): self.matrix = matrix self.cols = len(matrix) self.rows = len(matrix[0]) self.last = None self.matches = [] for i in range(self.rows): self.matches.append([False] * self.cols) def is_winner(self): for...
''' faca um programa que tenha uma funcao chamada escreva(), que receba um texto qualquer como parametro e mostre auma mensagem com tamanho adaptavel. x.: escreva('Olá Mundo!) saida: ------------- Olá Mundo? ------------- ''' def mensagem(txt): tam = len(txt) + 4 print('-' * tam) # print(f'{txt:^len(txt)}'...
DATABASE_ENGINE = 'sqlite3' ROOT_URLCONF = 'tests.urls' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'tests.app', ]
# using return in functions def my_function(name,surname): full_name = name.title() + " " + surname.title() return full_name print(my_function('selim', 'mh'))
class Solution: def reverseWords(self, s: str) -> str: q = [] raw_split = s.split(' ') for raw_w in raw_split: w = raw_w.strip() if w: q.append(w) return ' '.join(q[::-1])
class RaddarException(Exception): pass class FailedToCloneRepoException(RaddarException): pass class FailedToWriteRepoException(RaddarException): pass
# -*- coding: utf-8 -*- def pagarEstacionamiento(apagar): total = apagar print("Total a pagar:" + str(apagar)) while apagar > 0: moneda = int(input("Ingresa la cantidad de la moneda que quieres ingresar: ")) if moneda == 1 or moneda == 2 or moneda == 5 or moneda == 10 or moneda == 50: ...
QUERIES = {} QUERIES['1A'] = ''' SELECT count(distinct(cpims_ovc_id)) as dcount, gender as sex_id, agerange from vw_cpims_registration {ocbos} {oareas} {odate} group by gender, agerange ''' QUERIES['1B'] = ''' SELECT count(distinct(cpims_ovc_id)) as dcount, gender as sex_id, CASE exit_status WHEN 'ACTIVE' THEN 'Activ...
def countingSort(array, place): size = len(array) output = [0] * size count = [0] * 10 for i in range(0, size): index = array[i] // place count[index % 10] += 1 for i in range(1, 10): count[i] += count[i - 1] i = size - 1 while i >= 0: index = array...
def main(): num = int(input("Digite o número que deseja ter o fatorial: \n")) initial_number = num fat = 1 while num > 0: fat = fat * num num = num - 1 print("O fatorial de %d é" %initial_number, fat) main()
''' Created on Dec 2, 2013 @author: daniel ''' class PharmacyController(object): def __init__(self, repository): self.__pRepo = repository # cart is used to keep track of all the products self.__cart = [] self.__cartTotal = 0 def addProductToCart(self, product, qty): ...
####################################################################################### # 2.1 # change what is stored in the variables to another types of data # if a variable stores a string, change it to an int, or a boolean, or a float some_var = "hi" some_var2 = 1 some_var3 = True some_var4 = 1.32 #############...
load("@build_bazel_integration_testing//tools:import.bzl", "bazel_external_dependency_archive") def bazel_external_dependencies(rules_scala_version, rules_scala_version_sha256): bazel_external_dependency_archive( name = "io_bazel_rules_scala_test", srcs = { rules_scala_version_sha256: [ ...
class Line: pic = None color = -1 def __init__(self, pic, color): self.pic = pic self.color = color def oct1(self, x0, y0, x1, y1): if (x0 > x1): x0, y0, x1, y1 = x1, y1, x0, y0 x = x0 y = y0 A = y1 - y0 B = x0 - x1 d = 2 * A...
def test_signal_url_total_length(ranker): rank = lambda url: ranker.client.get_signal_value_from_url("url_total_length", url) rank_long = rank("http://www.verrrryyyylongdomain.com/very-long-url-xxxxxxxxxxxxxx.html") rank_short = rank("https://en.wikipedia.org/wiki/Maceo_Parker") rank_min = rank("http://t.co")...
terms=int(input("Enter the number of terms:")) a, b= 0, 1 count=0 if terms <= 0: print("Please enter a positive number") elif terms == 1: print("The fibonacci series upto",terms) print(a) else: print("The fabinocci series upto",terms,"terms is:") while count < terms: print(a, end=" ") ...
OV2640_JPEG_INIT = [ [ 0xff, 0x00 ], [ 0x2c, 0xff ], [ 0x2e, 0xdf ], [ 0xff, 0x01 ], [ 0x3c, 0x32 ], [ 0x11, 0x04 ], [ 0x09, 0x02 ], [ 0x04, 0x28 ], [ 0x13, 0xe5 ], [ 0x14, 0x48 ], [ 0x2c, 0x0c ], [ 0x33, 0x78 ], [ 0x3a, 0x33 ], [ 0x3b, 0xfB ], [ 0x3e, 0x00 ], [ 0x43, 0x11 ], [ 0x16,...
class Parent: value1="This is value 1" value2="This is value 2" class Child(Parent): pass parent=Parent() child=Child() print(parent.value1) print(child.value2)
begin_unit comment|'# Copyright (c) 2016 Intel, Inc.' nl|'\n' comment|'# Copyright (c) 2013 OpenStack Foundation' nl|'\n' comment|'# All Rights Reserved.' nl|'\n' comment|'#' nl|'\n' comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in ...
class Frame: __slots__ = ("name", "class_name", "line_no", "file_path") def __init__(self, name, class_name=None, line_no=None, file_path=None): self.name = name self.class_name = class_name self.line_no = line_no self.file_path = file_path
def test(): assert len(TRAINING_DATA) == 4, "Les données d'apprentissage ne correspondent pas – attendu 4 exemples." assert all( len(entry) == 2 and isinstance(entry[1], dict) for entry in TRAINING_DATA ), "Format incorrect des données d'apprentissage. Attendu une liste de tuples dont le second élém...
# 6.Input and Range # Given an integer n, write a program that generates a dictionary with # entries from 1 to n. For each key i, the corresponding value should # be i*i. def range_dict(_max): my_dict = {} for i in range(1, _max + 1): my_dict[i] = i ** 2 return my_dict # or with dictionary Comp...
# Holds permission data for a private race room def get_permission_info(server, race_private_info): permission_info = PermissionInfo() for admin_name in race_private_info.admin_names: for role in server.roles: if role.name.lower() == admin_name.lower(): permission_info.admi...
WORDLIST =\ ('dna', 'vor', 'how', 'hot', 'yud', 'fir', 'fit', 'fix', 'dsc', 'ate', 'ira', 'cup', 'fre', 'fry', 'had', 'has', 'hat', 'hav', 'old', 'fou', 'for', 'fox', 'foe', 'fob', 'foi', 'soo', 'son', 'pet', 'veo', 'vel', 'jim', 'bla', 'one', 'san', 'sad', 'say', 'sap', 'saw', 'sat', 'cim', 'ivy', 'wpi', 'pop', 'act',...
n1 = float(input("Type the first number: ")) n2 = float(input("Type the second number: ")) print("Are equals?", n1 == n2) print("Are different?", n1 != n2) print("First number is greater than Second number? =", n1 > n2) print("Second is greater or equal than First number ? =", n2 >= n1) strTest = input("Type a string:...
track = dict( author_username='ryanholbrook', course_name='Computer Vision', course_url='https://www.kaggle.com/ryanholbrook/computer-vision', course_forum_url='https://www.kaggle.com/learn-forum', ) TOPICS = [ 'The Convolutional Classifier', 'Convolution and ReLU', 'Maximum Pooling', '...
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved. """Contains a dict to validate the app configs""" VALIDATE_DICT = { "num_workers": { "required": False, "valid_condition": lambda c: True if c >= 1 and c <= 50 else False, "invalid_msg"...
names = ['Felipe','Celina','Jullyana','Lucas','Bryanda'] print(f'\nOlá {names[0]}\n') print(f'{names[1]}\n') print(f'{names[2]}\n') print(f'{names[3]}\n') print(f'{names[4]}\n') print('=-'* 30) print(f'\n{names[-1]}\n') print(f'{names[-2]}\n') print(f'{names[-3]}\n') print(f'{names[-4]}\n') print(f'{names[-5]}\n')
''' PythonExercicios\from math import factorial number = int(input('Choose a number: ')) result = factorial(number) print('The factorial of {}! is = {}'.format(number, result)) ''' number = int(input('Choose a number: ')) control = number result = 1 print('Calculating {}! = '.format(number), end='') while control > 0: ...
exclusions = ['\bCHAPTER (\d*|M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3}))\.*\b', 'CHAPTER', '\bChapter \d*\b', '\d{2}:\d{2}:\d{2},\d{3}\s-->\s\d{2}:\d{2}:\d{2},\d{3}', '^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})\.?\n', '^[^\w...
class Agent: def __init__(self, env, q_function, action_selector, logger): self.__env = env self.__q_function = q_function self.__action_selector = action_selector self.__logger = logger def train(self, steps, episodes, filepath, filename): episode_reward = 0 tot...
class Parser(): # Terminals T_LPAR = 0 T_RPAR = 1 T_ID = 2 T_OP = 3 T_END = 4 T_NEG = 5 T_INVALID = 6 # OPERATORS = ['~', '^', 'or', '->', '<->'] # OPERANDS = ['p', 'q'] # PARENTHESES = ['(', ')'] # LEXICON = OPERATORS + OPERANDS + PARENTHESES def __init__(self): #self.lexicon...
q = [] q.append('есть') q.append('спать') q.append('программировать') print(q) # ['есть', 'спать', 'программировать'] # Осторожно: это очень медленная операция! print(q.pop(0)) # 'есть'
student = {"name":"Rolf", "grades":(89,9,93,78,90)} def average(seq): return sum(seq)/len(seq) print(average(student["grades"])) class Student: def __init__(self,name,grades): self.name = name self.grades = grades def averageGrade(self): return sum(self.grades)/len(self.grades) ...
VERSION = '2.0b9' DEFAULT_TIMEOUT = 60000 REQUEST_ID_HEADER = 'Cko-Request-Id' API_VERSION_HEADER = 'Cko-Version'
#Leia um numero real e imprima a quinta parte deste numero n=float(input("Informe um numero real: ")) n=n/5 print(n)