content
stringlengths
7
1.05M
class ASGIWebSubException(Exception): ... class HubNotFoundException(ASGIWebSubException): ... class TopicNotFoundException(ASGIWebSubException): ... class SubscriptionException(ASGIWebSubException): ...
""" This script was used to select 20 MEN-data set pairs as test set for a sandbox (to explore incrementality) """ menfile = "../data/MEN_dataset_natural_form_full" wordlist = [] pairs = [] with open(menfile, "r") as f: for line in f: words = line.rstrip().split()[:2] pairs.append(words) wordlist.extend(words)...
""" Python > Basic Data Types > Find Second Largest To print second largest element in given input (2 -2 2 2 :o/p=-2) """ input() print('enter element in one line') arr=set(map(int,input().split())) lists=list(arr) print(lists) print(arr) try: print(arr[-1]) print(arr[-2]) except: print('TypeError: set is just a...
i = 4 d = 4.0 s = 'HackerRank ' #Input Format #The first line contains an integer that you must sum with . #The second line contains a double that you must sum with . #The third line contains a string that you must concatenate with . #Output Format #Print the sum of both integers on the first line, the ...
# # This software is Copyright (c) 2015 University of Oxford # # This work is made avaiable to you under the terms of the Apache # License, Version 2.0; you may not use this source code except in # compliance with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
############################################################################## # # Author: Avoin.Systems # Copyright 2017 Avoin.Systems # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Softwar...
# zip() in Python # https://www.geeksforgeeks.org/zip-in-python/ # 1. zip() in Python name = ["Manjeet", "Nikhil","Shambhavi", "Astha"]; roll_no = [4,1,3,2] marks = [40,50,60,70] mapped = zip(name,roll_no,marks) print(mapped) # <zip object at 0x7f7aaebc28c8> mapped = set(mapped) print("The zipped result...
sub = "tet" string = "tested" if sub in string: print("Yes")
#las linkedlist están creadas por cabeceras y nodos que la siguen #creamos el constructor de un nodo y de una cabecera class Node: def __init__(self, dataval=None): self.dataval = dataval #la cabecera de la lista self.nextval = None #el elemento siguiente a la cabecera class LinkedLis...
class Queue: def __init__(self): self.storage = [] def enqueue(self, value): self.storage.append(value) def dequeue(self): if self.size() > 0: return self.storage.pop(0) else: return None def size(self): return len(self.storage) class ...
def binary_search(arr:list, low:int, high:int, x:int) -> list: if high >= low: mid = (high + low) // 2 if arr[mid] == x: return mid elif arr[mid] > x: return binary_search(arr, low, mid - 1, x) else: return binary_search(arr, mid + 1, high, x) ...
n, k = map(int, input().split()) v = list(map(int, input().split())) prefMap = {} prefMap[0] = 1 prefSum = 0 countK = 0 for i in range(n): prefSum += v[i] if (prefSum - k) in prefMap: countK += prefMap[prefSum - k] if prefSum in prefMap: prefMap[prefSum] += 1 else: prefMap[...
q = 0 num = 0 while True: n = int(input('Insira um número (digite "0" para parar): ')) if n > 0: num += n q += 1 else: break if q > 0: media = num / q print(f'A média dos números é de {media:.2f}')
# -*- coding: utf-8 -*- { 'name': 'Sale Extend', 'author': 'Mr.Wan', 'version': '1.0', 'category': 'Sales', 'description': """ 1. 在产品档案中增加价格表视图,并与价格表数据双向绑定 2. 添加自定义发票模板 """, 'depends': ['product', 'sale'], 'data': [ 'security/evaluate_security.xml', 'secu...
class Product: def GetProduct(self): self.__id = input("Enter Id : ") self.__name = input("Enter Name : ") self.__rate = int(input("Enter Rate : ")) self.__stock = int(input("Enter Stock : ")) def PutProduct(self): print(self.__id, self.__name, self.__rate, self.__stock)...
# # This function calculates n! # Factorial function not works in less than 0 # def factorial(n): result = 1 for i in range(2, n+1): result *= i return result def factorial_recur(n): if n == 0: return 1 return n * factorial(n-1)
bicycles = ['trek', 'cannondale', 'redline', 'specialized'] # print(bicycles) # # or specific # print(bicycles[0].title()) # # get the last item with special syntax # print(bicycles[-1]) message = f"My first bike was a {bicycles[-2].title()}" print(message)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class Transaction(object): def __init__(self): self.commands = [] self.success = [] def add_command(self, command): self.commands.append(command) def execute(self): """ 调用者不需要知道执行什么,只知道有 execute 方法""" for command in s...
expressao = input('Digite a expressão numérica: ').strip() pilha = [] for elem in expressao: if elem == '(': pilha.append('(') elif elem == ')': if len(pilha) > 0: pilha.pop() else: pilha.append(')') break print('Sua expressão está ', end='') print('co...
def movezeros(nums): i = 0 for j in range(len(nums)): if nums[j] != 0: nums[i], nums[j] = nums[j], nums[i] i += 1 return nums print(movezeros([0,1,0,3,12,14])) # two pointer i and j # I will increase i if and only if swaping nums[j] and nums[i] and will only swap when nums[j...
def test_one(): w1 = input() w2 = input() display = input() first_letter = None second_letter = None for i in range(len(display)): if display[i] == '_': if first_letter is None: first_letter = i else: second_letter = i ...
# Given an index k, return the kth row of the Pascal's triangle. # # For example, given k = 3, # Return [1,3,3,1]. # # Note: # Could you optimize your algorithm to use only O(k) extra space? class Solution: def getRow(self, rowIndex): """ :type rowIndex: int :rtype: List[int] """ ...
A = int(input()) if A - 7 <= 7: print(-1) else: print(A - 7)
""" abstract baseBackend class """ class baseBackend(): def __init__(self): pass def load_model(self): raise NotImplementedError("baseBackend:load") def predict(self): raise NotImplementedError("baseBackend:predict")
#!/usr/bin/env python3 def show_banner(value: str, times: int): print(value * times) def show_strings_demo1(): first_name = "Mohd" last_name = 'Azim' person_description = """ My Name is Mohd Azim """ show_banner('=', 50) ...
def somatorio(a=0,b=0,c=0): s = a + b + c return s def funcao(): n1 = 4 print(f"n1 dentro vale {n1}") def somar(a=0,b=0,c=0): soma = a + b +c print(f"a soma vaale {soma}") def contador(i,y,x): """ essa funcao tem caracteristica de mostrar o usuario uma forma de contagem dos umeros ...
# here create parent class class Person : def __init__(self,_name,_age) : self.name = _name; self.age = _age; # here create child function with overwrite init class Student(Person) : def __init__(self,_id,_year,_p) : Person.__init__(self,_p.name,_p.age); self.student_id = _id; ...
class StackWithMax: def __init__(self): self.stack = [] def push(self, element): if self.stack and self.getMax() > element: self.stack.append((element, self.getMax())) else: self.stack.append((element, element)) def pop(self): self.stack.pop() ...
# -*- coding: utf-8 -*- """ Created on Thu Apr 25 17:54:53 2019 @author: Falble """ def rotate_letter(letter, n): """Rotates a letter by n places. Does not change other chars. letter: single-letter string n: int Returns: single-letter string """ if letter.isupper(): star...
class ReplList(list): def __init__(self, *args, **kwargs): list.__init__(self, *args, **kwargs) def __repr__(self): return ', '.join(map(repr, self)) class Repl(dict): def __init__(self, *args, **kwargs): dict.__init__(self) def fill(**kwargs): for k, v in kwa...
ONE_HUNDRED: int = 100 SEGMENT_MATCH_OPERATOR = "segmentMatch" IN_OPERATOR = "in" EQUAL_OPERATOR = "equal" GT_OPERATOR = "gt" STARTS_WITH_OPERATOR = "starts_with" ENDS_WITH_OPERATOR = "ends_with" CONTAINS_OPERATOR = "contains" EQUAL_SENSITIVE_OPERATOR = "equal_sensitive"
# Done by Carlos Amaral (2020/09/26) emotions = ("happy", "sad", "fear", "surprise") print("The length of the tuple is:", len(emotions)) print("The last emotion cotained in the tuple is: ", emotions[3])
def fatorial(valor, exibir=False): """ -> Cálculo de fatorial de um determinado valor :param valor: número a ser calculado :param exibir: opcional se mostra o cálculo :return: o valor fatorial do valor indicado """ fator = 1 for c in range(valor, 0, -1): fator *= c if exi...
def df_to_apex_data_single_gene(filtered_gene_df, actual): series = [ { 'name': data_type, 'dataType': actual.loc[data_type]['Data type'], 'data': [ { 'x': val[0], # sample ID 'y': val[1], # color scale val ...
def ans(x): r=0 w=1 while x//w: r+=(x//w)*(w-w//2) w*=2 return r a,b=map(int,input().split()) print(ans(b)-ans(a-1))
"Wrap stardoc to set our repo-wide defaults" load("@io_bazel_stardoc//stardoc:stardoc.bzl", _stardoc = "stardoc") _PKG = "@build_bazel_rules_nodejs//tools/stardoc" def stardoc(**kwargs): _stardoc( aspect_template = _PKG + ":templates/aspect.vm", header_template = _PKG + ":templates/header.vm", ...
class YamlReaderError(Exception): pass class ConfigurationError(Exception): pass class RasterFileError(Exception): pass class MeteoDataError(Exception): pass class CategoryError(Exception): pass class RuntimeError(Exception): pass
class EqualityAssertionError(AssertionError): def __init__(self, equal, actual, expected): template = "Expected {0} {1} {2}" equal_str = "to equal" if equal else "not to equal" message = template.format(str(actual), equal_str, str(expected)) super(EqualityAssertionError, self).__init...
print('digite o valor das retas do triangulo') r1 = float(input(('digite a reta 1:'))) r2 = float(input(('digite a reta 2:'))) r3 = float(input(('digite a reta 3:'))) if r1 < r2 + r3 and r2 < r1 + r3 and r3 < r1 + r2: print('Da para se formar um triangulo') else: print('Não da para se formar um triangulo')
# encoding=utf-8 class BaseSession(object): def session_id(self): raise NotImplementedError def save(self, expires=86400): raise NotImplementedError def destroy(self): raise NotImplementedError def __setitem__(self, key, value): raise NotImplementedError def __g...
""" Q394 Decode String Medium Stack; DFS. Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guaranteed to be a positive integer. You may assume that the input string is ...
# LEETCODE 152: Maximum Product Subarray # # https://leetcode.com/problems/maximum-subarray/ # # Given an integer array nums, find the contiguous subarray within an array # (containing at least one number) which has the largest product. # # Example 1: # # Input: [2,3,-2,4] # Output: 6 # Explanation: [2,3] has the larg...
class Solution: def selfDividingNumbers(self, left, right): """ :type left: int :type right: int :rtype: List[int] """ res = [] for num in range(left, right + 1): if self.isDividing(num): res.append(num) return res ...
def ok(cs, ds, l, r, k): cs_max = 0 for i in range(l, r + 1): cs_max = max(cs_max, cs[i]) ds_max = 0 for i in range(l, r + 1): ds_max = max(ds_max, ds[i]) if abs(cs_max - ds_max) <= k: return True return False def Solution(cs, ds, n, k): lr = 0 for i in range(n)...
cli_args = { 'actor-model': {'help': 'Path to actor model .cfg file'}, 'critic-model': {'help': 'Path to critic model .cfg file'}, 'gradient-steps': { 'help': 'Number of iterations per train step', 'type': int, 'hp_type': 'int', }, 'tau': { 'help': 'Value used for syn...
""" Configurable hooks in the build system. Can be used by various platforms to customize the build process. """ ################################################################################ # Hooks for the various parts of the build process # Internal mapping of hooks per tool _HOOKS = {} # Internal mapping of r...
# -*- coding: utf-8 -*- """ Created on Fri Jan 3 08:44:30 2020 @author: Simon """ """ Author: Simon Schalk S1910632012 Title: Schaltjahr Discription: Ueberpuefung ob ein beliebiges Jahr ein Schaltjahr ist. Last Change: 03.01.2020 """ #Funktion zur Schaltjahr-Berechnung def Scha...
""" httpy: modern, user-friendly, programmable command-line HTTP client for the API. """ __version__ = "0.0.4" __author__ = "Sinan Kanidağlı" __licence__ = "MIT"
def proc(command, message): return { "data": { "status": "ok", "html": """ <p> Hi! I can control your Raspberry Pi. Send me the commands <b>in bold</b> to make me do stuff.<br><br> &#128247; camera controls<br> ...
class User: def __init__(self, name, email, title): self.name = name self.email = email self.title = title def change_title(self, new_title): self.title = new_title def print_info(self): print(f"\nUser details:\nName: {self.name}\nEmail: {self.email}\nTitle: {self.t...
#!/usr/bin/env python3 # gets info from file, strips whitespaces, returns list of data in file def get_data_from_file(): flag = False # absolute path, should probably change in future filename = "/Users/visrunner/Desktop/PHerc118/2016_07_06_10_26_41/2016_07_06_10_26_41data.hdr" while flag == False: ...
"""***************************************************************************** * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
#!/usr/bin/env python3 ####################################################################################### # # # Program purpose: Converts an integer to binary, keeping leading zeros. # # Program Author : Happi ...
# URI Online Judge 1172 X = [] for i in range(10): X.append( int(input()) ) if X[i] <= 0: X[i] = 1 for i in range(10): print('X[{:}] = {:}'.format(i, X[i]))
# SPDX-FileCopyrightText: 2022 Stephan Lachnit <stephanlachnit@debian.org> # # SPDX-License-Identifier: EUPL-1.2 """ Classes holding the information of a SPDX document. """ class SPDXHeaderParagraph: """ Class containing the header paragraph of a SPDX document. """ # pylint: disable=too-few-public-me...
# https://leetcode.com/problems/binary-search/ class Solution: def search(self, nums, target): i = 0 n = len(nums) while nums[i] < target: i += 1 if i == n: return -1 if nums[i] == target: flag = i else: flag = ...
print("Bienvenido a su calculadora de ingresos") print(" ") inversion=int(input("Ingrese el valor que desea invertir\n")) tiempo=int(input("¿En cuantos meses desea invertir su capital?\n")) intereses=inversion*6/100 beneficio=intereses*tiempo ganancia=inversion+beneficio print("su ganancia total en ", tiempo,"meses, es...
""" Config """ """======= Main =======""" WEB_PREFIX = "http://zhjwxk.cic.tsinghua.edu.cn/" """======= Main =======""" """======= Urls =======""" CAPTCHAR_PATH = WEB_PREFIX + "login-jcaptcah.jpg?captchaflag=login1" LOGIN_PAGE = WEB_PREFIX + "xklogin.do" #LOGIN_POST_PAGE = WEB_PREFIX + "j_acegi_formlogin_xsxk.do"...
def ListComprehensions(x,y,z,n): data = [] for i in range(x+1): for j in range(y+1): for k in range(z+1): data.append([i,j,k]) datos = [x for x in data if (x[0]+x[1]+x[2])!= n] print(datos) if __name__ =="__main__": ListComprehensions(1,1,2,3)
# NOTE: Some variables are set as public variables for testing. They should be reset # to private variables in an official deployment of the contract. # # Events # RegisterNotary: event({index_in_notary_pool: int128, notary: indexed(address)}) DeregisterNotary: event({index_in_notary_pool: int128, notary: indexed(ad...
''' practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses by Aashik J Krishnan/Aash Gates ''' print(14 // 3) #end-of-the program
# -*- coding: utf-8 -*- class DeviceBusyError(Exception): pass class BlockedByRfKillError(Exception): pass class IncorrectInterfaceError(Exception): pass class IncorrectInterfaceStateError(Exception): pass class IncorrectInterfaceNameError(Exception): pass
#oct(x) for i in range(16): print(i, oct(i)) print() for i in range(16): print('{0:2d} {0:>4o}'.format(i))
''' 上下文管理器,要实现__enter__ 和__exit__方法 ''' class openfile(object): def __init__(self, filename, mode): self.filename = filename self.mode = mode def __enter__(self): self.f = open(self.filename, self.mode) return self.f def __exit__(self, type, value, tb): self.f.clo...
class InstrumentUpdate: insId: int updatedAt: str def __init__(self, insId, updatedAt): self.insId = insId self.updatedAt = updatedAt def __str__(self): return '{}: {}'.format(self.insId, self.updatedAt) def __repr__(self): return '{}: {}'.format(self.insId, self.u...
class Solution(object): def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ best = 0 run = 0 for n in nums: if n == 1: run += 1 else: run = 0 if run > best: ...
__description__ = "VOEvent Broker" __url__ = "https://comet.transientskp.org/" __author__ = "John Swinbank" __contact__ = "john@swinbank.org" __version__ = "3.2.0-pre"
def fib_iter(n): a=1 b=1 if n==1: print('0') elif n==2: print('0','1') else: print("Iterative Approach: ", end=' ') print('0',a,b,end=' ') for i in range(n-3): total = a + b b=a a= total print(total,end=' ') ...
class User(object): def __init__(self, user_name, user_id, email): self.user_name = user_name self.user_id = user_id self.email = email self.teams = [] def get_user_name(self): return self.user_name def get_user_id(self): return self.user_id def get_tea...
""" i represents the index of the current character we are checking We loop until one of the exit conditions are met. Every iteration of the parent loop increases i, moving on to the next character. It also loops through all the provided strings, checking to make sure they have the same charac...
""" Errors to be used by PyHomeSeer. """ class PyHomeSeerError(Exception): """ Base error for PyHomeSeer. """ pass class PyHomeSeerAuthenticationError(PyHomeSeerError): """ Error Authenticating to HomeSeer """ pass
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def cppHttplib(): http_archive( name="cpp_httplib" , build_file="//bazel/deps/cpp_httplib:build.BUILD" , sha256="1...
""" Author: Rayla Kurosaki File: my_colors.py Description: This file returns a list of certain color sets. """ def get_math_colors(): """ Gets the standard mathematics colors. """ black = "#000000" red = "#FF0000" blue = "#0000FF" return [black, red, blue] def get_shades_cyan(): ""...
class Colour: _MAX = 16**3 - 1 def __init__(self, r: int, g: int, b: int, scl=1): self.r, self.g, self.b = r, g, b self._scl = self._MAX / scl def fmt(self) -> str: """#rrrgggbbb""" return f"#{self._fmt(self.r)}{self._fmt(self.g)}{self._fmt(self.b)}" def _fmt(self, va...
"""Faça um programa que leia um número Inteiro qualquer e mostre na tela a sua tabuada""" num = int(input('Informe um número: ')) print(f'=' * 11) print(f'{num} X {1:2} = {num*1}') print(f'{num} X {2:2} = {num*2}') print(f'{num} X {3:2} = {num*3}') print(f'{num} X {4:2} = {num*4}') print(f'{num} X {5:2} = {num*5}') pr...
""" We know that, after swapping, the length of the continuous 1 will be equal to number of 1 in the data. Let's call it `L`. So what we need to do is sliding window with length L and see what is the max 1 count within the window. The window with max 1 count will need to do minimal swap. Time: O(N) Space: O(1) """ cla...
def cipher(text, shift, encrypt=True): """ Encrypts a given input alphabetical text string. Parameters ---------- text : str This is the input text data sent to be ciphered (should be English). shift : int This is the ficed number that each letter is replaced by a letter some fixed...
''' This problem was asked by Amazon. There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters. For example, if N is 4, then there are 5 unique ways: 1, 1, 1, 1 ...
x, y = 0, 0 def mul(a, b, mod): ans = 0 while b > 0: if b % 2 == 1: ans = (ans + a % mod) % mod a = (a + a) % mod b >>= 1 return ans def exgcd(a, b): global x, y if b == 0: x, y = 1, 0 return a d = exgcd(b, a % b) tmp, x = x, y y ...
# -*- coding: utf-8 -*- __author__ = "Hua777" __copyright__ = "Copyright 2018, Hua777" __version__ = "2.0" __email__ = "liao.700529@gmail.com" class ClassSelect(object): def __init__(self, data): self.Data = data ''' self.Get = array[0] self.Department = array[1] self.Numb...
''' Created on 09.10.2017 @author: rustr ''' def read_file_to_string(afile): with file(afile) as f: afile_str = f.read() return afile_str def read_file_to_list(afile): return [line for line in open(afile, "r").readlines()]
''' Description: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive integer. Example 1: Input: 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 s...
''' @author: cnunezre @Link: https://github.com/cnunezre/deepRacerReinvent @License: N/D ''' def reward_function (on_track, x, y, distance_from_center, car_orientation, progress, steps, throttle, steering, track_width, waypoints, closest_waypoint): reward = 1e-3 if distance_from_center >= 0.0 and...
class ReplyState(): def update(self, req): # TODO 入力 msg = "" # 分岐 if msg == 'agree': return ['Reply', 'Agree'] elif msg == 'reject': return ['Reply', 'Reject'] else: raise ValueError("Unexpected condition")
for i in range(int(input())): s = input() year, month, day = map(int, [s[:4], s[4:6], s[6:]]) answer = -1 if 1 <= month and month <= 12: dayOfMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] if 1 <= day and day <= dayOfMonth[month - 1]: answer = "{}/{}/{}".format(str(...
''' You are working in a ball factory where you have n balls numbered from lowLimit up to highLimit inclusive (i.e., n == highLimit - lowLimit + 1), and an infinite number of boxes numbered from 1 to infinity. Your job at this factory is to put each ball in the box with a number equal to the sum of digits of the bal...
def escreva(txt): tamanho = len(txt) + 4 print('~' * tamanho) print(f' {txt} ') print('~' * tamanho) # Programa Principal escreva('Juuzou Marques') escreva('Python é muito legal') escreva('John Frusciante is the best guitarist ever')
class Solution: def tribonacci(self, n: int) -> int: def dp(n: int) -> int: if n == 0: return 0 if n == 1: return 1 if n == 2: return 1 if n not in memo: memo[n] = dp(n-1)+dp(n-2) + dp(n-3) ...
# Converts a set of numbers into a python list with those numbers occurring multiple times # IE: by setting the step size to one, and replacing the percentNum list with [40,60], you # would get an output of 40 1s followed by 60 2s # almost exclusively useful for generating histograms and some other graph types when onl...
class Solution: def sortByBits(self, arr: List[int]) -> List[int]: x={} f=[] if len(set(arr))==1 and len(arr)!=1: return arr for i in arr: x[i]=str(bin(i)[2:]).count('1') for i in set(x.values()): d=[] for m,n in x.items(): ...
class Data: def __init__(self, a, b): self.testData = a + b
def bubble_sort(alist): for _ in range(len(alist)-1,0,-1): for i in range(_): if alist[i] > alist[i+1]: alist[i+1],alist[i] = alist[i],alist[i+1] return alist alist = [10,2,3,11,23,0,1,4] print(bubble_sort(alist))
class Controller: def __init__(self): pass def key_press(self, event): pass def key_release(self, event): pass def update(self): pass def receive_joy(self, event): pass
class Solution: def maxDiff(self, number: int) -> int: number_as_string = str(number) size = len(number_as_string) larger_number = str(number_as_string) for i in range(size): digit = number_as_string[i] if digit < "9": larger_number = larger_nu...
# Time: O(n^4) # Space: O(n^3) class Solution(object): # @return a boolean def isScramble(self, s1, s2): if not s1 or not s2 or len(s1) != len(s2): return False if s1 == s2: return True result = [[[False for j in xrange(len(s2))] for i in xrange(len(s1...
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Loyalty Program', 'version': '1.0', 'category': 'Point of Sale', 'sequence': 6, 'summary': 'Loyalty Program for the Point of Sale ', 'description': """ This module allows you to defin...
a, b, c = sorted([int(x) for x in input().split()]) left = a * a + b * b right = c * c print(a, b, c) if a+b > c: if left > right: print('Acute') elif left == right: print('Right') else: print('Obtuse') else: print('No')
escolha = input("Qual a capital é a capital de tocantins?(Digite a letra por favor!) \nA - Alagoas\nB-Tocantins\nC - Jerusalem\n:") if(escolha == "B" )or(escolha == "b" ): print("Parabéns você acertou... Palmas...") else: print("Que pena você errou, a alternativa correta era a B palmas!")
def readAI(ch): if 7<=ch<=0: raise Exeption('MCP3208 channel must be 0-7: ' + str(ch)) cmd = 128 cmd += 64 cmd += ((ch & 0x07) << 3) ret = spi.xfer2([cmd, 0x0, 0x0]) val = (ret[0] & 0x01) <<11 val |=ret[1]<<3 val |=ret[2]>>5 return (val & 0x0FFF)