content
stringlengths
7
1.05M
""" Initialize amr_kdtree """
def validate_pin(pin): if pin.isdigit() and (len(str(pin)) == 4 or len(str(pin)) == 6): return True else: return False;
#!/usr/bin/env python """ Train My Brain github.com/irlrobot/train_my_brain Categories: 1. word_jumble 2. spelling_backwords 3. simple_math 4. memory_game 5. simple_trivia 6. word_association 7. repeat 8. out_of_place 9. low_high_number """ def fuzzy_match_threshold(category): """determine the threshold for fuzzy ...
class FizzBuzz(): fizz, buzz = 'Fizz', 'Buzz' @staticmethod def is_mod_three_true(number): return number % 3 == 0 @staticmethod def is_mod_five_true(number): return number % 5 == 0 def is_mod_three_and_five_true(self, number): return self.is_mod_five_true(number) and s...
# https://leetcode.com/problems/find-pivot-index class Solution: def pivotIndex(self, nums): if not nums: return -1 l_sum = 0 r_sum = sum(nums) - nums[0] if l_sum == r_sum: return 0 for i in range(1, len(nums)): r_sum -= nums[i] ...
DATABASE_ENGINE = 'sqlite3' INSTALLED_APPS = 'yui_loader', MIDDLEWARE_CLASSES = 'yui_loader.middleware.YUIIncludeMiddleware', ROOT_URLCONF = 'yui_loader.tests.urls' YUI_INCLUDE_BASE = '/js/yui/'
params = { # Train "n_epochs": 200, "learning_rate": 1e-4, "adam_beta_1": 0.9, "adam_beta_2": 0.999, "adam_epsilon": 1e-8, "clip_grad_value": 5.0, "evaluate_span": 50, "checkpoint_span": 50, # Early-stopping "no_improve_epochs": 50, # Model "model": "model-mod-8", ...
name = "ping" def ping(): print("pong!")
''' Problem Statement : Lapindromes Link : https://www.codechef.com/LRNDSA01/problems/LAPIN score : accepted ''' for _ in range(int(input())): string = input() mid = len(string)//2 first_half = None second_half = None if len(string)%2==0: first_half = string[:mid] second_...
alt = int(input('Altura específica de la pirámide:')) for piramide in range(1, alt+1): print(' '*(alt-piramide)+'#'*piramide) if alt is str: break
#-*- coding: UTF-8 -*- # define a function def log(msg): "打印日志" print (msg); return; def testPassValue(a): "传入参数 对外部影响测试" a*=2; print (a); # 可变参数是一个元祖类型 def testParamter(arg1,agr2=30,*otherParas): "函数参数,默认参数->可变参数" print ('--------testParamter begin------------') print (arg1) print (agr2) for x in otherPa...
pid_yaw = rm_ctrl.PIDCtrl() pid_pitch = rm_ctrl.PIDCtrl() person_info = None def start(): global person_info global pid_yaw global pid_pitch global pit_chassis robot_ctrl.set_mode(rm_define.robot_mode_chassis_follow) # Enable person detection vision_ctrl.enable_detection(rm_define.vision_d...
'''bicycles = ['trek', 'cannondale', 'redline', 'specialized'] #lista print(bicycles) print(bicycles[0].title()) #a partir do primeiro elemento da lista print(bicycles[1].title()) print(bicycles[2].title()) print(bicycles[3].title()+"\n") print(bicycles[-1].title()) #a partir do ultimo elemento da lista print(bicycles[...
"""Possible average samples.""" AVERAGE_1 = 0 """Average of 1 sample.""" AVERAGE_2 = 1 """Average of 2 samples.""" AVERAGE_4 = 2 """Average of 4 samples.""" AVERAGE_8 = 3 """Average of 8 samples."""
n, x, y = map(int, input().split()) a = list(map(int, input().split())) for d, ad in enumerate(a): inf = ad + 1 l = max(0, d - x) l_min = min(a[l:d]) if l < d else inf r = min(n - 1, d + y) r_min = min(a[d + 1: r + 1]) if d < r else inf if ad < min(l_min, r_min): print(d + 1) ...
"""Main module.""" def main(): print('package')
PATH_DATA = "data/" URI_CSV = f"{PATH_DATA}Dades_meteorol_giques_de_la_XEMA.csv" URI_DELTA = f"{PATH_DATA}weather_data.delta" URI_DELTA_PART = f"{PATH_DATA}weather_data_partition.delta" URI_STATIONS = f"{PATH_DATA}Metadades_estacions_meteorol_giques_autom_tiques.csv" URI_VARS = f"{PATH_DATA}Metadades_variables_meteo...
''' 网络编程: 2个进程间的通信交互! 如何实现交互?通过大家都认可的一套协议,最重要的两个协议是TCP和IP协议。 1、IP(IPv4:32位证书按8位分组得到的字符串 和IPv6:128位整数按8位分组得到的字符串):是每个计算机的身份证,每个计算机可以有多个IP,IP地址对应的实际上是计算机的网络接口,通常是网卡! IP协议:负责把分割成小块的数据,以IP包的形式从一台计算机通过网络发送到另一台计算机。 通过IP(获取到某计算机地址)无法实现最终的准确通信,还需要端口:来区分当前哪些应用进程,每个网络程序都向操作系统申请唯一的端口号。 一个进程也可能同时与多个计算机建立链接,因此它会申请很多端口。 所以,实现交互要做到2...
MAX_DEPTH = 40 def gcd(a, b): while b != 0: t = b b = a % b a = t return a def play(a, b, turn_a, depth): if depth == 0 or (a == 1 or b == 1): if a == 1 and b == 1: return 0 else: if a == 1: r = 2 elif b == 1: ...
#SQL Server details SQL_HOST = 'localhost' SQL_USERNAME = 'root' SQL_PASSWORD = '' #Mongo Server details MONGO_HOST = 'localhost' #Cache details - whether to call a URL once an ingestion script is finished RESET_CACHE = False RESET_CACHE_URL = 'http://example.com/visualization_reload/' #Fab - configuration for deployin...
""" Given an integer array nums, return the third distinct maximum number in this array. If the third maximum does not exist, return the maximum number.   Example 1: Input: nums = [3,2,1] Output: 1 Explanation: The first distinct maximum is 3. The second distinct maximum is 2. The third distinct maximum is 1. Example...
def info(): print("Library By : Nishant Singh\n") def show(): print("Hello Guys !!\n Its a sample fun() for Suprath Technologies.\n")
def interpret(instruction_set, max_iterations=500): """ Runs the instruction set in a virtual machine. Returns the printed path. """ def make_dir(from_byte): if from_byte < 64: return 'U' elif from_byte < 128: return 'R' elif from_byte < 192: return '...
#!/usr/bin/python # -*- coding: utf-8 -*- def getlist(): liststr = """ 115img.com 2mdn.net 360doc.com 360buyimg.com 51buy.com acfun.com acfun.tv acg.tv acgvideo.com adnxs.com adroll.com adsame.com adsonar.com adtechus.com alipayobjects.com appgame.com atdmt.com betrad.com bilibili.com bilibili.tv bluekai.com cctv....
MYSQL_SERVER="" MYSQL_USER="" MYSQL_PASS="" MYSQL_DB="" UPLOAD_REQUEST_URL=""
''' Lab 4 Implementação de JACOBI Gabriel Tardochi Salles , TIA = 41822730 ''' # Implementacao do Algoritmo de Jacobi Iterativamente def JACOBI(incog, n, mat, sol_ini, e): comp = 0 # percorrendo e trocando linhas qnd a[i][i] eh zero for i in range(incog): if mat[i][i] == 0: for j in ran...
"""Module to provider installer interface. .. moduleauthor:: Xiaodong Wang <xiaodongwang@huawei.com> """ class Installer(object): """Interface for installer.""" NAME = 'installer' def __init__(self): raise NotImplementedError( '%s is not implemented' % self.__class__.__name__) ...
# -*- coding: utf-8 -*- __author__ = 'Erik Castro' __email__ = 'erik@erikcastro.net' __version__ = '0.1.0'
if __name__ == "__main__": newstr = "" many = input() for _ in range(int(many)): temp = input().split() repeat = temp[0] string = temp[1] for i in range(len(string)): #string의 길이만큼 for _ in range(int(repeat)): #문자열의 i번째 문자를 repeat번 만큼 이어붙인다 ...
"""Connect to Robin Hood Print Message""" #statment 1 connect_to_RobinHood_statment = "Hello, {fname} as of date {profile_time} account {profile_acct} has {profile_cash} in settled cash to trade. Algo Bot is engaging and connecting. Please monitor the system from time to time and message Michael Carrier at 815-355-73...
numbers = [12, 4, 9, 10, 7] total = 0 for num in numbers: total = total + num print("total: {}".format(total)) avg = total / len(numbers) print("average: {}".format(avg))
# pack.sub.abc模块 def func(): print('pack.sub.abc.func()')
# 029 - Write a Python program to print out a set containing all the colors from color_list_1 which are not present in color_list_2. colorInfo_1 = { "White", "Black", "Red", } colorInfo_2 = { "Red", "Green", } print(colorInfo_1 - colorInfo_2)
class Tag(object): def __init__(self, name, action): self.name = name self.action = action
class Conta(): def __init__(self,name,id,balance): self.name = name self.id = id self.balance = balance self.extract_list = [] def trasnfer(self, value): self.balance-=value self.extract_list.append(['trasnfer', value]) def deposit(self,value): self...
def get_IoU(confusion_matrix, label): assert ( label > 0 and label < 7 ), f"The given label {label} has to be between 1 and 6." if confusion_matrix[label - 1, :].sum() == 0: return None # There are -1 everywhere since "Unclassified" is not counted. return confusion_matrix[label - 1...
set1 = {10, 20, 30, 40, 50} set2 = {30, 40, 50, 60, 70} set3 = set1.union(set2) print(set3) # set3 = {70, 40, 10, 50, 20, 60, 30} # set1 y set2 se mantienen igual
def oriNumb(ori): if(ori=='r'): return 0 elif(ori=='d'): return 1 elif(ori=='l'): return 2 elif(ori=='u'): return 3 def numbOri(numb): if(numb==0): return 'r' elif(numb==1): return 'd' elif(numb==2): return 'l' elif(numb=...
mult_dict = {} pow_dict = {} def solution(n, m): mult_dict[(m, m)] = 1 for i in range(1, m+1): mult_dict[(m, m-i)] = mult_dict[(m, m-i+1)] * (m-i+1) % 1000000007 for i in range(m+1, 2*n-m+1): mult_dict[(i, m)] = mult_dict[(i-1, m)] * i % 1000000007 mult_dict[(2*n-m, 2*n-m)] = 1 for...
def odd_or_even(number: int): if (number % 2) == 0: return "Even" else: return "Odd" if __name__ == "__main__": while True: number = int(input("Number: ")) print(odd_or_even(number))
# # PySNMP MIB module HH3C-L2ISOLATE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-L2ISOLATE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:27:40 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
class Solution: # @param {integer} numRows # @return {integer[][]} def getRow(self, numRows): return self.generateResult(numRows+1) def generateResult(self, numRows): if numRows == 0: return [] if numRows == 1: return [1] ...
## print("Hello Kimbo!")
# The "real" article entry point # Maybe this has external (AWS) dependencies) class Article: def __init__(self): pass def get_article(self, idx): return { "id": idx, "title": "The real title" }
def test_passwd_file(host): passwd = host.file("/etc/passwd") assert passwd.contains("root") assert passwd.user == "root" assert passwd.group == "root" assert passwd.mode == 0o644 def test_nginx_config_file(host): nginx = host.run("sudo nginx -t") assert nginx.succeedd
# redis 配置 REIDS_HOST = '192.168.0.119' REIDS_PORT = 6379 REIDS_DB = 3 REIDS_DB3_ROW = "CONNECT_POLL" # ws检查周期 SLEEP_TIME = 10 DEBUG = True HOST = '127.0.0.1' PORT = 6001 # chrome服务地址 SERVER_LIST = [ {"host": "192.168.0.138"}, {"host": "192.168.0.105"}, # {"host": "192.168.0.111"}, ]
# coding: utf8 def maze_twisty_trampolines_v1(s): """A Maze of Twisty Trampolines, All Alike ---.""" steps = 0 cursor = 0 maze = s[:] l = len(maze) while True: if cursor < 0 or cursor >= l: break instruction = maze[cursor] maze[cursor] += 1 cursor +...
#!/user/bin/python # coding: utf8 class Larvae(Ant): """docstring for Larvae""" def __init__(self, arg): super().__init__(arg) self.arg = arg
def summation(num): if num == 0: return 0 return num + summation(num - 1) def summation1(num): return sum(range(num + 1)) # Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) ...
# Autogenerated file for Dot Matrix # Add missing from ... import const _JD_SERVICE_CLASS_DOT_MATRIX = const(0x110d154b) _JD_DOT_MATRIX_VARIANT_LED = const(0x1) _JD_DOT_MATRIX_VARIANT_BRAILLE = const(0x2) _JD_DOT_MATRIX_REG_DOTS = const(JD_REG_VALUE) _JD_DOT_MATRIX_REG_BRIGHTNESS = const(JD_REG_INTENSITY) _JD_DOT_MATRI...
''' File name: p3_utils.py Author: Date: '''
# Generate the Fibonacci list, stopping at given value def maxFibonacciValue(n): fib = [1, 2] for i in range(2, int(n)): if(fib[i-1] + fib[i-2] > int(n)): break else: fib.append(fib[i-1] + fib[i-2]) return fib # Calculate even-valued sum def evenFibonacciNumbers(n): ...
S = ["nwc10_hallway", "nwc1003b_danino", "nwc10", "nwc10m", "nwc8", "nwc7", "nwc4", "outOfLab", "nwc1008", "nwc1006", "nwc1007", "nwc1009", "nwc1010", "nwc1003g", "nwc1003g_a", "nwc1003g_b", "nwc1003g_c", "nwc1003b_a", "nwc1003b_b", "nwc1003b_c", "nwc1003b_t", "nwc1003a", "nwc1003b", "nwc1001l", "nwc1000m_a1", "n...
class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ # we need the best profit and its range in prices (the 1st transaction) profit1, l, r = self.maxProfit_1(prices) # then we consider other cases where we c...
class Support(Object): def __init__(self, name, ux = 1, uy = 1, uz = 1, rx = 1, ry = 1, rz = 1): self.name = name self.ux = ux self.uy = uy self.uz = uz self.rx = rx self.ry = ry self.rz = rz
# coding=utf-8 TEMPLATE = u'''${sys_default_coding} from __future__ import absolute_import import os from talos.server import base # from talos.core import config # @config.intercept('db_password', 'other_password') # def get_password(value, origin_value): # """value为上一个拦截器处理后的值(若此函数为第一个拦截器,等价于origin_value) # ...
num1 = int(input("Digite um numero")) num2 = int(input("Digite outro numero")) if num1 > num2: print("O primeiro valor é maior") elif num2 > num1: print("O segundo valor é maior") else: print("Não existe maior, os dois são iguais")
class Solution(object): def convertToTitle(self, n): """ :type n: int :rtype: str """ res = [] while(n>0): res.append(chr(ord('A')+(n-1)%26)) n-=1 n /= 26 return ''.join(res[::-1])
def display(p): L=[] s="" for i in range (0,9): if(i>=(9-p)): L.append("|---------|") #print" ".join(map(str,L[i])) else: L.append('| |') #s+=" ".join(map(str,L[i])) L.append("-----------") #s+=" ".join(map(...
# -*- coding: utf-8 -*- # # michael a.g. aïvázis # orthologue # (c) 1998-2019 all rights reserved # # class declaration class Filter: """ A mix-in class that changes the values of nodes iff they pass its constraints """ # value management def setValue(self, **kwds): """ Override...
ile_liczb = int(input("Podaj z ilu liczb obliczyć średnią:")) suma = 0 for i in range(ile_liczb): liczba = int(input("Podaj liczbe: ")) suma += liczba srednia = suma / ile_liczb print() print(srednia)
#!/usr/bin/env python # coding: utf-8 # This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # # Solution Notebook # ## Problem: Given a magazine, see if a ransom note could have been writte...
# Modify the code inside this loop to stop when i is greater than zero and exactly divisible by 11 for i in range(0, 100, 7): print(i) if i > 0 and i % 11 == 0: break
datashuru=0 bianliang=0 lujing='aaa' blF='q' blDataFrame=' Please complete the above before viewing the results ' y='1' x='2' yy='3' yx='4' bianliangy=0 chayi='0'#第二次预测真实值与预测值之间的差异 xishu='0'
# We are given an array A of size n that is sorted in ascending order, containing different # natural numbers in pairs. Find algorithm that checks if there is such an index i that A[i] == i. # What will change if the numbers are integers, not necessarily natural numbers? # Natural numbers def is_index_equal_to_numb...
class Solution: def jump(self, nums: List[int]) -> int: n, start, end, ans, amax = len(nums)-1, 0, 0, 0, 0 while True: for i in range(end, start-1, -1): if i >= n: return ans amax = max(amax, i+nums[i]) ...
with open('input/day6.txt', 'r', encoding='utf8') as file: fish_list = [int(value) for value in file.read().split(',')] population = [0,0,0,0,0,0,0,0,0] for fish in fish_list: population[fish] += 1 for day in range(1, 257): population = population[1:] + population[:1] population[6] += population[8] ...
# # @lc app=leetcode.cn id=86 lang=python # # [86] 分隔链表 # # https://leetcode-cn.com/problems/partition-list/description/ # # algorithms # Medium (45.66%) # Total Accepted: 7.7K # Total Submissions: 16K # Testcase Example: '[1,4,3,2,5,2]\n3' # # 给定一个链表和一个特定值 x,对链表进行分隔,使得所有小于 x 的节点都在大于或等于 x 的节点之前。 # # 你应当保留两个分区中每个节点的...
''' Listas em Python fatiamento, append, insert, pop, del, clear, extend, +, min, max, range ''' str = 'o rato roeu a roupa do rei de roma' nova_frase = '' for letra in str: if letra in 'r': nova_frase += letra.upper() elif letra in 'a': nova_frase = nova_frase + '@' else: nova_fras...
name0_0_1_1_0_2_0 = None name0_0_1_1_0_2_1 = None name0_0_1_1_0_2_2 = None name0_0_1_1_0_2_3 = None name0_0_1_1_0_2_4 = None
names = ['Christopher', 'Susan'] scores = [] scores.append(98) scores.append(99) print(names) print(scores)
# Copyright 2017 BBVA # # 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 to in writing, softwar...
''' pattern Enter number of rows: 5 54321 4321 321 21 1 ''' print('pattern: ') number_row=int(input('Enter number of rows: ')) for row in range(number_row,0,-1): for column in range(row,number_row): print(' ',end=' ') for column in range(row,0,-1): if column < 10: print(f'0{column}'...
""" 806. Number of Lines To Write String We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it is written on the next line. We are given an array widths, an array wh...
num1 = 00 num2 = 200 for n in range(num1, num2 + 1): if n > 1: for i in range(2, n): if (n % i) == 0: break else: print(n)
# This program displays property taxes. TAX_FACTOR = 0.0065 print('Enter the property lot number') print('or enter 0 to end.') lot = int(input('Lot number: ')) while lot != 0: value = float(input('Enter the property value: ')) tax = value * TAX_FACTOR print('Property tax: $', format(tax, ',.2f'), sep='...
CHROOTPW = """ dn: olcDatabase={0}config,cn=config changetype: modify add: olcRootPW olcRootPW: SSHA_KEY """ CHDOMAIN=""" dn: olcDatabase={1}monitor,cn=config changetype: modify replace: olcAccess olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read by dn.base="cn=admin,dc=mlo...
""" This module implements some interesting algorithmic challenges on strings """ def remove_duplicates(s): """ Given a string, remove duplicate characters, retaining only the first time for each unique character. Example: helloh -> helo """ unique_chars = set() new_string = "" for char in s: if char not in ...
""" The :mod:`pure_sklearn.metrics` module includes pairwise metrics and distance computations. """ __all__ = ["pairwise"]
# -*- coding: utf-8 -*- # @Author : LG """ 执行用时:40 ms, 在所有 Python3 提交中击败了67.68% 的用户 内存消耗:15 MB, 在所有 Python3 提交中击败了5.70% 的用户 解题思路: 具体实现见代码注释 """ class Solution: def monotoneIncreasingDigits(self, N: int) -> int: N = [int(s) for s in str(N)] # 转换为列表,便于计算 i = len(N) - 1 while i > 0: ...
def bingo_sort(L): minValue = min(L) maxValue = max(L) bingo = minValue next_bingo = maxValue nextIndex = 0 while bingo < maxValue: startPosition = nextIndex for i in range(startPosition, len(L)): if L[i] == bingo: L[i], L[nextIndex] = L[nextIndex], L[i] ; nextIndex +...
""" categories: Types,Exception description: User-defined attributes for builtin exceptions are not supported cause: MicroPython is highly optimized for memory usage. workaround: Use user-defined exception subclasses. """ e = Exception() e.x = 0 print(e.x)
num = int(input('Digite um número: ')) total = 0 for c in range(1, num + 1): if num % c == 0: print('\033[32m ', end=' ') total += 1 else: print('\033[31m', end=' ') print('{}'.format(c), end=' ') print('\n\033[mO número {} foi divisível {} vezes'.format(num, total)) if total == 2: ...
# You are given two integer arrays nums1 and nums2 both of unique elements, # where nums1 is a subset of nums2. # Find all the next greater numbers for nums1's elements in the corresponding # places of nums2. # The Next Greater Number of a number x in nums1 is the first greater number to # its right in nums2. If it d...
#encoding:utf-8 subreddit = 'arabfunny' t_channel = '@r_Arabfunny' def send_post(submission, r2t): return r2t.send_simple(submission)
# Copyright (C) 2015-2019 by Vd. # This file is part of RocketGram, the modern Telegram bot framework. # RocketGram is released under the MIT License (see LICENSE). class LocationMessageContent: """https://core.telegram.org/bots/api#inputlocationmessagecontent""" def __init__(self, latitude, longitude): ...
#!/usr/local/bin/python2 arquivo = open('pessoas.csv') for registro in arquivo: print('nome: {}, idade: {}'.format(*registro.split(','))) arquivo.close() print("ola mundo")
""" 颠倒给定的 32 位无符号整数的二进制位。 示例 1: 输入: 00000010100101000001111010011100 输出: 00111001011110000010100101000000 解释: 输入的二进制串 00000010100101000001111010011100 表示无符号整数 43261596, 因此返回 964176192,其二进制表示形式为 00111001011110000010100101000000。 示例 2: 输入:11111111111111111111111111111101 输出:10111111111111111111111111111111 解释:输入...
class SignalAndTarget(object): """ Simple data container class. Parameters ---------- X: 3darray or list of 2darrays The input signal per trial. y: 1darray or list Labels for each trial. """ def __init__(self, X, y): assert len(X) == len(y) self.X = X ...
"""1.6 String Compression: Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2b1c5a3. If the "compressed" string would not become smaller than the original string, your method should return the original string. You can assum...
'''Escreva um programa que leia um número 'n' inteiro qualquer e mostre na tela os 'n' primeiros elementos de uma Sequência de Fibonacci. Ex:. 0 - 1 - 1 - 2 - 3 - 5 - 8''' print('\033[1;33m-=\033[m' * 20) n1 = int(input('\033[34mDigite um número:\033[m ')) t1 = 0 t2 = 1 cont = 3 print('{} - {}'.format(t1, t2), end='') ...
""" Create a Os and Xs program! The program should do the following: - Create three lists for the three rows of the grid (and put three spaces in each one) - Repeatedly ask the O user and the X user (one after the other) for a row and column to place a symbol - Place the correct symbol for the user at that...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here t = int(input()) def calc(x): x //= 6...
# Script pour calculer le taux de rendement annualisé. # ------------------------------------------------------------ # Saisi des données v0 = int(input("veuillez sasir la valeur initial: ")) v1 = int(input("veuillez sasir la valeur final: ")) t = float(input("veuillez sasir le nombre d'année: ")) # Calcule du taux de ...
# Combination Sum III ''' Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers. Note: All numbers will be positive integers. The solution set must not contain duplicate combinations. Example 1: ...
class Solution: def canConstruct(self, ransomNote: str, magazine: str) -> bool: ransomNote = sorted(ransomNote) magazine = sorted(magazine) i = j = 0 while i < len(ransomNote) and j < len(magazine): if ransomNote[i] == magazine[j]: i += 1 elif ...
val = [] p = input('Digite uma sequência de números ').split() for i in range(0, 4): val.append(float(p[i])) #https://pt.stackoverflow.com/q/149149/101
# Crie um programa que tenha a funçao leiaint(), que vai funcionar de forma semelhante a funcao input(), # só que fazendo a validacao para aceitar apenas um valor numerico. def leiaint(msg): ok = False valor = 0 while True: n = str(input(msg)) if n.isnumeric(): valor = int(n) ...
# File: P (Python 2.4) protectedStates = [ 'Injured'] overrideStates = [ 'ThrownInJail']
print("You will meet two people - one is the sweet shop owner who wants to steal the password so he can keep the sweets.") print() playername=input("What is your name? ") print("Welcome "+ playername)