content
stringlengths
7
1.05M
# this is our descriptor object class Bar(): def __init__(self): self.value = 'casa' def __get__(self): print ("returned from descriptor object") return self.value def __set__(self, value): print ("set in descriptor object") self.value = value def __delete...
""" LeetCode Problem: 10. Regular Expression Matching Link: https://leetcode.com/problems/regular-expression-matching/ Language: Python Written by: Mostofa Adib Shakib """ # Time Complexity: O(m*n) # Space Complexity: O(m*n) # m = length of the pattern string # n = length of the text string class Solution: def is...
class Astronaut: def say_hello(self): name = self.get_name() print(f'My name... {name}') def get_name(self): return 'José Jiménez' jose = Astronaut() jose.get_name() # 'José Jiménez!' jose.say_hello() # My name... José Jiménez!
secret_key = b"" app_id = 0 client_secret = "" bot_token = ""
for _ in range(int(input())): n,m = [int(x) for x in input().split()] a = [int(x) for x in input().split()] b = [int(x) for x in input().split()] distinct_color = {} f, ans = 0, 0 for i in range(n): # if(a[i] >= a[i + 1]): for j in range(i - 1, -1,-1): if(a[j] > a[i]):break else: a[j] = 0 # print(a) f...
_MODEL_DICT = {} def register_model(name): def decorator(cls): _MODEL_DICT[name] = cls return cls return decorator def get_model(cfg): return _MODEL_DICT[cfg.type](cfg)
marks=int(input("Enter your marks out of 100:")) if marks>90: print("Grade A") elif marks>80: print("Grade B") elif marks>60: print("Grade C") elif marks>=0: print("Grade D") else : print("You entered incorrect marks")
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def balanceBST(self, root: TreeNode) -> TreeNode: result = [] def inorder(node): if node: i...
clist = ["orange", "apple apple", "banana anything banana", "mangao"] cstr = " ".join([c for c in clist]) mlist = list(set([m for m in cstr.split()])) print(mlist) clst = [] for m in mlist: if m != "anything": clst.append(cstr.replace("anything", m)) print(clst)
state2constituency_mapper = {2004: {'ANDHRA PRADESH': ['Srikakulam', 'Parvathipuram', 'Bobbili', 'Visakhapatnam', ...
# Task goodFood = [] goodFood.append("burgers") print(goodFood) # Task prerequisites = ["COP 2271c", "Introduction to Computation and Programming", 3, "Dr. Anderson" , 2015] prerequisites.pop(4) print(prerequisites) # Task prerequisites.remove("Dr. Anderson") print(prerequisites) prerequisites.remove(3) print(prerequ...
"""Indeterminate progress bars - simple_spinner - dots_spinner - arrow_spinner - bars_spinner - bars_spinner_v - bars_spinner_h - lt_spinner - triangle_spinner - square_spinner - circle_spinner_v1 - circle_spinner_v2 - circle_spinner_v3 - braille_spinner author - Sayan Goswami email - goswami [dot] sayan47+pygress [a...
__all__ = ['splitter_streams'] # goes into each unit in from units list and unfixes all the stream fractions associate with that unit #for optimization. eventually may want to optimize particular streams if more than 2 coming out of unit. def splitter_streams(m=None, from_units=None): for unit in from_units: ...
class Solution(object): def permute(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ alist = [] result = []; if not nums: return result self.helper(nums, alist, result) return result def helper(self, nums, a...
# config.py def can_build(env, platform): return not env['production'] def configure(env): pass
#Melhore o DESAFIO 61, perguntando para o usuário se ele quer mostrar mais alguns termos. #O programa encerrará quando ele disser que quer mostrar 0 termos. print('GERADOR DE P.A') primeiro = int(input('Digite o primeiro termo da P.A: ')) razão = int(input('Digite a razão dessa P.A: ')) print('\nOs 10 primeiros termos ...
def aumentar(n, taxa=10): a = n + (n * taxa / 100) return a def diminuir(n, taxa=10): a = n - (n * taxa / 100) return a def dobro(n): return float(n * 2) def metade(n): return n / 2
# # PySNMP MIB module BROCADE-PRODUCTS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BROCADE-PRODUCTS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:41:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
def includeme(config): config.add_route('index.dashboard', '/dashboard') config.add_route('index.dashboard.api', '/api/dashboard/') config.add_route('index.versions', '/versions') config.add_route('index.json_body', '/json-body')
_base_ = [ '../../../_base_/models/slowonly_r50.py', '../../../_base_/default_runtime.py' ] ann_type = 'tanz_base' # * change accordingly videos_per_gpu_train = 8 if ann_type == 'tanz_base' else 4 workers_per_gpu_train = 1 # Normally it was 4, but it creates a bottleneck in CPU usage. Check SlowTraining&High...
##Faça um programa que leia o nome completo de uma pessoa e mostre o primeiro e o último nome. nome = str(input('Qual o seu nome completo: ')).strip().split() print('Prazer em te conhecer!') print('O seu primeiro nome é {}.'.format(nome[0])) print('O seu último nome é {}.'.format(nome[len(nome)-1]))
# GENERATED ON 2019-06-18T08:50:41 - DO NOT EDIT MANUALLY content_header = 'Inhalt' expected_document = 'Das Dokument wurde erwartet.' expected_empty = 'Ein Leerfeld wurde erwartet.' expected_field = 'Ein Feld wurde erwartet.' expected_fields = 'Nur Felder wurden erwartet.' expected_fieldset = 'Ein Fieldset wurde erw...
Suffixes={1000:['KB','MB','TB','PB','EB','ZB','YB'], 1024:['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB']} def approximate_size(size,a_kilobyte_is_1024_byte=True): if size < 0: raise ValueError('Number is non-negitive') multiple = 1024 if a_kilobyte_is_1024_byte else 1000 for suffix in Suffixes[m...
class Solution: def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: n = len(intervals) if n == 0: return [newInterval] i = 0 while i < n and newInterval[0] > intervals[i][0]: i += 1 if i == n: # edge case 1: insert ...
#!/usr/bin/env python # -*- coding: utf-8 -*- connectives = [ "but", "because", "although", "though", "despite", "necessarily", "therefore", "thus", "nevertheless", "consequently", "alternatively", "resulting", "unless" # omitted "if"/"then" because they're ubiquitous outside conditionals # omitted...
class SymbTable: def __init__(self, debug=True): self.symbTable = dict() self.symbTable[0] = dict({'global': dict({'scope_type': 'global', 'parent': None, 'scope_vars': dict()})}) ''' Structure of SymbTable: top level key : Level - Basically represent nesting level (...
""" * Copyright 2008 Google Inc. * * 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, s...
# -------------- # Code starts here class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio'] class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes'] new_class = class_1 + class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') prin...
# Global settings def init(): global target_api_url target_api_url = "" global target_instance_url target_instance_url = "" global source_api_url source_api_url = "" global source_instance_url source_instance_url = "" global sourcetoken sourcetoken = "" global targ...
c.ServerProxy.servers = { 'code-server': { 'command': [ 'code-server', '--auth=none', '--disable-telemetry', '--bind-addr=localhost:{port}' ], 'timeout': 20, 'launcher_entry': { 'title': 'VS Code' } } }
#!/usr/bin/env python ##################################### # Installation module for CrackMapExec ##################################### # AUTHOR OF MODULE NAME AUTHOR="David Kennedy (ReL1K), updated by Russ Swift (0xsalt)" # DESCRIPTION OF THE MODULE DESCRIPTION="This module will install/update CrackMapExec - pentes...
''' calculate the similarity of the given question of problem1.4 ''' def calculate(X, Y): similarity = 0 for x, y in enumerate(X, Y): similarity += abs(x - y) return similarity / len(X)
# -*- coding: utf8 -*- __author__ = 'wangqiang' """ 图的遍历:广度优先遍历 """ def bfs(graph, start): result = [] # 通过队列保存待遍历的节点 queue = [start] # set过滤已经遍历过的节点 viewed = set() viewed.add(start) while len(queue) > 0: vertex = queue.pop(0) # 弹出第一个元素 nodes = graph[vertex] for ...
# Lecture 2.6, slide 4 x = int(raw_input('Enter an integer: ')) if (x % 2 == 0): if (x % 3 == 0): print ('Divisible by 2 and 3.') else: print ('Divisible by 2 but not 3.') elif (x % 3 == 0): print ('Divisible by 3 but not 2.')
# -*- coding: utf-8 -*- """Top-level package for elm-fluent.""" __author__ = """Luke Plant""" __email__ = "L.Plant.98@cantab.net" __version__ = "0.6.0"
infty = 10**20 def floyd_warshall(w): N = len(w) R = [weights[:] for weights in w] E = [[None]*N for _ in range(N)] for i in range(N): for j in range(N): if R[i][j] is None: R[i][j] = +infty for j in range(N): for i in set(range(N)) - {j}: f...
AluInstruction = [ 'NOP', 'ADD', 'SUBU', 'CMP', 'SLTU', 'AND', 'OR', 'SLL', 'SRA', 'NEG', 'JR', 'BN', 'BEQZ', 'BNEZ', 'BTEQZ', 'BTNEZ' ] def get_alu_index(alu): for i in range(len(AluInstruction)): if AluInstruction[i] == alu: return ("0000" + bin(i)[2:])[-4:] return "0000"...
#!/usr/bin/env python3 with open("gamelist.txt", "r") as f: for l in f: l = l.replace("\n", "") l = l.split("/", 1)[0] print(l)
""" 405. Submatrix Sum https://www.lintcode.com/problem/submatrix-sum/description 九章强化班C7 naive way: using prefix sum on matrix sum of area(x1, y1 -> x2, y2) = s(x2, y2) - s(x2, y1 - 1) - s(x1 - 1, y2) + s(x1 - 1, y1 - 1) traverse both top left corner and bottom right, assume n * m matrix time complexity O(n * m * n...
class SystemTopics: newCrownstoneFound = "newCrownstoneFound" stateUpdate = "stateUpdate" # used to propagate verified state messages through the system uartNewPackage = 'uartNewPackage' # Sent when a UART packet is received. Data is a UartWrapperPacket. uartNewMe...
a = list(map(int, input().split())) b = list(map(int, input().split())) print(max((sum(a) - min(a)), (sum(b) - min(b))))
class Solution: def find(self, m, n, visited, ans, s, i, j): if i == n-1 and j == n-1: ans.append(s) return visited[i][j] = 1 # Go Down and marking the path as visited if i < n-1 and visited[i+1][j] == 0 and m[i+1][j] == 1: visited[i+1][j] = 1 ...
# Copyright 2018 The Bazel Authors. 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 la...
#!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' ''' Contains various tweaks that affect calibre behavior. Only edit this file if you know what you are doing. If you delete...
class Settings(): """A class to store all settings for the game.""" def __init__(self): super().__init__() # General settings self.application_name = "SpaceInvaderv2" self.font = "arial" # Screen dimensions self.HEIGHT = 600 self.WIDTH = 600 ...
print("---Pallendrome check---") inputStr = input("Enter string ") revserStr = inputStr[::-1] if inputStr == revserStr : print (inputStr, "is a pallendrome!") else : print (inputStr, "is not a pallendrome!")
STREET_ID_DICT: dict = { "Adelsbredde": "241D7097", "Adolf-Kolping-Straße" : "4807D8DB", "Aegidistraße" : "D38A6339", "Agathastraße" : "1291D88D", "Agnes-Miegel-Straße" : "42CE70C8", "Ahornweg" : "EE95B714", "Albrecht-Dürer-Straße" : "E462E40B", "Alleestraße" : "1079C0C6", "Alsenstr...
class Interactions(object): ROBOT_LIBRARY_SCOPE = 'TEST SUITE' def __init__(self): self.mode = None @staticmethod def interact_with_sut(): return "foo"
class Photo: path = "" caption = "" def __init__(self, path, caption=""): self.path = path self.caption = caption def set_caption(self, caption): self.caption = caption def get_caption(self): return self.caption def __repr__(self) -> str: return "Photo...
# The idea is to construct the prefix sum arrays (four of them) containing the numbers of # each nucleotide up to jth position # Then, the difference between the pre- and post-sums for positions p and q are the numbers of # nucleotides in the region. # For these four differences, add the minimum impact factor def sol...
# -*- coding: utf-8 -*- class Solution: def isValid(self, s: str) -> bool: if len(s) % 2 == 1: return False pairs = { ')': '(', ']': '[', '}': '{', } stack = [] for ch in s: if ch in pairs: if not s...
#!/usr/bin/env python3 """ The default options for the faceswap Unbalanced Model plugin. Defaults files should be named <plugin_name>_defaults.py Any items placed into this file will automatically get added to the relevant config .ini files within the faceswap/config folder. The following variable...
_base_ = [ # '../_base_/models/cd_vit.py', # '../_base_/datasets/two_input.py', # '../_base_/default_runtime.py', # '../_base_/schedules/schedule_40k.py' ] # model settings # model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', # pretrained=''...
# Cloud Automation Services SDK for Python # Copyright (c) 2019 VMware, Inc. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 class Network(object): def __init__(self, network): pass @staticmethod def list(session): uri = f'/iaas/api/networks' j = session._request(f'{ses...
# -*- coding: utf-8 -*- """Mixins to be implemented by user.""" class RateMixin: """User defined mixin class for Rate.""" def __init__( self, *, base_ActivityEdge=None, base_ObjectNode=None, base_Parameter=None, rate=None, **kwargs, ): super...
async def handleRequest(request): visitor_ip = request.headers.js_get('CF-Connecting-IP') console.log(visitor_ip) r = await fetch("https://api.ip.sb/geoip/" + visitor_ip) d = await r.json() d['time'] = Date.now() return __new__(Response(JSON.stringify(d), { 'headers' : { 'content-type' :...
# 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, software # d...
__author__ = """OceanProtocol""" __version__ = '0.5.5' # Copyright 2018 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0
def generate_from_bytes_mod_order_test_vector(modulus): def gen_vector(number): byte_arr = convert_int_to_byte_vec(number) # s = str(number % modulus) # return "(" + byte_arr + ", \"" + s + "\")," return byte_arr + "," data = ["vec!["] small_values_to_test = [0, 1, 255, 256...
# Реализуйте функцию square с сигнатурой square(x: number): number # вычисляющую квадрат своего аргумента. def square_of_argument(number: float) -> float: return number * number if __name__ == '__main__': num = 3 result = square_of_argument(num) print(result)
class Stack: def __init__(self): # Stack dynamic array implementation self.stack = [] self.length = 0 def push(self, item): self.stack.append(item) self.length += 1 def pop(self): if self.isEmpty(): return None self.length -= 1 re...
class Movie: #Created a class w/properties of a Movie def __init__(self,movieName,rating,yearReleased): #initializes the properties and creates the template used for Instances self.movieName=movieName self.rating=rating self.yearReleased=yearReleased def __str__(self): #used to print all...
boilerplate_ = '''import PySimpleGUI as sg layout = [[]] window = sg.Window('App', layout) while True: event, values = window.read() if event in (None, 'Exit'): break if event == '': pass # ~TARGET window.close() '''
# EXERCISE 1: # Step 1: Join items from list `["Answer","to","life","the","universe","and","everything","is","42"]` with space. # Step 2: Append it with . at the end of line. print(" ".join(["Answer","to","life","the","universe","and","everything","is","42"])+'.') # EXERCISE 2: #Find how many occurances of "...
class Kid: def __init__(self, name="", age=-1): self.name = name self.age = age class Family: def __init__(self): self.parents = [] self.kids = [] def add_kid(self, kid): self.kids.append(kid)
listagem = ('Lápis', 1.75, 'Borracha', 2.00, 'Caderno', 15.90, 'Estojo', 25, 'Transferidor', 4.20, 'Compasso', 9.99, 'Mochila', 120.32, 'Canetas', 22.30, 'Livro', 34.90) print('-' * 40) print('{:^40}'.format(' LISTAGEM DE PREÇOS ')) print('-' * 40) cont = 0 while True: print('{:.<30}'.format...
# Message class to pydantic class converter def get_type(typ) -> str: if typ == str: return "str" elif typ == int: return "int" elif typ == dict: return "dict" elif typ == any: return "any" else: return typ.__name__ def convert(cls): res = [] res.a...
class Protocol: """ 规定: 数据包头部占4字节 整型占4字节 字符串长度位占2字节 字符串不定长 """ def __init__(self, bs=None): """ 如果bs为None则代表需要创建一个数据包 否则代表需要解析一个数据包 """ if bs: self.bs = bytearray(bs) else: self.bs = bytearray(0)...
#!/usr/bin/env python """Exceptions for the distributed data servers.""" class DataServerError(Exception): """Raised when some error condition happens in a data server.""" pass
'''PART1''' #open file seq_file = open("/Users/modia/Downloads/Homo_sapiens_sequence.fa","r") #make/initialize three lists to capture the sequence of the cDNA, 3'UTR, and 5'UTR cdna = "" utr3 = "" utr5 = "" #read first line and do nothing with it because its just the name seq_file.readline() #initialize string to...
data = [ 1, 2, 3, 4, 5, 6, 7, 8] events = [] for num in data: if not num % 2: events.append(num) print(events) events2 = [num for num in data if not num % 2] print(events2) data = [ 1, 'one', 2, 'two', 3, 'three', 4, 'four'] words = [] for num in data: if isinstance(num, str): words.append(nu...
class Plugin(object): __key__ = None __priority__ = 0 _client = None # TODO should this be changed to support both client and database updater plugins? def initialize(self, client): self._client = client @property def available(self): return True
""" CONTINUAÇÃO... dicionarios3.py """ # Remover dados de uma dicionário receita = {'jan': 100, 'fev': 120, 'mar': 300} print(receita) # Forma 1 - Mais comum ret = receita.pop('mar') print(ret) print(receita) # OBS 1: Aqui precisamos SEMPRE informar a chave, e caso nao encontre o elemeto, um Key...
a,b,c=map(int,input().split()) if a+b+c>=100: print("OK") elif a==min(a,b,c): print("Soongsil") elif b==min(a,b,c): print("Korea") else: print("Hanyang")
def main(): print("Implement {{ cookiecutter.package_name }}'s main function!") if __name__ == "__main__": main()
# -*- coding: utf-8 -*- nStr = input().split() nMap = map(int, nStr) nLst = list(nMap) if nLst[0] + nLst[1] > nLst[2] and nLst[0] + nLst[2] > nLst[1] and nLst[1] + nLst[2] > nLst[0]: if nLst[0] != nLst[1] and nLst[0] != nLst[2] and nLst[1] != nLst[2]: print("Valido-Escaleno") if (nLst[0] == nLst[1]...
def domultiplication(): a=2 b=5 print(a*b)#this is code for multiplication domultiplication()
"""Faça um programa para o cálculo de uma folha de pagamento, sabendo que os descontos são do Imposto de Renda, que depende do salário bruto (conforme tabela abaixo) e 3% para o Sindicato e que o FGTS corresponde a 11% do Salário Bruto, mas não é descontado (é a empresa que deposita). O Salário Líquido corresponde a...
# https://github.com/implus/PytorchInsight/blob/master/classification/models/imagenet/resnet_sge.py class SpatialGroupEnhance(nn.Module): def __init__(self, groups=64): super(SpatialGroupEnhance, self).__init__() self.groups = groups # 组个数 self.avg_pool = nn.AdaptiveAvgPool2d(1) sel...
MUSE_NB_EEG_CHANNELS = 5 MUSE_SAMPLING_EEG_RATE = 256 LSL_EEG_CHUNK = 12 MUSE_NB_PPG_CHANNELS = 3 MUSE_SAMPLING_PPG_RATE = 64 LSL_PPG_CHUNK = 6 MUSE_NB_ACC_CHANNELS = 3 MUSE_SAMPLING_ACC_RATE = 52 LSL_ACC_CHUNK = 1 MUSE_NB_GYRO_CHANNELS = 3 MUSE_SAMPLING_GYRO_RATE = 52 LSL_GYRO_CHUNK = 1 MUSE_GATT_ATTR_STREAM_TOGGL...
class Node: def __init__(self, state): self.state = state self.wins = 0.0 self.visits = 0.0 self.ressq = 0.0 self.parent = None self.children = [] self.sputc = 0.0 self.isTerminal = False def SetWeight(self, weight): self.weight = weig...
#!/usr/bin/env python3 print('Hello World!')
#!/usr/bin/python3 """ Define a Rectangle class that inherits from BaseGeometry """ BaseGeometry = __import__('7-base_geometry').BaseGeometry class Rectangle(BaseGeometry): """ Class that defines a rectangle """ def __init__(self, width, height): """ Initialize the Rectangle ...
n = int(input()) under200 = 0 bt200to399 = 0 bt400to599 = 0 bt600to799 = 0 more800 = 0 for i in range(1, n+1): num = int(input()) if num<200: under200+=1 elif 200<=num<=399: bt200to399+=1 elif 400<=num<=599: bt400to599+=1 elif 600<=num<=799: bt600to799+=1 else: ...
# Init f1 = 0 f2 = 0 f3 = 0 f4 = 0 # Input n1 = int(input("Enter First Number: ")) n2 = int(input("Enter Second Number: ")) n3 = int(input("Enter Third Number: ")) n4 = int(input("Enter Fourth Number: ")) # Process if n1 > n2 and n1 > n3 and n1 > n4: f4 = n1 if n2 > n3 and n2 > n4: f3 = n2 ...
# coding: utf-8 # # Copyright 2014 The Oppia Authors. 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 requi...
# # File: scripts/thread_handler.nut # Author: Astrofra # def GenericThreadWait(s): # _timeout = g_clock # # while ((g_clock - _timeout) < FixedSecToTick(Sec(s))) # suspend() pass def RawClockThreadWait(s): # local _timeout = 0.0 # # while (_timeout < Sec(s)): # _timeout += g_raw_dt_frame # suspend() ...
#class SeaDocument: #"Sea document" #def Info(self): #return "Sea document" # Get the Parameter Group of this module ParGrp = App.ParamGet("System parameter:Modules").GetGroup("Sea")
''' Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the following is not: 1 / \ 2 2 \ \ 3 3 Note: Bonus points if you could solve it both recursively and iterati...
py# phonebook_dict = { # 'Alice' : '703-493-1834', # 'Bob' : '857-384-1234', # 'Elizabeth' : '484-584-2923' # } # print(phonebook_dict['Alice']) # phonebook_dict['Kareem'] = '938-489-1234' # phonebook_dict.pop('Alice') # ramit = { # 'name': 'Ramit', # 'email': 'ramit@gmail.com', # 'interests': ['movie...
print('hello world') class C(object): abc = 42 def __init__(self): self.oar = 100 def f(a, b, c): i = 42 l = [2,3,4] d = {'abc':'fob'} o = C() print('in f') f(2, [3,4,5], {'x':42})
def myplot(nc_file, variable): """ nc_file application/netcdf variable string """ # plot variable of nc_file return plot.png
""" Write a Python program to compute the radius and the central coordinates (x,y) of a circle which is constructed by three given points on the plane surface. """ print("Input the three coordinates of the circle: ") x1, y1, x2, y2, x3, y3, = map(float, input().split()) c = (x1-x2)**2 + (y1-y2)**2 a = (x2-x3)**2 + (y2...
# -*- coding: UTF-8 -*- # Filename : test.py # author by : www.runoob.com num = float(input('请输入一个数字: ')) num_sqrt = num ** 0.5 print(' %0.3f 的平方根为 %0.3f' % (num, num_sqrt))
# coding=utf-8 # HEADER = '\033[95m' # OKBLUE = '\033[94m' def checked(text): print("[\033[94m+\033[0m] {}".format(text)) def not_checked(text): print("[\033[91m×\033[0m] {}".format(text)) def loading(text): print("[\033[93m*\033[0m] {}".format(text)) def underline(text): print("\033[4m{}\033[0...
cache_transformers = True log_transformations = True drop_bad_extractor_results = True progress_bar = True parallelize = False n_jobs = None default_converters = { 'AudioStim->TextStim': ('IBMSpeechAPIConverter', 'WitTranscriptionConverter'), 'ImageStim->TextStim': ('GoogleVisionAPITextConverter', 'TesseractCon...
if __name__ == '__main__': start_list = ... # 0-9 print("start: ", start_list) sorted_list = ... print("sorted: ", sorted_list) squared_list = ... print("squared: ", squared_list) only_bigger_than_5 = ... print("bigger 5: ", only_bigger_than_5) combined_list = [ s...
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Temperature, obj[3]: Time, obj[4]: Coupon, obj[5]: Coupon_validity, obj[6]: Gender, obj[7]: Age, obj[8]: Maritalstatus, obj[9]: Children, obj[10]: Education, obj[11]: Occupation, obj[12]: Income, obj[13]: Bar, obj[14]: Coffeehouse, obj[15]: Restaurantl...
# -*- coding: utf-8 -*- #Inheritence #is-a relationship #manager is-a employee #car is-a vehicle #rectangle is-a shape class Shape: def __init__(self, xcor, ycor): self.x = xcor self.y = ycor def __str__(self): return 'x: ' + str(self.x) + ' y: ' + str(self.y) + ...
class Point(): def __init__(self, x, y): self.x = x self.y = y def __str__(self): return 'P({:.2f}, {:.2f})'.format(self.x, self.y)