content stringlengths 7 1.05M |
|---|
fah = float(input("Qual a temperatura em farenheit ==> "))
celsius = 0.56 * (fah-32)
print("A temperatura de", fah, "farenheit equivale a", celsius, "celsius")
|
# coding: utf-8
BASE_DOCS_URL = 'https://developer.zendesk.com/rest_api/docs/support'
RESOURCE_MAPPING = {
'organizations': {
'resource': 'organizations.json',
'docs': '{0}/organizations'.format(BASE_DOCS_URL)
},
'tickets': {
'resource': 'tickets.json',
'docs': '{0}/tickets... |
# Copyright 2016 VMware, Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
###########################################
# Functional Tests to test all home pages #
###########################################
def test_home_page(test_client):
"""
GIVEN a Flask application
WHEN the '/' page is requested (GET)
THEN check if is redirected to the right route:
1. if the response is valid
2. ... |
"""
Created on March 30, 2018
@author: Alejandro Molina
"""
|
## Insertion Sort
def insertion_sort(arr, n):
"""
Given an array/list of integers,
return sorted array
"""
for i in range(1, n):
key = arr[i]
j = i-1
while j >= 0 and key < arr[j]:
arr[j+1] = arr[j]
j -= 1
arr[j+1] = key |
n= int(input())
for i in range(1,n+1):
u= (i**3 + 2*i)
print(u,end=',')
|
# File: ipcontrol_consts.py
# Copyright (c) 2021 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
IPCONTROL_ENDPOINT_LOGIN = '/login'
IPCONTROL_ENDPOINT = '/inc-rest/api/v1'
IPCONTROL_ENDPOINT_GET_CHILD_BLOCK = '/Exports/initExportChildBlock'
IPCONTROL_ENDPOINT_GET_HOSTNAME =... |
'''from math import trunc
num = float(input('Digite um número: '))
print('O número {} tem a parte Inteira {}.'.format(num, trunc(num)))'''
num = float(input('Digite um valor: '))
print('O número {} tem a parte Inteira {}.'.format(num, int(num)))
|
# using if statement in complex situation
# elif
country= input("Where are you form?\n").upper()
if country=="ENGLAND":
print("Hello!")
elif country=="GERMANY":# elif allows us to check for different values. It means else-if.
print("Gutan Tag!")
elif country=="FRANCE":
print("Bonjour!")
elif country=="MEXI... |
def input():
with open("input-20.txt") as lines:
for line in lines:
yield line.strip()
input = input()
enhancer = next(input)
assert len(enhancer) == 512
assert next(input) == ""
pixels = {(x, y): c for y, row in enumerate(input) for x, c in enumerate(row)}
class Image:
def __init__(self... |
x = 5
# whileを用いて、変数xが0ではない間、ループするように作ってください
while x != 0:
# whileの中で実行する処理は、変数xから1を引く処理と引いた後に出力させる処理です。
x -= 1
print(x) |
# -*- coding: utf-8 -*-
author = 'thecokerdavid'
|
"""Top-level package for Starter."""
__author__ = ""
__email__ = ""
__version__ = "0.1.0"
|
class LogMessages:
GW_SERVER_LISTENING = 'RD Gateway server listening on {}:{}'
GW_FAILED_PROCESS_HTTP_REQUEST = 'Failed to process HTTP request'
GW_ATTEMPT_NON_WEBSOCKET = 'Unsupported attempt to connect without WebSocket'
WEBSOCKET_RECEIVED_CONNECTION_REQUEST = 'Received WebSocket connec... |
# settings that are specific to Flask-User
class AuthConfig(object):
USER_ENABLE_USERNAMES = False
USER_ENABLE_CHANGE_USERNAME = False
USER_ENABLE_REGISTER = True
USER_ENABLE_INVITATION = True
USER_REQUIRE_INVITATION = True
USER_APP_NAME = "Clear My Record"
# def set_default_settings(user_mana... |
class Solution:
def corpFlightBookings(self, bookings: List[List[int]], n: int) -> List[int]:
dp = [0] * n
for i, j, k in bookings:
dp[i - 1] += k
if j < n:
dp[j] -= k
result = [0] * n
result[0] = dp[0]
for i in range(1, n):
... |
#!/bin/bash
x = 99
def f1():
x = 88
def f2():
print(x)
f2()
f1()
|
# -*- coding: utf-8 -*-
"""@package Methods.Machine.MagnetType10.comp_surface
Compute the Magnet surface method
@date Created on Wed Dec 17 14:56:19 2014
@copyright (C) 2014-2015 EOMYS ENGINEERING.
@author pierre_b
"""
def comp_surface(self):
"""Compute the Magnet surface (by analytical computation)
Paramete... |
class Solution:
def maxProfit(self, prices: List[int]) -> int:
low = prices[0]
ans = 0
for i in range(1, len(prices)):
low = min(low, prices[i])
ans = max(prices[i] - low, ans)
return ans |
# Copyright 2021 Nokia
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""This module contains the return codes used in the returncode structure"""
# General success code
SUCCESS = 0
# General error codes
GENERALERROR = 1000
MISSINGFIELDS = 1100
NORESULT = 1200
# Element managemen... |
class Solution:
def wordsAbbreviation(self, words: List[str]) -> List[str]:
def compute_LCP(w1, w2):
cnt = 0
for i, (c1, c2) in enumerate(zip(w1, w2)):
if c1 == c2:
cnt += 1
else:
break
return cnt
... |
def load_rom_raw(filename):
"""
Loads the data from a .nes file as the nesheader and the rom data without further processing
:param filename:
:return:
"""
with open(filename, "rb") as f:
nesheader = f.read(16)
bytecode = f.read()
return bytecode, nesheader
def load_palette(... |
def palindrome(s):
s=s.replace(" ",'')
reverse=s[::-1]
if s==reverse:
return True
else:
return False
|
# -*- coding: utf-8 -*-
# __author__ = xiaobao
# __date__ = 2019/11/06 19:12:23
# desc: desc
# 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。
# 示例:
# 输入: [-2,1,-3,4,-1,2,1,-5,4],
# 输出: 6
# 解释: 连续子数组 [4,-1,2,1] 的和最大,为 6。
# 进阶:
# 如果你已经实现复杂度为 O(n) 的解法,尝试使用更为精妙的分治法求解。
# 来源:力扣(LeetCode)
# 链接:https://leetcode-cn.... |
for _ in range(int(input())):
inp = input().lower()
cha = list('abcdefghijklmnopqrstuvwxyz')
for i in inp:
if i in cha: cha.remove(i)
if len(cha)==0: print('pangram')
else: print('missing', ''.join(cha)) |
#!/usr/bin/env python3
"""
The icarus NMR logging handler process. The process subscribes to a set of PVs and logs them into a file for further inspection.
"""
if __name__ == '__main__':
pass
|
msg = 'Hello World'
print(msg[8])
print(msg[-3])
tinker = 'Tinker'
print(tinker[1:4])
numbers = '123456789'
even = numbers[1:9:2]
odd = numbers[0:10:2]
print(even, odd)
|
string1 = "Linux"
string2 = "Hint"
joined_string = string1 + string2
print(joined_string)
|
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def deleteNode(self, root, key):
"""
:type root: TreeNode
:type key: int
:rtype: TreeNode
"... |
class PageInfo:
'''
current_page:当前点击的页码
per_page:每页显示的数据数量
all_count:数据总共的数量
base_url:网页根地址
show_page:页码总共显示的个数
'''
def __init__(self, current_page, per_page, all_count, base_url,show_page=11):
print('allcount', all_count)
try:
#当前页转换为int
self... |
N, M, X, Y = map(int, input().rstrip().split())
a = list(map(int, input().rstrip().split()))
a = [n for n in a if n > Y]
if len(a) <= M:
print(sum(a))
else:
a.sort()
while True:
n = a.pop(0)
if n >= X:
print('Handicapped')
exit()
if len(a) <= M:
print(sum(a))
exit() |
class Solution:
def maxDepth(self, root: 'Node') -> int:
if not root:
return 0
if not root.children:
return 1
return 1 + max(self.maxDepth(child) for child in root.children)
|
# Faça um programa que leia o nome de uma pessoa e mostre uma mensagem de boas-vindas
nome = input('Digite seu nome: ')
print('Prazer em te conhecer,', nome)
# Outra forma: print('Prazer em te conhecer, {}!'.format(nome)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Date : 2019-11-26 01:20:25
# @Author : Racter Liu (racterub) (racterub@gmail.com)
# @Link : https://racterub.io
# @License : MIT
def has_dups(data):
for i in data:
if data.count(i) > 1:
return True
else:
return False
... |
"""A Text Block Generator"""
def lines(file):
"""Lines generator"""
for line in file:
yield line
yield '\n'
def blocks(file):
"""Blocks generator"""
block = []
for line in lines(file):
if line.strip():
block.append(line)
elif block:
yield ''.join... |
def ler_vetor():
n = int(input("Qual o tamanho do Vetor? "))
v = [0] * n
for i in range (n):
v[i] = int(input(f'valor da posição {i}: '))
return v |
class Prays:
TheBenedictus = 'Blessed be the Lord, the God of Israel he has come to his people and set them free.\
He has raised up for us a mighty savior,\
born of the house of his servant David.\
Through his holy prophets he promised of old\
that he would save us from our enemies,\... |
# https://leetcode.com/problems/count-the-number-of-consistent-strings/
class Solution:
def countConsistentStrings(self, allowed: str, words: List[str]) -> int:
dictx = {}
for each in allowed:
dictx[each] = 1
count = 0
for each in ... |
test_str = "111"
def show():
print(__name__, "show")
|
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
s_nums = sorted(nums)
l = len(nums)
for i, num in enumerate(nums):
t = target - num
o = bisect.bisect_left(s_nums, t)
if o <l:
if t == s_nums[o]:
... |
class RangeSlicer:
@staticmethod
def get_sliced_range(start_block: int, end_block: int, step: int):
for index, block_index_breakpoint in enumerate(range(start_block, end_block+step, step)):
if not index:
continue
if block_index_breakpoint > end_block:
... |
#!/usr/bin/python
europe = []
germany = {"name": "Germany", "population": 81000000, "price": 1000}
europe.append(germany)
luxembourg = {"name": "Luxembourg", "population": 512000, "price": 2000}
europe.append(luxembourg)
andorra = {"name": "Andorra", "population": 900000, "price": 3000}
europe.append(andorra)
print(le... |
'''
Дано натуральное число (n≤9). Напишите программу,
которая печатает таблицу размером n×5,
где в i-ой строке указано число i (числа отделены одним пробелом).
'''
num = int(input())
# num = 8
for i in range(1, num + 1):
j = 1
while j < 6:
print(f'{i} ', end='')
j += 1
print()
|
go = goat = """\
___.
// \\\\
(( ''
\\\\__,
/6 (%)\\,
(__/:";,;\\--____----_
;; :';,:';`;,';,;';`,`_
;:,;;';';,;':,';';,-Y\\
;,;,;';';,;':;';'; Z/
/ ;,';';,;';,;';;'
/ / |';/~~~~~\\';;'
( K | | || |
\\_\\ | | || |
\\Z | | || |
L_| LL_|
LW/ LLW... |
LONG_TIMEOUT = 30.0 # For wifi scan
SHORT_TIMEOUT = 10.0 # For any other command
DEFAULT_MEROSS_HTTP_API = "https://iot.meross.com"
DEFAULT_MQTT_HOST = "mqtt.meross.com"
DEFAULT_MQTT_PORT = 443
DEFAULT_COMMAND_TIMEOUT = 10.0
|
class Solution:
def __init__(self):
self.memo = {}
def _can_cross(self, stones, cur_idx, step, last_idx) -> bool:
if (cur_idx, step) in self.memo:
return self.memo[(cur_idx, step)]
if cur_idx == last_idx:
return True
elif cur_idx > last_... |
# Programa 05
b = 5/2 + 6/4
a = 3 + b
if (a > 7):
c = a + c
print(b - a)
elif (a == 7):
c = a - b
print(2*c + 1)
else:
a = a + b |
message = input('Enter a message. Go ahead, I\'ll wait!\n')
count = 0
for i in message:
if i != 'a':
print(i, end = "")
elif i == 'a':
count += 1
if count > 3:
i = 'A'
print(i, end = '')
else:
i = '@'
print(i, end = '') |
class ExampleBase(object):
def template_method(self):
self.step_one()
self.step_two()
self.step_three()
def step_one(self):
raise NotImplementedError()
def step_two(self):
raise NotImplementedError()
def step_three(self):
raise NotImplementedError()
c... |
# PR#208, calling apply with bogus 3rd argument
def test(x):
return x
assert 7 == test(*(7,))
assert 7 == test(*(), **{'x': 7})
try:
test(*(1,), **7)
print('TypeError expected')
except TypeError:
pass
try:
test(*(1,), **{7:3})
print('TypeError expected')
except TypeError:
pass
try:
... |
class ResponseCookie:
def __init__(self, name, value, expires, max_age, domain, path, secure, http_only):
self._name = name
self._value = value
self._expires = expires
self._max_age = max_age
self._domain = domain
self._path = path
self._secure = secure
... |
n1 = int(input("Primeira nota: "))
n2 = int(input("Segunda nota: "))
m = n1/n2
print(f"A divião é:\n {m:.4}", end = '\n ...')
print("hi")
|
def isValid(self, s: str) -> bool:
stack = []
closeToOpen = {')':'(',']':'[','}':'{'} # dictionarry mappin to avoid alot of if staements
for symbol in s :
if symbol in closeToOpen:#because the key is always the closing parenthesis
if stack and stack... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""A trade represents a fill of an offer.
This happens when an incoming order matches an offer on the opposite side of the order book in price.
Trades can be seen on the Trade History column on Switcheo Exchange.
"""
# Retrieves trades that have already occurred on Switch... |
class Temperature(object):
'''
Used to model the temperature
value = 0 - Not known
value = 1 - < 25 degrees
value = 2 - => 25
'''
def __init__(self, value = 0, created = False):
self.value = value
self.created = created
@property
def value(self):
return sel... |
#!/usr/bin/python3
number = 2
number = number * number * number
print (number * number * number)
print ("!@#$%^&*()-=") # testing character matching
|
'''
Created on Oct 31, 2017
@author: jschm
'''
def mapSqr(L):
"""returns the map of sqr and L"""
power = 2
lst = []
# have to make a new list so old is not mutated
# cannot do better
for x in L:
#lst += [x ** power]
# faster
lst.append(x ** power)
return lst
prin... |
new_fruit=input('what fruit am I sorting?')
if new_fruit == Apple:
print ('Bin 1')
elif new_fruit == Orange:
print ('Bin 2')
elif new_fruit == Olive:
print ('Bin 3')
else:
print('Error! I do not recognize this fruit')
|
#Empty print for not disturbing the unit tests output
def myPrint( str ):
pass
def add( i, j):
return i + j
def subtract( i, j):
return i - j
def innerFunction():
pass
def outerFunction():
innerFunction()
def noParamsFunction():
return MyClass()
def mySubstring( st... |
# https://www.codewars.com/kata/522551eee9abb932420004a0/train/python
'''
Instructions :
I love Fibonacci numbers in general, but I must admit I love some more than others.
I would like for you to write me a function that when given a number (n) returns the n-th number in the Fibonacci Sequence.
For example:
nt... |
"""FOR statement
@see: https://docs.python.org/3/tutorial/controlflow.html
The for statement in Python differs a bit from what you may be used to in C or Pascal.
Rather than always iterating over an arithmetic progression of numbers (like in Pascal), or
giving the user the ability to define both the iteration step an... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2020/6/29 23:02
# @Author : 一叶知秋
# @File : reorderList.py
# @Software: PyCharm
"""
143. 重排链表
给定一个单链表 L:L0→L1→…→Ln-1→Ln ,
将其重新排列后变为: L0→Ln→L1→Ln-1→L2→Ln-2→…
你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。
示例 1:
给定链表 1->2->3->4, 重新排列为 1->4->2->3.
示例 2:
给定链表 1->2->3->4->... |
print('---------------遍历列表元素-----------------')
lst=[10,20,30,40]
for i in lst:
print(i)
print('--------------添加元素------------------')
lst=[10,20,30]
print('添加元素之前',lst,id(lst))
lst.append(100) #在列表末尾添加一个元素
print('添加元素之后',lst,id(lst))
lst2=[11,22]
lst.append(lst2)
print(lst)
lst.extend(lst2) #添加多个元素... |
# -*- coding: utf-8 -*-
"""
s
@author: MAQ
"""
class Node():
def __init__(self, value):
self.value = value
self.next = None
a = Node(1)
b = Node(2)
c = Node(3)
a.next = b
b.next = c
a.next.next.value |
'''
10.5 - 빈 문자열이 섞여 있는 정렬 상태의 배열이 주어졌을 때, 특정한 문자열 의 위치를 찾는 메서드를 작성하라.
'''
def search_arr_with_empty_string(arr, target):
assert arr
left = init_left(arr)
right = init_right(arr)
mid = get_mid(arr, left, right)
while mid>=0:
if arr[mid]==target:
return mid
if arr[mid]>... |
class c():
def __init__(self) :
self.h = {0:0,1:1}
self.max = 1
def fib(self,n):
if n in self.h: return self.h[n]
for i in range(self.max+1,n+1):
self.h[i] = self.h[i-1]+self.h[i-2]
return self.h[n]
Fib = c()
for i in range(3):
... |
def main():
in_string = input()
counts = [0] * 26
for c in in_string:
counts[ord(c) - 65] += 1
palindrome = ""
middle = ""
for i in range(26):
if counts[i] % 2 == 1:
if middle:
print("NO SOLUTION")
return
middle = chr(65 + ... |
#Métodos de las listas
#append()
#clear()
#extend() une una lista con otra
#count()
#index()
#insert(posicion,elemento)
#pop()
#remove()
#reverse()
#sort()
#.sort(reverse=True)
#lista
lista=[10,20,30,2,4,5,-102]
lista_dos=["a","b","c","a","a","z","w","f"]
#print(len(lista))
lista_dos.sort()
#lista.sort(reverse=True)
pr... |
# 3. Write a recursive Python function that returns the sum of the first
# n integers. (Hint: The function will be similar to the factorial function!)
# ie sum_nint(3) = 1 + 2 + 3 = 6 , sum_nint(4) = 1 + 2 + 3 + 4 = 10.
def sum_nint(num):
''' recursive sum of integers
num = last integer in range
'''
... |
# +-----------------------+
# | LarBASIC™ Interpreter |
# | by Martín del Río |
# +-----------------------+
VERSION = 1
reserved = ["LET", "PRINT", "INPUT", "IF", "GOTO",
"SLEEP", "END", "LIST", "REM", "READ",
"WRITE", "APPEND", "RUN", "CLS", "CLEAR",
"EXIT"]
operators = [["==",... |
'''
07 - Removing missing values:
Now that you know there are some missing values in your DataFrame, you
have a few options to deal with them. One way is to remove them from the
dataset completely. In this exercise, you'll remove missing values by
removing all rows that contain missing values.
pandas has be... |
#### Regulation B
IGNORE_DEFINITIONS_IN_PART_1002 = [
'International Banking Act of 1978',
'Packers and Stockyards Act',
'Federal Reserve Act',
'Federal Credit Unions',
'National Credit Union Administration',
'Federal Intermediate Credit Banks',
'Production Credit Associations',
'Farm C... |
# ------------------------------
# 844. Backspace String Compare
#
# Description:
# Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character.
# Example 1:
# Input: S = "ab#c", T = "ad#c"
# Output: true
# Explanation: Both S and T become "ac".
# Ex... |
# Author: btjanaka (Bryon Tjanaka)
# Problem: (HackerRank) and-product
# Title: AND Product
# Link: https://www.hackerrank.com/challenges/and-product/problem
# Idea: The problem boils down to finding the leftmost non-aligned bit between
# two numbers, i.e. the leftmost bit that is not identical in a and b. We know
# th... |
with open("/Users/mccoybecker/Documents/GitHub/scratch-code/numbers.txt", "r") as myfile:
data=myfile.read().replace('\n', '')
print(data)
max = 0
for i in range(len(data)-12):
product = 1
for j in range(i,13+i):
product = product * int(data[j])
if product > max:
max = product
print(ma... |
# An n-bit gray code sequence is a sequence of 2n integers where:
# Every integer is in the inclusive range [0, 2n - 1],
# The first integer is 0,
# An integer appears no more than once in the sequence,
# The binary representation of every pair of adjacent integers differs by exactly one bit, and
# The binary re... |
#! /usr/bin/env python3.7
def find_active_cat(game_categories, title):
in_title = []
position = {}
title = title.lower()
for k in list(game_categories.keys()):
if k.lower() in title:
in_title.append(k)
position[k] = title.find(k.lower())
in_title = list(set(in_title... |
x = float(input('Digite um valor [0]Para encerrar o programa: '))
tot = 0
while x != 0:
tot +=x
x = float(input('Digite um valor [0]Para encerrar o programa: '))
print(f'O total da soma dos números inseridos é de {tot}') |
class Solution:
def firstPalindrome(self, words: List[str]) -> str:
def checkPalindrome(word):
l = len(word)
for i in range(l // 2):
last = l - 1 - i
if word[i] != word[last]:
return False
... |
def run():
print('Calculando el tiempo en un número de días determinado por ti.')
days = int(input('Digite la cantidad de días a calcular: '))
print('La cantidad de horas en {} días son: {}'.format(days, days*24))
print('La cantidad de minutos en {} días son: {}'.format(days, days*24*60))
print('La ... |
def extractRinveltHouse(item):
"""
Rinvelt House
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
tagmap = [
('Isekai Gakkyuu', 'Chou! Isekai Gakkyuu!!', 'translated'),
(... |
class Solution(object):
def moveZeroes(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
N = len(nums)
i = 0
zeros = 0
while i + zeros < N:
if nums[i] != 0:
... |
"""Package helper functions, classes, and utilities.
Copyright (c) 2019 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.0 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All us... |
"""
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the Licens... |
# import DevsExpo
zee5 = "https://userapi.zee5.com/v1/user/loginemail?email={email}&password={password}"
nord = "https://zwyr157wwiu6eior.com/v1/users/tokens"
vortex = "https://vortex-api.gg/login"
vypr = "https://api.goldenfrog.com/settings"
|
class Vehicle:
def __init__(self, cost):
self.cost = cost
def description(self):
return "Vehicle cost is {}".format(self.cost)
car1 = Vehicle(12000)
car2 = Vehicle(5999.99)
print(car1.description())
print(car2.description())
|
class Solution:
def shortestPath(self, grid: List[List[int]], k: int) -> int:
m = len(grid)
n = len(grid[0])
if m == 1 and n == 1:
return 0
dirs = [0, 1, 0, -1, 0]
steps = 0
q = deque([(0, 0, k)])
seen = {(0, 0, k)}
while q:
steps += 1
for _ in range(len(q)):
... |
for i in range(1, 21):
for j in range(2, i):
if(i % 2 == 0):
break
else:
print(i)
|
Totalplyers = int(input("Number of players: "))
Starplayers = 0
for i in range(Totalplyers):
Numberofpoints = int(input("Number of goals: "))
Numberoffouls = int(input("Number of fouls: "))
Numberofstars = Numberofpoints * 5 - Numberoffouls * 3
if Numberofstars > 40:
Starplayers = Starplayers +... |
"""Generated an open-api spec for a grpc api spec.
Reads the the api spec in protobuf format and generate an open-api spec.
Optionally applies settings from the grpc-service configuration.
"""
def _collect_includes(gen_dir, srcs):
"""Build an include path mapping.
It is important to not just collect unique d... |
__all__ = ()
class InfoException(Exception):
def __init__(self, info=None):
self.info = info or {}
super().__init__(self.info)
class DeepQMCError(Exception):
pass
class NanError(DeepQMCError):
def __init__(self, rs):
super().__init__()
self.rs = rs
class TrainingBlowu... |
#
# PySNMP MIB module NETSCREEN-VR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-VR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:20:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
"""
3) Выполнить программную реализацию умножения матрицы на матрицу (матрица задается пользователем
(задается размерность и вводятся элементы с клавиатуры),
как и вторая матрица, реализуйте проверку корректности введенных данных)
"""
class MatrixClass:
"""Класс матрицы"""
def __init__(self, matrix_number=1)... |
pasword = '123456'
username = 'kamilklkn'
a,b,c,d = 5,5,10,4
result = (a==b) #True
result = (a == c) #False
result = ('sdktrn' == username)
result = (a != b)
result = (a != c)
result = (a >= b)
result = (True == 1)
result = (False == 1)
print(result) |
__title__ = 'sellsy_api'
__description__ = 'sellsy_api is a tiny client for Sellsy API'
__url__ = 'https://github.com/Annouar/sellsy-api'
__version__ = '0.0.2'
__author__ = 'Annouar'
__license__ = 'MIT'
|
buses = []
n, m, h = map(int, input().split())
for i in range(n):
buses.append(int(input()))
count = 0
for i in range(n - 1):
while buses[n - i - 1] - buses[n - i - 2] > h:
buses[n - i - 2] += m
count += 1
print(count) |
"""
"Descriptors" section example of descriptor that allows for lazy
initialization of class instance attributes
"""
class InitOnAccess:
def __init__(self, klass, *args, **kwargs):
self.klass = klass
self.args = args
self.kwargs = kwargs
self._initialized = None
def __get__(s... |
# Time: O(h)
# Space: O(1)
# Definition for a Node.
class Node:
def __init__(self, val):
pass
class Solution(object):
def flipBinaryTree(self, root, leaf):
"""
:type node: Node
:rtype: Node
"""
curr, parent = leaf, None
while True:
child = ... |
class Solution(object):
def divisorGame(self, N):
"""
:type N: int
:rtype: bool
"""
return N % 2 == 0
def test_divisor_game():
assert Solution().divisorGame(2)
assert Solution().divisorGame(3) is False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.