content
stringlengths
7
1.05M
def Scenario_Generation(): # first restricting the data to April 2020 when we are predicting six weeks out from april 2020 popularity_germany = np.load("./popularity_germany.npy") popularity_germany = np.copy(popularity_germany[:,0:63,:]) # april 20th is the 63rd index in the popularity number #...
def L1(y_output, y_input): """ L1 Loss Function calculates the sum of the absolute difference between the predicted and the input""" return sum(abs(y_input - y_output))
# loendur dictionary counter_dict = {} # loe failist ridade kaupa ja loendab dictionarisse erinevad nimed with open('/Users/mikksillaste/Downloads/aima-python/nameslist.txt') as f: line = f.readline() while line: line = line.strip() if line in counter_dict: counter_dict[line] += 1 ...
def eight_is_great(a, b): if a == 8 or b == 8: print(":)") elif (a + b) == 8: print(":)") else: print(":(")
'''53 Crie um programa que leia uma frase qualquer e diga se ela é um palíndromo, desconsiderando os espaços. ''' frase = str(input('Digite uma frase: ')).replace(' ', '').upper() print(f'O inverso de {frase} é {frase[::-1]}') if frase == frase[::-1]: print('A frase digitada é um palíndromo!') else: print('A f...
#ChangeRenderSetting.py ##This only use in the maya software render , not in arnold #Three main Node of Maya Render: # ->defaultRenderGlobals, defaultRenderQuality and defaultResolution # ->those are separate nodes in maya ''' import maya.cmds as cmds #Function : getRenderGlobals() #Usage : get the Value of Rend...
x = int(input()) y = int(input()) if (2 * y + 1 - x) % (y - x + 1) == 0: print("YES") else: print("NO")
# Description # Count how many nodes in a linked list. # Example # Example 1: # Input: 1->3->5->null # Output: 3 # Explanation: # return the length of the list. # Example 2: # Input: null # Output: 0 # Explanation: # return the length of list. """ Definition of ListNode class ListNode(object): def...
class Solution: def longestPalindrome(self, s: str) -> str: result = '' pal_s = set(s) if len(pal_s) == 1: return s for ind_c in range(len(s)): pal = '' ind_l = ind_c ind_r = ind_c + 1 while ind_l > -1 and ind_r < len(s): ...
print("@function from_script:thing") for i in range(10): print(f"say {i}")
nombre = input("Nombre: ") apellido = input("Apellido: ") edad_nac = input("Edad de nacimiento: ") correo1 = nombre[0] + "." + apellido + edad_nac[-2:] + "@uma.es" correo2 = nombre[:3] + apellido[:3] + edad_nac[-2:] + "@uma.es" print("Correos:", correo1, "y", correo2)
lista = list() for count in range(5): while True: num = str(input('Digite um número:\t')).strip() v = 0 for n in num: if n not in '0123456789': v += 1 if v == 0: num = int(num) break else: print("\033[31mDigite a...
#crie um porgrama que leia duas notas de um aluno e calcule sua media, #mostrando uma mensagem no final, de acordo com a media 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 nota1 = float(input('Primeira nota ')) nota2 = float(input('Segunda Nota')) ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return a ListNode def sortList(self, head): if head is None or head.next is None: return head fast...
class DiscreteActionWrapper: def __init__(self, env, n): self.env = env self.action_cont = [ # [l + (_+0.5)*(h-l)/n for _ in range(n)] # [l + _*(h-l)/(n+1) for _ in range(n)] [l + _*(h-l)/(n-1) for _ in range(n)] for h, l in zip(self.env.action_space.h...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def compare(self, lleft, rright): if (not lleft) and (not rright): return True elif (not lleft) or (not rrig...
class AbstractObserver(object): """Abstract Observer""" def __init__(self): self.is_stopped = False def next(self, value): raise NotImplementedError def error(self, error): raise NotImplementedError def completed(self): raise NotImplementedError def on_next(...
# -*- coding: utf-8 -*- def main(): n = int(input()) if n == 1: print("Hello World") else: a = int(input()) b = int(input()) print(a + b) if __name__ == '__main__': main()
class Message: def __init__(self, response, type_): self.response = response self.type = type_
#!/usr/bin/python3 MAXIMIZE = 1 MINIMIZE = 2
class StyleMapping: def __init__(self, opts): self._opts = opts def __getitem__(self, key): return getattr(self._opts, "style_{}".format(key), "").encode().decode("unicode_escape") def apply_styles(opts, command): return command.format_map(StyleMapping(opts))
# # @lc app=leetcode id=199 lang=python3 # # [199] Binary Tree Right Side View # # https://leetcode.com/problems/binary-tree-right-side-view/description/ # # algorithms # Medium (52.74%) # Likes: 1951 # Dislikes: 117 # Total Accepted: 264K # Total Submissions: 500.2K # Testcase Example: '[1,2,3,null,5,null,4]' #...
# -*- coding: utf-8 -*- """ File Name: fib.py Author : jynnezhang Date: 2020/4/30 11:16 上午 Description: 斐波那契 递归会超时! https://leetcode-cn.com/problems/fei-bo-na-qi-shu-lie-lcof/ https://leetcode-cn.com/problems/fibonacci-number/ """ class Solution: def fib(self, n: int) -> int: if n == 0: ...
#!/usr/bin/env python # _*_ coding:utf-8 _*_ ''' 函数的参数 ''' print("===============================默认参数====================================") def enroll(name, age, sex='男', city='上海'): print("姓名:" + str(name) + ",年龄:" + str(age) + ",性别:" + str(sex) + ",地址:" + str(city)) enroll("jack", "12", "女") enroll("to...
class Calculation: def __init__(cls, a, b, op): cls.a = float(a) cls.b = float(b) cls.op = op def getResult(cls): return cls.op(cls.a, cls.b)
"""Find the nth root of a number with the bisection method.""" __author__ = 'Nicola Moretto' __license__ = "MIT" def rootBisection(x, power, precision): ''' Find the nth root of a number with the bisection method. :param x: Number :param power: Root :param precision: Precision :return: power-t...
a = type('a_fyerr', (Exception,), {}) try: raise a('aa') except Exception as e: print(type(e))
#Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final, mostre: #A) Quantas vezes apareceu o valor 9. #B) Em que posição foi digitado o primeiro valor 3. #C) Quais foram os números pares. números = (int(input('Primeiro número: ')), int(input('Segundo número: ')), int(input('Terc...
expected_output = { "Tunnel0": { "nhs_ip": { "111.0.0.100": { "nhs_state": "E", "nbma_address": "111.1.1.1", "priority": 0, "cluster": 0, "req_sent": 0, "req_failed": 0, "reply_recv": ...
def main(): with open("emotions.txt", "r") as f: count = set(f.readlines()) print(count) print(len(count)) if __name__ == '__main__': main()
environmentdefs = { "local": ["localhost"], "other": ["localhost"] } roledefs = { "role": ["localhost"] } componentdefs = { "role": ["component"] }
class QueryUser: CREATE_TABLE_USERS: str = """ CREATE TABLE IF NOT EXISTS users ( user_id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL, email TEXT NOT NULL, phone TEXT NOT NULL, address TEXT NOT NULL, country TEX...
# https://leetcode.com/problems/palindrome-linked-list/submissions/ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def isPalindrome(self, head): """ :type head: Lis...
# 打印输出位的逻辑与运算的结果、逻辑或运算的结果、逻辑异或运算的结果以及取反的结果 a = int(input('正整数a:')) b = int(input('正整数b:')) w = int(input('表示位数:')) f = '{{:0{}b}}'.format(w) m = 2 ** w - 1 # w位都相当于二进制数的1 print('a = ' + f.format(a)) print('b = ' + f.format(b)) print('a & b = ' + f.format(a & b)) print('a | b = ' + f.format(a...
class Solution: def XXX(self, nums: List[int]) -> List[List[int]]: res = [[]] for num in nums: res.append([num]) for temp in res[1:-1]: res.append(temp+[num]) return res
class LCRecommendation: TURN_LEFT = -1 TURN_RIGHT = 1 STRAIGHT_AHEAD = 0 CHANGE_TO_EITHER_WAY = 2 change_lane = True change_to_either_way = False recommendation = 0 def __init__(self, lane, recommendation): self.lane = lane self.recommendation = recommendation ...
## ## this file autogenerated ## 8.4(6)5 ## jmp_esp_offset = "125.63.32.8" saferet_offset = "166.11.228.8" fix_ebp = "72" pmcheck_bounds = "0.176.88.9" pmcheck_offset = "96.186.88.9" pmcheck_code = "85.49.192.137" admauth_bounds = "0.32.8.8" admauth_offset = "240.33.8.8" admauth_code = "85.137.229.87" # "8.4(6)5" = ...
# -*- coding: utf-8 -*- # (C) shan weijia, 2018 # All rights reserved '''Description ''' __author__ = 'shan weijia <shanweijia@jiaaocap.com>' __time__ = '2018/12/22 8:10 PM' SQLALCHEMY_DATABASE_URI = "mysql://root:root@127.0.0.1:3306/test" # 配置数据库连接地址 SECRET_KEY = "cd17cb5e-fa95-45bd-98b8-fd6a8dd45957" SALT = "Goo...
# 격자판의 숫자 이어 붙이기 # DFS를 이용한 풀이 # https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV7I5fgqEogDFAXB&categoryId=AV7I5fgqEogDFAXB&categoryType=CODE t=int(input()) def dfs(x, y, l, s): s+=lis[x][y] if not l: result.add(s) return idx_x=[1,0,-1,0] idx_y=[0,1,0,-...
print('=ˆ= ' * 8) print(' TAULA DE MULTIPLICACIÓ') print('=ˆ= ' * 8) num = int(input('introduïu un número per trobar\nla taula de multiplicació: ')) print(' ' * 7, '-' * 13) x = 1 for c in range(1, 11): print(' ' * 7, '{} x {:2} = {:3}'.format(num, x, num*x)) x += 1 print(' ' * 7, '-' * 13)
# -*- encoding: utf-8 -*- """ KERI keri.vdr Package """ __all__ = ["issuing", "eventing", "registering", "viring", "verifying"]
# class with __init__ class C1: def __init__(self): self.x = 1 c1 = C1() print(type(c1) == C1) print(c1.x) class C2: def __init__(self, x): self.x = x c2 = C2(4) print(type(c2) == C2) print(c2.x)
''' Crie um programa que leia o nome de uma cidade diga se ela começa ou não com o nome "SANTO". ''' nome_cidade = str(input('Digite o nome de uma cidade: ')).strip() primeiro_nome = nome_cidade.split() print('{}'.format('Santo' in primeiro_nome[0].capitalize()))
class Fail_AuthUwU(Exception): """Thrown when when authentication fails Attrs: objName """ def __init__(self, objName, message='sowwy {self.objName} has failed auwthenication..'): self.objName = objName self.message = message super().__init__(message) def __st...
""" Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Find the minimum element. You may assume no duplicate exists in the array. Example 1: Input: [3,4,5,1,2] Output: 1 Example 2: Input: [4,5,6,7,0,1,2] Output: 0 ...
class Solution: ops = ['*', '/', '+', '-'] def clumsy(self, N: int) -> int: answer = [N] i = N - 1 j = 0 while i > 0: op = self.ops[j % 4] j += 1 if op == '*': n = answer.pop(-1) val = n * i a...
s = input() s = s[::-1] ans = 0 b = 0 for i in range(len(s)): if s[i] == "B": ans += i ans -= b b += 1 print(ans)
"""This py describe the class the could be accessed by other.""" __author__ = "Gustavo Figueiredo" __copyright__ = "CASA" __version__ = "1.0.1" __maintainer__ = "Gustavo Figueiredo" __email__ = "gustavodsf1@gmail.com" __status__ = "Development"
class PongError(Exception): pass class RoomError(PongError): def __init__(self, room, msg, **kwargs): err_msg = '{} room info : {}'.format(msg, room) super().__init__(err_msg, **kwargs) class PlayerError(PongError): def __init__(self, player, msg, **kwargs): err_msg = '{} player ...
BASE_HELIX_URL = "https://api.twitch.tv/helix/" # token url will return a 404 if trailing slash is added BASE_AUTH_URL = "https://id.twitch.tv/oauth2/token" TOKEN_VALIDATION_URL = "https://id.twitch.tv/oauth2/validate" WEBHOOKS_HUB_URL = "https://api.twitch.tv/helix/webhooks/hub"
def main(): t = int(input()) # t = 1 for _ in range(t): n, m = sorted(map(int, input().split())) # n, m = 5, 7 if n % 3 == 0 or m % 3 == 0: print(n * m // 3) continue if n % 3 == 1 and m % 3 == 1: print((m // 3) * n + n // 3 + 1) ...
numbers = range(1, 10) for number in numbers: if number == 1: print (str(number) + 'st') elif number == 2: print (str(number) + 'nd') elif number == 3: print (str(number) + 'rd') else: print (str(number) + 'th')
# 107 # Open the Names.txt file and display the data in Python. with open('Names.txt', 'r') as f: names = f.readlines() for index, name in enumerate(names): # To remove /n names[index] = name[:-1] print(names)
__all__ = ['jazBegin', 'jazEnd', 'jazReturn', 'jazCall', 'jazStackInfo'] class jazBegin: def __init__(self): self.command = "begin"; def call(self, interpreter, arg): interpreter.BeginSubroutine() return None class jazEnd: def __init__(self): self.command = "end"; de...
# New tokens can be found at https://archive.org/account/s3.php DOI_FORMAT = '10.70102/fk2osf.io/{guid}' DATACITE_USERNAME = '' DATACITE_PASSWORD = '' DATACITE_URL = 'https://doi.test.datacite.org/' DATACITE_PREFIX = '10.70102' # Datacite's test DOI prefix -- update in production CHUNK_SIZE = 1000 PAGE_SIZE = 100 O...
b, br, bs, a, ass = map(int, input().split()) bobMoney = (br - b) * bs aliceMoney = 0 while aliceMoney <= bobMoney: aliceMoney += ass a += 1 print(a)
# This is a config file for CCI data and CMIP5 sea surface temperature diagnostics # generell flags regionalization = True shape = "Seas_v" shapeNames = 1 #column of the name values # flags for basic diagnostics globmeants = False mima_globmeants=[255,305] cmap_globmeants='jet' mima_ts=[288,292] mima_mts=[270,310] p...
# ------------------------------ # 229. Majority Element II # # Description: # Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. # Note: The algorithm should run in linear time and in O(1) space. # Example 1: # Input: [3,2,3] # Output: [3] # # Example 2: # Input: [1,1,1,3,3,2,2,...
# # Created on Fri Apr 10 2020 # # Title: Leetcode - Middle of the Linked List # # Author: Vatsal Mistry # Web: mistryvatsal.github.io # # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def middleNode(self, head: ...
async def f(): return 0 def f(): return 0 async for x in test: print(x) for x in test: print(x) for (x, y, z) in test: print(x) with test as f: print(x) async with test as f: print(x) if (x): print(x) x = [1, 2, 3] try: raise x except D: print(x) except C: print(x) e...
num = (int(input('digite um numero: ')), int(input('digite um numero: ')), int(input('digite um numero: ')), int(input('digite um numero: '))) print(f'vc digitou {num}') print(f'o valor 9 apareceu {num.count(9)} vezes') if 3 in num: print(f'o valor 3 apareceu na {num.index(3)+1} posição') el...
tabs = int(input()) salary = float(input()) for tab in range(tabs): current_tab = input() if current_tab == "Facebook": salary -= 150 elif current_tab == "Instagram": salary -= 100 elif current_tab == "Reddit": salary -= 50 if salary <= 0: print("You have lost your s...
while True: try: a=input() except: break while "BUG" in a: a=a.replace("BUG","") print(a)
class Solution: """ @param a: The first integer @param b: The second integer @return: The sum of a and b """ # Actually both of these methods fail to work in Python # because Python supports infinite integer # Non-recursive def aplusb(self, a, b): # write your code here, try...
class Stack: def __init__(self): self.items = [] self.head = -1 def push(self, x): self.head+=1 self.items.insert(self.head, x) def pop(self): if self.isEmpty(): print("Stack is empty !!!") else: x = self.items[self.head] self.items.pop(self.head) self.head-=1 return x def size(sel...
class AttribDesc: def __init__(self, name, default, datatype = 'string', params = {}): self.name = name self.default = default self.datatype = datatype self.params = params def getName(self): return self.name def getDefaultValue(self): return self.default ...
print ("Em que classe o seu terreno se encaixa?") largura = float (input("Insira aqui a largura do seu terreno :")) comprimento = float (input("Insira aqui o comprimento do seu terreno :")) m2 = largura*comprimento if m2 <=100: print ("Terreno Popular") elif m2 <= 500: print ("Terreno Master") if m2 >= 500: ...
def mortgage_calculator(P,r,N): if r == 0: return P / N else: return ((r * P) / (1 - (1 + r)**-N)) if __name__ == '__main__': P = float(input('Enter the amount borrowed: ')) R = float(input('Enter the interest rate: ')) N = int(input("Enter the number of monthly payments: ")) r ...
{ "target_defaults": { "make_global_settings": [ [ "CC", "echo" ], [ "LD", "echo" ], ], }, "targets": [{ "target_name": "test", "type": "executable", "sources": [ "main.c", ], }], }
# # PySNMP MIB module SNMP-USM-HMAC-SHA2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMP-USM-HMAC-SHA2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:00:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
# # PySNMP MIB module XEDIA-FRAME-RELAY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XEDIA-FRAME-RELAY-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:42:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
### Основные функции def is_correct_triangle(A, B, C): line12 = line_equation(A, B) line23 = line_equation(B, C) return matrix_det(line12[0], line12[1], line23[0], line23[1]) def line_len(A, B): return ((A['x'] - B['x'])**2 + (A['y'] - B['y'])**2)**0.5 def line_equation(M, N): A = N['y'] - M['y'...
def num(): a=int(input('input a : ')) b=int(input('input b : ')) return a, b def func(a,b): add = a+b multi = a*b devi = a/b return add, multi, devi if __name__=='__main__': try: a, b=num() add,_,_=func(a,b) _,multi,_=func(a,b) _,_,devi=func(a,b) ex...
############################################################# # FILE : additional_file.py # WRITER : Nadav Weisler , Weisler , 316493758 # EXERCISE : intro2cs ex1 2019 # DESCRIPTION: include function called "secret_function" # that print "My username is weisler and I read the submission response." ###################...
def subsetsum(array,num): if num == 0 or num < 1: return None elif len(array) == 0: return None else: if array[0].marks == num: return [array[0]] else: x = subsetsum(array[1:],(num - array[0].marks)) if x: return [array[0]...
# File: imap_consts.py # # Copyright (c) 2016-2022 Splunk Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
""" 1792. Maximum Average Pass Ratio Medium There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array classes, where classes[i] = [passi, totali]. You know beforehand that in the ith class, there are totali total students, but only passi number of stude...
# One day n friends met at a party, they hadn't seen each other for a long time and so they decided # to make a group photo together. Simply speaking, the process of taking photos can be described as # follows. On the photo, each photographed friend occupies a rectangle of pixels: the i-th of them # occupies the rectan...
# The SavingsAccount class represents a # savings account. class SavingsAccount: # The __init__ method accepts arguments for the # account number, interest rate, and balance. def __init__(self, account_num, int_rate, bal): self.__account_num = account_num self.__interest_rate = in...
class memoize(object): """ Memoize wrapper for python Usage: @memoize def fib(n): pass """ def __init__(self, function): self.function = function self.memoized = {} def __call__(self, *args): try: return self.memoized[args] except KeyError: self.memoized[args] = self.function(*ar...
#Crie um programa que tenha uma tupla com VARIAS PALAVRAS. # Depois disso vc deve mostrar, para cada palavra, quais sao suas vogais. palavras = ('Olho', 'Cabeça', 'ombro', 'Joelho', 'pe', 'boca', 'nariz', 'mao', 'cotovelo', 'pescoço') for p in palavras: print('\n', '-=-' * 15) print(f'A palavra {str(p).title()}...
#Desafio029: A aplicação recebe a velocidade fo carro, se a mesma for superior a 80KM/h, # retorna uma mensagem dizendo que foi multado , com o valor total de cada km acima dos 80. #entrada da velocidade. vel = int(input('qual era a velocidade do seu carro? Km/h '))-80 multa = (vel*7) if vel >= 0: print(f'Você nao...
with open("input_9.txt", "r") as f: lines = f.readlines() nums = [int(line.strip()) for line in lines] # for i, num in enumerate(nums[25:]): # preamble = set(nums[i:25 + i]) # found_pair = False # for prenum in preamble: # diff = num - prenum # if diff in preamble: # found_p...
__VERSION__ = "0.0.1" __AUTHOR__ = "helloqiu" __LICENSE__ = "MIT" __URL__ = "https://github.com/helloqiu/SillyServer"
# Faça um programa que leia um número qualquer e mostre seu fatorial. numero = int(input('Digite um número: ')) fatorial = 1 i = 1 while i <= numero: fatorial *= i i += 1 print('{}! = '.format(numero), end='') j = 1 k = 1 if numero == 0 or numero == 1: print('{}'.format(fatorial)) else: while numero >=...
""" Python solution for CCC '17 S1 - Sum Game """ n = int(input()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] k = 0 a_sum = 0 b_sum = 0 for i in range(n): a_sum += a[i] b_sum += b[i] if a_sum == b_sum: k = i + 1 print(k)
""" Created by Chantal Worp, 24/01/2017 Solution to Problem Set 1 Introduction to Computer Science and Programming using Python (EDX) Problem Set 1: Assume s is a string of lower case characters. Write a program that prints the longest substring of s in which the letters occur in alphabeti...
# -*- coding: utf-8 -*- # # Copyright (c) 2021, SkyFoundry LLC # Licensed under the Academic Free License version 3.0 # # History: # 07 Dec 2021 Matthew Giannini Creation # class Ref: @staticmethod def make_handle(handle): time = (handle >> 32) & 0xffff_ffff rand = handle & 0xffff_ffff ...
class Solution: def getMaximumGenerated(self, n: int) -> int: if n < 2: return n ans = [None for _ in range(n + 1)] ans[0] = 0 ans[1] = 1 for i in range(1, n // 2 + 1): ans[2 * i] = ans[i] if 2 * i + 1 < n + 1: ans[2 * i + 1...
echo = "echo" gcc = "gcc" gpp = "g++" emcc = "emcc" empp = "em++" cl = "cl" clang = "clang" clangpp = "clang++"
# Accept the marks of 5 subjects m1 = input(" Enter the Marks of first subject: ") m2 = input(" Enter the Marks of second subject: ") m3 = input(" Enter the Marks of third subject: ") m4 = input(" Enter the Marks of forth subject: ") m5 = input(" Enter the Marks of fifth subject: ") # Total Marks Total = int(m1)+int(m...
h = int(input()) w = int(input()) no_paint = int(input()) litres_paint = input() space = round((h * w * 4) * ((100 - no_paint) / 100)) while not litres_paint == "Tired!": space -= int(litres_paint) if space <= 0: break litres_paint = input() if space < 0: print(f"All walls are painted and you h...
media_stats = { 'type': 'object', 'properties': { 'count': {'type': 'integer', 'minimum': 0}, 'download_size': {'type': 'integer', 'minimum': 0}, 'total_size': {'type': 'integer', 'minimum': 0}, 'duration': {'type': 'number', 'minimum': 0}, }, }
#!/usr/bin/env python3 # # vsim_defines.py # Francesco Conti <f.conti@unibo.it> # # Copyright (C) 2015-2017 ETH Zurich, University of Bologna # All rights reserved. # # This software may be modified and distributed under the terms # of the BSD license. See the LICENSE file for details. # # templates for vcompile.csh ...
################################################################################################ # Python authorisation # Write a program that asks the user for a username and password. (7 marks) # -> The program keeps asking for the username and password until the correct username and # password have been e...
class Solution: # my solution def numPairsDivisibleBy60(self, time: List[int]) -> int: dct = {} res = 0 for i, n in enumerate(time): dct[n % 60] = dct.get(n%60, []) + [i] print(dct) for left in dct.keys(): if left % 60 == 0 or...
def glyphs(): return 96 _font =\ b'\x00\x4a\x5a\x08\x4d\x57\x52\x46\x52\x54\x20\x52\x52\x59\x51'\ b'\x5a\x52\x5b\x53\x5a\x52\x59\x05\x4a\x5a\x4e\x46\x4e\x4d\x20'\ b'\x52\x56\x46\x56\x4d\x0b\x48\x5d\x53\x42\x4c\x62\x20\x52\x59'\ b'\x42\x52\x62\x20\x52\x4c\x4f\x5a\x4f\x20\x52\x4b\x55\x59\x55'\ b'\x1a\x48\x5c\x50\x42\x5...
''' Time: 2015.10.2 Author: Lionel Content: Company ''' class Company(object): def __init__(self, name=None): self.__name = name @property def name(self): return self.__name @name.setter def name(self, name): self.__name = name
#!/usr/bin/env python class Solution: def nearestPalindromic(self, n): mid = len(n) // 2 if len(n) % 2 == 0: s1 = n[0:mid] + n[0:mid][::-1] else: s1 = n[0:mid+1] + n[0:mid][::-1] s2, s3, s2_list, s3_list = '0', '9'*len(n), list(s1), list(s1) # This is...
new_model = tf.keras.models.load_model('my_first_model.h5') cap = cv2.VideoCapture(0) faceCascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml') while 1: # get a frame ret, frame = cap.read() # show a frame gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) fac...