content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
base_rf.fit(X_train, y_train) under_rf.fit(X_train, y_train) over_rf.fit(X_train, y_train) plot_roc_and_precision_recall_curves([ ("original", base_rf), ("undersampling", under_rf), ("oversampling", over_rf), ])
base_rf.fit(X_train, y_train) under_rf.fit(X_train, y_train) over_rf.fit(X_train, y_train) plot_roc_and_precision_recall_curves([('original', base_rf), ('undersampling', under_rf), ('oversampling', over_rf)])
# The view that is shown for normal use of this app # Button name for front page SUPERUSER_SETTINGS_VIEW = 'twitterapp.views.site_setup'
superuser_settings_view = 'twitterapp.views.site_setup'
'''Write a Python program to empty a variable without destroying it. Sample data: n=20 d = {"x":200} Expected Output : 0 {}''' n = 20 d = {"x":200} print(type(n)()) print(type(d)())
"""Write a Python program to empty a variable without destroying it. Sample data: n=20 d = {"x":200} Expected Output : 0 {}""" n = 20 d = {'x': 200} print(type(n)()) print(type(d)())
{ "name": "Module Wordpess Mysql", "author": "Tedezed", "version": "0.1", "frontend": "wordpress", "backend": "mysql", "check_app": True, "update_app_password": True, "update_secret": True, "executable": False, }
{'name': 'Module Wordpess Mysql', 'author': 'Tedezed', 'version': '0.1', 'frontend': 'wordpress', 'backend': 'mysql', 'check_app': True, 'update_app_password': True, 'update_secret': True, 'executable': False}
# Copyright (c) 2011-2020 Eric Froemling # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish,...
points = {} boxes = {} boxes['area_of_interest_bounds'] = (0.4687647786, 2.320345088, -3.219423694) + (0.0, 0.0, 0.0) + (21.34898078, 10.25529817, 14.67298352) points['ffa_spawn1'] = (-5.828122667, 2.301094498, -3.445694701) + (1.0, 1.0, 2.682935578) points['ffa_spawn2'] = (6.496252674, 2.397778847, -3.573241388) + (1....
#!/usr/bin/python # -*- utf-8 -*- class Solution: # @param nums, a list of integer # @param k, num of steps # @return nothing, please modify the nums list in-place. def rotate(self, nums, k): copy = [e for e in nums] l = len(nums) k = l - k % l for i in range(l): ...
class Solution: def rotate(self, nums, k): copy = [e for e in nums] l = len(nums) k = l - k % l for i in range(l): nums[i] = copy[(k + i) % l] def rotate2(self, nums, k): if not nums: return l = len(nums) for i in range(k % l): ...
# Enter your code for "camelCase" here. def to_camel(ident): def a(x): return x def b(x): return x[0].upper() + x[1::] def c(): yield a while True: yield b d = c() return "".join(d.__next__()(x) for x in ident.split("_"))
def to_camel(ident): def a(x): return x def b(x): return x[0].upper() + x[1:] def c(): yield a while True: yield b d = c() return ''.join((d.__next__()(x) for x in ident.split('_')))
# Write a program that asks the user to input any positive integer # and outputs the successive values of the following calculation. # At each step calculate the next value by taking the current value and, # if it is even, divide it by two, but if it is odd, multiply it by three and add one. # Have the program end if t...
x = int(input('Enter a positive integer and see what happens: ')) print(x) while True: if x % 2 == 0: x = x // 2 print(x) else: x = x * 3 + 1 print(x) if x == 1: break
class BatmanQuotes(object): @staticmethod def get_quote(quotes, hero): index = int(sorted(hero)[0]) return {'B':'Batman: ','R':'Robin: ','J':'Joker: '}[hero[0]] + quotes[index]
class Batmanquotes(object): @staticmethod def get_quote(quotes, hero): index = int(sorted(hero)[0]) return {'B': 'Batman: ', 'R': 'Robin: ', 'J': 'Joker: '}[hero[0]] + quotes[index]
class Node: starting = True ending = False name = "" weight = [1, 20] active = True edge_length = 0 nodes = [] def __init__(self, name, grid, posX, posY, active): self.name = name # Name of the node self.grid = grid # Which grid the node will be placed self.posX = posX # Position X on the grid s...
class Node: starting = True ending = False name = '' weight = [1, 20] active = True edge_length = 0 nodes = [] def __init__(self, name, grid, posX, posY, active): self.name = name self.grid = grid self.posX = posX self.posY = posY self.active = ac...
#!/usr/bin/env python3 dna = "ATGCAGGGGAAACATGATTCAGGAC" #Make all lowercase lowerDNA = dna.lower() #Replace the complementary ones complA = lowerDNA.replace('a','T') complAT = complA.replace('t','A') complATG = complAT.replace('g','C') complATGC = complATG.replace('c','G') #reverse the complement revDNA = complATG...
dna = 'ATGCAGGGGAAACATGATTCAGGAC' lower_dna = dna.lower() compl_a = lowerDNA.replace('a', 'T') compl_at = complA.replace('t', 'A') compl_atg = complAT.replace('g', 'C') compl_atgc = complATG.replace('c', 'G') rev_dna = complATGC[::-1] print("Original Sequence\t5'", dna, "5'") print("Complement\t\t3'", complATGC, "5'") ...
# with open("ReadMe.txt",'r') as file: # print(file.read()) # Hello from Python 201 # # Running after adding the second line to the .txt file # with open("ReadMe.txt",'r') as file: # print(file.read()) # Hello from Python 201 # # This is a new line # # Running after adding the se...
with open('ReadMe.txt', 'r') as file: content = file.read() print('The content is', content)
__all__ = ['__author__', '__license__', '__version__', '__credits__', '__maintainer__'] __author__ = 'Henrik Nyman' __license__ = 'MIT' __version__ = '0.1' __credits__ = ['Henrik Nyman'] __maintainer__ = 'Henrik Nyman'
__all__ = ['__author__', '__license__', '__version__', '__credits__', '__maintainer__'] __author__ = 'Henrik Nyman' __license__ = 'MIT' __version__ = '0.1' __credits__ = ['Henrik Nyman'] __maintainer__ = 'Henrik Nyman'
def ssort(array): for i in range(len(array)): indxMin = i for j in range(i+1, len(array)): if array[j] < array[indxMin]: indxMin = j tmp = array[indxMin] array[indxMin] = array[i] array[i] = tmp return array
def ssort(array): for i in range(len(array)): indx_min = i for j in range(i + 1, len(array)): if array[j] < array[indxMin]: indx_min = j tmp = array[indxMin] array[indxMin] = array[i] array[i] = tmp return array
depl_user = 'darulez' depl_group = 'docker' # defaults file for ansible-docker-apps-generator assembly_path = 'apps-assembly' apps_path = './apps-universe' stacks_path = './stacks-universe' default_docker_network = 'hoa_network' docker_main_sections = ['docker_from', 'docker_init', 'docker_reqs', 'docker_core', 'docker...
depl_user = 'darulez' depl_group = 'docker' assembly_path = 'apps-assembly' apps_path = './apps-universe' stacks_path = './stacks-universe' default_docker_network = 'hoa_network' docker_main_sections = ['docker_from', 'docker_init', 'docker_reqs', 'docker_core', 'docker_post']
class FastLabelException(Exception): def __init__(self, message, errcode): super(FastLabelException, self).__init__( "<Response [{}]> {}".format(errcode, message) ) self.code = errcode class FastLabelInvalidException(FastLabelException, ValueError): pass
class Fastlabelexception(Exception): def __init__(self, message, errcode): super(FastLabelException, self).__init__('<Response [{}]> {}'.format(errcode, message)) self.code = errcode class Fastlabelinvalidexception(FastLabelException, ValueError): pass
'''ALUMNA: HUAMANI TACOMA ANDY EJERCICIO : PAINT DASH GRIDS-DFS-RECURSIVE''' # DESCRIPCION: IMPLEMENTACION DE DFS-RECURSIVE PARA PINTAR LOS DASH GRIDS DE UNA MATRIZ def dfs_recursive(matrix, startX, startY, simbVisited, simbPared): # TABLERO, POSICION INICIALX, POSICION INICIALY, SIMBOLO VISITADO, SIMBOLO PA...
"""ALUMNA: HUAMANI TACOMA ANDY EJERCICIO : PAINT DASH GRIDS-DFS-RECURSIVE""" def dfs_recursive(matrix, startX, startY, simbVisited, simbPared): try: if matrix[startX][startY] != simbPared: matrix[startX][startY] = simbVisited else: print('es pared, no se pude pintar') ...
__all__ = ["PACK_HEADER_MAX"] # max scanned length of packet header PACK_HEADER_MAX = 60
__all__ = ['PACK_HEADER_MAX'] pack_header_max = 60
'''We sort a large sublist of a given list and go on reducing the size of the list until all elements are sorted.''' def shellSort(input_list): mid = len(input_list) // 2 while mid > 0: for i in range(mid, len(input_list)): temp = input_list[i] j = i # Sort t...
"""We sort a large sublist of a given list and go on reducing the size of the list until all elements are sorted.""" def shell_sort(input_list): mid = len(input_list) // 2 while mid > 0: for i in range(mid, len(input_list)): temp = input_list[i] j = i while j >= mid ...
#Esta es la respuesta del control def sumarLista(lista, largo): if (largo == 0): return 0 else: return lista[largo - 1] + sumarLista(lista, largo - 1) def Desglosar(numero:int,lista=[]): def rev(l): if len(l) == 0: return [] return [l[-1]] + rev(l[:-1]) if numero==0: ...
def sumar_lista(lista, largo): if largo == 0: return 0 else: return lista[largo - 1] + sumar_lista(lista, largo - 1) def desglosar(numero: int, lista=[]): def rev(l): if len(l) == 0: return [] return [l[-1]] + rev(l[:-1]) if numero == 0: reversa = re...
# Utility functions for incrementing counts in dictionaries or appending to a list of values def add_to_dict_num(D, k, v=1): if k in D: D[k] += v else: D[k] = v def add_to_dict_list(D, k, v): if k in D: D[k].append(v) else: D[k] = [v] def report(min_verbosity, *args): ...
def add_to_dict_num(D, k, v=1): if k in D: D[k] += v else: D[k] = v def add_to_dict_list(D, k, v): if k in D: D[k].append(v) else: D[k] = [v] def report(min_verbosity, *args): if report.verbosity >= min_verbosity: print(f'[{report.context}]', *args)
''' Created on Mar 19, 2022 @author: mballance ''' class ActivityBlockMetaT(type): def __init__(self, name, bases, dct): pass def __enter__(self): print("ActivityBlockMetaT.__enter__") def __exit__(self, t, v, tb): pass
""" Created on Mar 19, 2022 @author: mballance """ class Activityblockmetat(type): def __init__(self, name, bases, dct): pass def __enter__(self): print('ActivityBlockMetaT.__enter__') def __exit__(self, t, v, tb): pass
# -*- coding:utf-8 -*- class Solution: def LeftRotateString(self, s, n): # write code here if len(s)==0: return s s = list(s) def flip(s,start,end): for i in range(start,(start+end)//2 + 1): s[i],s[end-i+start] = s[end - i+start],s[i] ...
class Solution: def left_rotate_string(self, s, n): if len(s) == 0: return s s = list(s) def flip(s, start, end): for i in range(start, (start + end) // 2 + 1): (s[i], s[end - i + start]) = (s[end - i + start], s[i]) return s n %=...
''' question link- https://leetcode.com/problems/sum-of-all-subset-xor-totals/ Sum of All Subset XOR Totals Question statement: The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty. For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1. ''' def subse...
""" question link- https://leetcode.com/problems/sum-of-all-subset-xor-totals/ Sum of All Subset XOR Totals Question statement: The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty. For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1. """ def subse...
class Solution: def uniquePaths(self, m: int, n: int) -> int: ans = [1]*n for i in range(1,m): for j in range(1,n): ans[j] = ans[j-1] + ans[j] return ans[-1] if m and n else 0
class Solution: def unique_paths(self, m: int, n: int) -> int: ans = [1] * n for i in range(1, m): for j in range(1, n): ans[j] = ans[j - 1] + ans[j] return ans[-1] if m and n else 0
''' Write a Python program to compute the sum of all items of a given array of integers where each integer is multiplied by its index. Return 0 if there is no number. Sample Input: [1,2,3,4] [-1,-2,-3,-4] [] Sample Output: 20 -20 0 ''' def sum_index_multiplier(nums): # use enumerate to return count and value ...
""" Write a Python program to compute the sum of all items of a given array of integers where each integer is multiplied by its index. Return 0 if there is no number. Sample Input: [1,2,3,4] [-1,-2,-3,-4] [] Sample Output: 20 -20 0 """ def sum_index_multiplier(nums): return sum((j * i for (i, j) in enumerate(nums)...
class Node: def __init__(self, data=None): self.data = data self.left = None self.right = None class BinaryTree: def __init__(self, root): self.root = Node(root) def display(self, start, traversal=""): if start != None: traversal += (str(...
class Node: def __init__(self, data=None): self.data = data self.left = None self.right = None class Binarytree: def __init__(self, root): self.root = node(root) def display(self, start, traversal=''): if start != None: traversal += str(start.data) + '...
class Solution: def expandFromMiddle(self, s:str, l:int, r:int): while (l >= 0 and r < len(s) and s[l] == s[r]): l -= 1 r += 1 return (r - l - 1) def longestPalindrome(self, s: str) -> str: if len(s) < 1: return 0 start = 0 end = 0 ...
class Solution: def expand_from_middle(self, s: str, l: int, r: int): while l >= 0 and r < len(s) and (s[l] == s[r]): l -= 1 r += 1 return r - l - 1 def longest_palindrome(self, s: str) -> str: if len(s) < 1: return 0 start = 0 end = ...
class Paddle(): def __init__(self, x1, x2 , y1, y2): self.x1 = x1 self.y1 = y1 self.x2 = x2 self.y2 = y2 #private method def __setPaddleRight(self): self.x1 = 4 self.x2 = 4 self.y1 = 0 self.y2 = 1 display.set_pixel(self.x1, self.y1, 9)...
class Paddle: def __init__(self, x1, x2, y1, y2): self.x1 = x1 self.y1 = y1 self.x2 = x2 self.y2 = y2 def __set_paddle_right(self): self.x1 = 4 self.x2 = 4 self.y1 = 0 self.y2 = 1 display.set_pixel(self.x1, self.y1, 9) display.set...
N, C, S, *l = map(int, open(0).read().split()) c = 0 S -= 1 ans = 0 for i in l: ans += c == S c = (c+i+N)%N ans += c == S print(ans)
(n, c, s, *l) = map(int, open(0).read().split()) c = 0 s -= 1 ans = 0 for i in l: ans += c == S c = (c + i + N) % N ans += c == S print(ans)
def mensagem(cor='', msg='', firula='', tamanho=0): if '\n' in msg: linha = msg.find('\n') else: linha = len(msg) limpa = '\033[m' if tamanho == 0: tamanho = firula * (linha + 4) if firula == '': print(f'{cor} {msg} {limpa}') else: print(f'{cor}{tamanho}...
def mensagem(cor='', msg='', firula='', tamanho=0): if '\n' in msg: linha = msg.find('\n') else: linha = len(msg) limpa = '\x1b[m' if tamanho == 0: tamanho = firula * (linha + 4) if firula == '': print(f'{cor} {msg} {limpa}') else: print(f'{cor}{tamanho}...
''' Leetcode Problem number 687. Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root. The length of path between two nodes is represented by the number of edges between them. ''' class Solution: def longestUn...
""" Leetcode Problem number 687. Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root. The length of path between two nodes is represented by the number of edges between them. """ class Solution: def longest_univ...
class Except(Exception): def __init__(*args, **kwargs): Exception.__init__(*args, **kwargs) def CheckExceptions(data): raise Except(data)
class Except(Exception): def __init__(*args, **kwargs): Exception.__init__(*args, **kwargs) def check_exceptions(data): raise except(data)
del_items(0x80145350) SetType(0x80145350, "void _cd_seek(int sec)") del_items(0x801453BC) SetType(0x801453BC, "void init_cdstream(int chunksize, unsigned char *buf, int bufsize)") del_items(0x801453E4) SetType(0x801453E4, "void flush_cdstream()") del_items(0x80145438) SetType(0x80145438, "void reset_cdstream()") del_it...
del_items(2148815696) set_type(2148815696, 'void _cd_seek(int sec)') del_items(2148815804) set_type(2148815804, 'void init_cdstream(int chunksize, unsigned char *buf, int bufsize)') del_items(2148815844) set_type(2148815844, 'void flush_cdstream()') del_items(2148815928) set_type(2148815928, 'void reset_cdstream()') de...
# Sets an error rate of %0.025 (1 in 4,000) with a capacity of 5MM items. # See https://hur.st/bloomfilter/?n=5000000&p=0.00025&m=& for more information # 5MM was chosen for being a whole number roughly 2x the size of our most dense sparse plugin output in late July 2020. DEFAULT_ERROR_RATE = 0.00025 DEFAULT_CAPACITY ...
default_error_rate = 0.00025 default_capacity = 5000000 key_prefix = 'fwan_dataset_bf:' exclusions = ['augeas', 'file_hashes', 'file_tree', 'file_type', 'unpack_report', 'unpack_failed', 'printable_strings'] exclusion_prefixes = ['firmware_cpes', 'sbom', 'similarity_hash']
fp = open("./packet.csv", "r") vals = fp.readlines() count = 1 pre_val = 0 current = 0 sampling_rate = 31 val_bins = [] for i in range(len(vals)): pre_val = current current = int(vals[i]) if current == pre_val: count = count + 1 else: count = 1 if count == sampling_rate: ...
fp = open('./packet.csv', 'r') vals = fp.readlines() count = 1 pre_val = 0 current = 0 sampling_rate = 31 val_bins = [] for i in range(len(vals)): pre_val = current current = int(vals[i]) if current == pre_val: count = count + 1 else: count = 1 if count == sampling_rate: val_...
''' Specifies the username and password required to log into the iNaturalist website. These variables are imported into the 'inaturalist_scraper.py' script ''' username = 'your_iNaturalist_username_here' password = 'your_iNaturalist_password_here'
""" Specifies the username and password required to log into the iNaturalist website. These variables are imported into the 'inaturalist_scraper.py' script """ username = 'your_iNaturalist_username_here' password = 'your_iNaturalist_password_here'
FRONT_LEFT_WHEEL_TOPIC = "/capo_front_left_wheel_controller/command" FRONT_RIGHT_WHEEL_TOPIC = "/capo_front_right_wheel_controller/command" # BACK_RIGHT_WHEEL_TOPIC = "/capo_rear_left_wheel_controller/command", # BACK_LEFT_WHEEL_TOPIC = "/capo_rear_right_wheel_controller/command" HEAD_JOINT_TOPIC = "/capo_head_rotatio...
front_left_wheel_topic = '/capo_front_left_wheel_controller/command' front_right_wheel_topic = '/capo_front_right_wheel_controller/command' head_joint_topic = '/capo_head_rotation_controller/command' capo_joint_states = '/joint_states' topnav_feedback_topic = '/topnav/feedback' topnav_guidelines_topic = 'topnav/guideli...
# -*- coding:utf-8 -*- pizzas = ['fruit', 'buff', 'milk', 'zhishi', 'little'] # for pizza in pizzas: # print(pizza) # print(pizza.title() + ", I like eat !") # print("I like eat pizza!") pizzas_bak = pizzas[:] pizzas.append('chicken') pizzas_bak.append('dog') print(pizzas_bak) print(pizzas)
pizzas = ['fruit', 'buff', 'milk', 'zhishi', 'little'] pizzas_bak = pizzas[:] pizzas.append('chicken') pizzas_bak.append('dog') print(pizzas_bak) print(pizzas)
class Solution: def reformatDate(self, date: str) -> str: pattern = re.compile(r'[0-9]+') dateList=date.split(' ') day=pattern.findall(dateList[0])[0] monthList=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] month=monthList.index(da...
class Solution: def reformat_date(self, date: str) -> str: pattern = re.compile('[0-9]+') date_list = date.split(' ') day = pattern.findall(dateList[0])[0] month_list = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] month = monthList.ind...
inp = open('input_d24.txt').read().strip().split('\n') graph = dict() n = 0 yn = len(inp) xn = len(inp[0]) poss = '01234567' def find_n(ton): for y in range(len(inp)): for x in range(len(inp[y])): if inp[y][x] == str(ton): return (x,y) def exists(n, found): for ele in lis...
inp = open('input_d24.txt').read().strip().split('\n') graph = dict() n = 0 yn = len(inp) xn = len(inp[0]) poss = '01234567' def find_n(ton): for y in range(len(inp)): for x in range(len(inp[y])): if inp[y][x] == str(ton): return (x, y) def exists(n, found): for ele in list...
array = [] for i in range (16): # array.append([i,0]) array.append([i,5]) print(array)
array = [] for i in range(16): array.append([i, 5]) print(array)
# # PySNMP MIB module Juniper-PPPOE-PROFILE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-PPPOE-PROFILE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:03:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ...
class Solution(object): def isValidSudoku(self, board): return (self.is_row_valid(board) and self.is_col_valid(board) and self.is_square_valid(board)) def is_row_valid(self, board): for row in board: if not self.is_unit_valid(row): ...
class Solution(object): def is_valid_sudoku(self, board): return self.is_row_valid(board) and self.is_col_valid(board) and self.is_square_valid(board) def is_row_valid(self, board): for row in board: if not self.is_unit_valid(row): return False return True ...
n = int(input()) D = [list(map(int,input().split())) for i in range(n)] D.sort(key = lambda t: t[0]) S = 0 for i in D: S += i[1] S = (S+1)//2 S2 = 0 for i in D: S2 += i[1] if S2 >= S: print(i[0]) break
n = int(input()) d = [list(map(int, input().split())) for i in range(n)] D.sort(key=lambda t: t[0]) s = 0 for i in D: s += i[1] s = (S + 1) // 2 s2 = 0 for i in D: s2 += i[1] if S2 >= S: print(i[0]) break
#!/usr/local/bin/python3 # Copyright 2019 NineFx Inc. # Justin Baum # 20 May 2019 # Precis Code-Generator ReasonML # https://github.com/NineFX/smeagol/blob/master/spec/code_gen/precis_cp.txt fp = open('unicodedata.txt', 'r') ranges = [] line = fp.readline() prev = "" start = 0 while line: if len(line) < 2: break...
fp = open('unicodedata.txt', 'r') ranges = [] line = fp.readline() prev = '' start = 0 while line: if len(line) < 2: break linesplit = line.split(';') if ', First' in line: nextline = fp.readline().split(';') start = int(linesplit[0], 16) finish = int(nextline[0], 16) ...
# Public Attributes class Employee: def __init__(self, ID, salary): # all properties are public self.ID = ID self.salary = salary def displayID(self): print("ID:", self.ID) Steve = Employee(3789, 2500) Steve.displayID() print(Steve.salary)
class Employee: def __init__(self, ID, salary): self.ID = ID self.salary = salary def display_id(self): print('ID:', self.ID) steve = employee(3789, 2500) Steve.displayID() print(Steve.salary)
m: int; n: int; j: int; i: int m = int(input("Quantas linhas vai ter cada matriz? ")) n = int(input("Quantas colunas vai ter cada matriz? ")) A: [[int]] = [[0 for x in range(n)] for x in range(m)] B: [[int]] = [[0 for x in range(n)] for x in range(m)] C: [[int]] = [[0 for x in range(n)] for x in range(m)] print("Dig...
m: int n: int j: int i: int m = int(input('Quantas linhas vai ter cada matriz? ')) n = int(input('Quantas colunas vai ter cada matriz? ')) a: [[int]] = [[0 for x in range(n)] for x in range(m)] b: [[int]] = [[0 for x in range(n)] for x in range(m)] c: [[int]] = [[0 for x in range(n)] for x in range(m)] print('Digite os...
# class Tree: # def __init__(self, val, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def solve(self, root): stack = [] stack.append(root) level = -1 min_sum = float('inf') l = 0 ...
class Solution: def solve(self, root): stack = [] stack.append(root) level = -1 min_sum = float('inf') l = 0 while stack: new = [] s = 0 for node in stack: if node.left: new.append(node.left) ...
def ack ( m, n ): ''' ack: Evaluates Ackermann function with the given arguments m: Positive integer value n: Positive integer value ''' # Guard against error from incorrect input if n < 0 or (not isinstance(n, int)): return "Error: n is either negative or not an integer" if...
def ack(m, n): """ ack: Evaluates Ackermann function with the given arguments m: Positive integer value n: Positive integer value """ if n < 0 or not isinstance(n, int): return 'Error: n is either negative or not an integer' if m < 0 or not isinstance(m, int): return 'Er...
def love(): lover = 'sure' lover
def love(): lover = 'sure' lover
# class OtsUtil(object): STEP_THRESHOLD = 408 step = 0 @staticmethod def log(msg): if OtsUtil.step >= OtsUtil.STEP_THRESHOLD: print(msg)
class Otsutil(object): step_threshold = 408 step = 0 @staticmethod def log(msg): if OtsUtil.step >= OtsUtil.STEP_THRESHOLD: print(msg)
#Program to Remove Punctuations From a String string="Wow! What a beautiful nature!" new_string=string.replace("!","") print(new_string)
string = 'Wow! What a beautiful nature!' new_string = string.replace('!', '') print(new_string)
def condensate_to_gas_equivalence(api, stb): "Derivation from real gas equation" Tsc = 519.57 # standard temp in Rankine psc = 14.7 # standard pressure in psi R = 10.732 rho_w = 350.16 # water density in lbm/STB so = 141.5 / (api + 131.5) # so: specific gravity of oil (dimensionless) Mo = 5854 / (api - 8...
def condensate_to_gas_equivalence(api, stb): """Derivation from real gas equation""" tsc = 519.57 psc = 14.7 r = 10.732 rho_w = 350.16 so = 141.5 / (api + 131.5) mo = 5854 / (api - 8.811) n = rho_w * so / Mo v1stb = n * R * Tsc / psc v = V1stb * stb return V def general_equi...
def fibonacci(): number = 0 previous_number = 1 while True: if number == 0: yield number number += previous_number if number == 1: yield number number += previous_number if number == 2: yield previous_number if numbe...
def fibonacci(): number = 0 previous_number = 1 while True: if number == 0: yield number number += previous_number if number == 1: yield number number += previous_number if number == 2: yield previous_number if numbe...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def __repr__(self): return str(self.data) def count_unival_trees(root): if not root: return 0 elif not root.left and not root.right: return 1 elif not root....
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def __repr__(self): return str(self.data) def count_unival_trees(root): if not root: return 0 elif not root.left and (not root.right): return 1 elif not root.l...
# List Operations and Functions # '+' Operator print('-----------+ Operator------------') a = [1,2,3] b = [4,5,6] c = a + b print(c) print('----------* Operator--------------') # '*' Operator a1 = a * 2 print(a1) print('--------len function----------------') print(len(a)) print('--------max function----------------') ...
print('-----------+ Operator------------') a = [1, 2, 3] b = [4, 5, 6] c = a + b print(c) print('----------* Operator--------------') a1 = a * 2 print(a1) print('--------len function----------------') print(len(a)) print('--------max function----------------') print(max(a)) print('--------min function----------------')...
{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "9de928d7", "metadata": {}, "outputs": [], "source": [ "import os\n", "import csv\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "id": "8f1478f8", "metadata": {}, "outputs"...
{'cells': [{'cell_type': 'code', 'execution_count': 1, 'id': '9de928d7', 'metadata': {}, 'outputs': [], 'source': ['import os\n', 'import csv\n', 'import pandas as pd']}, {'cell_type': 'code', 'execution_count': 2, 'id': '8f1478f8', 'metadata': {}, 'outputs': [], 'source': ['#Set Path\n', "pollCSV = os.path.join('Resou...
text = input().split(' ') new_text = '' for word in text: if len(word) > 4: if word[:2] in word[2:]: word = word[2:] new_text += ' ' + word print(new_text[1:])
text = input().split(' ') new_text = '' for word in text: if len(word) > 4: if word[:2] in word[2:]: word = word[2:] new_text += ' ' + word print(new_text[1:])
class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: if len(strs) == 0: return "" resLen = 0 while True: if len(strs[0]) == resLen: return strs[0] curChar = strs[0][resLen] for i in range(1, len(strs)): ...
class Solution: def longest_common_prefix(self, strs: List[str]) -> str: if len(strs) == 0: return '' res_len = 0 while True: if len(strs[0]) == resLen: return strs[0] cur_char = strs[0][resLen] for i in range(1, len(strs)): ...
#!python3 # -*- coding:utf-8 -*- ''' this code is a sample of code for learn how to use python test modules. ''' def aaa(): ''' printing tree ! mark. ''' print("!!!") def bbb(): ''' printing tree chars. ''' print("BBB") def ccc(): ''' printing number with loop. '...
""" this code is a sample of code for learn how to use python test modules. """ def aaa(): """ printing tree ! mark. """ print('!!!') def bbb(): """ printing tree chars. """ print('BBB') def ccc(): """ printing number with loop. """ for i in range(5): pr...
# Project Framework default is 1 (Model/View/Provider) # src is source where is the lib folder located def startmain(src="flutterproject/myapp/lib", pkg="Provider", file="app_widget", home="", project_framework=1, autoconfigfile=True): maindart = open(src + "/main.dart", "w") if project_f...
def startmain(src='flutterproject/myapp/lib', pkg='Provider', file='app_widget', home='', project_framework=1, autoconfigfile=True): maindart = open(src + '/main.dart', 'w') if project_framework == 1: maindart.write("import 'package:flutter/material.dart';\nimport '" + pkg + '/' + file + ".dart';\n\nvoi...
# Avg week temperature print("Enter temperatures of 7 days:") a = float(input()) b = float(input()) c = float(input()) d = float(input()) e = float(input()) f = float(input()) g = float(input()) print("Average temperature:", (a+b+c+d+e+f+g)/7)
print('Enter temperatures of 7 days:') a = float(input()) b = float(input()) c = float(input()) d = float(input()) e = float(input()) f = float(input()) g = float(input()) print('Average temperature:', (a + b + c + d + e + f + g) / 7)
def digitSum(n,step): res=0 while(n>0): res+=n%10 n=n//10 step+=1 if(res<=9): return (res,step) else: return digitSum(res,step) t=int(input()) for _ in range(t): minstep=[99999999 for i in range(10)] #cache hitratio=[0 for i in range(10)] maxhit=0 n,d=[int(x) for x in input().strip().split()] if(n...
def digit_sum(n, step): res = 0 while n > 0: res += n % 10 n = n // 10 step += 1 if res <= 9: return (res, step) else: return digit_sum(res, step) t = int(input()) for _ in range(t): minstep = [99999999 for i in range(10)] hitratio = [0 for i in range(10)] ...
###################################################### # # # author # # Parth Lathiya # # https://www.cse.iitb.ac.in/~parthiitb/ # # # ###################################################### at =...
at = int(input().strip()) for att in range(at): u = list(map(int, input().strip().split())) u.remove(len(u) - 1) print(max(u))
# 15/15 num_of_flicks = int(input()) art = [] for _ in range(num_of_flicks): coords = input().split(",") art.append((int(coords[0]), int(coords[1]))) lowest_x = min(art, key=lambda x: x[0])[0] - 1 lowest_y = min(art, key=lambda x: x[1])[1] - 1 highest_x = max(art, key=lambda x: x[0])[0] + 1 highest_y = max...
num_of_flicks = int(input()) art = [] for _ in range(num_of_flicks): coords = input().split(',') art.append((int(coords[0]), int(coords[1]))) lowest_x = min(art, key=lambda x: x[0])[0] - 1 lowest_y = min(art, key=lambda x: x[1])[1] - 1 highest_x = max(art, key=lambda x: x[0])[0] + 1 highest_y = max(art, key=lam...
print("Leap Year Range Calculator: ") year1=int(input("Enter First Year: ")) year2 = int(input("Enter Last Year: ")) while year1<=year2: if year1 % 4 == 0 : print(year1,"is a leap year") year1= year1 + 1
print('Leap Year Range Calculator: ') year1 = int(input('Enter First Year: ')) year2 = int(input('Enter Last Year: ')) while year1 <= year2: if year1 % 4 == 0: print(year1, 'is a leap year') year1 = year1 + 1
# # PySNMP MIB module MITEL-IPVIRTUAL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MITEL-IPVIRTUAL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:03:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint) ...
def Reverse(Dna): tt = { 'A' : 'T', 'T' : 'A', 'G' : 'C', 'C' : 'G', } ans = '' for a in Dna: ans += tt[a] return ans[::-1] def main(infile, outfile): # Read the input, but do something non-trivial instead of count the lines in the file inp = lines =...
def reverse(Dna): tt = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'} ans = '' for a in Dna: ans += tt[a] return ans[::-1] def main(infile, outfile): inp = lines = [line.rstrip('\n') for line in infile] print(inp) output = str(reverse(inp[0])) print(output) outfile.write(output)
# configuracoes pessoais PERSONAL_NAME = 'YOU' # configuracoes de email EMAIL = 'your gmail account' PASSWORD = 'your gmail PASSWORD' RECEIVER_EMAIL = 'email to forward the contact messages' # configuracoes do Google ReCaptha SECRET_KEY = "Google ReCaptha's Secret key" SITE_KEY = "Google ReCaptha's Site key" APP_SEC...
personal_name = 'YOU' email = 'your gmail account' password = 'your gmail PASSWORD' receiver_email = 'email to forward the contact messages' secret_key = "Google ReCaptha's Secret key" site_key = "Google ReCaptha's Site key" app_secret_key = '65#9DMN_T' skills = [{'name': 'Quick learner', 'strength': '90%'}, {'name': '...
def test(): a = 10 fun1 = lambda: a fun1() print(a) a += 1 fun1() print(a) return fun1 fun = test() print(f"Fun: {fun()}")
def test(): a = 10 fun1 = lambda : a fun1() print(a) a += 1 fun1() print(a) return fun1 fun = test() print(f'Fun: {fun()}')
class DmpIo(): def __init__(self): # inputs self.event = None self.username = None self.password = None
class Dmpio: def __init__(self): self.event = None self.username = None self.password = None
# # PySNMP MIB module CISCO-STACK-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-STACK-CAPABILITY # Produced by pysmi-0.3.4 at Wed May 1 12:12:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint) ...
description = 'system setup' group = 'lowlevel' sysconfig = dict( cache='localhost', instrument='ESTIA', experiment='Exp', datasinks=['conssink', 'filesink', 'daemonsink'], ) modules = ['nicos.commands.standard'] includes = ['temp'] devices = dict( ESTIA=device('nicos.devices.instrument.Instrum...
description = 'system setup' group = 'lowlevel' sysconfig = dict(cache='localhost', instrument='ESTIA', experiment='Exp', datasinks=['conssink', 'filesink', 'daemonsink']) modules = ['nicos.commands.standard'] includes = ['temp'] devices = dict(ESTIA=device('nicos.devices.instrument.Instrument', description='instrument...
a = float(input()) b = float(input()) c = float(input()) media = (a * 2 + b * 3 + c * 5) / (2 + 3 + 5) print("MEDIA = {:.1f}".format(media))
a = float(input()) b = float(input()) c = float(input()) media = (a * 2 + b * 3 + c * 5) / (2 + 3 + 5) print('MEDIA = {:.1f}'.format(media))
#Aula 7 #Dicionarios lista = [] # dicionario = {'Nome':'Matheus', 'Sobrenome': 'Schuetz' } # print(dicionario) # print(dicionario['Sobrenome']) nome = 'Maria' lista_notas = [10,20,50,70] media = sum(lista_notas)/len(lista_notas) situacao = 'Reprovado' if media >=7: situacao = 'Aprovado' dicionario_alunos = {'No...
lista = [] nome = 'Maria' lista_notas = [10, 20, 50, 70] media = sum(lista_notas) / len(lista_notas) situacao = 'Reprovado' if media >= 7: situacao = 'Aprovado' dicionario_alunos = {'Nome': nome, 'Lista_Notas': lista_notas, 'Media': media, 'Situacao': situacao} print(f"{dicionario_alunos['Nome']} - {dicionario_alun...
TEACHER_AUTHORITIES = [ 'VIEW_PROFILE', 'JUDGE_TASK', 'SHARE_TASK', 'VIEW_ABSENT', 'SUBMIT_LESSON', 'VIEW_LESSON', 'VIEW_ACTIVITY', 'EDIT_PROFILE', 'GIVE_TASK', 'VIEW_TASK', 'ADD_ABSENT' ] STUDENT_AUTHORITIES = [ 'VIEW_PROFILE', 'VIEW_LESSON', 'VIEW_ACTIVITY', 'VIEW_TASK_FRAGMENT', 'DOING_TASK', 'VIEW...
teacher_authorities = ['VIEW_PROFILE', 'JUDGE_TASK', 'SHARE_TASK', 'VIEW_ABSENT', 'SUBMIT_LESSON', 'VIEW_LESSON', 'VIEW_ACTIVITY', 'EDIT_PROFILE', 'GIVE_TASK', 'VIEW_TASK', 'ADD_ABSENT'] student_authorities = ['VIEW_PROFILE', 'VIEW_LESSON', 'VIEW_ACTIVITY', 'VIEW_TASK_FRAGMENT', 'DOING_TASK', 'VIEW_ABSENT', 'EDIT_PROFI...
def _init(): global _global_dict _global_dict = {} def set_value(key, value): _global_dict[key] = value def get_value(key): return _global_dict.get(key) _init()
def _init(): global _global_dict _global_dict = {} def set_value(key, value): _global_dict[key] = value def get_value(key): return _global_dict.get(key) _init()
# # PySNMP MIB module CISCO-VLAN-GROUP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-VLAN-GROUP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:02:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ...
def hello_world(): print("hello world") # [REQ-002] def hello_world_2(): print("hello world") # [/REQ-002]
def hello_world(): print('hello world') def hello_world_2(): print('hello world')
class Solution: def solve(self, s, pairs): letters = set(ascii_lowercase) leaders = {letter:letter for letter in letters} followers = {letter:[letter] for letter in letters} for a,b in pairs: if leaders[a] == leaders[b]: continue if len(followers...
class Solution: def solve(self, s, pairs): letters = set(ascii_lowercase) leaders = {letter: letter for letter in letters} followers = {letter: [letter] for letter in letters} for (a, b) in pairs: if leaders[a] == leaders[b]: continue if len(f...
prompt = "How old are you?" message = "" while message != 'quit': message = input(prompt) if message != 'quit': age = int(message) if age < 3: print("Free") elif age < 12: print("The fare is 10 dollar") else: print("The fare is 15 dollar")
prompt = 'How old are you?' message = '' while message != 'quit': message = input(prompt) if message != 'quit': age = int(message) if age < 3: print('Free') elif age < 12: print('The fare is 10 dollar') else: print('The fare is 15 dollar')
# Variables first_name = "Ada" # print function followed by variable name. print("Hello,", first_name) print(first_name, "is learning Python") # print takes multiple arguments. print("These", "will be", "joined together by spaces") # input statement. first_name = input("What is your first name? ") print("Hello,", fi...
first_name = 'Ada' print('Hello,', first_name) print(first_name, 'is learning Python') print('These', 'will be', 'joined together by spaces') first_name = input('What is your first name? ') print('Hello,', first_name)
def extractThehlifestyleCom(item): ''' Parser for 'thehlifestyle.com' ''' tstr = str(item['tags']).lower() if 'review' in tstr: return None if 'actors' in tstr: return None if 'game' in tstr: return None vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "...
def extract_thehlifestyle_com(item): """ Parser for 'thehlifestyle.com' """ tstr = str(item['tags']).lower() if 'review' in tstr: return None if 'actors' in tstr: return None if 'game' in tstr: return None (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix...
ATTACK = '-' SUPPORT = '+' NEUTRAL = '0' CRITICAL_SUPPORT = '+!' CRITICAL_ATTACK = '-!' WEAK_SUPPORT = '+*' WEAK_ATTACK = '-*' NON_SUPPORT = '+~' NON_ATTACK = '-~' TRIPOLAR_RELATIONS = [ATTACK, SUPPORT, NEUTRAL] QUADPOLAR_RELATIONS = [ATTACK, SUPPORT, NEUTRAL, CRITICAL_SUPPORT] def get_type(val): if val > 0: ...
attack = '-' support = '+' neutral = '0' critical_support = '+!' critical_attack = '-!' weak_support = '+*' weak_attack = '-*' non_support = '+~' non_attack = '-~' tripolar_relations = [ATTACK, SUPPORT, NEUTRAL] quadpolar_relations = [ATTACK, SUPPORT, NEUTRAL, CRITICAL_SUPPORT] def get_type(val): if val > 0: ...
# repeating strings s = "?" for i in range(4): print(s, end="") print() print(s * 4) # looping strings text = "This is an example." count = 0 for char in text: # isalpha() returns true if the character is a-z if char.isalpha(): count += 1
s = '?' for i in range(4): print(s, end='') print() print(s * 4) text = 'This is an example.' count = 0 for char in text: if char.isalpha(): count += 1
CREDENTIALS = { 'username': 'Replace with your WA username', 'password': 'Replace with your WA password (b64)' } DEFAULT_RECIPIENTS = ('single-user@s.whatsapp.net', 'group-chat@g.us',) HOST_NOTIFICATION = '%(emoji)s %(type)s HOST ALERT %(emoji)s\n\n' + \ 'Host %(host)s, %(address)s is %(st...
credentials = {'username': 'Replace with your WA username', 'password': 'Replace with your WA password (b64)'} default_recipients = ('single-user@s.whatsapp.net', 'group-chat@g.us') host_notification = '%(emoji)s %(type)s HOST ALERT %(emoji)s\n\n' + 'Host %(host)s, %(address)s is %(state)s.\n\n' + '%(info)s\n\n' + '%(t...
'''9. Write a Python program to get the difference between the two lists. ''' def difference_twoLists(lst1, lst2): lst1 = set(lst1) lst2 = set(lst2) return list(lst1 - lst2) print(difference_twoLists([1, 2, 3, 4], [4, 5, 6, 7])) print(difference_twoLists([1, 2, 3, 4], [0, 5, 6, 7])) print(difference_twoLis...
"""9. Write a Python program to get the difference between the two lists. """ def difference_two_lists(lst1, lst2): lst1 = set(lst1) lst2 = set(lst2) return list(lst1 - lst2) print(difference_two_lists([1, 2, 3, 4], [4, 5, 6, 7])) print(difference_two_lists([1, 2, 3, 4], [0, 5, 6, 7])) print(difference_two...
''' module for implementation of cycle sort ''' def cycle_sort(arr: list): writes = 0 for cycleStart in range(0, len(arr) - 1): item = arr[cycleStart] pos = cycleStart for i in range(cycleStart + 1, len(arr)): if (arr[i] < item): pos += 1 if (p...
""" module for implementation of cycle sort """ def cycle_sort(arr: list): writes = 0 for cycle_start in range(0, len(arr) - 1): item = arr[cycleStart] pos = cycleStart for i in range(cycleStart + 1, len(arr)): if arr[i] < item: pos += 1 if pos == cyc...
class Script: @staticmethod def main(): cities = ["Albuquerque", "Anaheim", "Anchorage", "Arlington", "Atlanta", "Aurora", "Austin", "Bakersfield", "Baltimore", "Boston", "Buffalo", "Charlotte-Mecklenburg", "Cincinnati", "Cleveland", "Colorado Springs", "Corpus Christi", "Dallas", "Denver", "Detroit", "El Paso", "...
class Script: @staticmethod def main(): cities = ['Albuquerque', 'Anaheim', 'Anchorage', 'Arlington', 'Atlanta', 'Aurora', 'Austin', 'Bakersfield', 'Baltimore', 'Boston', 'Buffalo', 'Charlotte-Mecklenburg', 'Cincinnati', 'Cleveland', 'Colorado Springs', 'Corpus Christi', 'Dallas', 'Denver', 'Detroit', ...
fig, ax = create_map_background() # Contour 1 - Temperature, dotted cs2 = ax.contour(lon, lat, tmpk_850.to('degC'), range(-50, 50, 2), colors='grey', linestyles='dotted', transform=dataproj) plt.clabel(cs2, fontsize=10, inline=1, inline_spacing=10, fmt='%i', rightside_up=True, use_clabelte...
(fig, ax) = create_map_background() cs2 = ax.contour(lon, lat, tmpk_850.to('degC'), range(-50, 50, 2), colors='grey', linestyles='dotted', transform=dataproj) plt.clabel(cs2, fontsize=10, inline=1, inline_spacing=10, fmt='%i', rightside_up=True, use_clabeltext=True) clev850 = np.arange(0, 4000, 30) cs = ax.contour(lon,...
#Ejercicio 01 def binarySearch(arr, valor): #Dado un arreglo y un elemento #Busca el elemento dado en el arreglo inicio = 0 final = len(arr) - 1 while inicio <= final: medio = (inicio + final) // 2 if arr[medio] == valor: return True elif arr[medio...
def binary_search(arr, valor): inicio = 0 final = len(arr) - 1 while inicio <= final: medio = (inicio + final) // 2 if arr[medio] == valor: return True elif arr[medio] < valor: inicio = medio + 1 elif arr[medio] > valor: final = medio - 1 ...
# William Thompson (wtt53) # Software Testing and QA # Assignment 1: Test Driven Development # Retirement: Takes current age (int), annual salary (float), # percent of annual salary saved (float), and savings goal (float) # and outputs what age savings goal will be met def calc_retirement(age, salary, percent, goal):...
def calc_retirement(age, salary, percent, goal): try: age = int(age) salary = float(salary) percent = float(percent) goal = float(goal) except Exception: return False if (age < 15 or age > 99) or salary <= 0 or percent <= 0 or (goal <= 0): return False raw...
def solution(value): print("Solution: {}".format(value))
def solution(value): print('Solution: {}'.format(value))
def test(): # Here we can either check objects created in the solution code, or the # string value of the solution, available as __solution__. A helper for # printing formatted messages is available as __msg__. See the testTemplate # in the meta.json for details. # If an assertion fails, the message...
def test(): assert not world_df is None, 'Your answer for world_df does not exist. Have you loaded the TopoJSON data to the correct variable name?' assert 'topo_feature' in __solution__, 'The loaded data should be in TopoJSON format. In order to read TopoJSON file correctly, you need to use the alt.topo_feature...
class SimpleSpriteList: def __init__(self) -> None: self.sprites = list() def draw(self) -> None: for sprite in self.sprites: sprite.draw() def update(self) -> None: for sprite in self.sprites: sprite.update() def append(self, sprite) -> None: ...
class Simplespritelist: def __init__(self) -> None: self.sprites = list() def draw(self) -> None: for sprite in self.sprites: sprite.draw() def update(self) -> None: for sprite in self.sprites: sprite.update() def append(self, sprite) -> None: ...
numberLines = int(input()) while 0 < numberLines: number = int(input()) sum = 0 for i in range(number): if i%3 == 0 or i%5 == 0: sum = sum + i print(sum) numberLines = numberLines - 1
number_lines = int(input()) while 0 < numberLines: number = int(input()) sum = 0 for i in range(number): if i % 3 == 0 or i % 5 == 0: sum = sum + i print(sum) number_lines = numberLines - 1
#Mock class for GPIO BOARD = 1 BCM = 2 OUT = 1 IN = 1 HIGH = 1 LOW = 0 def setmode(a): print ("setmode GPIO",a) def setup(a, b): print ("setup GPIO", a, b) def output(a, b): print ("output GPIO", a, b) def cleanup(): print ("cleanup GPIO", a, b) def setwarnings(flag): print ("setwarnings"...
board = 1 bcm = 2 out = 1 in = 1 high = 1 low = 0 def setmode(a): print('setmode GPIO', a) def setup(a, b): print('setup GPIO', a, b) def output(a, b): print('output GPIO', a, b) def cleanup(): print('cleanup GPIO', a, b) def setwarnings(flag): print('setwarnings', flag)
# Damage Skin - Violetta success = sm.addDamageSkin(2433197) if success: sm.chat("The Damage Skin - Violetta has been added to your account's damage skin collection.")
success = sm.addDamageSkin(2433197) if success: sm.chat("The Damage Skin - Violetta has been added to your account's damage skin collection.")
#!/usr/bin/env python3 formulas = [ "XNd perr", "PNd (PNd (call And (XNu exc)))", "PNd (han And (XNd (exc And (XBu call))))", "G (exc --> XBu call)", "T Ud exc", "PNd (PNd (T Ud exc))", "G ((call And pa And ((~ ret) Ud WRx)) --> XNu exc)", "PNd (PBu call)", "PNd (PNd (PNd (PBu call)...
formulas = ['XNd perr', 'PNd (PNd (call And (XNu exc)))', 'PNd (han And (XNd (exc And (XBu call))))', 'G (exc --> XBu call)', 'T Ud exc', 'PNd (PNd (T Ud exc))', 'G ((call And pa And ((~ ret) Ud WRx)) --> XNu exc)', 'PNd (PBu call)', 'PNd (PNd (PNd (PBu call)))', 'XNd (PNd (PBu call))', 'G ((call And pa And (PNu exc Or...