content
stringlengths
7
1.05M
numbers_of_electrons = int(input()) electrons = [] cell_number = 1 while numbers_of_electrons > 0: possible_electrons = 2*cell_number**2 if possible_electrons > numbers_of_electrons: electrons.append(numbers_of_electrons) break electrons.append(possible_electrons) numbers_of_electrons -...
# Jerry Landeros def userInput(): number = int(input("Please enter a number: ")) return number def primeChecker(number): if number > 1: for i in range(2, number): if (number % i) == 0: print(number, "is not a prime number.") break else: ...
def print_welcome(): return """ <h1>Hello world!</h1> <p> <h3>This API is intended for FoodExplorer application.</h2> """ def print_man(): return """ <h3>api/v1/food</h3> <p>POST method</p> <p>form data berisi image</p> <h3>api/v1/food?q={query}</h3> <p>GET method</p> <p>sear...
"""Solution to 2.7: Intersection.""" def intersect(list_one, list_two): length_one = len(list_one) length_two = len(list_two) diff = abs(length_one - length_two) head_one = list_one.head head_two = list_two.head while range(max(length_one, length_two)): if diff > 0: di...
_base_ = [ '../_base_/models/deeplabv3_unet_s5-d16.py', './dataset.py', '../_base_/default_runtime.py', './schedule_20k.py' ] model = dict( decode_head=dict( num_classes=2,loss_decode=dict( _delete_=True, type='LovaszLoss', loss_weight=1.0, per_image=True) # type='CrossEn...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( arr , n ) : if ( n == 1 ) : return True i = 1 for i in range ( 1 , n ) : if arr [ i - 1...
# Maria O Sullivan # Project Euler 5 # https://projecteuler.net/problem=5 i = 20 while 1: i+=20 #i remainder 11 equals 0 if i%11==0 and i%12==0 and i%13==0 and i%14==0 and i%15==0\ and i%15==0 and i%16==0 and i%17==0 and i%18==0 and i%19==0: print(i) break ...
# # Problem: Create a function that takes a message as a list of characters and reverses the order of the words # in-place. # # For example: # message = [ 'c', 'a', 'k', 'e', ' ', # 'p', 'o', 'u', 'n', 'd', ' ', # 's', 't', 'e', 'a', 'l' ] # # reverse_words(message) # # print ''.join(messa...
""" Copyright 2018 Akshit Grover 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 ...
class TreeNode: def __init__(self, data, left=None, right=None): self.data = data self.left = left self.right = right def __repr__(self): return str(self.data) def insert(self, data): """ - If value is less then root node, find empty leaf and insert into le...
HTML_CODE_OPEN = "<code>" HTML_CODE_CLOSE = "</code>" HTML_NEW_LINE = "\n" ETH_NULL_ADDRESS = '0x0000000000000000000000000000000000000000' ETH_WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
question_data = [ {"category": "Science & Nature", "type": "boolean", "difficulty": "medium", "question": "The Neanderthals were a direct ancestor of modern humans.", "correct_answer": "False", "incorrect_answers": ["True"]}, {"category": "Science & Nature", "type": "boolean", "difficulty": "medium", ...
class User: def __init__(self, guid, client): self.guid = guid self.client = client def delete(self): """ Delete this Cloud Foundry user """ # Delete from Cloud Controller api_delete_endpoint = '/v2/users/%s' % self.guid self.client.api_request(endpoint=api_del...
# -*- coding: utf-8 -*- class TrieNode: def __init__(self): self.children = {} self.leaf = False class Trie: def __init__(self): self.root = TrieNode() def insert(self, word): current = self.root for char in word: if char not in current.children: ...
def yuvarlma(s): return round(s+0.0000000001) def odevHesaplama(v): odev= 50+ v/2 return odev def ortHesapla(v , o , f): return v*0.3 + o *0.2 + f*0.5 vize = 60 odev = odevHesaplama(vize) final = 45 print('Ödev :', odev) print('Vize :', vize) print('Final :', final) ortalama = ortHesapla(vize,odev,...
class Solution(object): def countPoints(self, points, queries): """ :type points: List[List[int]] :type queries: List[List[int]] :rtype: List[int] """ qP = [] for q in queries: count = 0 for p in points: if(sqrt(pow(q[0]...
class ActionRow: def __init__(self, components: list): self.base = {"type": 1, "components": [component.base for component in components]} class SelectMenuOption: def __init__(self, label: str, value, description: str ='', emoji: dict = {}): self.base = {"label": label, "description": descripti...
class Node: def __init__(self, key, value): self.key = key self.value = value self.next = None def __str__(self): return f'<Node: ({self.key}, {self.value}, Next: {self.next})>' def __repr__(self): return str(self) class Hash: """ Hash object class. ""...
f_no = 1 s_no = 2 print(f_no) print(s_no) result = 2 while True: t_no = f_no + s_no if t_no >= 4000000: break if t_no % 2 == 0: result += t_no # result = result + t_no print(t_no) f_no = s_no s_no = t_no print() print("Sum of even numbers till 4000000 is ", result)
# @file Search in Rotated Sorted ArrayII # @brief Given a sorted rotated array, search for target # https://leetcode.com/problems/search-in-rotated-sorted-array-ii ''' Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose an a...
#Given a string and a non-negative int n, return a larger string that is n copies of the original string. #string_times('Hi', 2) → 'HiHi' #string_times('Hi', 3) → 'HiHiHi' #string_times('Hi', 1) → 'Hi' def string_times(string,n): return string*n
class Bidict(dict): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.inverse = {} for key, value in self.items(): self.inverse.setdefault(value, []).append(key) def __setitem__(self, key, value): if key in self: self.inverse[sel...
L=[] for i in range(int(input())): L.append([i+1]+list(map(int,input().split()))) L.sort(key = lambda t : t[3]) L.sort(key = lambda t : t[2]) L.sort(key = lambda t: 700-t[1]) print(L[0][0])
# ====================================================================== # Seating System # Advent of Code 2020 Day 11 -- Eric Wastl -- https://adventofcode.com # # Python implementation by Dr. Dean Earl Wright III # ====================================================================== # ===========================...
# # PySNMP MIB module BENU-TWAG-STATS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BENU-TWAG-STATS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:37:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
class utils: def __init__(self): pass def readFile(self, fileName): pass
pole = [1, 2, 5, -1, 3] maximum = pole[0] i = 1 while i < len(pole): maximum = max(maximum, pole[i]) i += 1 print(maximum)
""" This package contains the DIRECT tools, a set of tkinter tools for exploring and manipulating the Panda3D scene graph. By default, these are disabled, but they can be explicitly enabled using the following PRC configuration:: want-directtools true want-tk true """
class Solution: def findDisappearedNumbers(self, nums): # since num in nums belongs to [1, len(nums)], we just need loop i from 1 to len(nums) and check if i in nums. # But the time complexity of checking whether an item in a list is O(n). We need O(1). So make a list to a set. length = le...
# declaring random seed randomseed = 0 C, H, W = 3,112,112 input_resize = 171,128# test_batch_size = 1 m1_path = 'models/model_CNN_94.pth' m2_path = 'models/model_my_fc6_94.pth' m3_path = 'models/model_score_regressor_94.pth' m4_path = 'models/model_dive_classifier_94.pth' c3d_path = 'models/c3d.pickle' with_dive_cl...
class _DoublyLinkedBase: class _Node: __slots__ = '_element', '_prev', '_next' def __init__(self, element, prev, next): self._element = element self._prev = prev self._next = next def __init__(self): self._header = self._Node(None, None, None) ...
class TV: def __init__(self): self.__mysonytvprice = 55000 def mysell(self): print("The Selling Price is : {}".format(self.__mysonytvprice)) def myMaxPrice(self, myprice): self.__mysonytvprice = myprice myobj = TV() myobj.mysell() # trying to change the price myobj.__mysony...
f1 = open("../../../prachi/kbi/kbi-pytorch/hits_id/fb15k_hits_10_pred.txt",'r').readlines() f2 = open("../../../prachi/kbi/kbi-pytorch/hits_id/fb15k_hits_10_true.txt",'r').readlines() f3 = open("fb15k_hits10_not_hits1_pred.txt",'w') for i in range(len(f1)): if(f1[i]!=f2[i]): print(f1[i].strip(),file=f3) f3...
#!/usr/bin/env python # Copyright 2010 Google Inc. All Rights Reserved. """GRR Rapid Response Framework."""
# Returned function def mult_by_x(x): def inner(y): return y * x return inner # Global? def alt_mult_by_x(x): return alt_inner def alt_inner(y): return y * x # Called function def apply(f, x): return f(x) def id(x): return x # print(id(id)(id(13))) def combine_funcs(op): def...
NobelFisica = {1901: "Wilhelm Conrad Röntgen", 1902: "Hendrik Antoon Lorentz e Pieter Zeeman", 1903: "Antoine-Henri Becquerel, Pierre Curie e Marie Curie", 1904: "John William Strutt", 1905: "Philipp Eduard Anton von Lenard", 1906: "Joseph John Thomson", 1907: "Albert Abraham Michelson", 1908: "Gabriel Lippmann", 1909:...
############################################## # DESCRIPTION : Format Based Steganography # # Algorithm : Open space encoding # # Author : Kishore # ############################################## def to_ascii(charector): # a method to convert charector into ascii int assert ...
""" cmd.do('distance ${1:dist3}, ${2:/rcsb074137//B/IOD`605/I`B}, ${3:/rcsb074137//B/IOD`605/I`A}') """ cmd.do('distance dist3, /rcsb074137//B/IOD`605/I`B, /rcsb074137//B/IOD`605/I`A') # Description: H-bond distances. # Source: placeHolder
def GetRoutes(area): query = 'select distinct Route from [dimensions].[wells] where [Area] = \'' + area + '\'' return query def GetWells(area, route): query = 'select distinct WellName from [dimensions].[wells] where [Route] = \'' + route + '\' and [Area] = \'' + area + '\'' return query ...
# Problem: https://www.hackerrank.com/challenges/diagonal-difference/problem # Score: 10 a = [] result = 0 for i in range(int(input())): a = list(map(int, input().split())) result += a[i] - a[- 1 - i] print(abs(result))
# 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"); you may not u...
sm.removeEscapeButton() sm.setSpeakerID(1102102) sm.sendNext("THERE YOU ARE! I told you not to move! You're going to pay for that. Maybe not today, maybe not tomorrow, but one day, when you're on a particularly annoying mission, know that I've secretly arranged it. Now get back to the Drill Hall!") sm.startQuest(pare...
CSS_STYLE = """ .kts {{ line-height: 1.6; }} .kts * {{ box-sizing: content-box; }} .kts-wrapper {{ display: inline-flex; flex-direction: column; background-color: {first}; padding: 10px; border-radius: 20px; }} .kts-wrapper-border {{ border: 0px solid {second}; }} .kts-pool {{ display: flex; flex-wr...
""" Title: 1004. Max Consecutive Ones III 1004. 最大连续1的个数 III Address: https://leetcode-cn.com/problems/max-consecutive-ones-iii/ """ # 方法一:滑动窗口 # 思路:借鉴「424. 替换后的最长重复字符」的解题思路 class Solution: def longestOnes(self, A: List[int], K: int) -> int: if len(A) == 0 or K < 0: return 0 ...
t = int(input()) for i in range(t): n,m,k = map(int,input().split()) l = list(map(int,input().split())) x = {} for j in range(n): x[j] = [] for j in range(n): temp = l[j] x[temp-1].append(j+1) print(x) j=0 me = l[0] while m>0 and j+1<=me: m-=len(x[j]) print(m) k-=1 j+=1 if j-1>me: print("YES")...
class PaginationHelper(): ''' Help keep track of pagination for the web UI, in terms of correct offsets ''' def __init__(self, bare_route, offset, interval=20, num_items=None): self.bare_route = bare_route self.interval = interval self.num_items = num_items if offset % interval ...
""" #### Generic "Writer" The ResultsWriter has been written s.t. it can be easily replaced if the way in which we would like to write results changes. For example, in the future we may want to replace the ResultsWriter with a writer to an SQL database or flat file system. Regardless of the "Writer" that is used, the ...
class TestingError(BaseException): pass class MisnamedFunctionError(TestingError): pass class TestNotFoundError(TestingError): pass class SolutionNotFoundError(TestingError): pass
""" ### What is Bucket Sort ? Bucket sort is a comparison sort algorithm that operates on elements by dividing them into different buckets and then sorting these buckets individually. Each bucket is sorted individually using a separate sorting algorithm or by applying the bucket sort algorithm recursively. Bucket s...
# # 1763. Longest Nice Substring # # Q: https://leetcode.com/problems/longest-nice-substring/ # A: https://leetcode.com/problems/longest-nice-substring/discuss/1074560/Kt-Js-Py3-Cpp-Recursive # class Solution: def longestNiceSubstring(self, s: str) -> str: best = '' def go(s): nonlocal ...
# -*- coding: utf-8 -*- """ Created on Mon Oct 4 10:59:09 2021 @author: shubhransu """ a=[] for i in range(0,5): k = int(input()) a.append(k) print(max(a))
s = input('Введите ФИО через пробел:') lst = s.split() print( 'Привет, ' ) for si in lst: print( si)
#frequency function for cities (could be used for all of the columns) def freq_function(col): city = [] for item in col: for j in item: city.append(j) freq= {x:city.count(x) for x in city} sorted_freq = {k: v for k, v in sorted(freq.items(), key=lambda item: item[1], ...
""" Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal". Example 1: Input: [5, 4, 3, 2, 1] Output: ["Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"] Explanation: The first three athle...
#!/usr/bin/python3.6 # created by cicek on 06.12.2018 00:46 def average(midterm, final): mid = (0.4)*midterm fin = (0.6)*final result = mid + fin return result while(True): vize = int(input("vize puanınızı giriniz: ")) if vize == -1: exit(0) final = int(input("final puanınızı giriniz: ")) ...
class solution: def max_distance(A): if len(A) < 2: return 0 A.sort() pre = A[0] max_gap = float("-inf") for i in A: max_gap = max(max_gap, i - pre) pre = i return max_gap print(solution.max_distance([3, 5, 4, 2]))
val_premio = float(input("VALOR TOTAL DO PRÊMIO: ")) imposto = val_premio*0.07 val_real = val_premio - imposto val_g1 = 0.46*val_real val_g2 = 0.32*val_real val_g3 = val_real - (val_g1 + val_g2) print("-----------------------------------") print("VALOR TOTAL DO PRÊMIO = {:.2f}".format(val_premio)) print("VALOR DO I...
# Casting an integer to a string # EXPECTED OUTPUT: # case5.py: x -> int # case5.py: y -> int # case5.py: z -> int # case5.py: my_function() -> str def my_function(): x = 5 y = 10 z = x + y return str(z)
letterFrequency = { "E": 12.0, "T": 9.10, "A": 8.12, "O": 7.68, "I": 7.31, "N": 6.95, "S": 6.28, "R": 6.02, "H": 5.92, "D": 4.32, "L": 3.98, "U": 2.88, "C": 2.71, "M": 2.61, "F": 2.30, "Y": 2.11, "W": 2.09, "G": 2.03, "P": 1.82, "B": 1.49,...
animals = ['bear' , 'python 3.6' , 'peacock' , 'kangroo' , 'whale' , 'zebra'] print(f"The animal at 1 is the 2nd animal and is a {animals[1]}.") print(f"The third (3rd) animal is at 2 and is a {animals[2]}.") print(f"The first (1st) animal is at 0 and is a {animals[0]}.") print(f"The animal at 3 is the forth animal an...
#inputArray is the input dataset #x is the searching integer in the array def binarySearch(inputArray,x): if (inputArray[-1] > x): mid = len(inputArray)//2 # get the mid index of the inputArray if (inputArray[mid] == x): #check it the with the searching number return true #if yes return true if (inputArray...
WALL = 'w' FOOD = 'f' SNAKEBODY = 'b' SNAKEHEAD = 'h' width = 5 height = 10 board = [[0 for i in range(width)] for j in range(height)] board[0][0] = 5 print(board)
#program to compute the values of n n = float(input( 'Enter the values of n.\n')) Values = (n+(n*n)+(n*n*n)) print(f'Sample value of n is {n}') print(f'The expected result:{Values} ')
# problem name: Array Shrinking # problem link: https://codeforces.com/contest/1312/problem/E # contest link: https://codeforces.com/contest/1312 # time: (?) # author: reyad # other_tags: greedy # this solution style is a bit different for this problem than most of the cf solutions # so i'm providing a tutor...
""" x = "its global" def fantastic(): print("about") global x x= 230 def lamented(): print("Sad") y = input() if y == "fantastic": fantastic() else: lamented() k = 5j print(type(k)) """ """ lst = [1,2,3,4,5,6,7,8,9, 12,12,23,34,435,6,56,34,23,45,7678,3] for x in lst: print(x) lst.append(777) print(l...
""" CloudConvert exceptions classes. """ class CloudConvertError(Exception): """ Basic CloudConvert exceptions class. """ pass class MissingFileException(CloudConvertError): """Raises when file to conversion is missed. """ pass class WrongRequestDataException(CloudConvertError): """Raises when...
class colored: def __init__(self, text, color='\033[1000m', highlight='\033[1000m', effect='\033[1000m'): self.text = text none = '\033[1000m' #---- color ---- Lred = '\033[91m' red = '\033[31m' Lblue = '\033[94m' blue = '\033[34m' Lgreen = '\033[92m' green = '\033[32m' yellow = '\033[93m' cyan...
# Algo's described clearly on the following link # https://math.stackexchange.com/questions/60742/finding-the-n-th-lexicographic-permutation-of-a-string def nth_permutation(alpha, n): # alpha is the list of item, and # n is the nth permutation, that is to be found out perm = [] t = len(alpha) fact...
class Solution: def subsets(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ n=len(nums) sub=[] for i in range(2**n): #l=[0 for k in range(n)] k=i p=[] for j in range(n): if (k &...
#Que 14 Bigger Number (x,y) x= int(input('Enter first Number :- ')) y= int(input('Enter second Number :- ')) def Big_Number(x,y): if x>y: print ("Bigger Number is :- ",x) if y>x: print ("Bigger Number is :- ",y) Big_Number(x,y)
# coding=utf-8 __author__ = 'mlaptev' if __name__ == "__main__": input_array = sorted([int(i) for i in input().split()]) amount = 0 for i in range(len(input_array) - 1): if input_array[i] == input_array[i+1]: amount += 1 elif amount > 0: print(input_array[i], end=' '...
{ 'targets': [{ 'target_name': 'meow_hash_node', 'cflags': [ '-fno-exceptions', '-O3', '-mavx', '-maes', '-msse4' ], 'cflags_cc!': [ '-fno-exceptions', '-O3', '-mavx', '-maes', '-msse4' ], 'sources': [ 'lib/cpp/meow_hash_native_stream.cpp', 'lib/cpp/main.cpp' ...
#!/usr/bin/env python3 # @Time : 17-9-2 01:53 # @Author : Wavky Huang # @Contact : master@wavky.com # @File : job.py """ Process information of the job. """ class Job: def __init__(self, required_manhour=0, daily_work_hours=0, hourly_pay=0, max_daily_overhours=0): """ Define your job's con...
class ErrorResponse: ''' This class handles if an Exception isreturn in a function. ''' def __init__(self): self.__error_response = self.__default_error_response def __default_error_response(self, req, res, error_messages=None): res.send_json({ "errors": error_messag...
# dataset settings dataset_type = 'ICCV09Dataset' data_root = 'data/custom/iccv09Data' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) crop_size = (512, 512) # reduce crop size to avoid cuda memory issue, have to match with model input (if fine-tune from a pretrained m...
# Enter your code here. Read input from STDIN. Print output to STDOUT r = int(input("Enter no of matrix rows : ")) #c = input("Enter no of matrix column") A = [] max = 0 for i in range(r): a = [] row_list = input("Enter row "+str(i+1)+" columns : ") a=list(map(int,row_list.split())) A.append(a) if l...
numbers = input().split(' ') sorted_numbers = sorted(numbers) reversed_numbers = list(reversed(sorted_numbers)) result = [print(x, end='') for x in reversed_numbers]
ACCOUNT_ID = '75ce4cee-6829-4274-80e1-77e89559ddfb' JOB_CONFIG = { 'image': 'registry.console.elementai.com/eai.issam/ssh', 'data': ['c76999a2-05e7-4dcb-aef3-5da30b6c502c:/mnt/home', '20552761-b5f3-4027-9811-d0f2f5...
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: cursorA, cursorB = headA, headB while cursorA != cursorB: cursorA =...
class DataGridViewDataErrorEventArgs(DataGridViewCellCancelEventArgs): """ Provides data for the System.Windows.Forms.DataGridView.DataError event. DataGridViewDataErrorEventArgs(exception: Exception,columnIndex: int,rowIndex: int,context: DataGridViewDataErrorContexts) """ @staticmethod d...
times = ('Internacional', 'Galo', 'São Paulo', 'Flamengo', 'Palmeiras', 'Santos', 'Vasco', 'Flu', 'Ceará', 'Fortaleza', 'Atlético Goianinse', 'Grêmio', 'CAP', 'Sport', 'Corinthians', 'Bahia', 'Botafogo', 'Goias', 'Coritiba', 'Bragantino') print('=-='*20) print(f'Os cinco primeiros times são:'...
#!/usr/bin/env python3 countryList = ["Unites States", "Russian Federation", "Germany", "Ireland"] capitalLetters = [ country[0] for country in countryList ] for i in range(len(capitalLetters)): lineToPrint = str.join(" stands for ", [capitalLetters[i], countryList[i]]) print(lineToPrint)
n = int(input()) test_list = [] q = 0 for i in range(n): entr = list(map(int, input().split())) if 0 <= entr[0] <= 100 and 0 <= entr[1] <= 100: test_list.append(entr) for tests in test_list: if tests[0] > tests[1]: q += tests[1] # if l > c: # q += l - c print(q)
def main(): determine_powerconsumption('src/december03/diagnostics.txt') def determine_powerconsumption(diagnostics): counter = [0] * 24 position = 0 with open(diagnostics, 'r') as diagnostics: for diagnostic in diagnostics: for position in range(12): if diagnostic[...
# Importação de bibliotecas # Título do programa print('\033[1;34;40mCONTANDO VOGAIS EM TUPLA\033[m') # Objetos varias = ('aprender', 'programar', 'linguagem', 'python', 'curso', 'gratis', 'estudar', 'praticar', 'trabalhar', 'mercador', 'programador', 'futuro') tamvarias = len(varias) vogais = ('a', 'e', '...
class Solution: def trap(self, height: List[int]) -> int: if not height: return 0 ans = 0 l = 0 r = len(height) - 1 maxL = height[l] maxR = height[r] while l < r: if maxL < maxR: ans += maxL - height[l] l += 1 maxL = max(maxL, height[l]) else: ...
class Solution: def fractionToDecimal(self, numerator: int, denominator: int) -> str: # is 0 if not numerator or not denominator: return "0" ans = "" # negative if (numerator < 0) != (denominator < 0): ans += '-' ...
_base_config_ = ["base.py"] generator = dict( use_norm=True, style_cfg=dict( type="SemanticStyleEncoder", encoder_modulator="SPADE", decoder_modulator="SPADE",middle_modulator="SPADE", nhidden=256), use_cse=False ) discriminator=dict(pred_only_cse=True) loss = dict( gan_c...
class Doc: date = None def __init__(self, title, content, data_src): self.title = title self.content = content self.data_src = data_src
# https://www.hackerrank.com/challenges/python-mod-divmod/problem if __name__ == '__main__': number1 = int(input()) number2 = int(input()) division_oldWays = number1 // number2 division_mod_oldWays = number1 % number2 division_modernWays = number1.__divmod__(number2) print(division_oldW...
times = ('Atlético-MG', 'Palmeiras', 'Fortaleza', 'Bragantino', 'Flamengo', 'Corinthians', 'Atlético-GO', 'Ceará', 'Atlético-PR', 'Internacional', 'Santos', 'São Paulo', 'Juventus', 'Cuiaba', 'Bahia', 'Fluminense', 'Gremio', 'Sport', 'America-MG', 'Chapecoense') print('Os 5 primeros times são: ') print(times[0:5]) prin...
data_list = input().split(' -> ') names_dict = {} while not data_list[0] == 'end': name = data_list[0] tokens = data_list[1].split(', ') if tokens[0].isdigit(): if name not in names_dict.keys(): names_dict[name] = [] else: names_dict[name].extend(tokens) else: ...
#!/usr/bin/python def lagFib(): k=1 mod=1000000 d=[None] while True: tmp = None if k <= 55: tmp = (100003 - 200003*k + 300007*k*k*k) % mod else: tmp = (d[32]+d.pop(1)) % mod d.append(tmp) yield tmp k+=1
class CleanData(): def __init__(self): pass def clear_question_marks(self, df): df = df[df['horsepower'] != '?'] df.astype({"horsepower": float}) return df def drop_unused_columns(self, df): return df.drop(['mpg', 'car_name'], axis=1) def drop_car_name(self, ...
# !/usr/bin/env python # -*-coding:utf-8 -*- # Warning :The Hard Way Is Easier """ ================================================================================================ 两个等长整数列表a,b无序,允许交换a,b列表中的数据位置,使得a列表中数值的和与b列表中数据和的差最小 ===================================================================================...
__author__ = 'Sphinx' """ Original newhsganalysis dependency lists import os import io import glob import errno import copy import json import numpy as np from scipy.optimize import curve_fit import scipy.interpolate as spi import scipy.optimize as spo import scipy.fftpack as fft import matplotlib.pyplot as plt impo...
s={} def update_s(s): s.update({"a":1}) print(s) update_s(s) print(s) class A: def __init__(self): self.test() @property def val(self): print("call val") return 1 def test(self): self.val a=A()
# print(type('Hello')) # print(type(2)) # print(type(True)) # print(type('True')) # print(type('False')) # The bool() function converted the strings 'True' and 'False' to the Boolean values True and False. # When the function is supplied with an empty string, # it returns False, while any other non-empty string retur...
'''Crie um programa que tenha uma dupla totalmente preenchida com uma contagem por extenso, de zero até vinte. Seu programa deverá ler um número pelo teclado (entre 0 e 20) e mostrá-lo por extenso.''' num = ('Zero', 'Um', 'Dois', 'Três', 'Quatro', 'Cinco', 'Seis', 'Sete', 'Oito', 'Nove', 'Dez', 'Onze', 'Doze', 'Treze...
# # PySNMP MIB module PDN-CROSSCONNECT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-CROSSCONNECT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:29:22 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...