content
stringlengths
7
1.05M
#Prints the number in matrix form def print_numbers(number): for i in range(1,number+1): for j in range(1, number+1): print(i,end=" ") print() number=int(input("please enter a number: ")) if number%2==0: print_numbers(number+1) else: print_numbers(number-1)
class Blackjack(): def __init__(self, cards): self.cards = cards def hand(self): """makes a list of your card values Returns: list: e.g. [1, 12] """ deck = { 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 'j': 10, 'q': 10, 'k': 10, 'a': 11 } result = [] for i in self.cards: result.append(deck[i]) return result def hand_value(self): """returns the sum of hand values Returns: int: simple hand value """ hand = self.hand() result = sum(hand) if 'a' in self.cards and result > 21: result -= 10 return result
def bar_spec(data): return { "config": { "view": {"continuousWidth": 400, "continuousHeight": 300}, "mark": {"opacity": 0.75} }, "layer": [ { "mark": {"type": "bar", "color": "red"}, "encoding": { "x": {"type": "nominal", "field": "subject"}, "y": { "type": "quantitative", "field": "percentage of input passed filter" } } }, { "mark": {"type": "bar", "color": "yellow"}, "encoding": { "x": {"type": "nominal", "field": "subject"}, "y": { "type": "quantitative", "field": "percentage of input non-chimeric" } } } ], "data": { "values": data }, "height": 600, "title": "% passed the filter and % non-chimeric for sample ID's", "width": 800, "$schema": "https://vega.github.io/schema/vega-lite/v4.8.1.json" }
#!/usr/bin/env python # # Copyright (C) 2017 ShadowMan # class FatalError(Exception): pass class FrameHeaderParseError(Exception): pass class ConnectClosed(Exception): pass class RequestError(Exception): pass class LoggerWarning(RuntimeWarning): pass class DeamonError(Exception): pass class SendDataPackError(Exception): pass class InvalidResponse(Exception): pass class ParameterError(Exception): pass def raise_parameter_error(name, except_type, got_val): if not isinstance(got_val, except_type): raise ParameterError( '{name} except {except_type}, got {got_type}'.format( name=name, except_type=except_type.__name__, got_type=type(got_val).__name__)) class ExitWrite(Exception): pass class BroadcastError(Exception): pass class HttpVerifierError(Exception): pass class FrameVerifierError(Exception): pass class WSSCertificateFileNotFound(Exception): pass
#!/usr/bin/env python #coding: utf-8 # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: # @return a ListNode def addTwoNumbers(self, l1, l2): h = ch = ListNode(-1) n1, n2, c = l1, l2, 0 while n1 or n2: a = n1.val if n1 else 0 b = n2.val if n2 else 0 s = a + b + c ch.next = ListNode(s % 10) c = s / 10 ch = ch.next if n1: n1 = n1.next if n2: n2 = n2.next if c: ch.next = ListNode(c) return h.next def printL(x): for i in x: print(i.val), print('') if __name__ == '__main__': t0 = [ListNode(i) for i in (2,4,3)] t0[0].next = t0[1] t0[1].next == t0[2] t1 = [ListNode(i) for i in (5,6,4)] t1[0].next = t1[1] t1[1].next == t1[2] t2 = [ListNode(i) for i in (7,0,8)] t2[0].next = t2[1] t2[1].next == t2[2] printL(t0), printL(t1), printL(t2) s = Solution() assert t2[0].val == s.addTwoNumbers(t0[0], t1[0]).val
def is_uppercase(letter: str): return True if 65 <= ord(letter) <= 90 else False def is_lowercase(letter: str): return True if 97 <= ord(letter) <= 122 else False def check_same_case(first: str, second: str) -> bool: if is_uppercase(first) and is_uppercase(second): return True if is_lowercase(first) and is_lowercase(second): return True return False def main(): same_case = check_same_case('?', '?') print(same_case) if __name__ == '__main__': main()
# ========================= VMWriter CLASS class VMEncoder(object): """ VM encoder for the CompilationEngine of the Jack compiler. """ def encodePush(self, segment, index): """ Creates VM push command based on the input. args: segment: (str) segment to operate on index: (int) index of the desired segment ret: string containing VM push command """ if segment == 'const': return 'push constant '+ str(index) +'\n' elif segment == 'arg': return 'push argument '+ str(index) +'\n' elif segment == 'local': return 'push local '+ str(index) +'\n' elif segment == 'static': return 'push static '+ str(index) +'\n' elif segment == 'this': return 'push this '+ str(index) +'\n' elif segment == 'that': return 'push that '+ str(index) +'\n' elif segment == 'pointer': return 'push pointer '+ str(index) +'\n' elif segment == 'temp': return 'push temp '+ str(index) +'\n' else: raise TypeError("Invalid segment type for writePush operation. Segment type: '{}'" .format(segment)) def encodePop(self, segment, index): """ Creates VM pop command based on the input. args: segment: (str) segment to operate on index: (int) index of the desired segment ret: string containing VM push command """ if segment == 'arg': return 'pop argument '+ str(index) +'\n' elif segment == 'local': return 'pop local '+ str(index) +'\n' elif segment == 'static': return 'pop static '+ str(index) +'\n' elif segment == 'this': return 'pop this '+ str(index) +'\n' elif segment == 'that': return 'pop that '+ str(index) +'\n' elif segment == 'pointer': return 'pop pointer '+ str(index) +'\n' elif segment == 'temp': return 'pop temp '+ str(index) +'\n' else: raise TypeError("Invalid segment type for writePop operation. Segment type: '{}'" .format(segment)) def encodeArithmetic(self, command): """ Creates VM arithmetic commands based on the input. args: command: (str) command to be encoded ret: string containing VM arithmetic command """ if command in ['+', 'add']: return 'add'+'\n' elif command in ['-', 'sub']: return 'sub'+'\n' elif command == '*': return 'call Math.multiply 2'+'\n' elif command == '/': return 'call Math.divide 2'+'\n' elif command == '&amp;': return 'and'+'\n' elif command == '|': return 'or'+'\n' elif command == '&lt;': return 'lt'+'\n' elif command == '&gt;': return 'gt'+'\n' elif command == '=': return 'eq'+'\n' elif command == 'not': return 'not'+'\n' elif command == 'neg': return 'neg'+'\n' else: raise TypeError("Invalid command for writeArithmetic operation. Command given: '{}'" .format(command)) def encodeLabel(self, label): """ Creates VM label command based on the input. args: label: (str) label to encode ret: string containing VM label command """ return 'label '+ label +'\n' def encodeGoto(self, label): """ Creates VM goto command based on the input. args: label: (str) label to go to ret: string containing VM goto command """ return 'goto '+ label +'\n' def encodeIfgoto(self, label): """ Creates VM if-goto command based on the input. args: label: (str) label to go to if latest stack entry is true ret: string containing VM if-goto command """ return 'if-goto '+ label +'\n' def encodeCall(self, name, nArgs): """ Creates VM function call command based on the input. args: name: (str) name of the function to be called nArgs: (int) number of arguments the function should expect ret: string containing VM function call command """ return 'call '+ name +' '+ str(nArgs) +'\n' def encodeFunction(self, name, nVars): """ Creates VM function declaration command based on the input. args: name: (str) name of the function to be declared nVars: (int) number of local variables the function has ret: string containing VM function declaration command """ return 'function '+ name +' '+ str(nVars) +'\n' def encodeReturn(self): """ Creates VM return command. """ return 'return'+'\n'
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ listL1, listL2 = "", "" while l1 != None: if l1: listL1 += str(l1.val) l1 = l1.next while l2 != None: if l2: listL2 += str(l2.val) l2 = l2.next sum = (str(int(listL1[::-1]) + int(listL2[::-1])))[::-1] sumNode = None currentNode = None for number in sum: node = ListNode(int(number)) if not sumNode: sumNode = node currentNode = node else: currentNode.next = node currentNode = node return sumNode
msg = str(input('Digite algo: ')) print(f'O tipo primitivo dele é {type(msg)}') print(f'So tem espaços? ', msg.isspace()) print(f'É um número? ', msg.isnumeric()) print(f'É alfabetico? ', msg.isalpha()) print(f'É alfanúmerico? ', msg.isalnum()) print(f'Está em maisculas? ', msg.isupper()) print(f'Está em minuscolas? ', msg.islower()) print(f'Etá capitalizada? ', msg.istitle())
""" z-matrix writers """ def write(syms, key_mat, name_mat, val_dct, mat_delim=' ', setval_sign='='): """ write a z-matrix to a string """ mat_str = matrix_block(syms=syms, key_mat=key_mat, name_mat=name_mat, delim=mat_delim) setval_str = setval_block(val_dct=val_dct, setval_sign=setval_sign) zma_str = '\n\n'.join((mat_str, setval_str)) return zma_str def matrix_block(syms, key_mat, name_mat, delim=' '): """ write the .zmat matrix block to a string """ def _line_string(row_idx): line_str = '{:<2s} '.format(syms[row_idx]) keys = key_mat[row_idx] names = name_mat[row_idx] line_str += delim.join([ '{:>d}{}{:>5s} '.format(keys[col_idx], delim, names[col_idx]) for col_idx in range(min(row_idx, 3))]) return line_str natms = len(syms) mat_str = '\n'.join([_line_string(row_idx) for row_idx in range(natms)]) return mat_str def setval_block(val_dct, setval_sign='='): """ write the .zmat setval block to a string """ setval_str = '\n'.join([ '{:<5s}{}{:>11.6f}'.format(name, setval_sign, val) for name, val in val_dct.items()]) return setval_str
n=int(input("enter a number")) m=int(input("enter a number")) if n%m==0: print(n,"is dividible by",m) else: print(n,"is not divisible by",m) if n%2==0: print(n,"is even") else: print(n,"is odd")
"""Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. """ class Solution(object): def addDigits(self, num): while num >= 10: num = sum([int(str(num)[i]) for i in range(len(str(num)))]) return num
file_extractors = {} def file_extractor(extension): """ This decorator registers functions to be used as extractors. Only functions decorated with this are considered metadata extractors, and will be called when the file extension matches the configured one. :param extension: the extension to match """ def deco(f): assert extension not in file_extractors, f"extension {extension} already registered" file_extractors[extension] = f return f return deco
MAX = 'x' MIN = 'o' def get_player(s): return MAX if len([1 for i in s if i == ' ']) % 2 == 1 else MIN def next_player(p): return MAX if p == MIN else MIN def get_actions(s): return [i for i in range(9) if s[i] == ' '] def result(s, a): player = get_player(s) s2 = list(s) s2[a] = player return s2 def is_winning_state(s, player): aux = [player] * 3 if s[0:3] == aux or \ s[3:6] == aux or \ s[6:9] == aux or \ s[0:9:3] == aux or \ s[1:9:3] == aux or \ s[2:9:3] == aux or \ s[2:8:2] == aux or \ s[0:9:4] == aux: return True else: return False def terminal(s): if is_winning_state(s, MAX) or is_winning_state(s, MIN): return True if ' ' not in s: return True return False def utility(s): if is_winning_state(s, MAX): return 1 if is_winning_state(s, MIN): return -1 return 0 def maxval(s): if terminal(s): return None, utility(s) best_utility = float("-Inf") best_action = None actions = get_actions(s) for action in actions: s2 = result(s, action) _, current_utility = minval(s2) if current_utility >= best_utility: best_utility = current_utility best_action = action if best_utility == 1: # Maximum utility break return best_action, best_utility def minval(s): if terminal(s): return None, utility(s) best_utility = float("Inf") best_action = None actions = get_actions(s) for action in actions: s2 = result(s, action) _, current_utility = maxval(s2) if current_utility <= best_utility: best_utility = current_utility best_action = action if best_utility == -1: # Minimum utility break return best_action, best_utility def minmax(s): p = get_player(s) if p == MAX: return maxval(s) if p == MIN: return minval(s) def print_s(s): print(" {} | {} | {} \n" " 0 | 1 | 2 \n" "-----------\n" " {} | {} | {} \n" " 3 | 4 | 5 \n" "-----------\n" " {} | {} | {} \n" " 6 | 7 | 8 \n".format(*s)) def ai_play(s): a, _ = minmax(s) return a def user_play(s): a = int(input()) return a if __name__ == "__main__": s = [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '] print_s(s) players = [ ("USER", user_play), ("AI", ai_play) ] while not terminal(s): for name, method in players: print("{} -> ".format(name)) a = method(s) s = result(s, a) print_s(s) if terminal(s): break if is_winning_state(s, MAX): print("PLAYER '{}' WON!".format(MAX)) elif is_winning_state(s, MIN): print("PLAYER '{}' WON!".format(MIN)) else: print("TIE!")
# What are the factors of 18? # factor: an integer which when multiplied with another integer, results in the product 18. # Hence when 18 is divided by this number, the dividend is an integer and there are no remainders. num = 18 for i in range(1, num+1): if num % i == 0: print(i, end=' ')
def main(): for _ in range(int(input())): n = int(input()) arr = list(map(int, input().strip().split())) if n == 1: print(arr[0]) else: n += 1 arr.append(1001) left, right = 0, 1 res = '' while left <= right and right < n and left < n: #print(left,right) if arr[right]-arr[left] == right-left: right += 1 else: if right-left >= 3: res += str(arr[left])+'...'+str(arr[right-1])+',' else: for i in range(left, right): res += str(arr[i])+',' left = right print(res.strip(',')) main()
######################################################################################### # IMPORTANT: This file should be copied to setting.py and then completed before use # ######################################################################################### # Rocky Version VERSION = '0.3.5' # Path to json file containing hostnames, ip addresses and credentials for monitoring HOSTS = 'file.json' # Path to where ports files will be saved PORTS_PATH = 'path/ports/' # DNS Name Servers - List of stringed DNS IPs ROUTER_NAME_SERVERS = ['8.8.8.8', '1.1.1.1'] # Public Keys # These keys allow Rocky and Robot to log in to the SRX Router(s) to update the network configuration # Rocky RSA ROCKY_RSA = '' # Robot RSA ROBOT_RSA = '' # Administrator encrypted password (sha256) ADMINISTRATOR_ENCRYP_PASS = '' # api-server user with limited access API_USER_PASS = '' # Radius server RADIUS_SERVER_ADDRESS = '' # hashed password RADIUS_SERVER_SECRET = '' # Network Device Repository Path DEVICE_CONFIG_PATH = 'path/repo/' # Managed Cloud Infrastructure # One instance of Rocky can manage multiple clouds and each cloud will consist of one or more regions. # This configuration describes the cloud infrastructure managed by this instance of Rocky. # Monitoring and Provisioning servers needs access to the cloud infrastructure. # Inbound Access list # The management network of this SRXPod is firewalled to block all inbound traffic. # Access is allowed to the management network from this list of external Public IPs. MAP_ACCESS_LIST = [ { 'source_address': '', # 'any' for all ips 'destination_address': '', # 'any' for all ips 'port': '', # valid values 1 , 0-655 'protocol': '', # 'tcp'/'udp'/'any' 'description': '', }, ] clouds = [ # First Cloud ... { 'name': 'First Cloud', 'id': '', # python-cloudcix api settings 'CLOUDCIX_API_URL': '', 'CLOUDCIX_API_USERNAME': '', 'CLOUDCIX_API_PASSWORD': '', 'CLOUDCIX_API_KEY': '', 'CLOUDCIX_API_VERSION': 2, 'CLOUDCIX_API_V2_URL': '', # COP inbound access list # The management network of this SRXPod is firewalled to block all inbound traffic. # Access is allowed to the management network from this list of external Public IPs. 'COP_ACCESS_LIST': [ { 'source_address': '', 'destination_address': '', 'port': '', 'protocol': '', 'description': '', }, ], # Pod settings 'pods': [ { 'name': 'name of the cop', 'id': '', 'type': 'cop', # Network schema 'IPv4_link_subnet': [ # this is optional, you can leave them as it is. { 'address_range': '', 'gateway': '', }, ], 'IPv4_pod_subnets': [ { 'address_range': '', 'gateway': '', }, { 'address_range': '', 'gateway': '', }, ], 'IPv6_link_subnet': [ { 'address_range': '', 'gateway': '', }, ], 'IPv6_pod_subnets': [ { 'address_range': '', }, ], 'IPv4_RFC1918_subnets': [ { 'address_range': '', 'gateway': '', }, ], # VPN Tunnel from Support Center to the SRXPOD for management. 'vpns': [], }, # first region { 'name': 'region name', 'id': '', 'type': 'region', # Network schema 'IPv4_link_subnet': [ # this is optional, you can leave them as it is. { 'address_range': '', 'gateway': '', }, ], 'IPv4_pod_subnets': [ { 'address_range': '', 'gateway': '', }, { 'address_range': '', 'gateway': '', }, ], 'IPv6_link_subnet': [ { 'address_range': '', 'gateway': '', }, ], 'IPv6_pod_subnets': [ { 'address_range': '', }, ], 'IPv4_RFC1918_subnets': [ { 'address_range': '', 'gateway': '', }, ], # VPN Tunnel from Support Center to the SRXPOD for management. 'vpns': [], }, # Second region { 'name': 'Second Region', }, ], }, # second cloud {}, ]
########################################################### # # # Solving factorial problem with recursive function # # # ########################################################### def factorial(n): if n == 2: return 2 return n * factorial(n - 1) print(factorial(int(input())))
"""Enter n, use the recursion method (for example, derive the latter term from the relationship between the preceding items, it is a one-loop question) and caculate the sum of 1+2!+3!+...+n! and output the result.""" n = int(input('Give me a integer: ')) s = term = 1 for i in range(2, n+1): term *= i s += term print(s)
cont = soma = media = maior = menor = 0 res = 'S' while res == 'S': num = int(input('Digite um número: ')) res = str(input('Quer continuar? [S/N] ').strip().upper()) soma += num cont += 1 if cont == 1: maior = menor = num else: if maior < num: maior = num if menor > num: menor = num media = soma / cont print('Você digitou {} números e a média foi de {:.2f}'.format(cont, media)) print('O maior valor foi de {} e o menor foi {}'.format(maior, menor))
""" 23 - Faça um programa que leia um número de 0 a 9999 e mostre na tela cada um dos dígitos separados. Ex: Digite um número: 1834 unidade: 4 dezena: 3 centena: 8 milhar: 1 """ num = int(input('Informe um número: ')) print('=*='*10) print(f'\033[33mAnalisando o número {num}\033[m') print('=*='*10) print(f'Unidade: \033[31m{num % 10}\033[m\n' f'Dezena:\t \033[31m{num // 10 % 10}\033[m\n' f'Centena: \033[31m{num // 100 % 10}\033[m\n' f'Milhar:\t \033[31m{num // 1000}\033[m')
# -*- coding: utf-8 -*- """ 1417. Reformat The String Given alphanumeric string s. (Alphanumeric string is a string consisting of lowercase English letters and digits). You have to find a permutation of the string where no letter is followed by another letter and no digit is followed by another digit. That is, no two adjacent characters have the same type. Return the reformatted string or return an empty string if it is impossible to reformat the string. Constraints: 1 <= s.length <= 500 s consists of only lowercase English letters and/or digits. """ class Solution: def reformat(self, s: str) -> str: num_set = set(str(i) for i in range(10)) digit_cache = "" letter_chace = "" for char in s: if char in num_set: digit_cache += char else: letter_chace += char res = "" digit_length = len(digit_cache) letter_length = len(letter_chace) if digit_length == letter_length: for ind in range(letter_length): res += digit_cache[ind] res += letter_chace[ind] elif digit_length == letter_length + 1: for ind in range(letter_length): res += digit_cache[ind] res += letter_chace[ind] res += digit_cache[-1] elif digit_length + 1 == letter_length: for ind in range(digit_length): res += letter_chace[ind] res += digit_cache[ind] res += letter_chace[-1] return res
# coding=utf-8 ''' Created on 2017年11月25日 @author: jianpinh ''' eng_10jqka_CookieList = [ 'AcL0X6qrL2k4wjM1rx64KE2PFcMhk8ameJe60Qzb7jXgX2x39CMWvUgnCuXc', 'AQI0H2rr7yl4gvABCen4aA1PVQNh0wayuNf6B0wbLnUgn6y3NGNW_YhnSiUc', 'AR0rznlCGEhb2_-QOepvqU4GKvISOlGMW261YN_iWXSjljNmp4phXOu-xTlv', 'AePVMIOgvj4xWXH-c8aJf_TEdCyI2HeWsWy7ZBVAP8K5VA3YnagHasE8S5El', 'AeHXOpWWHER_d7PExdHrFeoa9qb-jlUMfwL5vkO23ehHqg_Si95lUA9SCXTT', 'AQ85tPfMivJ9fY36Z5g9IyhgmKgcNGPp_YhnYCEcq36F8CFcKQTzpg1Y94gx', 'AQ07vgkyaBirC8_AyZcf2d62GiKC6kEDyx6luk-SSaQTRiNWFzpRjFtutXPf', 'ASwanfB9WQsSvE7DQIhOynfB-wFb5dAw0onkeYZtOFd6kcI1rvWgHyKZtPfW', 'AQw6PRCduavyHK4jYEluKleh22E7RbAQsunEmWbNGLda8aJVjlWAfwL5lFa2', 'ASsdGPvY9oY5QSkm-yxRF-wsvEQQQD89uVQDXJ2oB2rBPEUwJRDPEskkk9Ct', 'AUh-wfRJhZ-ugOrvxBzivjuNH71f8awEjlWAVQL5lEO23ebpqgF8i95lUBdS', 'AYm_Aq0uNMzHv8vM7J_TrUJinr7m1nxo58qhtiv-BXCvcqcqcyaN2HcasXC7', 'Aaie4ZRpZb8O4ErPZfgCnpvtf52_0Q277jXgdWLZ9CMWvUaJCuH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su8_s2bNGLda8az7jlsufwL5lEO23BpH', 'AXJET3rbf3lIskCwaepoGB1_xbNRA3bWqAdqwTxLniUQzxxnJJPGrXiXuk8M', 'AfHHSgUmDHTvx6OVRuL75RrqBnaO3mOrD1IJZNMG7bjX-h_iGy51IJ-iGMdj', 'AWVTtvH6UJBDw7e50qE3QUZuciqaohqbY1f9iGdKIYarb4teL_IpBPOmDQz3', 'ASEX-lXW3AS_N3MF9sUrVaraNuY-zpM7v0I51IP2HSiH6k8Syx6lkE-SSFAT', 'AbSCBSjVURNaZMYq-2pWoi_pg3kjjd6MGrFsu04VQD_CuVqtdp2oB2rBPb6e', 'AbOFgDOw7q5haaGPUO9ZD6TURLzY6EfhAXyL3mVQD1IJZN2o7bjX-hFMG7F1', 'AXBGSYwB3Ye2SIJ2H8NKthNVRzXHuVL4dp2oB2rBPEueJR5hEskkk8ateWG6', 'ARQiJcj1MTO6RKYKW2j2go_J41mDbT6sepHMm671oB8imbpN1n0I58qhndz-', 'AfTCxegVEdOaJIZqO8iW4u-pw7ljzRj8WvGs-45VgH8C-Zrttt3oR6oBfCve', 'AdDmaSwhvacWqGJWfwHqlvO1pxUnmbIY1n0I58qhnCv-BX4BcqmEcyaN2Y8a', 'Acj-QXTJBR8uAGpuN_5iPrsNnz3fcS_UDtQA_4J5FFk2TGZpKoH8C17l0NrS', 'AQA2GXzRTTemmDLGLx7aBgOl14XXieKohm04V3qRzJuu9a6xIpm049Z9CR7K', 'AZOlIFPQzk5ByYHvMEt5b4S0JBy4SCHx4dxrPkWw77LpxL3IzRi3WvGs-nRV', 'ATUDBqHKgACz0-dJIqHH0TZ-QrrqsumPs2bNGLda8az7jlsufwL5lEO23UlH', 'AS4Yk943--2kpgz8jchsLEHreY_1L_TSBPOmDVj3mjHsO8A7wL9COdSD9-Yo', 'AfPFQPPwrm6hKWHPkAmZT2SUhPwYKIERQbzLHqWQT5JJpB3oLfgXOlGMWpK1', ]
# # University of Luxembourg # Laboratory of Algorithmics, Cryptology and Security (LACS) # # FigureOfMerit (FOM) # # Copyright (C) 2015 University of Luxembourg # # Written in 2015 by Daniel Dinu <dumitru-daniel.dinu@uni.lu> # # This file is part of FigureOfMerit. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>. # __author__ = 'daniel.dinu'
__all__ = ( 'ESputnikException', 'InvalidAuthDataError', 'IncorrectDataError' ) class ESputnikException(AttributeError): pass class InvalidAuthDataError(ESputnikException): def __init__(self, code, message): self.code = code self.message = message class IncorrectDataError(InvalidAuthDataError): pass
class TextFieldFsm: def __init__(self, title, position, need_hide=False, initial_text=""): self.title = title self.position = position self.need_hide = need_hide self.initial_text = initial_text
BINDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/bin' DATADIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share' DATAROOTDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share' DESTDIR = '/' DOCDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share/doc/bento' DVIDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share/doc/bento' EPREFIX = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6' HTMLDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share/doc/bento' INCLUDEDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/include' INFODIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share/info' LIBDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/lib' LIBEXECDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/libexec' LOCALEDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share/locale' LOCALSTATEDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/var' MANDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share/man' PDFDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share/doc/bento' PKGDATADIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share/bento' PKGNAME = 'bento' PREFIX = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6' PSDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/share/doc/bento' PY_VERSION_SHORT = '3.6' SBINDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/sbin' SHAREDSTATEDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/com' SITEDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages' SYSCONFDIR = '/usr/local/Cellar/python3/3.6.2_1/Frameworks/Python.framework/Versions/3.6/etc'
""" Avoiding Syntax Errors with Strings Here’s how to use single and double quotes correctly. """ message = "One of Python's strengths is its diverse community." print(message) """ split line for each point """ print("------------------------------split line------------------------------") ''' However, if you use single quotes, Python can’t identify where the string should end ''' # message = 'One of Python's strengths is its diverse community.' # print(message)
wanted_profit = float(input()) is_wanted_profit_gained = False total_amount = 0 cocktail = input() while cocktail != 'Party!': number_of_cocktails = int(input()) cocktail_price = len(cocktail) order_price = cocktail_price * number_of_cocktails if order_price % 2 != 0: order_price = order_price - order_price * 0.25 total_amount += order_price if total_amount >= wanted_profit: is_wanted_profit_gained = True break cocktail = input() difference = abs(wanted_profit - total_amount) if is_wanted_profit_gained: print ('Target acquired.') print (f'Club income - {total_amount:.2f} leva.') else: print (f'We need {difference:.2f} leva more.') print (f'Club income - {total_amount:.2f} leva.')
''' Crie um programa que leia duas notas de um aluno e calcule sua média, mostrando uma mensagem no final, de acordo com a média atingida: - Média abaixo de 5.0: REPROVADO - Média entre 5.0 e 6.9: RECUPERAÇÃO - Média 7.0 ou superior: APROVADO ''' titulo = str( 'MÉDIA FINAL' ) centralizar = str( ' ' * int( ((60 - len(titulo)) / 2) ) ) print( '=-' * 31 ) print( centralizar, titulo, centralizar ) print( '=-' * 31 ) nota1 = float( input( 'Primeira nota: ' ) ) nota2 = float( input( 'Segunda nota: ' ) ) media = (nota1 + nota2) / 2 print( 'Sua média foi {:.1f}, portanto você está '.format( media ), end='' ) if media < 5.0 : print( 'REPROVADO!' ) elif media >=7.0 : print( 'APROVADO!' ) else: print( 'de RECUPERAÇÃO!' ) print( '==' * 31 )
# Define a class to receive the characteristics of each line detection class Line(): def __init__(self): # was the line detected in the last iteration? self.detected = False # x values of the last n fits of the line self.recent_xfitted = [] #average x values of the fitted line over the last n iterations self.bestx = None #polynomial coefficients averaged over the last n iterations self.best_fit = None #polynomial coefficients for the most recent fit self.current_fit = [np.array([False])] #radius of curvature of the line in some units self.radius_of_curvature = None #distance in meters of vehicle center from the line self.line_base_pos = None #difference in fit coefficients between last and new fits self.diffs = np.array([0,0,0], dtype='float') #x values for detected line pixels self.allx = None #y values for detected line pixels self.ally = None def pipeline(img, s_thresh=(170, 255), sx_thresh=(30, 100)): img = np.copy(img) # Convert to HLS color space and separate the V channel hls = cv2.cvtColor(img, cv2.COLOR_BGR2HLS) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) lab = cv2.cvtColor(img, cv2.COLOR_BGR2LAB) L_channel = lab[:,:,0] l_channel = hls[:,:,1] s_channel = hls[:,:,2] # Sobel x sobelx = cv2.Sobel(l_channel, cv2.CV_64F, 1, 0) # Take the derivative in x abs_sobelx = np.absolute(sobelx) # Absolute x derivative to accentuate lines away from horizontal scaled_sobel = np.uint8(255*abs_sobelx/np.max(abs_sobelx)) #Threshold LAB labbinary = np.zeros_like(L_channel) labbinary[(L_channel >= 100) & (L_channel <= 255)] = 1 # Threshold x gradient sxbinary = np.zeros_like(scaled_sobel) sxbinary[(scaled_sobel >= sx_thresh[0]) & (scaled_sobel <= sx_thresh[1])] = 1 # Threshold color channel s_binary = np.zeros_like(s_channel) s_binary[(s_channel >= s_thresh[0]) & (s_channel <= s_thresh[1])] = 1 img_bwa = cv2.bitwise_and(labbinary,s_binary) t_binary = np.zeros(img.shape[:2], dtype=np.uint8) t_binary[(L_channel >= 100) & (s_binary <= s_thresh[1])] = 1 # Stack each channel color_binary = np.dstack(( np.zeros_like(sxbinary), np.zeros_like(sxbinary), img_bwa + sxbinary)) * 255 return color_binary def find_lane_pixels(binary_warped): # Take a histogram of the bottom half of the image histogram = np.sum(binary_warped[binary_warped.shape[0]//2:,:], axis=0) # Create an output image to draw on and visualize the result out_img = np.dstack((binary_warped, binary_warped, binary_warped)) # Find the peak of the left and right halves of the histogram # These will be the starting point for the left and right lines midpoint = np.int(histogram.shape[0]//2) leftx_base = np.argmax(histogram[:midpoint]) rightx_base = np.argmax(histogram[midpoint:]) + midpoint # HYPERPARAMETERS # Choose the number of sliding windows nwindows = 15 # Set the width of the windows +/- margin margin = 100 # Set minimum number of pixels found to recenter window minpix = 50 # Set height of windows - based on nwindows above and image shape window_height = np.int(binary_warped.shape[0]//nwindows) # Identify the x and y positions of all nonzero (i.e. activated) pixels in the image nonzero = binary_warped.nonzero() nonzeroy = np.array(nonzero[0]) nonzerox = np.array(nonzero[1]) # Current positions to be updated later for each window in nwindows leftx_current = leftx_base rightx_current = rightx_base # Create empty lists to receive left and right lane pixel indices left_lane_inds = [] right_lane_inds = [] for window in range(nwindows): # Identify window boundaries in x and y (and right and left) win_y_low = binary_warped.shape[0] - (window+1)*window_height win_y_high = binary_warped.shape[0] - window*window_height ### TO-DO: Find the four below boundaries of the window ### win_xleft_low = leftx_current - margin win_xleft_high = leftx_current + margin win_xright_low = rightx_current - margin win_xright_high = rightx_current + margin # Draw the windows on the visualization image cv2.rectangle(out_img,(win_xleft_low,win_y_low), (win_xleft_high,win_y_high),(0,255,0), 2) cv2.rectangle(out_img,(win_xright_low,win_y_low), (win_xright_high,win_y_high),(0,255,0), 2) ### TO-DO: Identify the nonzero pixels in x and y within the window ### good_left_inds = ((nonzeroy >= win_y_low) & (nonzeroy < win_y_high) & (nonzerox >= win_xleft_low) & (nonzerox < win_xleft_high)).nonzero()[0] good_right_inds = ((nonzeroy >= win_y_low) & (nonzeroy < win_y_high) & (nonzerox >= win_xright_low) & (nonzerox < win_xright_high)).nonzero()[0] # Append these indices to the lists left_lane_inds.append(good_left_inds) right_lane_inds.append(good_right_inds) ### TO-DO: If you found > minpix pixels, recenter next window ### if len(good_left_inds) > minpix: leftx_current = np.int(np.mean(nonzerox[good_left_inds])) if len(good_right_inds) > minpix: rightx_current = np.int(np.mean(nonzerox[good_right_inds])) # Concatenate the arrays of indices (previously was a list of lists of pixels) try: left_lane_inds = np.concatenate(left_lane_inds) right_lane_inds = np.concatenate(right_lane_inds) except ValueError: # Avoids an error if the above is not implemented fully pass # Extract left and right line pixel positions leftx = nonzerox[left_lane_inds] lefty = nonzeroy[left_lane_inds] rightx = nonzerox[right_lane_inds] righty = nonzeroy[right_lane_inds] return leftx, lefty, rightx, righty, out_img def fit_polynomial(binary_warped): # Find our lane pixels first leftx, lefty, rightx, righty, out_img = find_lane_pixels(binary_warped) ### TO-DO: Fit a second order polynomial to each using `np.polyfit` ### left_fit = np.polyfit(lefty, leftx, 2) right_fit = np.polyfit(righty, rightx, 2) # Generate x and y values for plotting ploty = np.linspace(0, binary_warped.shape[0]-1, binary_warped.shape[0] ) try: left_fitx = left_fit[0]*ploty**2 + left_fit[1]*ploty + left_fit[2] right_fitx = right_fit[0]*ploty**2 + right_fit[1]*ploty + right_fit[2] except TypeError: # Avoids an error if `left` and `right_fit` are still none or incorrect print('The function failed to fit a line!') left_fitx = 1*ploty**2 + 1*ploty right_fitx = 1*ploty**2 + 1*ploty ## Visualization ## # Colors in the left and right lane regions out_img[lefty, leftx] = [255, 0, 0] out_img[righty, rightx] = [0, 0, 255] # Plots the left and right polynomials on the lane lines #plt.plot(left_fitx, ploty, color='yellow') #plt.plot(right_fitx, ploty, color='yellow') return out_img, left_fit, right_fit def fit_poly(img_shape, leftx, lefty, rightx, righty): ### TO-DO: Fit a second order polynomial to each with np.polyfit() ### left_fit = np.polyfit(lefty, leftx, 2) right_fit = np.polyfit(righty, rightx, 2) # Generate x and y values for plotting ploty = np.linspace(0, img_shape[0]-1, img_shape[0]) ### TO-DO: Calc both polynomials using ploty, left_fit and right_fit ### left_fitx = left_fit[0]*ploty**2 + left_fit[1]*ploty + left_fit[2] right_fitx = right_fit[0]*ploty**2 + right_fit[1]*ploty + right_fit[2] return left_fitx, right_fitx, ploty def compute_lane_curvature(leftx, rightx, ploty): """ Returns the triple (left_curvature, right_curvature, lane_center_offset), which are all in meters """ # Define conversions in x and y from pixels space to meters y_eval = np.max(ploty) # Fit new polynomials: find x for y in real-world space left_fit_cr = np.polyfit(ploty * ym_per_px, leftx * xm_per_px, 2) right_fit_cr = np.polyfit(ploty * ym_per_px, rightx * xm_per_px, 2) # Now calculate the radii of the curvature left_curverad = ((1 + (2 * left_fit_cr[0] * y_eval * ym_per_px + left_fit_cr[1])**2)**1.5) / np.absolute(2 * left_fit_cr[0]) right_curverad = ((1 + (2 *right_fit_cr[0] * y_eval * ym_per_px + right_fit_cr[1])**2)**1.5) / np.absolute(2 * right_fit_cr[0]) # Now our radius of curvature is in meters return left_curverad, right_curverad def search_around_poly(binary_warped, Minv, left_fit, right_fit, undist): # HYPERPARAMETER # Choose the width of the margin around the previous polynomial to search # The quiz grader expects 100 here, but feel free to tune on your own! margin = 100 # Grab activated pixels nonzero = binary_warped.nonzero() nonzeroy = np.array(nonzero[0]) nonzerox = np.array(nonzero[1]) ### TO-DO: Set the area of search based on activated x-values ### ### within the +/- margin of our polynomial function ### ### Hint: consider the window areas for the similarly named variables ### ### in the previous quiz, but change the windows to our new search area ### left_lane_inds = ((nonzerox > (left_fit[0]*(nonzeroy**2) + left_fit[1]*nonzeroy + left_fit[2] - margin)) & (nonzerox < (left_fit[0]*(nonzeroy**2) + left_fit[1]*nonzeroy + left_fit[2] + margin))) right_lane_inds = ((nonzerox > (right_fit[0]*(nonzeroy**2) + right_fit[1]*nonzeroy + right_fit[2] - margin)) & (nonzerox < (right_fit[0]*(nonzeroy**2) + right_fit[1]*nonzeroy + right_fit[2] + margin))) # Again, extract left and right line pixel positions leftx = nonzerox[left_lane_inds] lefty = nonzeroy[left_lane_inds] rightx = nonzerox[right_lane_inds] righty = nonzeroy[right_lane_inds] # Fit new polynomials left_fitx, right_fitx, ploty = fit_poly(binary_warped.shape, leftx, lefty, rightx, righty) ## Visualization ## # Create an image to draw on and an image to show the selection window out_img = np.dstack((binary_warped, binary_warped, binary_warped))*255 window_img = np.zeros_like(out_img) # Color in left and right line pixels out_img[nonzeroy[left_lane_inds], nonzerox[left_lane_inds]] = [255, 0, 0] out_img[nonzeroy[right_lane_inds], nonzerox[right_lane_inds]] = [0, 0, 255] # Generate a polygon to illustrate the search window area # And recast the x and y points into usable format for cv2.fillPoly() left_line_window1 = np.array([np.transpose(np.vstack([left_fitx-margin, ploty]))]) left_line_window2 = np.array([np.flipud(np.transpose(np.vstack([left_fitx+margin, ploty])))]) left_line_pts = np.hstack((left_line_window1, left_line_window2)) right_line_window1 = np.array([np.transpose(np.vstack([right_fitx-margin, ploty]))]) right_line_window2 = np.array([np.flipud(np.transpose(np.vstack([right_fitx+margin, ploty])))]) right_line_pts = np.hstack((right_line_window1, right_line_window2)) # Draw the lane onto the warped blank image #cv2.fillPoly(window_img, np.int_([left_line_pts]), (0,255, 0)) #cv2.fillPoly(window_img, np.int_([right_line_pts]), (0,255, 0)) #result = cv2.addWeighted(out_img, 1, window_img, 0.3, 0) # Plot the polynomial lines onto the image #plt.plot(left_fitx, ploty, color='yellow') #plt.plot(right_fitx, ploty, color='yellow') ## End visualization steps ## left_curverad, right_curverad = compute_lane_curvature(left_fitx, right_fitx, ploty) print(left_curverad, right_curverad) # Create an image to draw the lines on warp_zero = np.zeros_like(binary_warped).astype(np.uint8) color_warp = np.dstack((warp_zero, warp_zero, warp_zero)) # Recast the x and y points into usable format for cv2.fillPoly() pts_left = np.array([np.transpose(np.vstack([left_fitx, ploty]))]) pts_right = np.array([np.flipud(np.transpose(np.vstack([right_fitx, ploty])))]) pts = np.hstack((pts_left, pts_right)) # Draw the lane onto the warped blank image cv2.fillPoly(color_warp, np.int_([pts]), (0,255, 0)) # Warp the blank back to original image space using inverse perspective matrix (Minv) newwarp = cv2.warpPerspective(color_warp, Minv, (undist.shape[1], undist.shape[0])) # Combine the result with the original image result = cv2.addWeighted(undist, 1, newwarp, 0.3, 0) return result
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "core_library", "core_nunit3_test", "core_resource") COMMON_DEFINES = [ "NETSTANDARD2_0", "NETCOREAPP2_0", "SERIALIZATION", "ASYNC", #"PLATFORM_DETECTION", "PARALLEL", "TASK_PARALLEL_LIBRARY_API", ] core_library( name = "nunit.framework.dll", srcs = glob([ "src/NUnitFramework/framework/**/*.cs", ]) + [ "src/NUnitFramework/FrameworkVersion.cs", "src/CommonAssemblyInfo.cs", ], data = glob(["src/NUnitFramework/framework/Schemas/*.xsd"]), defines = COMMON_DEFINES, keyfile = "src/nunit.snk", visibility = ["//visibility:public"], deps = [ "@core_sdk_stdlib//:libraryset", ], ) core_library( name = "nunitlite.dll", srcs = glob(["src/NUnitFramework/nunitlite/**/*.cs"]) + ["src/CommonAssemblyInfo.cs"], data = glob(["src/NUnitFramework/framework/Schemas/*.xsd"]) + glob(["src/NUnitFramework/nunitlite/Schemas/*.xsd"]), defines = COMMON_DEFINES, keyfile = "src/nunit.snk", visibility = ["//visibility:public"], deps = [ ":nunit.framework.dll", ], ) core_library( name = "mock-assembly.dll", srcs = glob(["src/NUnitFramework/mock-assembly/**/*.cs"]) + ["src/CommonAssemblyInfo.cs"], defines = COMMON_DEFINES, keyfile = "src/nunit.snk", visibility = ["//visibility:public"], deps = [ ":nunitlite.dll", ], ) core_library( name = "nunit.testdata.dll", srcs = glob(["src/NUnitFramework/testdata/**/*.cs"]) + ["src/CommonAssemblyInfo.cs"], defines = COMMON_DEFINES, keyfile = "src/nunit.snk", visibility = ["//visibility:public"], deps = [ ":nunit.framework.dll", ], ) core_library( name = "slow-nunit-tests.dll", srcs = glob(["src/NUnitFramework/slow-tests/**/*.cs"]) + ["src/CommonAssemblyInfo.cs"], defines = COMMON_DEFINES, keyfile = "src/nunit.snk", visibility = ["//visibility:public"], deps = [ ":nunit.framework.dll", ], ) filegroup( name = "schemas", srcs = glob(["src/NUnitFramework/framework/Schemas/*"]), ) core_resource( name = "resource1", src = "src/NUnitFramework/tests/TestImage1.jpg", identifier = "NUnit.Framework.TestImage1.jpg", ) core_resource( name = "resource2", src = "src/NUnitFramework/tests/TestImage2.jpg", identifier = "NUnit.Framework.TestImage2.jpg", ) core_resource( name = "resource3", src = "src/NUnitFramework/tests/TestText1.txt", identifier = "NUnit.Framework.TestText1.txt", ) core_resource( name = "resource4", src = "src/NUnitFramework/tests/TestText2.txt", identifier = "NUnit.Framework.TestText2.txt", ) core_resource( name = "resource5", src = "src/NUnitFramework/tests/TestListFile.txt", identifier = "NUnit.Framework.TestListFile.txt", ) core_resource( name = "resource6", src = "src/NUnitFramework/tests/TestListFile2.txt", identifier = "NUnit.Framework.TestListFile2.txt", ) core_nunit3_test( name = "nunit.framework.tests.dll", srcs = glob( [ "src/NUnitFramework/tests/**/*.cs", "src/NUnitFramework/*.cs", ], exclude = ["**/RuntimeFrameworkTests.cs"], ) + ["src/CommonAssemblyInfo.cs"], data_with_dirs = { "@vstest.16.5//:Microsoft.TestPlatform.TestHostRuntimeProvider.dll": "Extensions", "@nunit3-vs-adapter.3.16.1//:NUnitTestAdapter.TestAdapter.dll": "Extensions", ":schemas": "Schemas", "@junit.testlogger//:extension": "Extensions", }, defines = COMMON_DEFINES, keyfile = "src/nunit.snk", resources = [ ":resource1", ":resource2", ":resource3", ":resource4", ":resource5", ":resource6", ], testlauncher = "@vstest.16.5//:vstest.console.exe", visibility = ["//visibility:public"], deps = [ ":mock-assembly.dll", ":nunit.framework.dll", ":nunit.testdata.dll", ":slow-nunit-tests.dll", "@nunit3-vs-adapter.3.16.1//:NUnitTestAdapter.TestAdapter.dll", ], )
""" 给定一个无序的整数数组,找到其中最长上升子序列的长度。 示例: 输入: [10,9,2,5,3,7,101,18] 输出: 4 解释: 最长的上升子序列是 [2,3,7,101],它的长度是 4。 说明: 可能会有多种最长上升子序列的组合,你只需要输出对应的长度即可。 你算法的时间复杂度应该为 O(n2) 。 进阶: 你能将算法的时间复杂度降低到 O(n log n) 吗? 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/longest-increasing-subsequence 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 """ class Solution: def lengthOfLIS(self, nums) -> int: '''从尾部考虑就正序循环 状态转移方程要从复杂到绝对简单 ''' if not nums: return 0 length_LIS_last_j = [1]*len(nums) for j in range(len(nums)): for i in range(j): if nums[i] < nums[j]: length_LIS_last_j[j] = max(length_LIS_last_j[j],length_LIS_last_j[i]+1) return max(set(length_LIS_last_j)) if __name__ == "__main__": s = Solution() nums = [4,6,7,9,10,1] print(s.lengthOfLIS(nums))
# Strings Part-1 - Definition,casting and indexing my_string = "Python101!" another_string = 'Welcome ' # quoting the quote ! dialog = 'He asked , "But sir, python is a snake?!" ' reply = "Monty replied , 'Of course it is.' " multi_line = """ You cans freely type here , without worrying about using \n to go on to a new line... """ # Casting! txt_num = str(123) print(txt_num) # output : '123' # Indexing letter = my_string[0] print(letter) # output : 'P' print(my_string[3],my_string[7]) # output : h 0 my_string[0] = "p" # TypeError: 'str' object does not support item assignment !
""" Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit. Example 1: Input: [7, 1, 5, 3, 6, 4] Output: 5 max. difference = 6-1 = 5 (not 7-1 = 6, as selling price needs to be larger than buying price) Example 2: Input: [7, 6, 4, 3, 1] Output: 0 In this case, no transaction is done, i.e. max profit = 0. """ class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ if len(prices)<=1: return 0 maxi = prices[0] mini = prices[0] maxa = 0 mina = 0 alldecreasing=True for i in range(1,len(prices)): if prices[i]>maxi: #print "Max is",prices[i]," at ",i maxi=prices[i] maxa=i if i == 1: alldecreasing=False if i > 1 and alldecreasing==True: #print "In Here" return self.maxProfit(prices[mina:]) elif prices[i]<=mini: #print "Min is",prices[i]," at ",i mini=prices[i] mina=i else: if alldecreasing==True: alldecreasing=False return self.maxProfit(prices[i-1:]) #print mina,maxa if mina<maxa: #print maxi-mini return maxi-mini elif mina==maxa: return 0 else: if alldecreasing==True: return 0 return max(self.maxProfit(prices[0:maxa+1]),self.maxProfit(prices[maxa+1:mina]),self.maxProfit(prices[mina:]),0)
""" Given two sorted linked lists, merge them so that the resulting linked list is also sorted. Consider two sorted linked lists and the merged list below them as an example. Click here to view the solution in C++, Java, JavaScript, and Ruby. head1 -> 4 -> 8 -> 15 -> 19 -> null head2 -> 7 -> 9 -> 10 -> 16 -> null head1 -> 4 -> 7 -> 8 -> 9-> 10 -> 15 -> 16 -> 19 -> NULL """ class Node: def __init__(self, data = None): self.data = data self.next = None def insert(self, A): node = self for data in A: node.next = Node(data) node = node.next def display(self): elements = [] node = self while True: elements.append(node.data) if node.next: node = node.next else: break print(elements) def get(self, index): if index >= self.length(): print ("ERROR: 'Get' index out of range!") return None currentIndex = 0 currentNode = self.head while True: currentNode = currentNode.next if currentIndex == index: return currentNode.data currentIndex += 1 def erase(self, index): if index >= self.length(): print ("ERROR: 'Erase' Index out of range!") return currentIndex = 0 currentNode = self.head while True: lastNode = currentNode currentNode = currentNode.next if currentIndex == index: lastNode.next = currentNode.next return currentIndex += 1 def merge_sorted(head1, head2): # if both lists are empty then merged list is also empty # if one of the lists is empty then other is the merged list if head1 == None: return head2 elif head2 == None: return head1 mergedHead = None if head1.data <= head2.data: mergedHead = head1 head1 = head1.next else: mergedHead = head2 head2 = head2.next mergedTail = mergedHead while head1 != None and head2 != None: temp = None if head1.data <= head2.data: temp = head1 head1 = head1.next else: temp = head2 head2 = head2.next mergedTail.next = temp mergedTail = temp if head1 != None: mergedTail.next = head1 elif head2 != None: mergedTail.next = head2 return mergedHead def create_linked_list(A): node = Node(A[0]) A = A[1:] node.insert(A) return node array1 = [2, 3, 5, 6] linkedList1 = create_linked_list(array1) print("Original1:") linkedList1.display() array2 = [1, 4, 10] linkedList2 = create_linked_list(array2) print("\nOriginal2:") linkedList2.display() new_head = merge_sorted(linkedList1, linkedList2) print("\nMerged:") new_head.display() stop = True """ Runtime Complexity: Linear, O(m+n) where m and n are lengths of both linked lists Memory Complexity: Constant, O(1) Maintain a head and a tail pointer on the merged linked list. Then choose the head of the merged linked list by comparing the first node of both linked lists. For all subsequent nodes in both lists, you choose the smaller current node, link it to the tail of the merged list, and move the current pointer of that list one step forward. Continue this while there are some remaining elements in both the lists. If there are still some elements in only one of the lists, you link this remaining list to the tail of the merged list. Initially, the merged linked list is NULL. Compare the value of the first two nodes and make the node with the smaller value the head node of the merged linked list. In this example, it is 4 from head1. Since it’s the first and only node in the merged list, it will also be the tail. Then move head1 one step forward. """
def solution(l): parsed = [e.split(".") for e in l] toSort = [map(int, e) for e in parsed] sortedINTs = sorted(toSort) sortedJoined = [('.'.join(str(ee) for ee in e)) for e in sortedINTs] return sortedJoined
#!/usr/bin/env python # -*- coding: utf-8 -*- if __name__ == '__main__': print("************************************************************************") print("* WELCOME TO ZEROMCMP (OpenSource MultiCloud Management Platform) *") print("************************************************************************")
class Settings: def __init__(self): self.screen_width = 900 self.screen_height = 700 self.bg_color = (230, 230, 230) self.ship_speed_factor = 1 # bullet self.bullet_speed_factor = 1 self.bullet_width = 4 self.bullet_height = 4 self.bullet_color = (60, 60, 60) self.bullet_count = 4 # alien self.alien_speed_factor = 1 self.fleet_drop_factor = 10 self.fleet_direction = 1
def main() -> None: S = input() print("Yes" if "AC" in [S[i:i+2] for i in range(len(S)-1)] else "No") if __name__ == '__main__': main()
i= 1 while i<=3: print("Guess:", i) i=i+1 print("sorry you failed")
config = { # application info 'name': "texfuuin", # navbar application name 'db_path': "./texfuuin-db.json", # path to tinydb file 'port': 5000, # port to listen in production mode 'devel': True, # use gevent or flask server 'recaptcha-sitekey': "6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI", 'recaptcha-secretkey': "6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe", # user management 'default_user': "anonymous", # user default in new post form 'admin_trip': "50a3cf2", # tripcode of admin 'trip_salt': "kasdjhfkasdhfklasjdhfksjadhfkljahsdlkjfhlskj", # salt added to tripcode # validation 'uname_limit': 32, 'title_limit': 32, 'message_limit': 5000, # error 'error_msgs': { 'post-id': """The specified post could not be found.""", 'uname-limit': """The specified username is not valid.""", 'title-limit': """The specified title is not valid.""", 'message-limit': """The specified message is not valid.""", 'no-auth': """The specified tripcode is incorrect.""", 'captcha': """The captcha is incorrect.""" } }
src = Split(''' aos/soc_impl.c hal/uart.c hal/flash.c main.c ''') deps = Split(''' kernel/rhino platform/arch/arm/armv7m platform/mcu/wm_w600/ kernel/vcall kernel/init ''') global_macro = Split(''' STDIO_UART=0 CONFIG_NO_TCPIP RHINO_CONFIG_TICK_TASK=0 RHINO_CONFIG_WORKQUEUE=0 CONFIG_AOS_KV_MULTIPTN_MODE CONFIG_AOS_KV_PTN=5 CONFIG_AOS_KV_SECOND_PTN=6 CONFIG_AOS_KV_PTN_SIZE=4096 CONFIG_AOS_KV_BUFFER_SIZE=8192 SYSINFO_PRODUCT_MODEL=\\"ALI_AOS_WM_W600\\" SYSINFO_DEVICE_NAME=\\"WM_W600\\" ''') global_cflags = Split(''' -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -march=armv7-m -mthumb -mthumb-interwork -mlittle-endian -w ''') local_cflags = Split(''' -Wall -Werror -Wno-unused-variable -Wno-unused-parameter -Wno-implicit-function-declaration -Wno-type-limits -Wno-sign-compare -Wno-pointer-sign -Wno-uninitialized -Wno-return-type -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-value -Wno-strict-aliasing ''') global_includes = Split(''' ../../arch/arm/armv7m/gcc/m3 ''') global_ldflags = Split(''' -mcpu=cortex-m3 -mthumb -mthumb-interwork -mlittle-endian -nostartfiles --specs=nosys.specs ''') prefix = '' if aos_global_config.compiler == "gcc": prefix = 'arm-none-eabi-' component = aos_mcu_component('WM_W600', prefix, src) component.set_global_arch('Cortex-M3') component.add_comp_deps(*deps) component.add_global_macros(*global_macro) component.add_global_cflags(*global_cflags) component.add_cflags(*local_cflags) component.add_global_includes(*global_includes) component.add_global_ldflags(*global_ldflags)
# Test helper functions and classes class ParameterPassLevel: FLAG = 0 INI_KEY = 1 MARKER = 2 def _assert_result_outcomes( result, passed=0, skipped=0, failed=0, error=0, dynamic_rerun=0 ): outcomes = result.parseoutcomes() _check_outcome_field(outcomes, "passed", passed) _check_outcome_field(outcomes, "skipped", skipped) _check_outcome_field(outcomes, "failed", failed) _check_outcome_field(outcomes, "error", error) _check_outcome_field(outcomes, "dynamicrerun", dynamic_rerun) def _check_outcome_field(outcomes, field_name, expected_value): field_value = outcomes.get(field_name, 0) expected_value = int(expected_value) assert ( field_value == expected_value ), "outcomes.{} has unexpected value. Expected '{}' but got '{}'".format( field_name, expected_value, field_value )
# O(1) time | O(1) space def validIPAddresses(string): ipAddressesFound = [] for i in range(1, min(len(string), 4)): # from index 0 - 4 currentIPAddressParts = ["","","",""] currentIPAddressParts[0] = string[:i] # before the first period if not isValidPart(currentIPAddressParts[0]): continue for j in range(i + 1, i + min(len(string) - i, 4)): # i + 1 = for second period, placement of i at most in 3 positions past of i currentIPAddressParts[1] = string[i : j] # start from index i where the first position started to j at placement if not isValidPart(currentIPAddressParts[1]): continue for k in range(j + 1, j + min(len(string) - j, 4)): # j + 1 = for third period, placement of j at most in 3 positions past of j currentIPAddressParts[2] = string[j:k] # 3rd section currentIPAddressParts[3] = string[k:] # 4th section if isValidPart(currentIPAddressParts[2]) and isValidPart(currentIPAddressParts[3]): ipAddressesFound.append(".".join(currentIPAddressParts)) return ipAddressesFound def isValidPart(string): stringAsInt = int(string) if stringAsInt > 255: return False return len(string) == len(str(stringAsInt)) # check for leading 0 # 00 converted to 0, 01 converted to 1
REST_FRAMEWORK = { "DEFAULT_AUTHENTICATION_CLASSES": ( "rest_framework_simplejwt.authentication.JWTAuthentication", # TODO: 'oauth2_provider.contrib.rest_framework.OAuth2Authentication', # django-oauth-toolkit >= 1.0.0 # 'rest_framework_social_oauth2.authentication.SocialAuthentication', ), "DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",), "DEFAULT_PARSER_CLASSES": ( "rest_framework.parsers.JSONParser", "rest_framework.parsers.FormParser", "rest_framework.parsers.MultiPartParser", "rest_framework.parsers.FileUploadParser", ), "DATETIME_FORMAT": "%d-%m-%Y %H:%M", "PAGE_SIZE": 10, "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination", "DEFAULT_VERSIONING_CLASS": "rest_framework.versioning.URLPathVersioning", }
def is_merge(s, part1, part2): all_chars = len(s) == len(part1) + len(part2) if not all_chars: return False d = {} for i, c in enumerate(s): d[c] = i indices1, indices2 = [d[c] for c in part1], [d[c] for c in part2] part1_good = indices1 == sorted(indices1) part2_good = indices2 == sorted(indices2) return part1_good and part2_good
def Duplicate_Charaters(Test_String): Duplicates = [] for char in Test_String: if Test_String.count(char) > 1 and char not in Duplicates: Duplicates.append(char) return Duplicates Test_String = input("Enter a String: ") print(*(Duplicate_Charaters(Test_String)))
#!python3 def main(): with open('21.txt', 'r') as f, open('21_out.txt', 'w') as f_out: lines = f.readlines() # Part 1 answer = 0 print(answer) print(answer, file=f_out) # Part 2 print(answer) print(answer, file=f_out) if __name__ == '__main__': main()
class HashState: def __init__(self, player, cards, leading, upper, lower, tricks): self.current_player = player self.cards = cards self.upper_bound = upper self.lower_bound = lower self.leading_suite = leading self.tricks_left = tricks def get_current_player(self): return self.current_player def set_current_player(self, player): self.current_player = player def get_cards(self): return self.cards def set_cards(self, cards): self.cards = cards def get_upper_bound(self): return self.upper_bound def set_upper_bound(self, upper): self.upper_bound = upper def get_lower_bound(self): return self.lower_bound def set_lower_bound(self, lower): self.lower_bound = lower def get_leading_suite(self): return self.leading_suite def set_leading_suite(self, leading): self.leading_suite = leading def get_tricks_left(self): return self.tricks_left def set_tricks_left(self, tricks): self.tricks_left = tricks
# -*- coding: utf-8 -*- # License: See LICENSE file. required_states = ['position'] required_matrices = ['cellular_binary_grass'] def run(name, world, matrices, states, extra_life=10): y,x = states['position'] #if matrices['cellular_binary_grass'][int(y),int(x)]: # Eat the cell under the agent's position matrices['cellular_binary_grass'][int(y),int(x)] = False #endif
class Config: def __init__(self, classified_types: [str]): self.classified_types = classified_types
nterms = int(input("Stevilo cifr? ")) n1, n2 = 0, 1 count = 0 if nterms <= 0: print("Vnesi pozitivno stevilo: ") elif nterms == 1: print("Sekvenca do ",nterms,": ") print(n1) else: print("Sekvenca:") while count < nterms: print(n1) nth = n1 + n2 n1 = n2 n2 = nth count += 1
# -*- coding: utf-8 -*- # Kurs: Python: Grundlagen der Programmierung für Nicht-Informatiker # Semester: Herbstsemester 2018 # Homepage: http://accaputo.ch/kurs/python-uzh-hs-2018/ # Author: Giuseppe Accaputo # Aufgabe: 2.1 def summe(a,b,c): print(a + b + c) summe(1,2,3) summe(1,-1,0) summe(-1,-2,-3)
#Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80kmH, mostre uma messagem #dizendo que ele foi mutado. A multa vai custar R$7,00 por cada Km acima do limite. vel = float(input('Qual é a velocidade atual do carro? ')) if vel > 80: print('MULTADO! Você excedeu o limite permitido que é de 80Km/h') mul = (vel - 80) * 7 print(f'Você deve pagar uma multa de R${mul:.2f}') print('Tenha um bom dia! Dirija com segurança!')
issues=[ dict(name='Habit',number=5,season='Winter 2012', description='commit to a change, experience it, and record'), dict(name='Interview', number=4, season='Autumn 2011', description="this is your opportunity to inhabit another's mind"), dict(name= 'Digital Presence', number= 3, season= 'Summer 2011', description='what does your digital self look like?'), dict(name= 'Adventure', number=2, season= 'Spring 2011', description='take an adventure and write about it.'), dict(name= 'Unplugging', number=1, season= 'Winter 2011', description='what are you looking forward to leaving?') ] siteroot='/Users/adam/open review quarterly/source/' infodir='/Users/adam/open review quarterly/info' skip_issues_before=5 illustration_tag='=== Illustration ===' illustration_tag_sized="=== Illustration width: 50% ==="
def bestSum(t, arr, memo=None): """ m: target sum, t n: len(arr) time = O(n^m*m) space = O(m*m) [in each stack frame, I am storing an array, which in worst case would be m] // Memoized complexity time = O(n*m*m) space = O(m*m) """ if memo is None: memo = {} if t in memo: return memo[t] if t == 0: return [] if t < 0: return None shortestCombination = None for ele in arr: r = t - ele rRes = bestSum(r, arr, memo) if rRes is not None: combination = rRes + [ele] # If the combination is shorter than current shortest, update it if (shortestCombination is None or len(combination) < len(shortestCombination)): shortestCombination = combination memo[t] = shortestCombination return memo[t] print(bestSum(7, [5,3,4,7])) print(bestSum(8, [2,3,5])) print(bestSum(8, [1,4,5])) print(bestSum(100, [1,2,5,25]))
"""Expectations that can be placed on an HTTP request""" class ResponseExpectation(object): """An expectation placed on an HTTP response.""" def __init__(self): pass def validate(self, validation, response): """If the expectation is met, do nothing. If the expectation is not met, call validation.fail(...) """ pass class _ExpectedStatusCodes(ResponseExpectation): """An expectation about an HTTP response's status code""" def __init__(self, status_codes): """Create an ExpectedStatusCodes object that expects the HTTP response's status code to be one of the elements in status_codes. """ ResponseExpectation.__init__(self) self.status_codes = status_codes def validate(self, validation, response): """This expectation is met if the HTTP response code is one of the elements of self.status_codes """ if response.status_code not in self.status_codes: string_code = ' or '.join(str(status) for status in self.status_codes) if len(string_code) > 33: string_code = string_code[:34] + "..." validation.fail( "expected status code: {0}, actual status code: {1} ({2})" .format(string_code, response.status_code, response.reason)) def __repr__(self): return "{}: Code {}".format(type(self).__name__, self.status_codes) class ExpectContainsText(ResponseExpectation): """An expectation that an HTTP response will include some text.""" def __init__(self, text): """Creates an ExpectContainsText object that expects the HTTP response text to contain the specified text. """ ResponseExpectation.__init__(self) self.text = text def validate(self, validation, response): if not self.text in response.text: validation.fail("could not find '{0}' in response body: '{1}'" .format(self.text, response.text)) def __repr__(self): return "{}: expect {}".format(type(self).__name__, self.text) class ExpectedHeader(ResponseExpectation): """An expectation that an HTTP response will include a header with a specific name and value. """ def __init__(self, name, value): """Creates an ExpectedHeader object.""" ResponseExpectation.__init__(self) self.name = name self.value = value def validate(self, validation, response): if self.name not in response.headers: validation.fail("No header named: '{0}'. Found header names: {1}" .format(self.name, ', '.join(list(response.headers.keys())))) elif self.value != response.headers[self.name]: validation.fail( "The value of the '{0}' header is '{1}', expected '{2}'" .format(self.name, response.headers[self.name], self.value)) def __repr__(self): return "{}: {} should be {}".format(type(self).__name__, self.name, self.value) class ExpectedContentType(ExpectedHeader): """An expectation that an HTTP response will have a particular content type """ def __init__(self, content_type): ExpectedHeader.__init__(self, "Content-Type", content_type)
num = 1 factors = list() while num <= 100: if (num % 10) == 0: factors.append(num) num = num + 1 print("Factors :",factors)
#! /usr/bin/env python3 """ Print patterns based on Pascal's Triangle. """ class Triangle: """Represents a Pascal's Triangle which can be rendered as text. """ def __init__(self, num_rows): self.num_rows = num_rows self.rows = [[1]] prev_row = [1] for row_num in range(1, num_rows): this_row = [1] for col_num in range(1, row_num): this_row.append(prev_row[col_num-1] + prev_row[col_num]) this_row.append(1) self.rows.append(this_row) prev_row = this_row def printAsChars(self, modulus, chars=None): assert modulus > 1, "modulus too small" if chars is None: chars = "*" + " "*(modulus-1) if len(chars) < modulus: chars += " "*(modulus - len(chars)) for row in self.rows: print(" " * (self.num_rows - len(row)), end=" ") for i in row: print(chars[i % modulus], end=" ") print() def main(): tri = Triangle(16) print(tri.rows) tri.printAsChars(2) tri.printAsChars(4) tri.printAsChars(4, " +X+") tri.printAsChars(4, " .oO") main()
dict( source=["/home/yzhang3151/project/NMT/experiments/nmt/binarized_text.diag.shuf.h5"], target=["/home/yzhang3151/project/NMT/experiments/nmt/binarized_text.drug.shuf.h5"], indx_word="/home/yzhang3151/project/NMT/experiments/nmt/ivocab.diag.pkl", indx_word_target="/home/yzhang3151/project/NMT/experiments/nmt/ivocab.drug.pkl", word_indx="/home/yzhang3151/project/NMT/experiments/nmt/vocab.diag.pkl", word_indx_trgt="/home/yzhang3151/project/NMT/experiments/nmt/vocab.drug.pkl", null_sym_source=8360, null_sym_target=1010, n_sym_source=16001, n_sym_target=16001, loopIters=1000000, seqlen=50, bs=80, dim=1000, saveFreq=30, last_forward = False, forward = True, backward = True, last_backward = False, use_context_gate=True, ########## # for coverage maintain_coverage=True, # for linguistic coverage, the dim can only be 1 coverage_dim=10, #----------------------- use_linguistic_coverage=False, # added by Zhaopeng Tu, 2015-12-16 use_fertility_model=True, max_fertility=2, coverage_accumulated_operation = "additive", ########## use_recurrent_coverage=True, use_recurrent_gating_coverage=True, use_probability_for_recurrent_coverage=True, use_input_annotations_for_recurrent_coverage=True, use_decoding_state_for_recurrent_coverage=True, )
# ******************************************************************** # THE RED ACT # rOsita fu # 06-23-2020 # github.com/atisor73 # ******************************************************************** save = True def setup(): size(500, 700) frameRate(10) rows, cols = 15, 15 num_squares = rows*cols t = [random(10) for i in range(num_squares)] stretch = [random(3, 7) for i in range(num_squares)] # choosing random squares chosen = [] for i in range(rows): chosen_row = [] for j in range(cols): if int(random(0.7, 1.99)) == 0: chosen_row.append(0) else: chosen_row.append(1) chosen.append(chosen_row) # bacon lorem ipsum, and political lorem ipsum words = """Bacon ipsum dolor amet frankfurter salami ball tip drumstick leberkas hamburger. Boudin chuck capicola pork belly. Porchetta strip steak cupim, ham tail burgdoggen shankle sausage ham hock pork chop pork. Picanha flank tri-tip chicken, prosciutto capicola pig sirloin bresaola pastrami swine sausage pancetta spare ribs. Beef pork chop capicola, flank cow spare ribs chuck ham salami. Burgdoggen ham hock porchetta, pastrami turkey shank alcatra buffalo hamburger chislic strip steak drumstick beef capicola cupim. Sausage filet mignon ground round cupim pork chop, shoulder pork salami meatball. Frankfurter tail salami doner filet mignon short loin ground round cupim fatback shankle strip steak ball tip pancetta tongue. Tri-tip sausage drumstick tenderloin rump kielbasa turducken. Kielbasa ham turducken shankle, porchetta ham hock brisket spare ribs pork chop shoulder doner. Chicken shoulder burgdoggen meatball cupim buffalo jowl turkey short loin capicola boudin pork belly.""" words = """For over a thousand years, Al-Azhar becaon of Islamic learning. Egypt's advancement Buchenwald, a network of camps where reverends were enslaved, tortured, and shot. Countries grew their economoies while maintaining distinct cultures. Waded into battles over prison reform and temperance, above all, abolition. Speak as clearly and plainly as I can. Thank you. Change tax code lobbyists station. Live communities power in mosques, temples, synagogues. Nuclear elections share common principles of justice and progress, tolerance and dignity of all human beings. Offensive sexuality and mindless violence, the internet and television can bring. Source of advancement, faith, daughters contribute and gather. Preparing to divide, pledge our allegiance, and race with bombings. Race, criminal systems emerging church of aggression knocking at the very source of administrative duties. March into the future, WAR takien to the Palestinian lives, civilians, real evil, hardship, and suffering plague. Government court justices can fail to explain the pledging, the verge of helpless poverty. Unemployment plans particularly tricky of the type""" def draw(): global rows, cols, stretch, t, num_squares, chosen # setting global variables background(color(204, 196, 181)) # color of paper # DRAWING LETTERS ---------------------------------------------- # f = createFont("1942.ttf",25) f = createFont("AmericanTypewriter-Condensed", 25) textFont(f) # textSize(25) textSize(20) fill(0) start = 0 end = start + 50 for i in range(rows+1): text(words[start: end], 10, i*height/rows+35) start = end end += 75 # DRAWING BOXES -------------------------------------------------- noStroke() # no outline for boxes stretch = [stretch[i] + sin(40*t[i]) for i in range(num_squares)] # width of boxes t += [t[i] + 2*PI/400 for i in range(num_squares)] # advance in time for i in range(rows): for j in range(cols): if chosen[i][j] == 1: # randomize 'redness' of square colors fill(int(random(140, 170)), int( random(0, 10)), int(random(0, 10))) index = j+i*rows centerx = i*width/cols + width/25 centery = j*height/rows + height/25 x1, y1 = centerx-stretch[index], centery-8+int(random(4)) x2, y2 = centerx-stretch[index], centery+8+int(random(4)) x3, y3 = centerx+stretch[index], centery+8+int(random(4)) x4, y4 = centerx+stretch[index], centery-8+int(random(4)) quad(x1, y1, x2, y2, x3, y3, x4, y4) # # .__....._ _.....__, # .": o :': ;': o :". # `. `-' .'. .'. `-' .' # `---' `---' # _...----... ... ... ...----..._ # .-'__..-""'---- `. `ρζ` .' ----'""-..__`-. # '.-' _.--"""' `-._.-' '"""--._ `-.` # ' .-"' : `"-. ` # ' `. _.'"'._ .' ` # `. ,.-'" "'-., .' # `. .' # `-._ _.-' # `"'--...___...--'"`' # # ********************************************************************
# Faça um programa que leia um número inteiro qualquer e mostre na tela a sua tabuada. # num = int(input('Digite um numero: ')) print(f'{num} x {1} = ', num * 1) print(f'{num} x {2} = ', num * 2) print(f'{num} x {3} = ', num * 3) print(f'{num} x {4} = ', num * 4) print(f'{num} x {5} = ', num * 5) print(f'{num} x {6} = ', num * 6) print(f'{num} x {7} = ', num * 7) print(f'{num} x {8} = ', num * 8) print(f'{num} x {9} = ', num * 9) print(f'{num} x {10} = ', num * 10)
#!/usr/bin/python -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ # Basic list exercises # Fill in the code for the functions below. main() is already set up # to call the functions with a few different inputs, # printing 'OK' when each function is correct. # The starter code for each function includes a 'return' # which is just a placeholder for your code. # It's ok if you do not complete all the functions, and there # are some additional functions to try in list2.py. # A. match_ends # Given a list of strings, return the count of the number of # strings where the string length is 2 or more and the first # and last chars of the string are the same. # Note: python does not have a ++ operator, but += works. def match_ends(words): return len([word for word in words if len(word)>=2 and word[0]==word[-1]]) #print(match_ends(['aaa', 'be', 'abc', 'hello'])) # test(match_ends(['aba', 'xyz', 'aa', 'x', 'bbb']), 3) # test(match_ends(['', 'x', 'xy', 'xyx', 'xx']), 2) # test(match_ends(['aaa', 'be', 'abc', 'hello']), 1) # B. front_x # Given a list of strings, return a list with the strings # in sorted order, except group all the strings that begin with 'x' first. # e.g. ['mix', 'xyz', 'apple', 'xanadu', 'aardvark'] yields # ['xanadu', 'xyz', 'aardvark', 'apple', 'mix'] # Hint: this can be done by making 2 lists and sorting each of them # before combining them. def front_x(words): strings_with_x = sorted([word for word in words if word[0] == 'x']) other_strings = sorted([word for word in words if word[0]!= 'x']) return strings_with_x + other_strings #print(front_x(['mix', 'xyz', 'apple', 'xanadu', 'aardvark'])) # test(front_x(['bbb', 'ccc', 'axx', 'xzz', 'xaa']), # ['xaa', 'xzz', 'axx', 'bbb', 'ccc']) # test(front_x(['ccc', 'bbb', 'aaa', 'xcc', 'xaa']), # ['xaa', 'xcc', 'aaa', 'bbb', 'ccc']) # test(front_x(['mix', 'xyz', 'apple', 'xanadu', 'aardvark']), # ['xanadu', 'xyz', 'aardvark', 'apple', 'mix']) # C. sort_last # Given a list of non-empty tuples, return a list sorted in increasing # order by the last element in each tuple. # e.g. [(1, 7), (1, 3), (3, 4, 5), (2, 2)] yields # [(2, 2), (1, 3), (3, 4, 5), (1, 7)] # Hint: use a custom key= function to extract the last element form each tuple. def sort_last(tuples): def last_element(tuples): return tuples[-1] return sorted(tuples, key=last_element) #print(sort_last([(1, 7), (1, 3), (3, 4, 5), (2, 2)])) # test(sort_last([(1, 3), (3, 2), (2, 1)]), # [(2, 1), (3, 2), (1, 3)]) # test(sort_last([(2, 3), (1, 2), (3, 1)]), # [(3, 1), (1, 2), (2, 3)]) # test(sort_last([(1, 7), (1, 3), (3, 4, 5), (2, 2)]), # [(2, 2), (1, 3), (3, 4, 5), (1, 7)]) #list2 # Additional basic list exercises # D. Given a list of numbers, return a list where # all adjacent == elements have been reduced to a single element, # so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or # modify the passed in list. def remove_adjacent(nums): result = [] if len(nums) > 0: for number in nums: if len(result) == 0: result.append(number) if number != result[-1]: result.append(number) return result print(remove_adjacent([2, 2, 3, 3, 3, 4, 3])) # test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3]) # test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3]) # test(remove_adjacent([]), []) # E. Given two lists sorted in increasing order, create and return a merged # list of all the elements in sorted order. You may modify the passed in lists. # Ideally, the solution should work in "linear" time, making a single # pass of both lists. def linear_merge(list1, list2): return sorted((list1+list2)) print(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb'])) # test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']), # ['aa', 'bb', 'cc', 'xx', 'zz']) # test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']), # ['aa', 'bb', 'cc', 'xx', 'zz']) # test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']), # ['aa', 'aa', 'aa', 'bb', 'bb'])
""" 10171 : 고양이 URL : https://www.acmicpc.net/problem/10171 Input : Output : \ /\ ) ( ') ( / ) \(__)| """ print("\\ /\\") print(" ) ( ')") print("( / )") print(" \\(__)|")
#HERE IS WHERE YOU CHANGE THE URL TO YOUR MOODLE SERVER #MAKE SURE ALL THE PHP FILES ARE IN THE API FOLDER FOR THIS TO WORK #CAN CHANGE THE API KEY HERE AS WELL loginAPIcall = 'http://157.245.126.159/api/login.php' getPointsAPIcall = 'http://157.245.126.159/api/get_user_points.php' removePointsAPIcall = 'http://157.245.126.159/api/cut_user_points.php' transactionsAPIcall = 'http://157.245.126.159/api/get_user_pointlist.php' changeNicknameAPIcall = 'http://157.245.126.159/api/getnickname.php' leaderboardAPIcall = 'http://157.245.126.159/api/get_leaderboard.php' changeAvatarAPIcall = 'http://157.245.126.159/api/changeavatar.php' APIkeys = ')ma#e*lz)m*881ghgwgkc&vodfodfdopvjdqp9vb_4pdohndpw2o8g2hf=s'
# # PySNMP MIB module DELL-NETWORKING-FIB-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DELL-NETWORKING-FIB-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:37:54 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:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion") dellNetMgmt, = mibBuilder.importSymbols("DELL-NETWORKING-SMI", "dellNetMgmt") InterfaceIndexOrZero, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndexOrZero") InetAddressPrefixLength, InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressPrefixLength", "InetAddress", "InetAddressType") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") MibIdentifier, TimeTicks, Integer32, Counter64, iso, Unsigned32, Gauge32, ModuleIdentity, Bits, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, IpAddress, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "TimeTicks", "Integer32", "Counter64", "iso", "Unsigned32", "Gauge32", "ModuleIdentity", "Bits", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "IpAddress", "Counter32") TextualConvention, MacAddress, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "MacAddress", "DisplayString") dellNetIpForwardMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 6027, 3, 9)) dellNetIpForwardMib.setRevisions(('2011-07-08 12:00', '2007-09-14 12:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: dellNetIpForwardMib.setRevisionsDescriptions(('This version of MIB module deprecates the dellNetIpForwardTable and replaces it with dellNetInetCidrRouteTable which adds the IP Protocol Independance ', 'Initial version of this MIB module.',)) if mibBuilder.loadTexts: dellNetIpForwardMib.setLastUpdated('200709141200Z') if mibBuilder.loadTexts: dellNetIpForwardMib.setOrganization('Dell Inc') if mibBuilder.loadTexts: dellNetIpForwardMib.setContactInfo('http://www.dell.com/support') if mibBuilder.loadTexts: dellNetIpForwardMib.setDescription('This MIB module is used to display CIDR multipath IP Routes.') dellNetIpForwardMibObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1)) dellNetIpForwardMibConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 6027, 3, 9, 2)) dellNetIpForwardVariable = MibIdentifier((1, 3, 6, 1, 4, 1, 6027, 3, 9, 3)) chSysCardNumber = MibScalar((1, 3, 6, 1, 4, 1, 6027, 3, 9, 3, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: chSysCardNumber.setStatus('current') if mibBuilder.loadTexts: chSysCardNumber.setDescription('This is the card number assigned to the line cards and the RPM cards in the chassis. The line cards number are from 0 to 13 and the RPM are from 0 to 1.') dellNetIpForwardVersionTable = MibTable((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 1), ) if mibBuilder.loadTexts: dellNetIpForwardVersionTable.setStatus('current') if mibBuilder.loadTexts: dellNetIpForwardVersionTable.setDescription("This entity's IP forward version table.") dellNetIpForwardVersionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 1, 1), ).setIndexNames((0, "DELL-NETWORKING-FIB-MIB", "chSysCardNumber"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetIpForwardAddrFamily")) if mibBuilder.loadTexts: dellNetIpForwardVersionEntry.setStatus('current') if mibBuilder.loadTexts: dellNetIpForwardVersionEntry.setDescription('The row definition for the ip forward version Table.') dellNetIpForwardAddrFamily = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 1, 1, 1), InetAddressType()) if mibBuilder.loadTexts: dellNetIpForwardAddrFamily.setStatus('current') if mibBuilder.loadTexts: dellNetIpForwardAddrFamily.setDescription('Address Family of the IP Forwarding Table for which this entry provides the Version information. ') dellNetIpForwardVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 1, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetIpForwardVersion.setStatus('current') if mibBuilder.loadTexts: dellNetIpForwardVersion.setDescription('A version number on the Forwarding Table. This is always fetched from one line card.') dellNetIpForwardTable = MibTable((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2), ) if mibBuilder.loadTexts: dellNetIpForwardTable.setStatus('deprecated') if mibBuilder.loadTexts: dellNetIpForwardTable.setDescription("This entity's IP Routing table.") dellNetIpForwardEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1), ).setIndexNames((0, "DELL-NETWORKING-FIB-MIB", "chSysCardNumber"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetIpforwardDest"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetIpforwardMask"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetIpforwardNextHop"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetIpforwardFirstHop")) if mibBuilder.loadTexts: dellNetIpForwardEntry.setStatus('deprecated') if mibBuilder.loadTexts: dellNetIpForwardEntry.setDescription('A particular route to a particular destination, under a particular policy.') dellNetIpforwardDest = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetIpforwardDest.setStatus('deprecated') if mibBuilder.loadTexts: dellNetIpforwardDest.setDescription('The destination IP address of this route. An entry with a value of 0.0.0.0 is considered a default route.') dellNetIpforwardMask = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetIpforwardMask.setStatus('deprecated') if mibBuilder.loadTexts: dellNetIpforwardMask.setDescription('Indicate the mask to be logical-ANDed with the destination address before being compared to the value in the dellNetIpforwardDest field.') dellNetIpforwardNextHop = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 3), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetIpforwardNextHop.setStatus('deprecated') if mibBuilder.loadTexts: dellNetIpforwardNextHop.setDescription('On remote routes, the address of the next system en route; Otherwise, 0.0.0.0.') dellNetIpforwardFirstHop = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 4), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetIpforwardFirstHop.setStatus('deprecated') if mibBuilder.loadTexts: dellNetIpforwardFirstHop.setDescription('On remote routes, the address of the Gateway to the nexthop; 0.0.0.0 if the Nexthop itself is a Gateway to the Destination') dellNetIpforwardIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetIpforwardIfIndex.setStatus('deprecated') if mibBuilder.loadTexts: dellNetIpforwardIfIndex.setDescription('The ifIndex value which identifies the local interface through which the next hop of this route should be reached.') dellNetIpforwardMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 6), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetIpforwardMacAddress.setStatus('deprecated') if mibBuilder.loadTexts: dellNetIpforwardMacAddress.setDescription('The Mac address of the NextHop.') dellNetIpforwardEgressPort = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetIpforwardEgressPort.setStatus('deprecated') if mibBuilder.loadTexts: dellNetIpforwardEgressPort.setDescription('The name of the egress port to which the packets will be forwarded.') dellNetIpforwardCamIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 2, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetIpforwardCamIndex.setStatus('deprecated') if mibBuilder.loadTexts: dellNetIpforwardCamIndex.setDescription('Cam Entry corresponding to a row.') dellNetInetCidrIpv4RouteNumber = MibScalar((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetInetCidrIpv4RouteNumber.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrIpv4RouteNumber.setDescription('The number of current dellNetInetCidrRouteTable entries that are not Invalid and whose dellNetInetCidrRouteDestType is ipv4(1)') dellNetInetCidrIpv6RouteNumber = MibScalar((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetInetCidrIpv6RouteNumber.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrIpv6RouteNumber.setDescription('The number of current dellNetInetCidrRouteTable entries that are not Invalid and whose dellNetInetCidrRouteDestType is ipv6(2)') dellNetInetCidrRouteTable = MibTable((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5), ) if mibBuilder.loadTexts: dellNetInetCidrRouteTable.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteTable.setDescription("This entity's IP Routing table.") dellNetInetCidrRouteTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1), ).setIndexNames((0, "DELL-NETWORKING-FIB-MIB", "chSysCardNumber"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteDestType"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteDest"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRoutePfxLen"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteNextHopType"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteNextHop"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteFirstHopType"), (0, "DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteFirstHop")) if mibBuilder.loadTexts: dellNetInetCidrRouteTableEntry.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteTableEntry.setDescription('A particular route to a particular destination Implementers need to be aware that if the total number of elements (octets or sub-identifiers) in inetCidrRouteDest, inetCidrRoutePolicy, and inetCidrRouteNextHop exceeds 111, then OIDs of column instances in this table will have more than 128 sub- identifiers and cannot be accessed using SNMPv1, SNMPv2c, or SNMPv3. For S-Series Platform, Value of chSysCardNumber will always be zero') dellNetInetCidrRouteDestType = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 1), InetAddressType()) if mibBuilder.loadTexts: dellNetInetCidrRouteDestType.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteDestType.setDescription('The type of the inetCidrRouteDest address, as defined in the InetAddress MIB. Only those address types that may appear in an actual routing table are allowed as values of this object.') dellNetInetCidrRouteDest = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 2), InetAddress()) if mibBuilder.loadTexts: dellNetInetCidrRouteDest.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteDest.setDescription('The destination IP address of this route. The type of this address is determined by the value of the inetCidrRouteDestType object.') dellNetInetCidrRoutePfxLen = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 3), InetAddressPrefixLength()) if mibBuilder.loadTexts: dellNetInetCidrRoutePfxLen.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRoutePfxLen.setDescription('Indicates the number of leading one bits that form the mask to be logical-ANDed with the destination address before being compared to the value in the inetCidrRouteDest field.') dellNetInetCidrRouteNextHopType = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 4), InetAddressType()) if mibBuilder.loadTexts: dellNetInetCidrRouteNextHopType.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteNextHopType.setDescription('The type of the inetCidrRouteNextHop address, as defined in the InetAddress MIB. Value should be set to unknown(0) for non-remote routes. Only those address types that may appear in an actual routing table are allowed as values of this object.') dellNetInetCidrRouteNextHop = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 5), InetAddress()) if mibBuilder.loadTexts: dellNetInetCidrRouteNextHop.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteNextHop.setDescription('On remote routes, the address of the next system en route. For non-remote routes, a zero length string. The type of this address is determined by the value of the inetCidrRouteNextHopType object.') dellNetInetCidrRouteFirstHopType = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 6), InetAddressType()) if mibBuilder.loadTexts: dellNetInetCidrRouteFirstHopType.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteFirstHopType.setDescription('The type of the inetCidrRouteFirstHop address, as defined in the InetAddress MIB. Value should be set to unknown(0) for non-remote routes. Only those address types that may appear in an actual routing table are allowed as values of this object.') dellNetInetCidrRouteFirstHop = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 7), InetAddress()) if mibBuilder.loadTexts: dellNetInetCidrRouteFirstHop.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteFirstHop.setDescription('The address of the gateway to the Nexthop. If the nexthop itself is the gateway, a zero length string. The type of this address is determined by the value of the inetCidrRouteFirstHopType object.') dellNetInetCidrRouteIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 8), InterfaceIndexOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetInetCidrRouteIfIndex.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteIfIndex.setDescription('The ifIndex value that identifies the local interface through which the next hop of this route should be reached. A value of 0 is valid and represents the scenario where no interface is specified.') dellNetInetCidrRouteMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 9), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetInetCidrRouteMacAddress.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteMacAddress.setDescription('The Mac address of the NextHop.') dellNetInetCidrRouteEgressPort = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetInetCidrRouteEgressPort.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteEgressPort.setDescription('The name of the egress port to which the packets will be forwarded.') dellNetInetCidrRouteCamIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 6027, 3, 9, 1, 5, 1, 11), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dellNetInetCidrRouteCamIndex.setStatus('current') if mibBuilder.loadTexts: dellNetInetCidrRouteCamIndex.setDescription('Cam Entry corresponding to a row.') dellNetIpForwardMibCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 6027, 3, 9, 2, 1)) dellNetIpForwardMibGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 6027, 3, 9, 2, 2)) dellNetIpForwardMibCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 6027, 3, 9, 2, 1, 1)).setObjects(("DELL-NETWORKING-FIB-MIB", "dellNetIpForwardObjectGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dellNetIpForwardMibCompliance = dellNetIpForwardMibCompliance.setStatus('current') if mibBuilder.loadTexts: dellNetIpForwardMibCompliance.setDescription('The basic implementation requirements for the Dell Networking OS Ip Forward MIB.') dellNetIpForwardObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6027, 3, 9, 2, 2, 1)).setObjects(("DELL-NETWORKING-FIB-MIB", "dellNetIpForwardVersion"), ("DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteIfIndex"), ("DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteMacAddress"), ("DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteEgressPort"), ("DELL-NETWORKING-FIB-MIB", "dellNetInetCidrRouteCamIndex")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): dellNetIpForwardObjectGroup = dellNetIpForwardObjectGroup.setStatus('current') if mibBuilder.loadTexts: dellNetIpForwardObjectGroup.setDescription('Objects for the IP aware Route Table.') mibBuilder.exportSymbols("DELL-NETWORKING-FIB-MIB", dellNetIpForwardMibGroups=dellNetIpForwardMibGroups, dellNetIpForwardEntry=dellNetIpForwardEntry, dellNetIpforwardDest=dellNetIpforwardDest, dellNetIpForwardObjectGroup=dellNetIpForwardObjectGroup, dellNetIpforwardCamIndex=dellNetIpforwardCamIndex, dellNetInetCidrIpv4RouteNumber=dellNetInetCidrIpv4RouteNumber, dellNetIpForwardMib=dellNetIpForwardMib, dellNetIpForwardMibCompliance=dellNetIpForwardMibCompliance, dellNetInetCidrRouteNextHopType=dellNetInetCidrRouteNextHopType, dellNetInetCidrRouteTableEntry=dellNetInetCidrRouteTableEntry, dellNetIpforwardIfIndex=dellNetIpforwardIfIndex, dellNetIpForwardVersionEntry=dellNetIpForwardVersionEntry, dellNetInetCidrRouteIfIndex=dellNetInetCidrRouteIfIndex, dellNetInetCidrRouteFirstHop=dellNetInetCidrRouteFirstHop, dellNetIpforwardEgressPort=dellNetIpforwardEgressPort, PYSNMP_MODULE_ID=dellNetIpForwardMib, dellNetIpForwardTable=dellNetIpForwardTable, dellNetInetCidrRouteEgressPort=dellNetInetCidrRouteEgressPort, dellNetInetCidrRouteCamIndex=dellNetInetCidrRouteCamIndex, dellNetInetCidrIpv6RouteNumber=dellNetInetCidrIpv6RouteNumber, chSysCardNumber=chSysCardNumber, dellNetInetCidrRouteTable=dellNetInetCidrRouteTable, dellNetIpForwardVersion=dellNetIpForwardVersion, dellNetInetCidrRouteNextHop=dellNetInetCidrRouteNextHop, dellNetInetCidrRouteMacAddress=dellNetInetCidrRouteMacAddress, dellNetIpforwardNextHop=dellNetIpforwardNextHop, dellNetIpForwardMibObjects=dellNetIpForwardMibObjects, dellNetIpforwardFirstHop=dellNetIpforwardFirstHop, dellNetInetCidrRouteFirstHopType=dellNetInetCidrRouteFirstHopType, dellNetInetCidrRouteDestType=dellNetInetCidrRouteDestType, dellNetInetCidrRouteDest=dellNetInetCidrRouteDest, dellNetIpForwardMibCompliances=dellNetIpForwardMibCompliances, dellNetIpForwardVariable=dellNetIpForwardVariable, dellNetIpforwardMacAddress=dellNetIpforwardMacAddress, dellNetInetCidrRoutePfxLen=dellNetInetCidrRoutePfxLen, dellNetIpForwardAddrFamily=dellNetIpForwardAddrFamily, dellNetIpforwardMask=dellNetIpforwardMask, dellNetIpForwardVersionTable=dellNetIpForwardVersionTable, dellNetIpForwardMibConformance=dellNetIpForwardMibConformance)
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: if l1 is None: return l2 elif l2 is None: return l1 head = ph = ListNode(-1) pl1 = l1 pl2 = l2 while pl1 is not None and pl2 is not None: if pl1.val > pl2.val: ph.next = pl2 pl2 = pl2.next else: ph.next = pl1 pl1 = pl1.next ph = ph.next if pl1 is not None: ph.next = pl1 if pl2 is not None: ph.next = pl2 return head.next
class AuthNError(Exception): """AuthN is missing something. Either URL and/or API Keys Args: Exception ([type]): [description] """ pass
def fib(n): f1 = 1 f2 = 2 s = 2 while f2 < n: nxt = f1 + f2 f1 = f2 f2 = nxt if nxt & 1 == 0: s += nxt return s print(fib(4000000))
num1=100 num2=200 num3=300
def recherche_dichotomique(tableau, element): return _recherche_dichotomique(tableau, element, 0, len(tableau) - 1) def _recherche_dichotomique(tableau, element, premier, dernier): '''recherche_dichotomique (list(object) * object * int * int-> int) : renvoie l'indice de l'élément dans le tableau préalablement trié''' # Initialisation '''milieu (int) : indice de la valeur médiane du sous-tableau allant de l'indice premier à l'indice dernier''' milieu = (premier + dernier) // 2 # Début du traitement if element > tableau[milieu]: return _recherche_dichotomique(tableau, element, milieu + 1, dernier) elif element < tableau[milieu]: return _recherche_dichotomique(tableau, element, premier, milieu - 1) elif element == tableau[milieu]: return milieu else: return False print(recherche_dichotomique([1,2,3,4,5],3))
class FieldType: def __init__(self): pass Invalid = 0 Integer = 1 Text = 2 Note = 3 DateTime = 4 Counter = 5 Choice = 6 Lookup = 7 Boolean = 8 Number = 9 Currency = 10 URL = 11 Computed = 12 Threading = 13 Guid = 14 MultiChoice = 15 GridChoice = 16 Calculated = 17 File = 18 Attachments = 19 User = 20 Recurrence = 21 CrossProjectLink = 22 ModStat = 23 Error = 24 ContentTypeId = 25 PageSeparator = 26 ThreadIndex = 27 WorkflowStatus = 28 AllDayEvent = 29 WorkflowEventType = 30 Geolocation = 31 OutcomeChoice = 32 MaxItems = 33
'''Challenges Set 1 Challenge 3 Single-byte XOR cipher''' # http://www.data-compression.com/english.html CHARACTER_FREQ = { 'a': 0.0651738, 'b': 0.0124248, 'c': 0.0217339, 'd': 0.0349835, 'e': 0.1041442, 'f': 0.0197881, 'g': 0.0158610, 'h': 0.0492888, 'i': 0.0558094, 'j': 0.0009033, 'k': 0.0050529, 'l': 0.0331490, 'm': 0.0202124, 'n': 0.0564513, 'o': 0.0596302, 'p': 0.0137645, 'q': 0.0008606, 'r': 0.0497563, 's': 0.0515760, 't': 0.0729357, 'u': 0.0225134, 'v': 0.0082903, 'w': 0.0171272, 'x': 0.0013692, 'y': 0.0145984, 'z': 0.0007836, ' ': 0.1918182 } ''' crypto is a hex string, without 0x. key is a char ''' def denc_xor(crypto, key): hex_data = crypto.decode('hex') buf = [] for ch in hex_data: buf.append(chr(ord(ch) ^ ord(key))) return ''.join(buf) def calc_score(string): score = 0 for c in string: c = c.lower() if c in CHARACTER_FREQ: score = score + CHARACTER_FREQ[c] return score def get_plain_text(hex_string): text_list = [] for i in range(256): text = denc_xor(hex_string, chr(i)) score = calc_score(text) result = { 'key':chr(i), 'plain_text':text, 'score':score } text_list.append(result) return sorted(text_list, key = lambda i: i['score'])[-1] def main(): data = '1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736' '''Output: Cooking MC's like a pound of bacon''' print(get_plain_text(data)) if __name__ == '__main__': main()
#!/usr/bin/env python3 # -*- coding=utf-8 -*- # 注意: # input()返回的是字符串 # 必须通过int()将字符串转换为整数 # 才能用于数值比较: age = int(input('请输入你的年龄:')) if age >= 18: print("成年人") elif age >= 6: print("青少年") else: print('孩子')
bids_schema = { # BIDS identification bits 'modality': { 'type': 'string', 'required': True }, 'subject_id': { 'type': 'string', 'required': True }, 'session_id': {'type': 'string'}, 'run_id': {'type': 'string'}, 'acq_id': {'type': 'string'}, 'task_id': {'type': 'string'}, 'run_id': {'type': 'string'}, # BIDS metadata 'AccelNumReferenceLines': {'type': 'integer'}, 'AccelerationFactorPE': {'type': 'integer'}, 'AcquisitionMatrix': {'type': 'string'}, 'CogAtlasID': {'type': 'string'}, 'CogPOID': {'type': 'string'}, 'CoilCombinationMethod': {'type': 'string'}, 'ContrastBolusIngredient': {'type': 'string'}, 'ConversionSoftware': {'type': 'string'}, 'ConversionSoftwareVersion': {'type': 'string'}, 'DelayTime': {'type': 'float'}, 'DeviceSerialNumber': {'type': 'string'}, 'EchoTime': {'type': 'float'}, 'EchoTrainLength': {'type': 'integer'}, 'EffectiveEchoSpacing': {'type': 'float'}, 'FlipAngle': {'type': 'integer'}, 'GradientSetType': {'type': 'string'}, 'HardcopyDeviceSoftwareVersion': {'type': 'string'}, 'ImagingFrequency': {'type': 'integer'}, 'InPlanePhaseEncodingDirection': {'type': 'string'}, 'InstitutionAddress': {'type': 'string'}, 'InstitutionName': {'type': 'string'}, 'Instructions': {'type': 'string'}, 'InversionTime': {'type': 'float'}, 'MRAcquisitionType': {'type': 'string'}, 'MRTransmitCoilSequence': {'type': 'string'}, 'MagneticFieldStrength': {'type': 'float'}, 'Manufacturer': {'type': 'string'}, 'ManufacturersModelName': {'type': 'string'}, 'MatrixCoilMode': {'type': 'string'}, 'MultibandAccelerationFactor': {'type': 'float'}, 'NumberOfAverages': {'type': 'integer'}, 'NumberOfPhaseEncodingSteps': {'type': 'integer'}, 'NumberOfVolumesDiscardedByScanner': {'type': 'float'}, 'NumberOfVolumesDiscardedByUser': {'type': 'float'}, 'NumberShots': {'type': 'integer'}, 'ParallelAcquisitionTechnique': {'type': 'string'}, 'ParallelReductionFactorInPlane': {'type': 'float'}, 'PartialFourier': {'type': 'boolean'}, 'PartialFourierDirection': {'type': 'string'}, 'PatientPosition': {'type': 'string'}, 'PercentPhaseFieldOfView': {'type': 'integer'}, 'PercentSampling': {'type': 'integer'}, 'PhaseEncodingDirection': {'type': 'string'}, 'PixelBandwidth': {'type': 'integer'}, 'ProtocolName': {'type': 'string'}, 'PulseSequenceDetails': {'type': 'string'}, 'PulseSequenceType': {'type': 'string'}, 'ReceiveCoilName': {'type': 'string'}, 'RepetitionTime': {'type': 'float'}, 'ScanOptions': {'type': 'string'}, 'ScanningSequence': {'type': 'string'}, 'SequenceName': {'type': 'string'}, 'SequenceVariant': {'type': 'string'}, 'SliceEncodingDirection': {'type': 'string'}, 'SoftwareVersions': {'type': 'string'}, 'TaskDescription': {'type': 'string'}, 'TotalReadoutTime': {'type': 'float'}, 'TotalScanTimeSec': {'type': 'integer'}, 'TransmitCoilName': {'type': 'string'}, 'VariableFlipAngleFlag': {'type': 'string'}, } prov_schema = { 'version': { 'type': 'string', 'required': True }, 'md5sum': { 'type': 'string', 'required': True }, 'software': { 'type': 'string', 'required': True }, 'settings': { 'type': 'dict', 'schema': { 'fd_thres': {'type': 'float'}, 'hmc_fsl': {'type': 'boolean'}, 'testing': {'type': 'boolean'} }, }, 'mriqc_pred': {'type': 'integer'}, 'email': {'type': 'string'}, } bold_iqms_schema = { 'aor': { 'type': 'float', 'required': True }, 'aqi': { 'type': 'float', 'required': True }, 'dummy_trs': {'type': 'integer'}, 'dvars_nstd': { 'type': 'float', 'required': True }, 'dvars_std': { 'type': 'float', 'required': True }, 'dvars_vstd': { 'type': 'float', 'required': True }, 'efc': { 'type': 'float', 'required': True }, 'fber': { 'type': 'float', 'required': True }, 'fd_mean': { 'type': 'float', 'required': True }, 'fd_num': { 'type': 'float', 'required': True }, 'fd_perc': { 'type': 'float', 'required': True }, 'fwhm_avg': { 'type': 'float', 'required': True }, 'fwhm_x': { 'type': 'float', 'required': True }, 'fwhm_y': { 'type': 'float', 'required': True }, 'fwhm_z': { 'type': 'float', 'required': True }, 'gcor': { 'type': 'float', 'required': True }, 'gsr_x': { 'type': 'float', 'required': True }, 'gsr_y': { 'type': 'float', 'required': True }, 'size_t': { 'type': 'float', 'required': True }, 'size_x': { 'type': 'float', 'required': True }, 'size_y': { 'type': 'float', 'required': True }, 'size_z': { 'type': 'float', 'required': True }, 'snr': { 'type': 'float', 'required': True }, 'spacing_tr': { 'type': 'float', 'required': True }, 'spacing_x': { 'type': 'float', 'required': True }, 'spacing_y': { 'type': 'float', 'required': True }, 'spacing_z': { 'type': 'float', 'required': True }, 'summary_bg_k': { 'type': 'float', 'required': True }, 'summary_bg_mean': { 'type': 'float', 'required': True }, 'summary_bg_median': { 'type': 'float', 'required': True }, 'summary_bg_mad': { 'type': 'float', 'required': True }, 'summary_bg_p05': { 'type': 'float', 'required': True }, 'summary_bg_p95': { 'type': 'float', 'required': True }, 'summary_bg_stdv': { 'type': 'float', 'required': True }, 'summary_bg_n': { 'type': 'float', 'required': True }, 'summary_fg_k': { 'type': 'float', 'required': True }, 'summary_fg_mean': { 'type': 'float', 'required': True }, 'summary_fg_median': { 'type': 'float', 'required': True }, 'summary_fg_mad': { 'type': 'float', 'required': True }, 'summary_fg_p05': { 'type': 'float', 'required': True }, 'summary_fg_p95': { 'type': 'float', 'required': True }, 'summary_fg_stdv': { 'type': 'float', 'required': True }, 'summary_fg_n': { 'type': 'float', 'required': True }, 'tsnr': { 'type': 'float', 'required': True }, } struct_iqms_schema = { 'cjv': { 'type': 'float', 'required': True }, 'cnr': { 'type': 'float', 'required': True }, 'efc': { 'type': 'float', 'required': True }, 'fber': { 'type': 'float', 'required': True }, 'fwhm_avg': { 'type': 'float', 'required': True }, 'fwhm_x': { 'type': 'float', 'required': True }, 'fwhm_y': { 'type': 'float', 'required': True }, 'fwhm_z': { 'type': 'float', 'required': True }, 'icvs_csf': { 'type': 'float', 'required': True }, 'icvs_gm': { 'type': 'float', 'required': True }, 'icvs_wm': { 'type': 'float', 'required': True }, 'inu_med': { 'type': 'float', 'required': True }, 'inu_range': { 'type': 'float', 'required': True }, 'qi_1': { 'type': 'float', 'required': True }, 'qi_2': { 'type': 'float', 'required': True }, 'rpve_csf': { 'type': 'float', 'required': True }, 'rpve_gm': { 'type': 'float', 'required': True }, 'rpve_wm': { 'type': 'float', 'required': True }, 'size_x': { 'type': 'integer', 'required': True }, 'size_y': { 'type': 'integer', 'required': True }, 'size_z': { 'type': 'integer', 'required': True }, 'snr_csf': { 'type': 'float', 'required': True }, 'snr_gm': { 'type': 'float', 'required': True }, 'snr_total': { 'type': 'float', 'required': True }, 'snr_wm': { 'type': 'float', 'required': True }, 'snrd_csf': { 'type': 'float', 'required': True }, 'snrd_gm': { 'type': 'float', 'required': True }, 'snrd_total': { 'type': 'float', 'required': True }, 'snrd_wm': { 'type': 'float', 'required': True }, 'spacing_x': { 'type': 'float', 'required': True }, 'spacing_y': { 'type': 'float', 'required': True }, 'spacing_z': { 'type': 'float', 'required': True }, 'summary_bg_k': { 'type': 'float', 'required': True }, 'summary_bg_mean': { 'type': 'float', 'required': True }, 'summary_bg_median': { 'type': 'float' }, 'summary_bg_mad': { 'type': 'float' }, 'summary_bg_p05': { 'type': 'float', 'required': True }, 'summary_bg_p95': { 'type': 'float', 'required': True }, 'summary_bg_stdv': { 'type': 'float', 'required': True }, 'summary_bg_n': { 'type': 'float' }, 'summary_csf_k': { 'type': 'float', 'required': True }, 'summary_csf_mean': { 'type': 'float', 'required': True }, 'summary_csf_median': { 'type': 'float' }, 'summary_csf_mad': { 'type': 'float' }, 'summary_csf_p05': { 'type': 'float', 'required': True }, 'summary_csf_p95': { 'type': 'float', 'required': True }, 'summary_csf_stdv': { 'type': 'float', 'required': True }, 'summary_csf_n': { 'type': 'float' }, 'summary_gm_k': { 'type': 'float', 'required': True }, 'summary_gm_mean': { 'type': 'float', 'required': True }, 'summary_gm_median': { 'type': 'float' }, 'summary_gm_mad': { 'type': 'float' }, 'summary_gm_p05': { 'type': 'float', 'required': True }, 'summary_gm_p95': { 'type': 'float', 'required': True }, 'summary_gm_stdv': { 'type': 'float', 'required': True }, 'summary_gm_n': { 'type': 'float' }, 'summary_wm_k': { 'type': 'float', 'required': True }, 'summary_wm_mean': { 'type': 'float', 'required': True }, 'summary_wm_median': { 'type': 'float' }, 'summary_wm_mad': { 'type': 'float' }, 'summary_wm_p05': { 'type': 'float', 'required': True }, 'summary_wm_p95': { 'type': 'float', 'required': True }, 'summary_wm_stdv': { 'type': 'float', 'required': True }, 'summary_wm_n': { 'type': 'float' }, 'tpm_overlap_csf': { 'type': 'float', 'required': True }, 'tpm_overlap_gm': { 'type': 'float', 'required': True }, 'tpm_overlap_wm': { 'type': 'float', 'required': True }, 'wm2max': { 'type': 'float', 'required': True }, } rating_schema = { 'rating': { 'type': 'string', 'required': True }, 'name': { 'type': 'string', 'required': False }, 'comment': { 'type': 'string', 'required': False }, 'md5sum': { 'type': 'string', 'required': True } }
# prime.py # coding: utf-8 def primeList(num): """エラトステネスの篩を使ってn以下の素数リストを返す""" if num<1: return [] tmp=range(num+1) tmp[0],tmp[1]=False,False primes=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] for i in xrange(len(primes)): if num >= primes[i]: tmp[primes[i]::primes[i]]=[0]*(num/primes[i]) else: return primes[:i] for p in xrange(primes[len(primes)-1],num+1): if tmp[p]: primes.append(p) n=0 while p+n<len(tmp): tmp[p+n]=False n+=p return primes def isprime(num,primes=False): if not primes: primes=primeList(num) elif primes[-1]<num: primes=primeList(num) return num in primes
class Adder: ''' This class of functions contains all the additional functions required to add the website components. ''' def __init__(self): pass def addBlogsL1(self, index_file: str) -> str: ''' Function to add blogs section and meta text (comment) needed for blogpost workflow in level 1 theme. ''' L1_template = ''' <h1 style="color:#d45131"> My Latest Blogs✍️</h1> <div align='left' class="div-blog"> <!-- BLOG-POST-LIST:START --><!-- BLOG-POST-LIST:END --> </div> ''' temp_file = index_file.replace('<!-- BLOG-ENTRY -->', L1_template) return temp_file def addBlogsL2(self, index_file: str) -> str: ''' Function to add blogs section and meta text (comment) needed for blogpost workflow in level 2 theme. For theme 2, "Blogs" section needed to be added both in Menu (Navigation) bar and main section ''' nav_template = ''' <li class="nav-item"><a class="nav-link js-scroll-trigger" href="#blogs">Latest Blogs</a></li> ''' temp_file = index_file.replace( '<!-- BLOGS-NAV-ENTRY -->', nav_template) L2_template = ''' <section class="resume-section" id="blogs"> <div class="resume-section-content"> <h2 class="mb-5">Blogs</h2> <!-- BLOG-POST-LIST:START --><!-- BLOG-POST-LIST:END --> </div> </section> <hr class="m-0" /> ''' final_file = temp_file.replace('<!-- BLOGS-ENTRY -->', L2_template) return final_file def addFooter(self, index_file: str) -> str: ''' Function to add creator credits at the end of the webpage generated. ''' footer_template = '''<p class="text-info">Generated by <a href="https://github.com/kaustubhgupta">Kaustubh Gupta</a></p>''' replacement = index_file.replace( "<!-- FOOTER-ENTRY -->", footer_template) return replacement def addHackathonL1(self, hackathons: str, lastUpdated: str, intermediate: str) -> str: ''' Function to add hackathons data in level 1 theme ''' hackathonTemplate = f''' <h1 style="color:#d45131"> Hackathons I participated👇</h1> <text class="text-info">*Updated: {lastUpdated}</text> <br> {hackathons} ''' indexWithHackathon = intermediate.replace( '<!-- HACKATHON-ENTRY -->', hackathonTemplate) return indexWithHackathon def addHackathonL2(self, hackathons: str, lastUpdated: str, intermediate: str) -> str: ''' Function to add hackathons data to level 2 theme. Here, the navigation menu also needs to be updated for hackathon section. ''' nav_template = ''' <li class="nav-item"><a class="nav-link js-scroll-trigger" href="#hackathons">Hackathons</a></li> ''' indexWithNav = intermediate.replace( '<!-- HACKATHON-NAV-ENTRY -->', nav_template) hackathonTemplate = f''' <section class="resume-section" id="hackathons"> <div class="resume-section-content"> <h2 class="mb-5">Hackathons</h2> <text class="text-info">*Updated: {lastUpdated}</text> <br> {hackathons} </div> </section> <hr class="m-0" /> ''' indexWithHackathon = indexWithNav.replace( '<!-- HACKATHON-ENTRY -->', hackathonTemplate) return indexWithHackathon def addResumeL1(self, index_file: str, resume_link: str) -> str: ''' Function to add "View Resume" hyperlink in level 1 theme ''' resumeTemplate = f''' <a href="{resume_link}" target="_blank"><h2 style='color:#d45131'>👉View Resume</h2></a> ''' indexWithResume = index_file.replace( '<!-- RESUME-ENTRY -->', resumeTemplate) return indexWithResume def addResumeL2(self, index_file: str, resume_link: str) -> str: ''' Function to add "View Resume" hyperlink in level 2 theme ''' resumeTemplate = f''' <a href="{resume_link}" target="_blank"><h4 style='color:#d45131; margin:20px 0;'>View Resume</h4></a> ''' indexWithResume = index_file.replace( '<!-- RESUME-ENTRY -->', resumeTemplate) return indexWithResume def addGitHubStats(self, index_file: str, statsChoice: str, username: str, themeSelected: str, statsCustomization: str) -> str: ''' Function to add GitHub stats. Different choices will be available for each stats. Stats can be customized. ''' statsLinks = { '1': 'https://github-readme-stats.vercel.app/api?username=', '2': 'https://metrics.lecoq.io/', '3': 'https://github-profile-summary-cards.vercel.app/api/cards/profile-details?username=', '4': 'https://github-readme-streak-stats.herokuapp.com/?user=', '5': 'https://github-contribution-stats.vercel.app/api/?username=', '6': 'https://github-profile-trophy.vercel.app/?username=', '7': 'https://sourcekarma-og.vercel.app/api/', '8': 'https://activity-graph.herokuapp.com/graph?username=' } statsImgLink = statsLinks[statsChoice] + username if statsChoice == '7': statsImgLink += '/github' # if 'false' not in statsCustomization: # statsImgLink += statsCustomization if themeSelected == '2': statsImgTag = f'''<img class="img-fluid" src="{statsImgLink}">''' elif themeSelected == '1': statsImgTag = f'''<img src="{statsImgLink}">''' indexWithStats = index_file.replace( '<!-- GITHUBSTATS-ENTRY -->', statsImgTag) return indexWithStats
# https://blog.csdn.net/l153097889/article/details/48310739 class TreeNode: def __init__(self, value=None, leftNode=None, rightNode=None): self.value = value self.leftNode = leftNode self.rightNode = rightNode class Tree: def __init__(self, root=None): self.root = root def preOrder_1(self): if root is not None: stackNode = [] node = self.root stackNode.append(node) while stackNode != []: node = stackNode.pop(0) print() def preOrder_2(self): ''' stack is a queue that first in later out #1st put root 2nd put right 3nd put left :return: ''' if self.root is not None: stackNode = [] node = self.root stackNode.append(node) while stackNode != []: node = stackNode.pop() print(node.value, ) if node.rightNode: stackNode.append(node.rightNode) if node.leftNode: stackNode.append(node.leftNode) def midOrder(self): ''' :return: ''' if self.root is not None: stack_node = [] second = [] second.append(self.root) node=self.root while stack_node!=[] or node: while node!=0: stack_node.append(node) node=node.leftNode node = stack_node.pop() print(node.value) node=node.rightNode #对于一个节点而言,要实现访问顺序为左儿子-右儿子-根节点,可以利用后进先出的栈, # 在节点不为空的前提下,依次将根节点,右儿子,左儿子压栈。 # 故我们需要按照根节点-右儿子-左儿子的顺序遍历树,而我们已经知道先序遍历的顺序是根节 # 点-左儿子-右儿子,故只需将先序遍历的左右调换并把访问方式打印改为压入另一个栈即可。 # 最后一起打印栈中的元素。 def aftOrder(self): if not self.root: return stackNode = [] flag=[] node = self.root while stackNode or node: while node: stackNode.append(node) flag.append(0) node=node.leftNode node=stackNode[-1] if flag[-1]==0 and node.rightNode: node =node.rightNode flag.append(1) else: flag.pop() node=stackNode.pop() print(node.value) node = 0 def BFSOrder(self): ''' https://www.cnblogs.com/simplepaul/p/6721687.html http://www.cnblogs.com/LZYY/p/3454778.html 1.首先将根节点放入队列中。 2.当队列为非空时,循环执行步骤3到步骤5,否则执行6; 3.出队列取得一个结点,访问该结点; 4.若该结点的左子树为非空,则将该结点的左子树入队列; 5.若该结点的右子树为非空,则将该结点的右子树入队列; 6.结束。 :return: ''' if not self.root: return stack=[] stack.append(self.root) while stack: node=stack.pop(0) if node.leftNode: stack.append(node.leftNode) if node.rightNode: stack.append(node.rightNode) ## def midOrder(self): ## if not self.root: ## return ## stackNode = [] ## stackNode.append(self.root) ## while stackNode: ## node = stackNode.pop() ## if node: ## stackNode.append(node) ## node = node.leftNode ## stackNode.append(node) ## elif stackNode: ## node = stackNode.pop() ## print node.value, ## stackNode.append(node.rightNode) if __name__ is '__main__': n10 = TreeNode(10, 0, 0) n9 = TreeNode(9, 0, 0) n3 = TreeNode(3, n9, n10) n8 = TreeNode(8, 0, 0) n14 = TreeNode(14, 0, 0) n7 = TreeNode(7, 0, 0) n16 = TreeNode(16, n7, 0) n2 = TreeNode(2, n14, n8) n1 = TreeNode(1, n2, n16) root = TreeNode(4, n1, n3) tree = Tree(root) tree.BFSOrder()
# Python - 2.7.6 class Ship: def __init__(self, draft, crew): self.draft = draft self.crew = crew def is_worth_it(self): return (self.draft - self.crew * 1.5) > 20
# 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 law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. load("//go/private:providers.bzl", "GoStdLib") def _pure_transition_impl(settings, attr): return {"//go/config:pure": True} pure_transition = transition( implementation = _pure_transition_impl, inputs = ["//go/config:pure"], outputs = ["//go/config:pure"], ) def _stdlib_files_impl(ctx): # When a transition is used, ctx.attr._stdlib is a list of Target instead # of a Target. Possibly a bug? libs = ctx.attr._stdlib[0][GoStdLib].libs runfiles = ctx.runfiles(files = libs) return [DefaultInfo( files = depset(libs), runfiles = runfiles, )] stdlib_files = rule( implementation = _stdlib_files_impl, attrs = { "_stdlib": attr.label( default = "@io_bazel_rules_go//:stdlib", providers = [GoStdLib], cfg = pure_transition, # force recompilation ), "_whitelist_function_transition": attr.label( default = "@bazel_tools//tools/whitelists/function_transition_whitelist", ), }, )
def is_palindrome(word: str) -> bool: word = word.replace(' ','').lower() #Take out every space and convert to lowercase the entire string assert len(word) > 0 , 'Error: Cannot process empty words' return word == word[::-1] def main(): word: str = input('Write a word: ') if is_palindrome(word): print(f'{word} is a palindrome!') else: print(f'{word} is NOT a palindrome!') if __name__ == '__main__': main()
# Python allows you to assign values to multiple variables in one line: x, y, z = "Orange", "Banana", "Cherry" print(x) print(y) print(z) # And you can assign the same value to multiple variables in one line: x = y = z = "Orange" print(x) print(y) print(z)
frogs = input().split() while True: line = input() tokens = line.split() command = tokens[0] if command == 'Join': name = tokens[1] frogs.append(name) elif command == 'Jump': name = tokens[1] index = int(tokens[2]) if 0 <= index < len(frogs): frogs.insert(index, name) elif command == 'Dive': index = int(tokens[1]) if 0 <= index < len(frogs): frogs.pop(index) elif command == 'First': count = int(tokens[1]) frogs_to_print = frogs[:count] print(" ".join(frogs_to_print)) elif command == 'Last': count = int(tokens[1]) slice_count = len(frogs) - count frogs_to_print = frogs[slice_count:] print(" ".join(frogs_to_print)) elif command == 'Print': if tokens[1] == 'Reversed': frogs = frogs[::-1] final_frogs = " ".join(frogs) print(f'Frogs: {final_frogs}') break
print('===== DESAFIO 065 =====') op = '' count = 0 media = 0 maior = menor = 0 while op != 'n': num = int(input('digite um valor: ')) count += 1 media += num if count == 1: maior = num menor = num else: if num > maior: maior = num if num < menor: menor = num op = str(input('vc deseja continuar: ')) print(f'a media dos numeros foi de {media/count}') print(f'o maior numero foi {maior} e o menor foi {menor}')
# 🚨 Don't change the code below 👇 height = input("enter your height in m: ") weight = input("enter your weight in kg: ") # 🚨 Don't change the code above 👆 #Write your code below this line 👇 #My Solution print(int(float(weight)/(float(height)*float(height)))) #Facit bmi = int(weight) / float(height)**2 print(int(bmi))
def max_sub_array_of_size_k(k, arr): # TODO: Write your code here if not arr: return -1 curSum = 0 i = 0 j = len(arr) -1 while i < j: subarr = arr[i:k] print(subarr) total = 0 for num in subarr: total += num if total > curSum: curSum = total total = 0 else: total = 0 i += 1 k += 1 return curSum print(max_sub_array_of_size_k(3, [2, 1, 5, 1, 3, 2])) print(max_sub_array_of_size_k(2, [2, 3, 4, 1, 5])) print(max_sub_array_of_size_k(5, [10, 3, 4, 1, 5, 9, 2, 1, 8]))
# DESAFIO 1 '''nome = input('Qual o seu nome?') print('Olá', nome, '! Sejá bem-vinde!')''' # DESAFIO 2 '''dia = input('Dia: ') mes = input('Mês: ') ano = input('Ano: ') print('Você nasceu no dia:' , dia , 'de' , mes , 'de' , ano , '. Certo?')''' # DESAFIO 3 ''' Precisa especificar tipo primitivo. num1 = input('1º Número: ') num2 = input('2º Número: ') soma = num1 + num2 print(num1 , ' + ' , num2 , ' = ' , soma) '''
template = "#include \"kernel.h\"\n#include \"ecrobot_interface.h\"\n@@BALANCER@@\n@@VARIABLES@@\n\nvoid ecrobot_device_initialize(void)\n{\n@@INITHOOKS@@\n}\n\nvoid ecrobot_device_terminate(void)\n{\n@@TERMINATEHOOKS@@\n}\n\n/* nxtOSEK hook to be invoked from an ISR in category 2 */\nvoid user_1ms_isr_type2(void){ /* do nothing */ }\n\n@@CODE@@" task_template = "TASK(OSEK_Task_Number_0)\n{\n@@CODE@@\n}" template = template.replace("@@CODE@@", task_template) number_of_ports = 4 port_values = [initBlock.port_1, initBlock.port_2, initBlock.port_3, initBlock.port_4] for i in xrange(number_of_ports): init_ecrobot_color_sensor_port_s = "ecrobot_init_nxtcolorsensor(NXT_PORT_S" if port_values[i] == "Ультразвуковой сенсор": init_code.append("ecrobot_init_sonar_sensor(NXT_PORT_S" + str(i + 1) + ");\n") terminate_code.append("ecrobot_term_sonar_sensor(NXT_PORT_S" + str(i + 1) + ");\n") port_values[i] = "ecrobot_get_sonar_sensor(NXT_PORT_S" elif port_values[i] == "Сенсор цвета (все цвета)": init_code.append(init_ecrobot_color_sensor_port_s + str(i + 1) +", NXT_LIGHTSENSOR_WHITE);\n") terminate_code.append("ecrobot_term_nxtcolorsensor(NXT_PORT_S" + str(i + 1) + ");\n") port_values[i] = "ecrobot_get_light_sensor(NXT_PORT_S" elif port_values[i] == "Сенсор цвета (красный)": init_code.append(init_ecrobot_color_sensor_port_s + str(i + 1) + ", NXT_LIGHTSENSOR_RED);\n") terminate_code.append("ecrobot_term_nxtcolorsensor(NXT_PORT_S" + str(i + 1) + ");\n") port_values[i] = "ecrobot_get_light_sensor(NXT_PORT_S" elif port_values[i] == "Сенсор цвета (зеленый)": init_code.append(init_ecrobot_color_sensor_port_s + str(i + 1) + ", NXT_LIGHTSENSOR_GREEN);\n") terminate_code.append("ecrobot_term_nxtcolorsensor(NXT_PORT_S" + str(i + 1) + ");\n") port_values[i] = "ecrobot_get_light_sensor(NXT_PORT_S" elif port_values[i] == "Сенсор цвета (синий)": init_code.append(init_ecrobot_color_sensor_port_s + str(i + 1) + ", NXT_LIGHTSENSOR_BLUE);\n") terminate_code.append("ecrobot_term_nxtcolorsensor(NXT_PORT_S" + str(i + 1) + ");\n") port_values[i] = "ecrobot_get_light_sensor(NXT_PORT_S" elif port_values[i] == "Сенсор цвета (пассивный)": init_code.append(init_ecrobot_color_sensor_port_s + str(i + 1) + ", NXT_COLORSENSOR);\n") terminate_code.append("ecrobot_term_nxtcolorsensor(NXT_PORT_S" + str(i + 1) + ");\n") port_values[i] = "ecrobot_get_light_sensor(NXT_PORT_S" else: port_values[i] = "ecrobot_get_touch_sensor(NXT_PORT_S" initBlock.id = max_used_id cur_node_is_processed = True
# Time: O(n^2 * 2^n) # Space: O(1) # brute force, bitmask class Solution(object): def maximumGood(self, statements): """ :type statements: List[List[int]] :rtype: int """ def check(mask): return all(((mask>>j)&1) == statements[i][j] for i in xrange(len(statements)) if (mask>>i)&1 for j in xrange(len(statements[i])) if statements[i][j] != 2) def popcount(x): result = 0 while x: x &= x-1 result += 1 return result result = 0 for mask in xrange(1<<len(statements)): if check(mask): result = max(result, popcount(mask)) return result
# coding: utf-8 """ 一些语言相关的接口 """ class Parser(object): def __init__(self, preps=""): self.prep_strs = preps.split('!') self.preps = [] self.setup_prep() def setup_prep(self): pass def parse(self, path): """ parse """ raise NotImplementedError() def get_tokens(self): """ 获取 Tokens """ raise NotImplementedError() def get_ast(self): """ 获取 AST """ raise NotImplementedError() class Processor(object): """ 预处理/后处理器 """ def __init__(self): pass def __call__(self, *arg, **kwargs): """ 可能是针对 token 的预处理, 也可能是针对 ast 的预处理/后处理. """ raise NotImplementedError()
# Leia um valor de áreas em acres e apresente-o convertido em m². # A formula de conversão é: M = A * 4048.58 A = float(input("Digite um valor em acres: ")) M = A * 4048.58 print(f"O valor em acres para m² é: {M}")
string = "Hello world" for char in string: print(char) length = len(string) print(length)
expected_output = { 'vrf': { 'HIPTV': { 'address_family': { 'ipv4': { 'routes': { '172.25.254.37/32': { 'known_via': 'bgp 7992', 'ip': '172.25.254.37', 'metric': 0, 'installed': { 'date': 'Feb 6 13:12:22.999', 'for': '10w6d', }, 'next_hop': { 'next_hop_list': { 1: { 'index': 1, 'metric': 0, 'next_hop': '172.25.253.121', 'from': '172.25.253.121', }, }, }, 'active': True, 'distance': 20, 'route': '172.25.254.37/32', 'mask': '32', 'tag': '65525', 'type': 'external', }, }, }, }, }, }, }
class Search: def __init__(self): pass def execute(self): pass def __repr__(self): pass def __str__(self): pass class QueryBuilder: pass class Query: pass
def double_exponential_smoothing(series, initial_level, initial_trend, level_smoothing, trend_smoothing): """ Fit the trend and level to the timeseries using double exponential smoothing Args: - series: series, time-series to perform double exponential smoothing on Returns: - fit: series, double exponential smoothing fit - level: float, current level - trend: float, current trend """ # set initial level and trend level = initial_level trend = initial_trend fit = [initial_level] # apply double exponential smoothing to decompose level and trend for ind in range(1, len(series)): # predict time step projection = level + trend # update level level_new = (1 - level_smoothing) * (series[ind]) + level_smoothing * (level + trend) # update trend trend_new = (1 - trend_smoothing) * trend + trend_smoothing * (level_new - level) # append to projected fit.append(projection) # set to re-iterate trend = trend_new level = level_new return fit, trend, level
''' You are given an integer n, the number of teams in a tournament that has strange rules: - If the current number of teams is even, each team gets paired with another team. A total of n / 2 matches are played, and n / 2 teams advance to the next round. - If the current number of teams is odd, one team randomly advances in the tournament, and the rest gets paired. A total of (n - 1) / 2 matches are played, and (n - 1) / 2 + 1 teams advance to the next round. Return the number of matches played in the tournament until a winner is decided. Example: Input: n = 7 Output: 6 Explanation: Details of the tournament: - 1st Round: Teams = 7, Matches = 3, and 4 teams advance. - 2nd Round: Teams = 4, Matches = 2, and 2 teams advance. - 3rd Round: Teams = 2, Matches = 1, and 1 team is declared the winner. Total number of matches = 3 + 2 + 1 = 6. Example: Input: n = 14 Output: 13 Explanation: Details of the tournament: - 1st Round: Teams = 14, Matches = 7, and 7 teams advance. - 2nd Round: Teams = 7, Matches = 3, and 4 teams advance. - 3rd Round: Teams = 4, Matches = 2, and 2 teams advance. - 4th Round: Teams = 2, Matches = 1, and 1 team is declared the winner. Total number of matches = 7 + 3 + 2 + 1 = 13. Constraints: - 1 <= n <= 200 ''' #Difficuty: Easy #200 / 200 test cases passed. #Runtime: 32 ms #Memory Usage: 14.3 MB #Runtime: 32 ms, faster than 100.00% of Python3 online submissions for Count of Matches in Tournament. #Memory Usage: 14.3 MB, less than 33.33% of Python3 online submissions for Count of Matches in Tournament. class Solution: def numberOfMatches(self, n: int) -> int: return n - 1
# The purpose of __all__ is to define the public API of this module, and which # objects are imported if we call "from {{ cookiecutter.project_name }}.hello import *" __all__ = [ "HelloClass", "say_hello_lots", ] class HelloClass: """A class whose only purpose in life is to say hello""" def __init__(self, name: str): """ Args: name: The initial value of the name of the person who gets greeted """ #: The name of the person who gets greeted self.name = name def format_greeting(self) -> str: """Return a greeting for `name` >>> HelloClass("me").format_greeting() 'Hello me' """ greeting = f"Hello {self.name}" return greeting def say_hello_lots(hello: HelloClass = None, times=5): """Print lots of greetings using the given `HelloClass` Args: hello: A `HelloClass` that `format_greeting` will be called on. If not given, use a HelloClass with name="me" times: The number of times to call it """ if hello is None: hello = HelloClass("me") for _ in range(times): print(hello.format_greeting())
"""This problem was asked by Quora. Given an absolute pathname that may have . or .. as part of it, return the shortest standardized path. For example, given "/usr/bin/../bin/./scripts/../", return "/usr/bin/". """
def day23P1(): pullzle = "463528179" #pullzle = "389125467" cups = [int(x) for x in list(pullzle)] l = len(cups) startIdx = 0 for i in range(100): p1 = (startIdx + 1) % l p2 = (startIdx + 2) % l p3 = (startIdx + 3) % l p4 = (startIdx + 4) % l pickup = [cups[p1], cups[p2], cups[p3]] destination = cups[startIdx] - 1 nextCup = cups[p4] # find destination number while destination in pickup and destination > 0: destination -= 1 if destination == 0: destination = 9 while destination in pickup and destination > 0: destination -= 1 print(f"----move {i+1}----") print(f"cups: {cups}") print(f"current cup: {cups[startIdx]}") print(f"pick up: {pickup}") print(f"destination: {destination}") for j in range(3): cups.remove(pickup[j]) desIdx = cups.index(destination) # add pickup into cups cups = cups[:desIdx+1] + pickup + cups[desIdx+1:] # find new start startIdx = cups.index(nextCup) index1 = cups.index(1) return cups[index1+1:] + cups[:index1] class Cup(object): def __init__(self, cupNum): self.cupNum = cupNum self.next = None self.pre = None class CycleList(object): def __init__(self): self.root = Cup(0) self.current = self.root def construct(self, cups): if len(cups) == 0: print("Wrong Cups") self.root = Cup(cups[0]) self.current = self.root for i in range(1,len(cups)): cup = Cup(cups[i]) self.current.next = cup cup.pre = self.current self.current = cup self.current.next = self.root self.current = self.root def traverse(self): current = self.current while current.next != self.current: if current.cupNum == 1: self.current = current break current = current.next print(self.current.next.cupNum, self.current.next.next.cupNum) print(self.current.next.cupNum * self.current.next.next.cupNum) current = self.current while current.next != self.current: print(current.cupNum) current = current.next print(current.cupNum) def printList(self): current = self.current while current.next != self.current: print(current.cupNum, end = ' ') current = current.next print(current.cupNum) def remove(self, current): pickup = [] for i in range(3): nextCup = current.next pickup.append(nextCup.cupNum) current.next = nextCup.next return pickup def add(self, current, pickups): for i in reversed(range(3)): cup = Cup(pickups[i]) cup.next = current.next cup.pre = current current.next = cup def findDest(self, dest): current = self.current while current.cupNum != dest: current = current.next return current def move(self, numMoves, maxNum): for i in range(numMoves): # ten millision iteration print(f"----move {i + 1}----") #print(f"cups: ", end = ' ') #self.printList() pickup = self.remove(self.current) #print(f"current cup: {self.current.cupNum}") #print(f"pick up: {pickup}") destination = self.current.cupNum - 1 # find destination number while destination in pickup and destination > 0: destination -= 1 if destination == 0: destination = maxNum # one millision numbers while destination in pickup and destination > 0: destination -= 1 #print(f"destination: {destination}") des = self.findDest(destination) self.add(des, pickup) self.current = self.current.next def day23P2(): numMoves = 10000000 numCups = 1000000 maxNum = numCups pullzle = "463528179" pullzle = "389125467" init = [int(x) for x in list(pullzle)] cups = [x for x in range(numCups)] for i in range(len(init)): cups[i] = init[i] cycle = CycleList() cycle.construct(cups) cycle.move(numMoves, maxNum) cycle.traverse() if __name__ == "__main__": #value = day23P1() #print(value) day23P2()