content stringlengths 7 1.05M |
|---|
print("hello")
a=9
b=10
print(a+b)
|
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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 la... |
class A():
def __init__(self):
pass
def f(self):
return "A"
class B(A):
def __init__(self):
pass
def f(self):
return "B"
def g(self):
return "B"
class C(B):
def __init__(self):
pass
def g(self):
return "C"
class D(C):
def __... |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtype: ListNode
"""
# curA, cu... |
registry = {
"twicer_service": {
"grpc": 7003,
},
"halfer_service": {
"grpc": 7004,
},
"incrementer_service": {
"grpc": 7005,
},
"registry_service": {
"grpc": 7006,
},
"compo_service": {
"grpc": 7007,
},
}
|
# -*- coding: utf-8 -*-
def T(t0, i):
if i == 0:
return t0;
return T(t0, i - 1) + i * 2.71828
n = int(input("n: "))
if n < 1 or n > 10:
print("n值不合法")
else:
data = {}
for x in range(n):
data[x] = str(input("(T0, i) = "))
for d in data.items(): # d為tuple,所以要取d[1]才為資料
... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def CheckChangeOnUpload(input_api, output_api):
return _CommonChecks(input_api, output_api)
def CheckChangeOnCommit(input_api, output_api):
return _Co... |
"""
백준 9663번 : N-Queen
- 백트래킹
"""
n = int(input())
ans = 0
row = [0] * n
def is_promising(x):
for i in range(x):
if row[x] == row[i] or abs(row[x] - row[i]) == abs(x - i):
return False
return True
def n_queens(x):
global ans
if x == n:
ans += 1
else:
for i in... |
elements = {"Ag": 106.905095,
"Al": 26.981541,
"Ar": 39.962383,
"As": 74.921596,
"Au": 196.96656,
"B": 11.009305,
"Ba": 137.905236,
"Be": 9.012183,
"Bi": 208.980388,
"Br": 78.918336,
"C": 12,
... |
class stack(object):
def __init(self, limit = 10):
self.stk = []
self.limit = limit
def is_empty(self):
return len(self.stk) <= 0
def push(self, data):
if len(self.stk) > self.limit:
print("The stack is full")
else:
self.stk.app... |
#!/usr/bin/env python3
# Copyright (c) 2016-2020, henry232323
#
# 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, mo... |
v2_header = [
'globaleventid',
'sqldate',
'monthyear',
'year',
'fractiondate',
'actor1code',
'actor1name',
'actor1countrycode',
'actor1knowngroupcode',
'actor1ethniccode',
'actor1religion1code',
'actor1religion2code',
'actor1type1code',
'actor1type2code',
'act... |
'''
Pattern
Enter number of rows: 5
1
123
12345
1234567
123456789
'''
print('Number pattern:')
number_rows=int(input('Enter number of rows: '))
for row in range(1,number_rows+1):
for column in range(1,(2*row-1)+1):
print(column,end=' ')
print() |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'target',
'type': 'none',
'actions': [
{
'action_name': 'action1',
'inputs': []... |
'''
Given an array of integers nums, write a method that returns the "pivot" index of this array.
We define the pivot index as the index where the sum of the numbers to the left of the index is equal to the sum of the numbers to the right of the index.
If no such index exists, we should return -1. If there are multip... |
#!/usr/bin/env python3
with open("p079_keylog.txt") as f:
c = [line.rstrip() for line in f]
c = list(set(c))
print(c)
for n in c:
print("Pas {} vijne {}".format(n[0], n[1:]))
print("Pas {} vijne {}".format(n[1], n[2:]))
|
def selectionSort(lst):
for i in range(len(lst)):
ind = lst.index(min(lst[i:]))
print(i,ind,min(lst[i:]))
lst[i],lst[ind] = lst[ind],lst[i]
return lst
lst = list(map(int,input('Enter the number list: ').split()))
print(lst.index(min(lst)))
print(selectionSort(lst))
|
#!/usr/bin/env python3
def is_palindromic(a):
if int(a / 1e5) != a % 10:
return False
if int(a / 1e4) % 10 != int(a / 10) % 10:
return False
if int(a / 1e3) % 10 != int(a/ 100) % 10:
return False
return True
if __name__ == '__main__':
max_pad = 0
for i in range(99... |
# 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... |
# Big O complexity
# Average = O(log2(log2(n)))
# Pessimistic = O(n)
def interpolationSearch(arr, arg):
left = 0
right = (len(arr) - 1)
while left <= right and arr[left] <= arg <= arr[right]:
index = left + int(((float(right - left) / (arr[right] - arr[left])) * (arg - arr[left])))
if arr... |
DATALINK_CONTENT_TYPE = 'application/x-votable+xml;content=datalink'
DATALINK_TABLE = {
'name': 'datalink',
'description': 'The table of datalinks for the service',
'order': 4,
'access_level': 'PUBLIC',
'metadata_access_level': 'PUBLIC'
}
DATALINK_FIELDS = [
{
'name': 'ID',
'orde... |
# Project Euler 2 - Even Fibonacci Numbers
# GitHub: urtuba
def evenFibonacciGenerator(limit: int):
'''
The function to create a generator for even fibonacci numbers
:param limit: maximum number for the generator
:return: even fibonacci numbers generator
'''
fib = 1
fib_next = 2
while ... |
#Q2. Given a list of integers, my_list = [4,2,4,0,2,4,5,7,8,9,23,8,5,4,2,2,34,4,45].
# Find the maximum and minimum numbers in the list.
my_list = [4,2,4,0,2,4,5,7,8,9,23,8,5,4,2,2,34,4,45]
sorted_my_list=sorted(my_list)
print("The minimum number is:",my_list[0])
i=len(my_list)
print("The maximum number is:",my_list[i... |
# coding: utf-8
"""
File contains base API Exception.
"""
class ApiException(Exception):
"""
Base exception.
"""
def __init__(self, message, status_code=None, api_error_code=None, payload=None):
Exception.__init__(self)
self.message = message
self.status_code = status_code if s... |
print(
"""
Please use one of the following:
python -m gmailcopy.core
python -m gmailcopy.server
"""
)
|
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# # MIT License
#
# Copyright (c) 2020 Mike Simms
#
# 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... |
src =Split('''
base/log/LITE-log/lite-log.c
base/utils/LITE-utils/src/json_parser.c
base/utils/LITE-utils/src/json_token.c
base/utils/LITE-utils/src/mem_stats.c
base/utils/LITE-utils/src/string_utils.c
base/utils//misc/utils_httpc.c
base/utils//misc/utils_list.c
base/utils//misc... |
class Bucket:
def __init__(self):
self.bucket = []
def get(self, key):
for (k, v) in self.bucket:
if k == key:
return v
return -1
def update(self, key, value):
found = False
for i, value in enumerate(self.bu... |
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT = 465
MAIL_USE_TLS = False
MAIL_USE_SSL = True
MAIL_USERNAME = 'playiq.com@gmail.com'
MAIL_PASSWORD = 'notplaynet'
|
"""
this class is responsible for storing all the information about the current
state of a chess game, it will aslo be responsible for determning the valid
move at the current state. It will also keep a move log
"""
class Gamestate():
def __init__(self):
#board is an 8X8 2D list
#string "--"... |
def HCF (x,y):
if x > y:
d=[]
for i in range(1,y+1):
if y % i == 0 and x % i == 0:
d.append(i)
print(d[-1])
elif x < y:
d=[]
for i in range(1,x+1):
if y % i == 0 and x % i == 0:
d.append(i)
print(d[-1])
prin... |
# By Kamran Bigdely Nov. 2020
# Replace temp variable with query
# TODO: Use 'extract method' refactoring technique to improve this code.
# TODO: If required, use 'replace temp variable with query' technique to make it easier to extract methods.
class Employer:
"""A class to represent a employer"""
def __ini... |
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "core_binary", "core_library", "core_resource")
def buildall(framework):
core_library(
name = "assert.xunit",
srcs = native.glob(["**/*.cs"]),
visibility = ["//visibility:public"],
deps = [
"@io_bazel_rules_dotnet//dotnet/s... |
#
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions an... |
def resolve():
'''
code here
'''
X = int(input())
memo = 0
res = 0
for i in range(1, X+3):
memo += i
if memo >= X:
res = i
break
print(res)
if __name__ == "__main__":
resolve()
|
# if-else
# Created by JKChang
# 14/08/2018, 10:48
# Tag:
# Description: https://www.hackerrank.com/challenges/py-if-else/problem
# Task
# Given an integer, , perform the following conditional actions:
# If n is odd, print Weird
# If n is even and in the inclusive range of 2 to 5, print Not Weird
# If n is even and in ... |
def recursive_sum(n):
if n <= 0:
return 0
return n + recursive_sum(n - 1)
print(recursive_sum(3))
# O(n) time; O(n) space
|
major, minor, patch = (0, 1, 1)
__version__ = f"{major}.{minor}.{patch}"
__author__ = "Unai Saralegui"
__email__ = "usaralegui@gmail.com"
__credits__ = ["Unai Saralegui"]
__maintainer__ = "Unai Saralegui"
__status__ = "Development"
|
# --------------------------------------------- #
# Plugin Name : TelegramAirdropBot #
# Author Name : fabston #
# File Name : config.py #
# --------------------------------------------- #
# Enable / disable the airdrop
airdrop_live = True
# Telegram
api_to... |
def diagonal(width):
yield 1 # middle cell
for level in range(1, (width + 1)//2 ):
first = (2*level+1)**2
for i in range(4):
yield(first - i * (2*level))
print(sum(diagonal(1001)))
|
# Write a Python script using class to reverse a string word by word
class String:
def __init__(self, string):
self.string = string
def reverse(self):
self.words = self.string.split()
self.reversed_words = self.words[::-1]
self.reversed_string = ' '.join(self.reversed_words)
... |
a, b = input().split()
s = str(int(a)**int(b))
for i in range(len(s)):
if i % 70 == 0 and i != 0:
print()
print(s[i], end='')
|
"""After looking at question we can see that we need 5 iterations for finding a match between a substring(length 3) and string(length 7). Keep th count using whole.
"""
def count_substring(string, sub_string):
whole = 0
for i in range(len(string) - len(sub_string) + 1):
if(string[i:i+len(sub_string... |
def applyOpts(opts=None, otherOpts=None, override=None, *args, **kwargs):
otherOptNames = dir(otherOpts)
for i in range(1, len(otherOptNames)):
optName = otherOptNames[i]
if not (hasattr(opts, optName)) or override:
setattr(opts, optName, getattr(otherOpts, (optName)))
return op... |
# TODO: fix auto-increase
class IntCodeSolver:
# Calls the helper, which runs the majority of the code
def intCodeSolver(self, intcode):
return self.intCodeStepper(intcode, 0)
# Performs one step of the IntCode
def intCodeStepper(self, intcode, headloc):
opcode = intcode[headloc]
... |
_base_ = ['../../recognizers/_base_/model_r3d18.py',
'../../recognizers/_base_/runtime_ssv1.py']
work_dir = './output/ctp/r3d_18_kinetics/finetune_ssv1/'
model = dict(
backbone=dict(
pretrained='./output/ctp/r3d_18_kinetics/pretraining/epoch_90.pth',
),
st_module=dict(temporal_size=4),
... |
# from Bio.Seq import Seq
# with open('dataset_3_2.txt', 'r') as file:
# text = file.read().replace('\n', '')
# my_seq = Seq(text)
# print(my_seq.reverse_complement())
# def swap(char):
# if char == 'A':
# return 'T'
# if char == 'T':
# return 'A'
# if char == 'C':
# return 'G... |
# -*- coding: utf-8 -*-
"""
pip_services_logging.__init__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Logging module initialization
:copyright: Conceptual Vision Consulting LLC 2015-2016, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
__all__ = []
|
class BaseCache:
"""Baseclass for the cache systems. All the cache systems implement this
API or a superset of it.
:param default_timeout: the default timeout (in seconds) that is used if
no timeout is specified on :meth:`set`. A timeout
of 0 indicat... |
self.description = 'download a remote package with -U'
self.require_capability("curl")
url = self.add_simple_http_server({})
self.args = '-Uw {url}/foo.pkg'.format(url=url)
self.addrule('!PACMAN_RETCODE=0')
self.addrule('!CACHE_FEXISTS=foo.pkg')
self.addrule('!CACHE_FEXISTS=foo.pkg.sig')
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#--------------------------------------------------
# Zmień parametry aby uszyć własny szalik
#--------------------------------------------------
# kolory szalika
kolory = ['#','-','$']
# długość każdego koloru
dlugosc_koloru = 4
# długość szalika
dlugosc_szalika = 35
#... |
foo = 0
while foo < 5:
foo = foo + 1
if foo == 3:
continue # jump back to while loop, print 'foo is n' is not called
print('foo is ' + str(foo))
|
def binary_or_not(str):
binary="01"
return all([num in binary for num in str])
str="001021010001010"
if binary_or_not(str):
print("Binary")
else:
print("Not Binary") |
magicians = ['Dynamo', 'Jason Latimer', 'Franz Harary']
temp_magicians = []
def show_magicians(name):
for i in name:
print(i)
def make_great(current_name):
# j = len(current_name)
while current_name:
# j = current_name.pop()
temp_magicians.append('The great ' + current_name.pop()... |
class Solution:
def isPalindrome(self, x: int) -> bool:
if x < 0:
return False
if x < 10:
return True
return str(x) == str(x)[::-1]
|
# user input
# https://www.hackerrank.com/challenges/nested-list/problem?h_r=internal-search
if __name__ == '__main__':
z = int(input())
phy = []
grd = []
for _ in range(z):
name = input().strip()
score = float(input().strip())
phy.append([name, score])
grd.append(score)
... |
n, i = int(input()), 0
while n:
i += 1
n = int(input())
print(i)
|
""" You will learn more about "Bayesian brains" and the theory surrounding
these ideas once the course begins. Here is a brief explanation: it may
be ideal for human brains to implement Bayesian inference by integrating "prior"
information the brain has about the world (memories, prior knowledge, etc.) with
new eviden... |
# Write a python script to generate Fibonacci terms using generator function.
def fin(n):
a, b = 0, 1
for _ in range(n):
yield a
a, b = b, a + b
ln = int(input('Enter a number: '))
print(list(fin(ln))) |
class Calc:
def calc(opr, num1, num2):
if (opr.lower() == "+") or (opr.lower() == "sum") or (opr.lower() == "plus"):
print(num1 + num2)
elif (opr.lower() == "-") or (opr.lower() == 'subtract') or (opr.lower() == 'minus'):
print(num1 - num2)
elif (opr.lower() == "*") ... |
""" Auteur = Frédéric Castel
Date : Avril 2020
Projet : MOOC Python 3 - France Université Numérique
Objectif:
Écrire une fonction bat(joueur_1, joueur_2) où joueur_1 et joueur_2 ont chacun une valeur entière 0, 1 ou 2, qui encode ce que le joueur a fait comme coup (0 : PIERRE, 1 : FEUILLE, 2 : CISEAUX) qui... |
BOT_TOKEN = "1629027959:AAEaTw4s2qaAL3mYP3fQRnE"
RESULTS_COUNT = 4 # NOTE Number of results to show, 4 is better
SUDO_CHATS_ID = [-1001477025068, -1001440596979]
DRIVE_NAME = [
"Root", # folder 1 name
"Cartoon", # folder 2 name
"Course", # folder 3 name
"Movies", # ....
"Series", # ......
... |
def list_sum(input_list):
sum = 0
# todo: Write a for loop that adds the elements
# of input_list to the sum variable
for value in input_list:
sum += value
return sum
#These test cases check the list_sum works correctly
test1 = list_sum([1, 2, 3])
print("expected result: 6, actual result... |
'''
basic_config.py
'''
# debug 模式
DEBUG = False
# 顯示 sql 查詢語句
SQLALCHEMY_ECHO = False
# SQLAlchemy 將會追蹤對象的修改並且發送信號。這需要額外的內存,如果不必要的可以禁用它。
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class GcpParams(object):
"""Implementation of the 'GcpParams' model.
Specifies various resources when converting and deploying a VM to GCP.
Attributes:
instance_id (long|int): Specifies id of the GCP instance type in which
to de... |
class FileSystem:
def __init__(self):
self.fileSystem = {}
self.endToken = '#'
def createPath(self, path: str, value: int) -> bool:
if path in {'', '/'}:
return False
if path.startswith('/'):
tokens = path.split('/')[1:]
currentNode = self.fi... |
print('-=-=-=-= DESAFIO 69 -=-=-=-=')
print()
pessoas = homens = mulheres = 0
while True:
print('-'*30)
print(' CADASTRE UMA PESSOA')
print('-'*30)
idade = int(input('Idade: '))
sexo = ' '
while sexo not in 'MF':
sexo = str(input('Sexo: [M/F] ')).strip().upper()[0]
if idade >= 1... |
# Here are the tests belonging to e3sm suites. Format is
# <test>.<grid>.<compset>.
# suite_name -> (inherits_from, timelimit, [test [, mods[, machines]]])
# To elaborate, if no mods are needed, a string representing the testname is all that is needed.
# If testmods are needed, a 2-ple must be provided (test, mods... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
print('<[100]> evalsupport module start')
def deco_alpha(cls):
print('<[200]> deco_alpha')
def inner_1(self):
print('<[300]> deci_alpha:inner_1')
cls.method_y = inner_1
return cls
class MetaAleph(type):
print('<[400]> MetaAleph bo... |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class PrivilegeIdEnum(object):
"""Implementation of the 'PrivilegeId' enum.
Specifies unique id for a privilege. This number must be unique when
creating a new privilege.
Type for unique privilege Id values.
All below enum values specify a va... |
firstName = input()
lastName = input()
age = int(input())
town = input()
print("You are %s %s, a %d-years old person from %s." % (firstName, lastName, age, town)) |
# ===--- gyb_stdlib_support.py -----------------------*- coding: utf-8 -*-===//
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.t... |
def _build_mimetype(resource_name, fmt="json"):
return "application/vnd.reviewboard.org.%s+%s" % (resource_name, fmt)
api_token_list_mimetype = _build_mimetype("api-tokens")
api_token_item_mimetype = _build_mimetype("api-token")
archived_item_mimetype = _build_mimetype("archived-review-request")
change_list_mimetype =... |
num = int(input('Digite um numero inteiro:'))
print('''Escolha uma das bases para conversao:
[1] converter para BINARIO
[2] converter para OCTAL
[3] converter para HEXADECIMAL''')
opcao = int(input('Escolha sua opcao:'))
if opcao == 1:
print(f'{num} convertido para BINARIO e igual a {bin(num)}')
elif opcao == 2:
... |
class Eigenstates:
def __init__(self, energies, array, extent, N, type):
"""Info about the eigenstates"""
self.energies = energies
self.array = array
self.number = len(array)
self.extent = extent
self.N = N
self.type = type
|
f=input("enter no")
beg=0
end=5
flag=0
while (beg<=end):
mid=(end+beg)/2;
if(list[mid]==f):
print("found");
flag=1;
break;
elif(list[mid]<f):
beg=beg+1;
else:
end=end-1;
if(flag==0):
print("not found");
|
"""
mod2
"""
def decorator(f):
return f
@decorator
def func2(a, b):
"""
this is func2
"""
return a, b
@decorator
class Class2(object):
"""
this is Class2
"""
|
def mergeOverlappingIntervals(array):
if(len(array)<2):
print(array)
return array
res = []
array.sort()
print(array)
prev = array[0]
for i in range(1, len(array)):
if(prev[1]>= array[i][0]):
prev = [prev[0], max(prev[1], array[i][1])]
else:
... |
DD_ORIGIN = "_dd_origin"
AUTO_REJECT = 0
AUTO_KEEP = 1
USER_KEEP = 2
SAMPLE_RATE_METRIC_KEY = "_sample_rate"
SAMPLING_PRIORITY_KEY = "_sampling_priority_v1"
ENV_KEY = "env"
VERSION_KEY = "version"
|
class Angel:
color = "white"
feature = "wings"
home = "Heaven"
class Demon:
color = "red"
feature = "horns"
home = "Hell"
a_angel = Angel()
a_demon = Demon()
print(a_angel.color)
print(a_angel.feature)
print(a_angel.home)
print(a_demon.color)
print(a_demon.feature)
print(a_demon.home) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
M = int(input())
arr = [list(map(int, input().split())) for i in range(M)]
ans = 0
f = [[0]*M for i in range(M)]
def dfs(i, j):
if i == M or i == -1 or j == M or j == -1:
return
f[i][j] = 1
if arr[i][j] == 0:
return
if i+1 != M and f[i+1][j... |
class HashTable():
def __init__(self ,size = 1024):
"""initialization hash table"""
self.max = size #length of list
self.arr = [[] for i in range(self.max)]
# or [None]*self.size\ we store key value pairs in each index [('Key',value),('Key',value)]
def get_hash(self, key):
"""function to retur... |
SECRET_KEY = 'ratelimit'
INSTALLED_APPS = (
'ratelimit',
)
RATELIMIT_USE_CACHE = 'default'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'ratelimit-tests',
},
'connection-errors': {
'BACKEND': 'django.core.cache.backends.memcac... |
web_server_ip = '0.0.0.0'
web_server_port = 8080
checker_max_continuous_fail_count = 5
checker_period = 150
checker_judge_timeout = 5
checker_number = 50
fetcher_period = 60
|
'''65-CRIE UM PROGRAMA QUE LEIA VARIOS NUMEROS INTEIROS PELO TECLADO. NO FINAL DA EXECUÇÃO , MOSTRE A MEDIA ENTRE TODOS OS VALORES E QUAL FOI O MAIOR E O MENOR VALOR LIDO. O PROGRAMA DEVE PERGUNTAR AO USUARIO SE ELE QUER OU NÃO CONTINUAR A DIGITAR VALORES. '''
resposta='S'
soma=quantidade=media=maior=menor=0
while re... |
lastback = False
startback = 0
unprintable = []
for i in range(0x7f, 0x10001):
c = chr(i)
thisback = repr(c)[1] == "\\"
if thisback != lastback:
# print("{:08x}|{!r}: {}".format(i, c, thisback))
if thisback:
startback = i
else:
end = i-1
if startback == end:
unprintable.append("\\u{:04x}".format... |
# jogo da palavra secreta
# para revisao / aula 38
secreto = 'perfume'
digitadas = []
while True:
letra = input('digite uma letra: ')
if len(letra) > 1:
print('por favor, digite apenas uma letra')
continue
digitadas.append(letra)
if letra in secreto:
print(f'uhuull, a letra... |
num, den = map(int, input().split(" "))
n = int(input())
p = num / den
print(round(((1-p)**(n-1))*p, 3))
|
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: A ListNode
@return: A ListNode
"""
def deleteDuplicates(self, head):
if not head:
return None
cu... |
if 1:
2
elif 3:
4
elif 5:
6
|
#!/usr/bin/env python
"""
Created by: Lee Bergstrand (2017)
Description: The literature reference class.
"""
class LiteratureReference(object):
"""A class representing a literature reference supporting the existence of a genome property."""
def __init__(self, number, pubmed_id, title, authors, journal):
... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
UserAgents = [
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; AcooBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)",
"Mozil... |
class DimensionSelection:
""" Instances of this class to be passed to construct_mdx function
"""
SUBSET = 1
EXPRESSION = 2
ITERABLE = 3
def __init__(self, dimension_name, elements=None, subset=None, expression=None):
self.dimension_name = dimension_name
self.selection_type = se... |
"""Constants for the component."""
# Component domain, used to store component data in hass data.
__version__ = "1.0.4"
VERSION = __version__
DOMAIN = "swemail"
SENSOR_NAME = "Delivery"
DEVICE_NAME = "Mail Delivery API"
DEVICE_AUTHOR = "Daniel Sörlöv"
DEVICE_VERSION = __version__
CONF_POSTALCODE = "postalcode"
CONF... |
print("Here is combine_strings test:")
s1 = input("Please enter a string:")
s2 = input("Please enter another string:")
print(s1, s2)
|
def read_input(fname):
lines = open(fname).readlines()
algorithm = lines[0].strip()
input_image = [line.strip() for line in lines[2:]]
return algorithm, input_image
def make_first_grid(input_image):
grid = {}
imin = 0
imax = len(input_image)
jmin = 0
jmax = len(input_image[0])
... |
arr = [3,5,6,7,1,4,2]
def bubbleSort(arr):
count = 0
for j in range(len(arr)-1):
#print("\n\n", "-"*50, "Iteration", j)
for i in range(len(arr)-1-j):
count += 1
# print("\n","*"*80, "\nindex ", i, "value", arr[i])
#print("\n","*"*80, "\ncomparing", arr[i], ar... |
#!/usr/bin/env python
NAME = 'AdNovum nevisProxy'
def is_waf(self):
# credit goes to an anonymous reporter
return self.matchcookie('^Navajo.*?$')
|
#
# PySNMP MIB module ALCATEL-IND1-DHCPV6-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-DHCPV6-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:17:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
#
# PHASE: write manifest
#
# DOCUMENT THIS
#
load(
"@io_bazel_rules_scala//scala/private:common.bzl",
"write_manifest",
)
def phase_write_manifest(ctx, p):
write_manifest(ctx)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.