content stringlengths 7 1.05M |
|---|
class Config:
# AWS Information
ec2_region = "eu-west-2" # London # Same as environment variable EC2_REGION
ec2_amis = ['ami-09c4a4b013e66b291']
ec2_keypair = 'OnDemandMinecraft'
ec2_secgroups = ['sg-0441198b7b0617d3a']
ec2_instancetype = 't3.small'
|
with open('payload.bin', 'rb') as stringFile:
with open('payload.s', 'w') as f:
for byte in stringFile.read():
print('byte %s' % hex(byte), file=f)
|
def fast_scan_ms(name = 'test', tilt_stage=True):
print("in bens routine")
yield from expert_reflection_scan_full(md={'sample_name': name}, detector=lambda_det, tilt_stage=tilt_stage)
def ms_align():
yield from bps.mv(geo.det_mode,1)
yield from bps.mv(abs2,3)
yield from nab(-0.1,-0.1)
y... |
#Restaurant:
class Restaurant():
"""A simple attempt to make class restaurant. """
def __init__(self, restaurant_name, cuisine_type):
""" This is to initialize name and type of restaurant"""
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
def describe_resta... |
# Insert a Node at the Tail of a Linked List
# Developer: Murillo Grubler
# https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list/problem
class SinglyLinkedListNode:
def __init__(self, data):
self.data = data
self.next = None
class SinglyLinkedList:
def __init__(self... |
tempClasses = []
tempStudents = []
def student(_, info, id):
for s in tempStudents:
if s['id'] == id:
return s
return None
def students(_, info):
return {
'success': True,
'errors': [],
'students': tempStudents}
def classes(_, info, id):
for c in tempCla... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Time : 11:41
# Email : spirit_az@foxmail.com
# File : readMe.py
# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ #
# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ #
# +--+--+--+--+--+-... |
class WechatPayError(Exception):
pass
class APIError(WechatPayError):
pass
class ValidationError(APIError):
pass
class AuthenticationError(APIError):
pass
class RequestFailed(APIError):
pass
|
# #1
# def count_red_beads(n):
# return 0 if n < 2 else (n - 1) * 2
def count_red_beads(n): # 2
return max(0, 2 * (n-1))
|
class SystemFonts(object):
""" Contains properties that expose the system resources that concern fonts. """
CaptionFontFamily=None
CaptionFontFamilyKey=None
CaptionFontSize=12.0
CaptionFontSizeKey=None
CaptionFontStyle=None
CaptionFontStyleKey=None
CaptionFontTextDecorations=None
CaptionFontTextDecora... |
class StringViewIter:
__slots__ = ("inp", "position")
def __init__(self, inp: str):
self.inp = inp
self.position = 0
def __iter__(self):
return self
def __next__(self):
if self.position >= len(self.inp):
raise StopIteration
self.position += 1
... |
#paste your date in collections
collections = """28/03/2020
28/04/2020
28/05/2020
28/06/2020
28/07/2020
28/08/2020
28/10/2019
28/11/2019
28/12/2019
28/01/2020
28/02/2020
28/03/2020
28/04/2020
28/05/2020
28/06/2020
28/07/2020
28/08/2020
28/12/2019
28/01/2020
28/02/2020
28/03/2020
28/04/2020
28/05/2020
28/06/2020
28/07/2... |
def check_fabs(matrix):
print(matrix)
s = set()
i = 0
while i < len(matrix):
if matrix[i][1] in s:
matrix[i][1] += 1
if matrix[i][1] == len(matrix):
matrix[i][1] = 0
else:
s.add(matrix[i][1])
i += 1
print(matrix)
pri... |
# Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai).
# n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0).
# Find two lines, which together with x-axis forms a container, such that the container contains the most water.
# Note: ... |
#Entering Input
n = int(input("Enter the no of elements in List: "))
print(f"Enter the List of {n} numbers: ")
myList = []
for num in range (n):
myList.append(int(input()))
print (myList)
#Finding the largest Number
larNo = myList[0]
for num in range(0,n-1):
if larNo < myList[num+1]:
larNo = myLi... |
resultado=""
K=int(input())
if K>0 and K<=1000:
while K!=0:
N,M=list(map(int, input().split()))
if N>-10000 or M<10000:
for x in range(K):
X,Y=list(map(int, input().split()))
if X>=-10000 or Y<=10000:
if X<N and Y>M:
resultado += "NO\n"
elif X>N and Y>M:
resultado += "NE\n"
el... |
"""Provides the repository macro to import LLVM."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def repo():
"""Imports LLVM."""
XED_COMMIT = "5976632eeaaaad7890c2109d0cfaf4012eaca3b8"
XED_SHA256 = "8cc7c3ee378a8827e760e71ecf6642a814f0a991d768a120df5f177323b692e6"
MBUILD_C... |
print("Welcome to the tip calculator.")
bill = float(input("What was your total? $"))
tip = int(input("What percentage tip would you like to give? 10, 12 or 15? "))
people = int(input("How many people to split the bill? "))
bill_with_tip = ((tip /100 ) * bill + bill) / people
final_bill = round(bill_with_tip,2)
# print... |
def distance(strand_a, strand_b):
try:
if strand_a == strand_b:
return 0
else:
count = 0
total = 0
while count < len(strand_a):
if strand_a[count] != strand_b[count]:
total = total + 1
count += 1
... |
# Initial state.
a = 1
b = c = d = e = f = g = h = 0
b = 67
c = b
# if a != 0 goto ANZ # jnz a 2
# When a was 0, this would skip the next 4 lines
# jnz 1 5
# ANZ
b = b * 100 # (6700) # mul b 100 #1
b -= -100000 # sub b -100000 # 2
c = b # set c b # 3
c -= -17000 # sub c -17000 # 4
# b = 106700
# c = 123700
# -23... |
#Embedded file name: ACEStream\__init__.pyo
LIBRARYNAME = 'ACEStream'
DEFAULT_I2I_LISTENPORT = 0
DEFAULT_SESSION_LISTENPORT = 8621
DEFAULT_HTTP_LISTENPORT = 6878
|
list1 = list()
list2 = ['a', 25, 'string', 14.03]
list3 = list((1,2,3,4)) # list(tuple)
print (list1)
print (list2)
print (list3)
# List Comprehension
list4 = [x for x in range(10)]
print (list4)
list5 = [x**2 for x in range(10) if x > 4]
print (list5)
# del(): delete list item or list itself
list6 = ['sugar', 'rice... |
project='pbdcex'
version='0.1.1'
debug = 1 #0/1
defs = []
verbose = 'on' #on/off
extra_c_flags = '-wno-unused-parameter'
extra_cxx_flags = '--std=c++11 -lpthread -lrt -ldl'
env = {
'protoi':'/usr/local/include',
'protoc':'protoc',
'protoi':'/usr/local/include',
}
units = [
{
'name':'pbdcexer',... |
def merge(A, temp, frm, mid, to):
k = frm
i = frm
j = mid + 1
# loop till no elements are left in the left and right runs
while i <= mid and j <= to:
yield A, i, j, frm, to
if A[i] < A[j]:
temp[k] = A[i]
i = i + 1
else:
temp[k] = A[j]
... |
#
# PySNMP MIB module NRC-HUB1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NRC-HUB1-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:24:24 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... |
# Animate plot as a wire-frame
plotter = pv.Plotter(window_size=(800, 600))
plotter.add_mesh(grid, scalars=d[:, 1],
scalar_bar_args={'title': 'Y Displacement'},
show_edges=True,
rng=[-d.max(), d.max()], interpolate_before_map=True,
style='wireframe')
p... |
def display():
def message():
return "Hello "
return message
fun=display()
print(fun())
|
def sku_lookup(sku):
price_table = [
{
'item': 'A',
'price': 50,
'offers': [
'3A for 130',
],
},
{
'item': 'B',
'price': 30,
'offers': [
'2B for 45',
... |
class One:
def __init__(self):
super().__init__()
print("This is init method of class One")
self.i=5
class Two(One):
def __init__(self):
super().__init__()
print("This is init method of class Two")
self.j=10
class Three(Two):
def __init__(self):... |
{
"targets": [
{
"target_name": "mmap",
"sources": ["mmap.cc" ],
"include_dirs": [
"<!(node -e \"require('nan')\")",
],
"xcode_settings": {
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"MACOSX_DEPLOYMENT_TARGET": "10.12",
"OTHER_CPLUSPLUSFLAGS": [ "-std=c++11",... |
# Python modules
# 3rd party modules
# Our modules
#------------------------------------------------------------------------------
# Method calls for different entry points' processing
def do_processing_all(chain):
"""
"""
return
set = chain._block.set
... |
#!/usr/local/bin/python3.3
L = [1, 2, 3, 4]
print(L[-1000:100])
L[3:1] = ['?']
print(L)
|
def bissexto(ano):
if(ano % 4 == 0 and (ano % 400 == 0 or ano % 100 != 0)):
return True
return False
def dias_mes(ano):
if(len(ano)=='fev'):
return ValueError("Nao tem 3 caracteres")
return
mes=str(input("Mes: "))
print(dias_mes(mes)) |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... |
# Marcelo Campos de Medeiros
# ADS UNIFIP 2020.1
# Patos-PB 03/04/2020
'''
Leia dois valores inteiros, no caso para variáveis A e B.
A seguir, calcule a soma entre elas e atribua à variável SOMA.
A seguir escrever o valor desta variável.
'''
a = int(input())
b = int(input())
soma = a + b
print("SOMA = {}".format(so... |
"""Farcy test helpers."""
class Struct(object):
"""A dynamic class with attributes based on the input dictionary."""
def __init__(self, iterable=None, **attrs):
"""Create an instance of the Struct class."""
self.__dict__.update(attrs)
self._iterable = iterable or []
def __getitem... |
# djamplek8s/__init__.py
"""
A Django example project for Kubernetes
"""
__version__ = "0.0.2"
__title__ = "djamplek8s"
__description__ = "Django example project for Kubernetes"
__uri__ = "https://github.com/maartenq/djamplek8s"
__author__ = "Maarten"
__email__ = "ikmaarten@gmail.com"
__license__ = "MIT or Apache Lic... |
def _fetch_signature(nmf_genes, signature):
"""
Group and sort NMF signatures. Return the table for a single signature
Parameters:
-----------
nmf_genes
gene x signature table
type: pandas.DataFrame
signature
NMF gene signature selection
type: int or float
... |
"""
Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.
Your task is to find the smallest possible length of a (contiguous) subarray of nums, that has the same degree as nums.
Example 1:
Input: [1, 2, 2, 3, 1]
Output: 2
Explan... |
n = int(input())
f = {}
ans = set()
for i in range(n):
tmp = input().split()
if tmp[0] not in f.values():
ans.add(tmp[0])
f[tmp[0]] = tmp[1]
print(len(ans))
for old in ans:
new = old
while new in f.keys():
new = f[new]
print(old, new)
|
# -*- coding: utf-8 -*-
"""Digital Forensics Date and Time (dfDateTime).
dfDateTime, or Digital Forensics date and time, provides date and time
objects to preserve accuracy and precision.
"""
__version__ = '20180324'
|
# TODO: Things that might be implemented some time
#VisItExecuteCommand
#VisItSaveWindow
#VisItInitializeRuntime
"""
Excerpt from the visit/simv2 sources:
int VisItAddPlot(const char *plotType, const char *var);
int VisItAddOperator(const char *operatorType, int applyToAll);
int VisItDrawPlots(void);
int VisItDeleteA... |
"""
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
Note: next() and hasNext() should run in average O(1) time and uses O(h) memory, where h is the height of the tree.
"""
__author__ =... |
x1 = 0
x2 = 1
s = 0
while True:
fib = x1 + x2
x1 = x2
x2 = fib
if fib % 2 == 0:
s += fib
if fib >= 4e6: break
print(s) |
class Sprite():
''' The Sprite class manipulates the imported sprite and is utilized for texture mapping
Attributes:
matrix (array): the color encoded 2d matrix of the sprite
width (int): width of the 2d sprite matrix
height (int): heigth of the 2d sprite matrix
... |
# 69
# Crie um programa que leia a idade e o sexo de várias pessoas. A cada pessoa cadastrada, o programa deverá perguntar se o usuário quer ou não continuar. No final, mostre: A) quantas pessoas tem mais de 18 anos. B) quantos homens foram cadastrados. C) quantas mulheres tem menos de 20 anos.
# Description
# maior18... |
#menjalankan python
a=10
b=2
c=a/b
print(c)
print("-------------------------")
#penulisan variabel
Nama="Fazlur"
_nama="Fazlur"
nama="Zul"
print(Nama)
print(_nama)
print(nama)
print("-------------------------")
#mengenal nilai dan tipe data dalam python
a=1
makanan ="ayam"
print(type(makanan))
pri... |
PATH={ "amass":"../amass/amass",
"subfinder":"../subfinder",
"fierce":"../fierce/fierce/fierce.py",
"dirsearch":"../dirsearch/dirsearch.py"
}
|
class TreeNode():
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __repr__(self):
return '<TreeNode {}>'.format(self.val)
def sorted_array_to_bst(arr):
"""
Given a sorted array turn it into a balanced binary tree
"""
if len(arr) == 0:... |
def get_input():
total_cows = int(input(""))
cow_str = input("")
return total_cows, cow_str
def calc_lonely_cow(total_cows, cow_str):
total_lonely_cow = 0
#for offset in range(3, total_cows + 1):
for offset in range(3, 60):
for start_pos in range(0, total_cows):
total_count... |
# nested
# função declarada dentro de outra função
def f1():
x = 3000
def f2():
print(x)
f2()
# uso 1:
def exp(n):
def base(x):
return x ** n
return base
f = exp(3) # define o valor de n e f se torna um espelho de base
print(f(10)) # 10 elevado a 3
# nonlocal
# permite alterar o val... |
# use part function of problem 290
class Solution:
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
def get_p(string):
p = []
keys = []
for word in string:
if len(keys) == 0:
... |
class Parameterset(object):
""" Parameter set """
def __init__(self, name, description, uri=None):
self.name = name
self.description = description
self.uri = uri
self.params = {}
def _load_from_uri(self):
pass
def parameterset(model, name, kw... |
# -*- coding: utf-8 -*-
class InvalidTodoFile(Exception):
pass
class InvalidTodoStatus(Exception):
pass
|
num=int(input("Enter a number: "))
sum=0
for i in range(len(str(num))):
sum=sum+(num%10)
num=num//10
print("The sum of the digits in the number entered is: ",sum) |
words_count = int(input())
english_persian_dict = {}
france_persian_dict = {}
german_persian_dict = {}
for i in range(words_count):
words = input().split()
english_persian_dict[words[1]] = words[0]
france_persian_dict[words[2]] = words[0]
german_persian_dict[words[3]] = words[0]
sentence = input()
... |
class tiger:
def __init__(self, name: str):
self._name = name
def name(self) -> str:
return self._name
@staticmethod
def greet() -> str:
return "Mijau!"
@staticmethod
def menu() -> str:
return "mlako mlijeko"
|
#!/usr/bin/env/python
class ABcd:
_types_map = {
"Child1": {"type": int, "subtype": None},
"Child2": {"type": str, "subtype": None},
}
_formats_map = {}
def __init__(self, Child1=None, Child2=None):
pass
self.__Child1 = Child1
self.__Child2 = Child2
def _... |
cities = [
'Rome',
'Milan',
'Naples',
'Turin',
'Palermo',
'Genoa',
'Bologna',
'Florence',
'Catania',
'Bari',
'Messina',
'Verona',
'Padova',
'Trieste',
'Brescia',
'Prato',
'Taranto',
'Reggio Calabria',
'Modena',
'Livorno',
'Cagliari',
... |
"""
15649 : N과 M (1)
URL : https://www.acmicpc.net/problem/15649
Input #1 :
3 1
Output #1 :
1
2
3
Input #2 :
4 2
Output #2 :
1 2
1 3
1 4
2 1
2 3
2 4
3 1
3 2
3 4
4 1
4 2... |
def check(func):
def inner(a, b):
if b == 0:
return "Can't divide by 0"
elif b > a:
return b/a
return func(a, b)
return inner
@check
def div(a, b):
return a/b
print(div(10, 0)) |
# Program to search for Happy Numbers
"""
A Happy Number is a number where the sum of digits squared s equal to 1 ultimately. What do we mean by ultimately?
The best way is to learn by an example.
Example
10 = 12 + 02 = 1 + 0=1. So 10 is a Happy Number
Let us try with 19
sum =12 + 92 = 1 + 81 = 82
sum=82 + 22 = 64 +... |
def f(a, d):
"""
:param a : foo
:param d : quux
""" |
# NameID Formats from the SAML Core 2.0 spec (8.3 Name Identifier Format Identifiers)
UNSPECIFIED = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
EMAIL = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
PERSISTENT = "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
TRANSIENT = "urn:oasis:names:tc... |
Sweep_width_List = {
'Person':{
'150':{
'6':0.7,
'9':0.7,
'19':0.9,
'28':0.9,
'37':0.9
},
'300':{
'6':0.7,
'9':0.7,
'19':0.9,
'28':0.9,
'37':0.9
},
'450':(... |
num = int(input())
n = int((num - 1) / 2)
for l in range(n+1):
space = ' ' * (n - l)
nums = [str(i) for i in range(n-l+1, n-l+1+3)]
left = space + ''.join(nums) + ' ' * l
right = left[::-1].rstrip()
middle = (str(num) if l == 0 else ' ')
print(left+middle+right)
for l in range(n, -1, -1):
sp... |
# coding: utf-8
# Copyright 2020, Oracle Corporation and/or its affiliates.
FILTER_ERR = 'Some of the chosen filters were not found, we cannot continue.'
|
# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/
LANGUAGE_CODE = 'ru-RU'
TIME_ZONE = 'Asia/Yekaterinburg'
USE_I18N = True
USE_L10N = True
USE_TZ = True
|
# Copyright (c) 2012, Tom Hendrikx
# All rights reserved.
#
# See LICENSE for the license.
VERSION = 'GIT'
|
class RequestHeaderMiddleware(object):
def __init__(self, headers):
self._headers = headers
@classmethod
def from_crawler(cls, crawler):
headers = {
'Referer': 'http://www.fundsupermart.com.hk/hk/main/home/index.svdo',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel M... |
# -*- coding: utf-8 -*-
class Solution:
def projectionArea(self, grid):
result = 0
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j]:
result += 1
for i in range(len(grid)):
partial = 0
for j in r... |
# -*- coding: utf-8 -*-
"""Copyright 2020 Jeremy Pardo @grm34 https://github.com/grm34.
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 requi... |
user_db = ''
password_db = ''
def register(username,password,repeat_password):
if password == repeat_password:
user_db = username
password_db = password
return user_db,password_db
else:
return 'Paroli ne sovpadaut!'
print(register('zarina','123456','1234567'))
|
stats_default_config = {
"retention_size": 1024,
"retention_time": 365,
"wal_compression": "false",
"storage_path": '"./stats_data"',
"prometheus_auth_enabled": "true",
"log_level": '"debug"',
"max_block_duration": 25,
"scrape_interval": 10,
"scrape_timeout": 10,
"snapshot_timeou... |
#returns the quotient and remainder of the number
#retturns two arguements
#first arguement gives the quotient
#second arguement gives the remainder
print(divmod(9,2))
print(divmod(9.6,2.5))
|
class FormatInput():
def add_low_quality_SNV_info(self,CNV_information,total_read, alt_read,total_read_cut,mutant_read_cut):
New_CNV_information={}
for tumor in CNV_information:
CNVinfo=CNV_information[tumor]
TotRead=total_read[tumor]
AltRead=alt_read[tumor] ... |
'''
URL: https://leetcode.com/problems/island-perimeter/
Difficulty: Easy
Description: Island Perimeter
You are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water.
Grid cells are connected horizontally/vertically (not diagonally). The grid is completely ... |
class Solution(object):
def subdomainVisits(self, cpdomains):
"""
:type cpdomains: List[str]
:rtype: List[str]
"""
counter = collections.Counter()
for item in cpdomains:
num, url = item.split()
num = int(num)
i = 0
while... |
#
# PySNMP MIB module CISCO-BULK-FILE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-BULK-FILE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:51:35 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
# -*- coding: utf-8 -*-
def doinput(self):
dtuid = ('log', 9)
rhouid = ('log', 15)
parentuid = ('well', 0)
dtlog = self._OM.get(dtuid)
rholog = self._OM.get(rhouid)
dtdata = dtlog.data
rhodata = rholog.data
self.input = dict(dtdata=dtdata, rhodata=rhodata, parentuid=parentuid)
re... |
MADHUSUDANA_MASA = 0
TRIVIKRAMA_MASA = 1
VAMANA_MASA = 2
SRIDHARA_MASA = 3
HRSIKESA_MASA = 4
PADMANABHA_MASA = 5
DAMODARA_MASA = 6
KESAVA_MASA = 7
NARAYANA_MASA = 8
MADHAVA_MASA = 9
GOVINDA_MASA = 10
VISNU_MASA = 11
ADHIKA_MASA = 12
|
# adding two matrices using nested loop
"""
x = ['12', '72', '43']['34', '54', '34']['32', '23', '24']
y = ['5', '3', '5']['3', '2', '1']['5', '5', '2']
result = x + y
print(result)
"""
x = [['1', '2', '3'],
['4', '5', '6'],
['7', '8', '9']]
y = [['1', '2', '3'],
['4', '5', '6'],
... |
# Define an initial dictionary
my_dict = {
'one': 1,
'two': 2,
'three': 3,
}
# Add a new number to the end of the dictionary
my_dict['four'] = 4
# Print out the dictionary
print(my_dict)
# Print the value 'one' of the dictionary
print(my_dict['one'])
# Change a value on the dictionary
my_dict['one'] = 5
# Pr... |
'''
Created on Jan 1, 2019
@author: Winterberger
'''
#Write your function here
def middle_element(lst):
#print(len(lst))
#print(len(lst) % 2)
if 0 == len(lst) % 2:
ind1 = int(len(lst)/2-1)
ind2 = int(len(lst)/2)
item1 = lst[int(len(lst)/2-1)]
item2 = lst[int(len(lst)/2)]
print(i... |
#calculo de indice de massa corporea
Peso=float(input("Entre com seu peso (em kg): " ))
Altura=float(input("Entre com sua altura (em metros): " ))
Imc=Peso/(Altura**2)
if Imc < 18.5:
print("Seu imc é {:.2f} e você está abaixo do peso".format(Imc))
elif Imc >= 18.5 and Imc < 25:
print("seu imc é {:.2f} e você ... |
class MissingValue:
def __init__(self, required_value: str, headers: list[str]):
super().__init__()
self.__current_row = 0
self.__required_value = required_value
self.__headers = headers
self.__failures = {}
if required_value in headers:
self.__required_v... |
'''
Uma empresa de pesquisas precisa tabular os resultados da seguinte enquete feita a um grande quantidade de organizações:
"Qual o melhor Sistema Operacional para uso em servidores?"
As possíveis respostas são:
1- Windows Server
2- Unix
3- Linux
4- Netware
5- Mac OS
6- Outro
Você foi contratado para desenvolver um... |
"""
Write a program to take the list of names below and print
"Hello, {first} {last}"
for each item in the list
"""
names = ["Jobs, Steve", "Gates, Bill", "Musk, Elon", "Hopper, Grace"]
#Create a for loop to get each full name
for full_name in names:
#Method for finding the separator
sep = full_name.find(",")
#... |
class Ability:
cost = None
exhaustible = True
constant = False
def __init__(self, cost, context):
self.cost = cost
def get_context(self):
return self.cost.context
def is_valid(self, cost):
return cost.context == self.get_context() and cost == self.cost
|
# -*- coding: utf-8 -*-
def main():
q, h, s, d = list(map(int, input().split()))
n = int(input())
# See:
# https://www.youtube.com/watch?v=9OiB8ot3a0w
x = min(4 * q, h * 2, s)
print(min(n * x, d * (n // 2) + n % 2 * x))
if __name__ == '__main__':
main()
|
nome = str(input('Digite o seu nome: ')).strip().split()
a = nome[0]
print('Primeiro nome:', a)
b = nome[-1]
print('Último nome:', b) |
# -*- coding: utf-8 -*-
__author__ = 'alsbi'
HOST_LOCAL_VIRSH = 'libvirt_local or remote host'
HOST_REMOTE_VIRSH = 'libvirt remote host'
SASL_USER = "libvirt sasl user"
SASL_PASS = "libvirt sasl pass"
SECRET_KEY_APP = 'random'
LOGINS = {'admin': 'admin'} |
print(1)
print(1 + 1)
print(3 * 1 + 2)
print(3 * (1 + 2))
if 2 > 1:
print("One is the loneliest number")
else:
print('Two is the lonliest number?')
|
# https://dmoj.ca/problem/ccc07j1
# https://dmoj.ca/submission/1744054
a = int(input())
b = int(input())
c = int(input())
if (a>c and a<b) or (a<c and a>b): print(a)
elif (b>c and b<a) or (b<c and b>a): print(b)
else: print(c)
|
class Myclass:
"""This is doc string"""
a=10
def function(self):
print("Hello")
print(Myclass.a)
print(Myclass.function)
print(Myclass.__doc__)
Mycl1 = Myclass()
|
# quizScoring.py
# A program that accepts a quiz score as an input and prints out
# the corresponding grade.
# 5-A, 4-B, 3-C, 2-D, 1-F, 0-F
"""A certain CS professor gives 5-point quizzes that are graded on the scale
5-A, 4-B, 3-C, 2-D, 1-F, 0-F. Write a progra that accepts a quiz score as an
input and prints out the c... |
# HARD
# 1. check length + counts of word + current word with maxWidth
# 2. round robin
# maxWidth - lenght = number of spaces
# loop through number of spaces times
# each time assign a space to a word[0] -word[len]
# Time O(N) Space O(N)
class Solution:
def fullJustify(self, words: List[str],... |
class Solution:
def matrixReshape(self, nums: List[List[int]], r: int, c: int) -> List[List[int]]:
new_matrix=[[0 for _ in range (c)] for _ in range (r)]
if r*c!=len(nums)*len(nums[0]):
return nums
i1=0
j1=0
for j in range(0,len(nums)):
for i i... |
a= int(input('Digite um numero: '))
b= int(input('Digite outro numero: '))
s= a+b
print('A soma entre {} e {} vale {}'.format(a,b,s))
print (f'A soma de {a} e {b} é {s}')
#a=int(input("Digite primeiro numero"))
#b=int(input("Digite segundo numero"))
#s= (a+b)
#
#print('A soma é:',s)
#print('A soma é: {}'.format(s))
... |
for k in model.state_dict():
print(k)
for name,parameters in net.named_parameters():
print(name,':',parameters.size())
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.