content
stringlengths
7
1.05M
class SolutionHashTableNaive: def findLength(self, nums1: List[int], nums2: List[int]) -> int: num_index1 = defaultdict(list) for index1, num in enumerate(nums1): num_index1[num].append(index1) max_len = 0 for index2, num in enumerate(nums2): for index1 in...
""" Validate if a given string is numeric. Some examples: "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true Note: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing one. Update (2015-02-10): The signature of the C++ function...
class Category: def __init__(self, categoryId, name): self.categoryId = categoryId self.name = name
# -*- coding:utf-8 -*- ''' 叠罗汉是一个著名的游戏,游戏中一个人要站在另一个人的肩膀上。 为了使叠成的罗汉更稳固,我们应该让上面的人比下面的人更轻一点。 现在一个马戏团要表演这个节目,为了视觉效果,我们还要求下面的人的身高比上面的人高。 请编写一个算法,计算最多能叠多少人,注意这里所有演员都同时出现。 给定一个二维int的数组actors,每个元素有两个值,分别代表一个演员的身高和体重。 同时给定演员总数n,请返回最多能叠的人数。保证总人数小于等于500。 ''' class Stack: def getHeight(self, actors, n): # height...
######### # Copyright (c) 2017 GigaSpaces Technologies Ltd. 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...
# demonstrate function scope spam = "global spam" # local scope def do_local(): spam = "local spam" print(spam) do_local() print(spam)
class RecentCounter(object): def __init__(self): self.p = [] def ping(self, t): """ :type t: int :rtype: int """ self.p.append(t) res = 0 for s in self.p[::-1]: if t - s > 3000: break; res += 1 retu...
class NCoverage(): # Model under test def __init__(self, threshold = 0.2, exclude_layer=['pool', 'fc', 'flatten'], only_layer = ""): self.cov_dict = {} self.threshold = threshold def scale(self, layer_outputs, rmax=1, rmin=0): ''' scale the intermediate lay...
""" Dla pobranej liczby, sprawdz czy liczba jest ujemna, dodatnia, czy jest zerem. """ if __name__ == "__main__": print("podaj liczbe") a = int(input()) if a < 0: print("libczba jest ujemna") elif a > 0: print("liczba jest dodatnia") else: print("liczba jest zerem")
CHOICES = (None, ' ℹ️ Display information', '🔮 Emotion analysis') EMOTION_ANALYSIS = """ ## Emotion Analysis ### Description This application uses a machine learning algorithm in order to guess the emotion of the user f...
class Question: # Defines the init function that is called each time a new object is created def __init__(self, text, correct_answer): # The attribute text is initialized with the value of the parameter text self.text = text # The attribute answer is initialized with the value of the p...
TO_KANA_METHODS = {"HIRAGANA": "to_hiragana", "KATAKANA": "to_katakana"} ROMANISATIONS = {"HEPBURN": "hepburn", "KUNREI": "kunrei"} DEFAULT_OPTIONS = { "use_obsolete_kana": False, "pass_romaji": False, "uppercase_katakana": False, "ignore_case": False, "IME_mode": False, "romanisation": ROMANI...
''' This is the __init__.py file for the PyCSW common scripts. author :kballantyne date :20190304 version :1.1 python_version :2.7.5 #================================================================================================================ ''' __all__ = ['pycsw_func']
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def sortList(self, head: Optional[ListNode]) -> Optional[ListNode]: if not head or not head.next: return head arr = [] ...
i = 10 while i >= 0: print(i) i = i - 1
""" Contains the EnzymeLookup class. """ class EnzymeLookup(): """ This is the enzyme lookup class. It is a reverse lookup table that loads an enzyme data from the path given to its initialize operator. In turn a find method is supplied that looks up any matching names. """ ###########...
""" Contains Event class """ class Event: """ Represents a LoTLan Event instance """ def __init__(self, logical_name, physical_name, event_type, comparator=None, value=None): self.logical_name = logical_name self.physical_name = physical_name self.event_type = event_type self.c...
# # Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this # list o...
# opaflib/parsetab_pdf_brute_end.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = 'v\xc8s\x99\xa0\x80\x10\xa9\xcbe\x07\xb2\x86\xf3\xc42' _lr_action_items = {'DOUBLE_GREATER_THAN_SIGN':([5,7,9,11,12,13,14,15,16,17,19,20,21,22,26,],[-17,9,-15,-10,-6,-...
# Copyright 2011 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 required by applicable ...
# -*- coding: utf-8 -*- info = { "%%after-billions": { "(0, 999)": "' kpakple =%spellout-cardinal=;", "(1000, 99999999)": "' kple =%spellout-cardinal=;", "(100000000, 99999999999)": "' kple =%spellout-cardinal=;", "(100000000000, 'inf')": "' =%spellout-cardinal=;" }, "%%after...
# # PySNMP MIB module XYLAN-CSM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLAN-CSM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:38:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
def create_printer(): my_favourite_number = 123 def printer(): print(f"My Favourite Number is {my_favourite_number}") return printer # Closure # As we can see, the output will be 123. Which means my_printer can still access to my_favourite_number which is outer scope. # this is what Closure is my...
# # PySNMP MIB module DC-RTM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DC-RTM-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:44:32 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, 09:...
n = int(input()) ans = 0 cnt = [[0] * 9 for _ in range(9)] for i in range(1, n + 1): one = str(i) if one[-1] == '0': continue cnt[int(one[0]) - 1][int(one[-1]) - 1] += 1 for i in range(9): for j in range(9): ans += cnt[i][j] * cnt[j][i] print(ans)
def help_command(ctx, command_name=None): if not command_name: msg = "" for cog in ctx.bot.cogs: msg += "\n\n" msg += cog.name + "\n" msg += "\n".join([f"/{command.name} - {command.description or 'No description'}" for command in cog.commands if not command.hidden...
def overview(bot, c, e, args): if len(args) >= 1: command = None for module in bot.loaded_modules.values(): try: for comm in module['object'].commands(): if comm[0] == args[0]: command = comm except AttributeError: ...
# coding: utf-8 """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache LICENSE, Version 2.0 (the "LICENSE");...
class Solution(object): def singleNumber(self, nums): """ :type nums: List[int] :rtype: int """ res = set() for num in nums: if num in res: res.remove(num) else: res.add(num) return res.pop() a = Solut...
PARAMS = { # max length of junction read overlap to consider a target site duplication "tsd=" : 20 }
print("Choose a language:") print("1. English - United Kingdom") print("2. Русский - Россия") print("3. Español - España") print("4. Português - Portugal") print("5. Português - Brazil") Language = int(input("Type number of language: ")) if Language == 1: print("") print("Hello! I am Minecraft text helper Damir. Yo...
class Drawer(object): """@brief Acts as a component, but with custom functions that are defined within the controller and passed into refresh/load. This allows for z index loading which may have complex drawing functionality. """ def __init__(self, controller, refresh=None, load=None, z=0): ...
""" https://www.hackerrank.com/challenges/max-array-sum/problem?isFullScreen=true Given: a arr of ints Find subset of non-adjacent els with the max sum. Return that sum. Example: arr = [-2, 1,3,-4,5] possible subsets: Subset Sum [-2, 3, 5] 6 [-2, 3] 1 [-2, -4] -6 [-2, 5] 3 [1, -4] -3 [1, 5] ...
# ----------------------------------------------------------------------------- # @brief: Define some signals used during parallel # ----------------------------------------------------------------------------- # it makes the main trpo agent push its weights into the tunnel START_SIGNAL = 1 # it ends the training E...
# 予めsx, syを全て計算しておく # このとき漸化式を使えば毎回全ての話を求める必要がない mod = int(1e9 + 7) n, m = [int(num) for num in input().split()] x = [int(x) for x in input().split()] y = [int(y) for y in input().split()] sx = [0] * n sx[0] = x[0] for i in range(n - 1): sx[i + 1] = sx[i] + x[i + 1] sxd = 0 for i in range(n - 1):...
"""""" #!/usr/bin/env python # -*- coding: utf-8 -*- __title__ = 'PyScenic' __description__ = 'A Python wrapper around Scenic REST APIs' __url__ = 'https://github.com/ScenicWeather/pyScenicWeather' __version__ = "0.0.3" __author__ = 'Conor Forde' __author_email__ = 'conor@scenicdata.com' __license__ = 'MIT'
""" If you only do what you can do, You will never be better than you are now. - Master shifu """
Lista=[6,5,3,2,1,9,7,4] numero = int(input('Digite um número:')) #verificar se o número digitado está na lista ou não for n in Lista: if (n == numero): print('O elemento pertence a lista') break else: print('O elemento não pertence a lista')
#descobrindo se o número é par ou ímpar x=int(input('Digite o número que deseja saber se é impar ou par: ')) if x%2==0: print(f'O número {x} é par.') else: print(f'O número {x} é ímpar')
# Time: O(1) # Space: O(1) class Solution(object): def findComplement(self, num): """ :type num: int :rtype: int """ return 2 ** (len(bin(num)) - 2) - 1 - num class Solution2(object): def findComplement(self, num): i = 1 while i <= num: i <...
def primes(value): for num in range(value): res = True for k in range(2, num): if k != 0: if num % k == 0: res = False if res == True: print(num) primes(100)
# # PySNMP MIB module IBMIROC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBMIROC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:51:37 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, 0...
# Time: O(n) # Space: O(1) def read4(buf): global file_content i = 0 while i < len(file_content) and i < 4: buf[i] = file_content[i] i += 1 if len(file_content) > 4: file_content = file_content[4:] else: file_content = "" return i class Solutio...
## Declare file path STYLE_AURORA= 'static/img/aurora.jpg' STYLE_CHINESE = 'static/img/chinese.jpg' STYLE_CHINGMIN = 'static/img/chingmin.jpg' STYLE_COLORFUL = 'static/img/colorful.jpg' STYLE_CRYSTAL = 'static/img/crystal.jpg' STYLE_DES_GLANEUSES = 'static/img/des_glaneuses.jpg' STYLE_FIRE = 'static/img/fire.jpg' STYLE...
# -*- coding: utf-8 -*- # @Time : 2020/8/16 22:51 # @Author : kangqing # @Email : kangqing.37@gmail.com # @File : LeetCode5488.py # @Software: PyCharm """ LeetCode5488 使数组中所有元素相等的最小操作数 """ class Solution: @staticmethod def min_operations(n: int) -> int: # 第一位数是1 最后一位是 2 * (n - 1) + 1 最后相同的值是 ...
nome = str(input('Digite seu nome completo: ')).strip() n = nome.split() print('Um prazer te conhecer {}'.format(nome.title())) print('Seu primeiro nome é {} '.format(n[0].title())) print('Seu último nome é {}'.format(n[len(n)-1].title()))
def parallel_play_test(par_env): obs = par_env.reset() assert isinstance(obs, dict) assert set(obs.keys()).issubset(set(par_env.agents)) for i in range(1000): actions = {agent:space.sample() for agent, space in par_env.action_spaces.items()} obs, rew, done, info = par_env.step(actions)...
class BattleshAPIException(Exception): pass class GameNotStartedException(BattleshAPIException): pass class NotYourTurnException(BattleshAPIException): pass class AlreadyRegisteredException(BattleshAPIException): pass class ShipInTheWayException(BattleshAPIException): pass class Insufficie...
# -*- coding: utf-8 -*- # # Author: Thomas Hangstoerfer # License: MIT # class Screen(object): """docstring for Screen""" def __init__(self): #super(Screen, self).__init__() #self.arg = arg self.isVisible_ = False pass def setVisible(self, visible): # print("Screen...
games_won = dict(sara=0, bob=1, tim=5, julian=3, jim=1) def print_game_stats(games=games_won): """Loop through games_won's dict (key, value) pairs (dict.items) printing (print, not return) how many games each person has won, pluralize 'game' based on number. Expected output (ignore the docst...
MALE = "male" FEMALE = "female" OTHER = "other" GENDERS = ((MALE, MALE), (FEMALE, FEMALE), (OTHER, OTHER)) MEMBER = "member" LEADER = "leader" CO_LEADER = "co-leader" TREASURER = "treasurer" RECRUITING = "recruiting" DEVELOPMENT = "development" EDITOR = "editor" RETIREE = "retiree" MEDIA_RELATIONS = "media_relations"...
class ReprMixin: def __repr__(self) -> str: """ This function is used to represent the object. """ return f'<{self.__class__.__name__} {self.id}>' class Hashable(ReprMixin): def __hash__(self): """ This function is used to hash the object. """ ...
_NO_DEFAULT = object() class Record(dict): def __getitem__(self, key): try: return dict.__getitem__(self, key) except TypeError: return Record({k: dict.__getitem__(self, k) for k in key}) def __setitem__(self, key, value): try: dict.__setitem__(self, ...
# -*- coding: utf-8 -*- """ This module serves the class for wrapping any known client specific exceptions. """ class FullContactException(Exception): pass
""" Solution for https://codeforces.com/problemset/problem/236/A """ def main(): s = input() set_s = set(s) if len(set_s) % 2 == 0: print("CHAT WITH HER!") else: print("IGNORE HIM!") if __name__ == '__main__': main()
class Calculation: def __init__(self): self.checks = [] self.max_ratio_index = 0 self.show_max_ratio_calc = False def add_item(self, location, name, check_item, check_force, unit): self.checks.append([location, name, check_item["result"], check_force, ...
""" Interface for pin class functionality described in azubot_gpio.py """ class IPin: def __init__(self, pin_no, mode): raise NotImplementedError def write(self, value): raise NotImplementedError
def voting(winners, author, text): """ Every author gets to vote once with their vote being text. The text is a numberic string indicating a voting choice. Each vote is added to a dict of all other votes. """ if author not in winners.keys(): if text.isnumeric(): winners[autho...
for i in range(1,10): for j in range(1,i+1): print('{}*{} = {}''\t'.format(i,j,i*j),end = '') print()
''' Bayesian machine learning models with sklearn api ================================================= IMPLEMENTED ALGORITHMS: ----------------------- ** Linear Models - Type II ML Bayesian Logistic Regression with Laplace Approximation (EBLogisticRegression) - Type II ML Bayesian...
### O comando break faz todo loop parar, ou seja ele quebra a execução de um loop. Assim o retorno será (0,1,2) l = range(0,11) for i in l: if i >= 3: break print(i)
# rodičovská třída class Bird: #vypisujici def __init__(self): print("Bird je připraven") def whoisThis(self): print("Bird") def swim(self): print("Plav rychleji") # child třída class Penguin(Bird): #vypisujici funkce ktere jsou na sobě zavisle def __init__(self): ...
#0.04s user 0.02s system 63% cpu 0.086 total numbers = '731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331952853208805511125406987471585238630507156932909632952274430435576689664895044524452316173185640309871112172238311362229893423380...
# from pokemon import Pokemon class Trainer: def __init__(self, name): self.name = name self.pokemon = [] def add_pokemon(self, pokemon): repeats = [owned_pokemon for owned_pokemon in self.pokemon if pokemon.name == owned_pokemon.name] if not repeats: self.pokemon...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: diffs = {} for i in range(len(nums)): if nums[i] in diffs: return [diffs[nums[i]], i] diffs.update({ target - nums[i]: i })
S = input() d = {} for c in S: d.setdefault(c, 0) d[c] += 1 if all(map(lambda x: x == 1, d.values())): print('YES') else: print('NO')
var = 0 print(var == 0) print(var == 0.) var = 1 print(var == 0) print(var != 1.1)
nome = input("Insira seu nome: ") nota1 = float(input("Insira sua nota da primeira prova: ")) nota2 = float(input("Insira sua nota da segunda prova: ")) div = (nota1 + nota2) / 2 print(f"a media de {nome} foi {div:.2f} ao final das provas.")
""" Ende ==== Personal (En)cryption (De)cryption package with command-line tool This program provides string, file & whole folder encrytion / decryption. It may be used either as a importable package or a command-line tool. - Encryption uses AES-128 CBC mode - Authentication is signed with a SHA256 HMAC. - Individua...
dictionary = dict( edep = r'$\mathrm{E}_\mathrm{dep}$', edep_unit = 'MeV', evis = r'$\mathrm{E}_\mathrm{vis}$', evis_unit = 'MeV', eres_sigma_rel = r'$\sigma_E/E$', eres_sigma_rel_unit = '%', )
# Radové číslovky # Napíšte definíciu funkcie ordinal, ktorá ako argument prijme prirodzené číslo a vráti zodpovedajúcu radovú číslovku v angličtine (tj. 1st, 2nd, 3rd, 4th, 11th, 20th, 23rd, 151st, 2012th a pod.). def ordinal(number: int) -> str: """ >>> ordinal(5) '5th' >>> ordinal(151) '151st' ...
"""pylint option block-disable""" __revision__ = None class Child2Class(object): """block-disable test""" def __init__(self): pass def meth1OfChild(self, arg): """this issues a message""" print (self)
""" For loops are called count controlled iteration Unlike while loops that are controlled by a condition for loops run a certain number of times and then stop. The i variable after the key word for is the loop variable Each time the loop executes the loop variable is incremented The value of the loop variable starts a...
""" molssi_math.py A package containing math functions Handles the primary functions """ def mean(my_list): """ This function calculates the mean of a list Parameters ---------- my_list: list The list of numbers that we want to average Returns ------- mean_list : float ...
class GameWorldMixin(): def __init__(self): self.init_game = None self._worlds = None self.gameworld = None def add_world(self, world_name, **kwargs): self._worlds[world_name] = GameWorld(world_name, **kwargs) self.gameworld.init_gameworld([], callback=self.init_game) c...
soma = 0 cont = 0 for c in range(1,501, 2): if c % 3 == 0: soma = soma +c cont = cont +1 print('A soma de todos os {} valores de 1 a 500 é {}'.format(cont,soma))
BOT_NAME = 'transparencia' SPIDER_MODULES = ['transparencia.spiders'] NEWSPIDER_MODULE = 'transparencia.spiders' USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0' ROBOTSTXT_OBEY = False RETRY_TIMES = 5 RETRY_HTTP_CODES = [500, 502, 503, 504, 522, 524, 403, 404, 408]
""" Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. """ def simple_solution(numbers, sum): """Complexity : O(N²)""" for first in numbers: for second in numbers: ...
#!/usr/bin/python -S """Fake get-quantenna-interfaces implementation.""" _INTERFACES = [] def call(*unused_args, **unused_kwargs): return 0, '\n'.join(_INTERFACES) def mock(interfaces): global _INTERFACES _INTERFACES = list(interfaces)
def collect_args(obj): i = 0 items = [] while True: key = '_{n}'.format(n=i) if key not in obj: break items.append(obj[key]) i += 1 return items
ALL_LAYERS = ('A', 'B', 'C', 'D', 'E', 'F') def seconds_to_readable_time(seconds): seconds = seconds if seconds > 0 else 0 return f'{int(seconds // 60)}:{seconds % 60:04.1f}'
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations # ------------------------------------------------------------------------- # This is a sample controller # - index is the default action of any application # - user is required for authentication and authorization ...
class Matrix: def __init__(self, matrix): self.matrix = list(matrix) def number_of_row(self): return len(self.matrix) def number_of_column(self): return len(self.matrix[0]) def __add__(self, other): if (self.number_of_row() != other.number_of_row() or self.n...
# https://leetcode.com/explore/learn/card/fun-with-arrays/511/in-place-operations/3157/ # O(n) class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ i = -1 j = 0 for j in range(len(nums)): ...
"""商品字典dict_commodity_infos = {1001: {"name": "屠龙刀",\ "price": 10000}, 1002: {"name": "倚天剑", "price": 10000}, \ 1003: {"name": "金箍棒", "price": 52100}, \ 1004: {"name": "口罩", "price": 20}, \ 1005: {"name": "酒精", "price": 30}, }# \ 订单列表list_orders = [{"cid": 1001, "count": 1}, \ {"cid": 1002, "count": 3}, {"cid": 1...
PRODUCT_STORES = [ ('LOBLAWS', 'Loblaws'), ('WALMART', 'Walmart'), ('VOILA', 'Voila'), ('GROCERYGATEWAY', 'Grocery Gateway'), ('MINTEL', 'Mintel') ] # All available categories that can be selected/predicted for any particular product. This list should be maintained. # https://www.canada.ca/en/healt...
destination = 0 new_savings = 0 savings = 0 while destination != "End": destination = input() if destination == "End": break min_budget = float(input()) while min_budget >= new_savings: savings = float(input()) new_savings += savings if new_savings >= min_budget: ...
class DefaultConfigEstimator: def __init__(self, num_cores, # int total_memory): self.num_cores = num_cores self.total_memory = total_memory def get_min_executor_mem(self): """ :return: Returns the minimum executor memory """ return int(self.g...
class Solution(object): def multiply(self, num1: str, num2: str) -> str: # If both number are 0 if num1 == "0" and num2 == "0": return "0" # Reverse both numbers first_number = num1[::-1] second_number = num2[::-1] # For each digit in seco...
# pylint: disable=line-too-long,invalid-name,missing-module-docstring def extend_AllIndexed(self, elements, validate_continuity=False): """ Add all elements in list ``elements``, respecting ``@index`` order. With ``validate_continuity``, check that all new elements come after all old elements (or raise ...
# coding: utf-8 n, x = [int(i) for i in input().split()] current = 1 ans = 0 for i in range(n): l, r = [int(i) for i in input().split()] ans += (l-current)%x + (r-l+1) current = r+1 print(ans)
#print("Hello World") print("Hello World") a= 5 b =5 c = [9, 5,3] if a == a: print("Hello") if a == c : print("Hello") if a > b: print('Hello') while True : print ( "Hello" ) break print ( a + b )
# -*- coding: utf-8 -*- ''' File name: code\coin_partitions\sol_78.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #78 :: Coin partitions # # For more information see: # https://projecteuler.net/problem=78 # Problem Statement ''' Let p(...
#!/usr/bin/python3 def add(a, b): i = a j = b return(i + j)
#DictExample2.py employee = {"Name":"Suprit","Age":22,"Company":"Wipro","Location":"Wipro"} print("---------------------------------------------------") print("Employee Name : ",employee['Name']) print("Employee age : ",employee['Age']) print("Employee Company : ",employee['Company']) print("Company Locatio...
#Four Fours #Zero print("Zero is ", 44-44) # One print("One is ", 4/4 * 4/4) # Two print("Two is ", (4*4)/(4+4) ) # Three print("Three is ", (4 + 4 + 4)/4) # Four print("Four is ", (4-4)/4 + 4)
class Solution(object): def singleNumber(self, nums): """ :type nums: List[int] :rtype: int """ def singleNumberK(nums, k): ret = 0 count = [0] * 32 for i in xrange(0, 32): for num in nums: if ...
# Specialization: Google IT Automation with Python # Course 01: Crash Course with Python # Week 1 Module Part 4 Exercise 01 # Student: Shawn Solomon # Learning Platform: Coursera.org # Now that you know what’s going on with this piece of code, try making Python output a different string. # Write a Python scrip...
num = int(input('Escreva um número: ')) if num % 2 == 0: print('Esse número é PAR!') else: print('Esse número é ÍMPAR!')
IMAGES_FOLDER = 'visual_images' ACTUAL_IMAGE_BASE_FOLDER = 'actual' DIFF_IMAGE_BASE_FOLDER = 'diff' BASELINE_IMAGE_BASE_FOLDER = 'baseline' MODE_TEST = 'test' MODE_BASELINE = 'baseline' REPORT_FILE = 'visualReport.html' REPORT_EXPIRATION_THRESHOLD = 10 IMAGE_EXTENSIONS = ['png', 'jpg', 'jpeg', 'bmp', 'raw', 'pdf'] ROBO...