index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
987,800 | 53a91d72136a390e6a178b30e8e87966c4097238 | #this function returns the nth triangular number.1,3,6,10,15,21 etc.
def triangularnum():
n = int(input("Which triangular number do you need?: "))
tri = 0
c = 0
for i in range (0,n+1):
tri += i
c += 1
return (tri,c-1)
result = triangularnum()
count = result[1]
num = result[0]
print... |
987,801 | e5152573b78fee12cd5935f02dd2bb8b65a731ec | import discord
from discord.ext import commands
from discord.ext.commands.cooldowns import BucketType
import asyncio
import colorsys
import random
import platform
from discord import Game, Embed, Color, Status, ChannelType
from discord import Spotify
import os
import functools
import time
import datetime
i... |
987,802 | a6deccc2155efe269783370f116254f68a0528a2 | from celery import shared_task
from notifications.models.task_notification import task_notification
from repository.models import UnlinkedConstituency
from .lda import (
update_commons_divisions,
update_constituencies,
update_election_results,
)
from .membersdataplatform import (
update_active_member_d... |
987,803 | 1a8eca607e2370e7da145cdc0842f1cec73601df | from flask import jsonify
from app.api import bp
@bp.route('/ping', methods=['GET'])
def ping():
return jsonify('Pong!')
@bp.route('/test-email', methods=['GET'])
def test_email():
from flask import current_app
from app.utils.email import send_email
send_email('[Shui] Test Email',
sen... |
987,804 | 30081760b4c51bc959b0b30f5ac7e58dd480a854 | from django.shortcuts import render, redirect
from django.db.models import Sum
from django.contrib import messages
from apps.base.models import *
from apps.base.forms import *
def commercial(request, place_id=None):
places = Place.objects.all()
if not place_id and places:
return redirect ('commercial', place_id=p... |
987,805 | 9f81a58231c209d70053ffa3506890a721e15819 | from django.db import models
from django.utils.timezone import now
from django.contrib.auth.models import User
# Multiselectfield
from multiselectfield import MultiSelectField
# ckEditor
from ckeditor.fields import RichTextField
class Colaborador(models.Model):
nombre = models.CharField(
max_length=200... |
987,806 | 14e4973847e5bd39cefe0416b4251c6254ad8afe | import numpy as np
from tensorflow.keras.datasets import cifar100, mnist
from icecream import ic
### 가중치 저장(아주 중요!!!!!!!) / 순수하게 모델만 저장(나머지 다 주석처리) - 확장자는 무조건 .h5
'''
# 1. 데이터
(x_train, y_train), (x_test, y_test) = mnist.load_data()
ic(x_train.shape, y_train.shape)
ic(x_test.shape, y_test.shape)
# 1-2. x 데이... |
987,807 | 951778cd1c2b5e1d8d3e95d03572b6945a0cb4d1 |
product = 1
i = 100
while i > 0:
product *= i
i -= 1
sum = 0
for elem in str(product):
sum += int(elem)
print(sum) |
987,808 | 39c0aca375e5b442b09e625eb5b6a85117f82ea1 | '''
Given a sorted array with possibly duplicate elements, the task is to find indexes of first and last occurrences of an element x in the given array.
Note: If the number x is not found in the array just print '-1'.
Input:
The first line consists of an integer T i.e number of test cases. The first line of each test... |
987,809 | 2c9806c2002cb3555654d13cd06c128c388f114a | #!/usr/bin/env python
# coding: utf-8
# In[18]:
import pandas as pd
Location = "C:/Users/soura/OneDrive/Desktop/Data Visualization/datasets/BPS01.xlsx"
df = pd.read_excel(Location)
df.head()
# In[ ]:
# In[ ]:
|
987,810 | 90af63d4e7575cb32fa72daa500221bc853d8299 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import numpy as np
from collections import OrderedDict
__all__ = [
"wigner3j",
"get_camb_cl",
"expand_qb",
"scale_dust",
]
def blackbody(nu, ref_freq=353.0):
k = 1.38064852e-23 # Boltzman... |
987,811 | 5550ec5b1a6fc585e0eaed942dca613167475758 | """Class definition for fixing image rotation."""
from kaishi.core.pipeline_component import PipelineComponent
from kaishi.image.labelers.generic_convnet import LabelerGenericConvnet
class TransformFixRotation(PipelineComponent):
"""Fix rotations of each image in a dataset given pre-determined labels (uses the de... |
987,812 | ea707647b3d7dacccb9f262689218eecb7e8a0e3 | import functools
import sys
from flask import (
Blueprint, flash, g, redirect, render_template, request, session, url_for
)
from werkzeug.security import check_password_hash, generate_password_hash
from flaskr.db import get_db
bp = Blueprint('group', __name__, url_prefix='/group')
@bp.route('/create', methods=(... |
987,813 | 0795a97993e9410995c25cf077339f43b1af93c2 | import numpy as np
import random
import os
import pickle
from matplotlib import pyplot as plt
class Player:
def __init__(self, name):
self.name = name
self.value = None
def move(self, board):
raise Exception
def set_value(self, value):
self.value = value
def update_fi... |
987,814 | ccbfb2e81893cc7d40b7b1b2b3f90cd8794094d0 | $NetBSD$
Make it recognize DragonFlyBSD
--- src/calibre/constants.py.orig 2012-04-13 04:21:01.000000000 +0000
+++ src/calibre/constants.py
@@ -28,7 +28,8 @@ isosx = 'darwin' in _plat
isnewosx = isosx and getattr(sys, 'new_app_bundle', False)
isfreebsd = 'freebsd' in _plat
isnetbsd = 'netbsd' in _plat
-isbsd =... |
987,815 | e95307d1a961c61427163f09ae084fc9c5befcd4 | class AdvancedArithmetic(object):
def divisorSum(n):
raise NotImplementedError
class Calculator(AdvancedArithmetic):
def __init__(self):
self.lst = list()
#self.answer = 0
#self.x
def divisorSum(self, n):
answer = 0
x = list(range(n+1))
... |
987,816 | 56e819e42e0ffcb044e5ba5845154f16c7a93e15 | import datetime as dt
import json
import os
from datetime import datetime
import bs4
import pandas as pd
import requests
import yfinance as yf
from pandas_datareader import data as pdr
yf.pdr_override()
info_types = ["info", "options", "dividends",
"mutualfund_holders", "institutional_hol... |
987,817 | f1262f33aa271ca66adf7247c01bb6ef4a011b96 | # !user/bin/python
# -*- coding: UTF-8 -*-
import pandas as pd
import numpy as np
df = pd.read_excel('sales_transactions.xlsx')
print(df)
# account name order sku quantity unit price ext price
# 0 383080 Will LLC 10001 B1-20000 7 33.69 235.83
# 1 38308... |
987,818 | 0363750f004a8b8461cb6e02c2b660b50624400d | #!/usr/bin/env python
# -*-coding:UTF-8 -*-
import sys
import os
import pymysql # Module used to connect to a MySQL database
import smtplib # Module for using SMTP functions for sending mail via script
import time
from datetime import date
from oneIncident import envoi_oneinc #Sending function of the incident aler... |
987,819 | 01ee69ba160668d450314017f70365f56d667f69 | #!/usr/bin/python
import RPi.GPIO as GPIO
import sys
LED_RED = 7 # 3 color led on POE HAT
LED_GREEN = 22 # 3 color led on POE HAT
LED_BLUE = 9 # 3 color led on POE HAT
LED_RJ45 = 25 # second green led on rj45 connector
def initialize():
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(LED_RED, GP... |
987,820 | c4b8881ffc12212bc6962350da93f52eb04fd762 | """ Wraptor
Provides a set of useful decorators and other wrap-like python utility functions
"""
__version__ = "1.0.0"
|
987,821 | 85177214ee1d0043aeea6238d4dd18bfc52d0d61 | import base64
import json
import socket
from Helpers.Helper import send_command
from collections import deque
from Helpers.StoppableThread import StoppableThread
from Helpers.Helper import socketmanager
from Models.Node import Node
from RoutingTable import RoutingTable
from Helpers.Helper import xor
from Helpers.NodeEx... |
987,822 | 72131b42ca90e10b9d1b39f8188b642db763bd3c | import pymssql
import pandas_datareader.data as pd
import datetime
today = datetime.datetime.now().strftime('%Y%m%d')
yesterday = (datetime.datetime.now() + datetime.timedelta(days=-8)).strftime('%Y%m%d')
def shcode_load(db_adr,id,pw,db_name):
global shcode_list
shcode_list = []
if(db_adr == ''):
... |
987,823 | 725ffad5211dfa3097fa15b20f88e8f757ef7aec | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# local_settings.py
'''
@author: friend
'''
import numpy, sys
# pickle,
import __init__
__init__.setlocalpythonpath()
import local_settings as ls
from maths.tils import TilR
# from models.Files.ReadConcursosHistory import ConcursosHistoryPickledStorage
from generators.Ge... |
987,824 | 40860a449a211edccd07a8d77e8ab9a50eee78a5 | from RPi import GPIO
import httplib
import urllib
import time
from time import sleep
key=" " #Enter things speak key
begin=17
end=27
distance=10.0
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(begin,GPIO.IN)
GPIO.setup(end,GPIO.IN)
stime,etime=0,0
count=0
while(True):
print(".")
wh... |
987,825 | 7b1cf62c9b6006e3e519075e847d7015927074b6 | import cv2
import scipy.io as scio
import numpy as np
class img_operator:
def __init__(self):
self.path = '../image/1.png'
def print(self, name, gray):
print(name + '=\n{}\n'.format(gray))
def qu(self, gray, rc):
return gray[rc[0]:rc[1] + 1, rc[2]:rc[3] + 1]
def readImg(self... |
987,826 | 9320894622232324256716fd33a857e5ae92073a | from django.db import models
from mutualtracker.fundtracking.models import Fund
class Country(models.Model):
class Meta:
verbose_name_plural = 'countries'
name = models.CharField(max_length=255)
def __unicode__(self):
return self.name
class Industry(models.Model):
class Meta:
v... |
987,827 | d658c069b4699fd23f7e2c83ab0e33a600a6fa89 | from tornado.web import Application
from day1.utils.dbutil import DBUtil
class MyAppliction(Application):
def __init__(self, handlers, tp, sp, um):
super().__init__(handlers, template_path=tp,
static_path=sp, ui_modules=um)
self.dbutil = DBUtil() |
987,828 | 713da99a464057c9a4e8ca3a29be887ecad0d66a | """
PROBLEM 45
Write a program to print the output of the following poblem statement :-
Initialize `fahrenheit` dictionary
fahrenheit = {'t1':-30, 't2':-20, 't3':-10, 't4':0}
1 Get the corresponding `celsius` values in list
2 Create the `celsius` dictionary
3 convert a dictionary of Fahrenheit temperatures into... |
987,829 | f8c4d4f6a950513ed8591d30f0fa0e6ac02c69f7 | # -*- coding: utf-8 -*-
# vim: set expandtab:ts=4
"""
/***************************************************************************
Timeseries base class
A QGIS plugin
Plugin for visualization and analysis of remote sensing time series
-------------------
... |
987,830 | 6b25b81f4752e1df62a50aefc590449c5658e984 | from torch import nn
from torch.nn import functional as F
# https://fleuret.org/ee559/src/dlc_practical_4_solution.py as inspiration for this model
class SimpleConvolutionalNeuralNetwork(nn.Module):
def __init__(self, hidden_layers):
super(SimpleConvolutionalNeuralNetwork, self).__init__()
# Fir... |
987,831 | b2704e6625efd503d9dfe94d33da2668699924fa | """This module marks the folder as a python package and do some import."""
from .file_globbing import expan_globbing_pattern
from .parameter_expansion import expan_parameter
from .tilde_expansion import expan_tilde
from .parameter_assignment import assign_paramenter
|
987,832 | 28c1a53884380c7ed82eb2db031595c768f30917 | from pathlib import Path
import asyncio
from kallikrein import k, Expectation, kf
from kallikrein.matchers.maybe import be_just
from amino.test import temp_dir
from amino import List, Just, _, Map
from ribosome.machine.messages import Nop, Stage1
from ribosome.machine.state import AutoRootMachine
from ribosome.nvim... |
987,833 | e6e09a1f9a4143d876f6dc475d02fa770496c1b8 | def urlsafe_b64encode(bs: bytes) -> str:
return encode(bs, True).decode('utf-8')
def urlsafe_b64decode(s: str) -> bytes:
return base64url_decode(s)
_to_base64 = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a... |
987,834 | 2629e6a2e9f136fe61b55d1550c4941977f32a86 | from flask import Flask
# 导入Flask模块
app = Flask(__name__)
# 创建Flask对象并且以当前模块的名称作为参数
@app.route('/hello/<name>')
# route是个装饰器,
# app.route(rule, options),rule 绑定的URL,options 转发给基础Rule对象的参数列表
# route装饰器可将URL绑定到函数,URL需要是规范的URL
# @app.route(‘/hello’) 等同于 app.add_url_rule(‘/’, ‘hello’, hello_world)
def hello_name(name):
... |
987,835 | 7aa683eac4d728295f8a720f96f2ca62c1cf0f2d | import ft_retriver.views as ft_retriver_view
"""retriver URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns:... |
987,836 | 40af1bd88b639325af79b05380ed598d3b64510e | """
const.py:
Store class to help deal with constant variable
"""
class Template():
"""
Store template name
"""
PUBLIC_INDEX = "roomalloc/public/index.html"
PUBLIC_ABOUT = "roomalloc/public/about.html"
PUBLIC_CONTACT = "roomalloc/public/contact.html"
PUBLIC_FD_CONF = "roomall... |
987,837 | af97a07a157a26774fc34860a9a6a3577719d04b | #! /usr/bin/env python
"""
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.
"""
class Solution:
def maxProfit(self, p... |
987,838 | fe7492cacea4b2b2564987b7cb57d9f0524bd008 | from django.shortcuts import render, redirect
from django.http.response import HttpResponseRedirect
from .models import JadwalBelajarBareng
from .forms import JadwalForm
from django.core import serializers
from django.http.response import HttpResponse
from django.contrib.auth.decorators import login_required
... |
987,839 | 2e0577cfbf1feb5239ae3c6119a48c3d81a8d93b | import sys
from diot import Diot
from bioprocs.utils import shell2 as shell
infile = {{i.infile | quote}}
hfile = {{i.hfile | quote}}
samfile = {{i.samfile | ?!:args.params.get('s', args.params.get('samples')) | repr}}
outfile = {{o.outfile | quote}}
bcftools = {{args.bcftools | quote}}
params = {{args.params... |
987,840 | 50a406ec8d784bd094dd1a0472c1486ccda27379 | from __future__ import annotations
import logging.config
import os
from collections.abc import Sequence
from pathlib import Path
import dask.config
import xarray as xr
from dask import compute
from dask.diagnostics import ProgressBar
from xclim.core import calendar
from miranda.gis import subset_domain
from miranda.... |
987,841 | 7ec6461ee9bc80e0c036c787a943b2211c320c60 | # Generated by Django 2.0.9 on 2019-05-16 21:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('apps', '0038_auto_20190516_1522'),
]
operations = [
migrations.AlterField(
model_name='app',
name='last_editor',
... |
987,842 | 216f911fdbb7b94275c01a11ccfc0cb54b704b8c | # coding: utf-8
import json
import datetime
from dateutil.tz import tzutc
import responses
import ibm_watson
from ibm_watson import ApiException
from ibm_watson.assistant_v1 import Context, Counterexample, \
CounterexampleCollection, Entity, EntityCollection, Example, \
ExampleCollection, MessageInput, Intent, ... |
987,843 | b6841397e45fda7010b20d00d9df975636b198eb | # Generated by Django 2.0.1 on 2018-02-20 15:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recruiting', '0003_auto_20180216_2214'),
]
operations = [
migrations.AlterField(
model_name='answer',
name='long_ans... |
987,844 | 9ad2b0d30ff85cfdf30ecd9a138fc920bcc3e20d | def test_request_items_runner_fixture(testdir):
"""Make sure that pytest accepts our fixture."""
# create a temporary pytest test module
testdir.makepyfile(
"""
def test_exists(request_items_runner):
assert request_items_runner
"""
)
# run pytest with the following ... |
987,845 | 5f59011b42d1c515f33ada68e31f0e527c884d1e | # 🚨 Don't change the code below 👇
two_digit_number = input("Type a two digit number: ")
# 🚨 Don't change the code above 👆
####################################
#Write your code below this line 👇
first_digit = int(two_digit_number[0]) # convert to int for adding
second_digit = int(two_digit_number[1])
print(first... |
987,846 | 302664130552e9c9dd7a7f0e93422856461f358a | routers = dict(
# base router
BASE=dict(
default_application='blog',
),
blog=dict(
default_controller='initial',
default_function='home',
functions=['home', 'contact'],
)
)
|
987,847 | 3804238fcc0247da53c61db1c2374d2e920e3664 | import tensorflow as tf
import numpy as np
from viz import viz_utils
from architectures import th_utils
FLAGS = tf.flags.FLAGS
def gen_composed_hierarchical_seqs(low_level_seqs, dt, n_seqs):
n_segs, batch_size, seg_len = dt.shape
assert(n_seqs <= batch_size, "Number of requested vis seqs in larger than batch_si... |
987,848 | 5512ea6def652865c440188f5b77c79c07d1241a | from sympy.ntheory.continued_fraction import continued_fraction_reduce
from sympy import fraction
from euler_helpers import digit_sum
def e_convergent_fraction(n):
def cycle():
k = 2
yield 2
while True:
yield 1
yield k
yield 1
k += 2
c =... |
987,849 | f7e7783bd788c044b4faeb28ea56a032a0e5ca31 | import sys
sys.path.append("..")
sys.path.append("../..")
import numpy as np
import os
import argparse
from sklearn.metrics import accuracy_score
import tensorflow as tf
from data.kenyan_water_dataset import KenyanWaterDataset, get_subportion_confounders
from data.kenyan_water_dataset import median_child_paper, media... |
987,850 | d06aa78e7c7cf5eb44e2b3d630cb3f5084bf760d | class Employee:
def __init__(self, id, firstName, lastName, salary):
self.id = id
self.firstName = firstName
self.lastName = lastName
self.salary = salary
def getID(self):
return self.id
def getFirstName(self):
return self.firstName
def get... |
987,851 | eccd41c56c6de43897a7ebcebbf2f2a15cc33f21 | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 28 18:30:48 2020
@author: Cati
"""
import numpy
from random import randint, random
from sys import maxsize
from copy import deepcopy
class Population :
def __init__(self, n, popSize, prM, prC):
self.squareSize = n
self.popSize = popSize
... |
987,852 | 2b2620497a66b3d24dea53337aee94b422ee5cc5 | #!/usr/bin/env python
###
#
# This script creates a 3D vector map, 2D vector maps for each height
# using data from the micro-PIV experiments. It averages over each height
# and combines this into a single graph. It can also write the averaged
# velocities to a new file.
#
# Author: Callum Kift
#
# Directory setup:
# ... |
987,853 | e7d86fb7f47f6d2449685d4ea5e019683d681d42 | #!/usr/bin/env python
'''
rotate a structure to satisfy the ssneb requirements:
cell[0] along the x axis and cell[1] on the xoy plane
'''
from ase.io import read,write
import sys
finput = sys.argv[1]
p1 = read(finput,format='vasp')
a = p1.get_cell()
print a[0]
p1.rotate(a[0],'x',center=(0,0,0),rotate_cell=True)
a = p... |
987,854 | 4593012c3cf2f35ef98a48e4f3c403856c22c487 | number = input('Please input an integer.')
#Try to cast the input
try:
number = int(number)
#Catch the raised exeption if there is an error
except ValueError as e:
print("Your input is not an ingeter.")
print(e)
#Otherwise, there is no error
else:
print(str(number) + " is indeed an integer!")
|
987,855 | 6c60e22666652fbe9571cb13fb1082f22bd25a52 | import hou
import hou_rig.my_null
import master
class character_placer(master.master):
def __init__(self, node, rig_subnet):
print "character placer"
self.node = node
self.rig_subnet = rig_subnet
self.limb_subnet = self.create_rig_node(self.rig_subnet)
self.node_rename(self... |
987,856 | c353a1655c9bc0b15bbd6cc6d4d49d86c5147d6b | # coding: utf-8
# pylint: disable=W0611
"""Compatibility layer"""
# optional support for Pandas: if unavailable, define a dummy class
try:
from pandas import DataFrame
PANDAS_INSTALLED = True
except ImportError:
class DataFrame(): # pylint: disable=R0903
"""dummy for pandas.DataFrame"""
PAN... |
987,857 | 6ad8c39d7934ebfea439dfc804791069c64a441a | city = "Miami"
event = "Concert"
print("Welcome to " + city + " and enjoy the " + event)
#This same pring statement can be rewritten as seen below
print("Welcome to %s and enjoy the %s" %(city, event))
#We can use the same approach when it's just one variable involved
print("Welcome to %s" % city) |
987,858 | b2aef432d62788489695f23d6f42f097e2384ee0 | # Pandas example
import pandas as pd
import numpy as np
# Construct a dataframe from a dictionary
data = {
"col1": [1,2,3],
"col2": [5,3,2]
}
dataframe = pd.DataFrame(data)
print("Dictionary frame: ")
print(dataframe)
# Using numpy arrays
data2 = np.array([(1,2,3), (4,5,6)])
df2 = pd.DataFrame(data2)
print(... |
987,859 | a2e116afacbf2e95bcbe18974310697b9c188852 | """
Tests for accessing methods through classes and instances
"""
import objc
from PyObjCTest.clinmeth import PyObjC_ClsInst1, PyObjC_ClsInst2
from PyObjCTools.TestSupport import TestCase
class TestClassMethods(TestCase):
# Some very basic tests that check that getattr on instances doesn't
# return a class me... |
987,860 | 571a564fcf82aded808c1deac462331092f9f0e8 | '''
------------------------------------------------------------------------
Last updated 6/3/2015
Firm functions for taxes in SS and TPI.
------------------------------------------------------------------------
'''
# Packages
import numpy as np
import tax_funcs as tax
'''
-----------------------------------------... |
987,861 | 819c11fb2ff6e9bbda0cb03380c26525458095b7 | -X FMLP -Q 0 -L 3 120 400
-X FMLP -Q 0 -L 3 93 400
-X FMLP -Q 0 -L 3 80 400
-X FMLP -Q 1 -L 2 73 400
-X FMLP -Q 1 -L 2 63 250
-X FMLP -Q 2 -L 1 55 200
-X FMLP -Q 2 -L 1 45 400
-X FMLP -Q 3 -L 1 35 125
-X FMLP -Q 3 -L 1 35 150
22 100
21 100
|
987,862 | 31efbe592fc3314bb957983c19ae73bc0c41ce94 | from HighwayNetwork import HighwayNetwork
from random import randint, seed, random
########
#
# Initialize randomizer
#
########
import sys
#myseed = randint(0, sys.maxint)
myseed = 4909137950491786826
print "Random seed:", myseed
seed(myseed)
########
#
# Load data
#
########
import scipy.io
data = scipy.io.lo... |
987,863 | 836caac438a8724782c5339b4583d59010115bdd | import RPi.GPIO as GPIO
class Lcd:
def __init__(self, rs=2, e=3, db7=4, db6=14, db5=15, db4=18):
"""
Initialize GPIO pin numbers (BCM numbering).
RS selects register
0: instruction register
1: data register
E starts data read/write
Rising edge: read RS
... |
987,864 | bb63813e2527f2f9666d467ad59b7ad982250e30 | # Dakota Bourne db2nb
"""
The purpose of this program is to take user inputs and depending on the input for the answer, either generate a new
number or use the number given by the user to play a guessing game.
"""
import random
answer = int(input("What should the answer be? "))
guesses = int(input("How many gues... |
987,865 | 0f1012c9ebadb2342666c69d12273975149bd225 | '''
This module contains the class tasks
'''
from __future__ import print_function
import glob
import copy
import atexit
import logging
import os
import shutil
import sys
import re
import locale
import yaml
import TarSCM.scm
import TarSCM.archive
from TarSCM.helpers import Helpers
from TarSCM.changes import Changes
f... |
987,866 | cd3a176eff2198c8f301172b063f85b314e34d6b | """Using inputs, concatenation to hype myself up with inspirational messages."""
__author__: str = "730401081"
# Your solution starts here...
name: str = input("What is your name? ")
print(name + ", you have overcome 100% of the days you've faced!")
print("I am proud of you, " + name + ".")
print("Resting yourself,... |
987,867 | 654223c16f0a202d01f8bb5d845d8dbab406a84b | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
url = 'http://www.magtu.ru/student/bakalavriat-spetsialitet-magistratura/raspisanie-konsultatsij-prepodavatelej.html'
import requests
rs = requests.get(url)
from bs4 import BeautifulSoup
root = BeautifulSoup(rs.content, 'html.parser')
from url... |
987,868 | 19456565e86839abbe39c4c79857d2017c47feb2 | #!/usr/bin/python3
import common.db_helper as db
tablename='tb_assets_detail'
def insert_demo():
cursor=db.get_cursor()
cursor.execute("select column_name,data_type,column_comment from information_schema.COLUMNS where table_name = '%s'" % tablename)
rows=cursor.fetchall()
insert_sql="insert into %s... |
987,869 | df7207c85a90ae874d91bdeccc4eb917d766dee1 | from cleverbot import Cleverbot
bot1 = Cleverbot()
bot2 = Cleverbot()
text = 'こんにちは'
while True:
text = bot1.ask(text).encode('ISO-8859-1').decode('utf-8')
print('bot1 >> {}'.format(text))
text = bot2.ask(text).encode('ISO-8859-1').decode('utf-8')
print('bot2 >> {}'.format(text))
|
987,870 | 36ae837fabc9f9e80da38bb89e3bf97063e8ac8d | # Copyright (C) 2003-2013 Python Software Foundation
import copy
import operator
import pickle
import struct
import unittest
import plistlib
import os
import datetime
import codecs
import binascii
import collections
from test import support
from test.support import os_helper
from io import BytesIO
from plistlib import... |
987,871 | ab6dbf875757b2af6a38373c0643b2d26b5d775e | my_list = [
7,
5,
3,
3,
2
]
newPoint = int(input('Введите новый балл для рейтинга: '))
for index, value in enumerate(my_list):
if value < newPoint:
my_list.insert(index, newPoint)
break
print(my_list)
|
987,872 | e441d92b71ee02111434a4f25224e73799a0c76c | def func(inp):
if int_input <= 10:
return True
user_input = raw_input("Enter a number between 0 and 10.\n")
int_input = int(user_input)
funkciq = func(int_input)
if funkciq == True:
print "Great. This is:",funkciq
print
else:
print "%s is more than 10. This is False" % int_input
|
987,873 | 593c720decf9ae3e2b1de8cb18f1594f699cf65f | import pytest
from eth_utils.toolz import (
partial,
)
from web3._utils.blocks import (
select_method_for_block_identifier,
)
selector_fn = partial(
select_method_for_block_identifier,
if_hash="test_hash",
if_number="test_number",
if_predefined="test_predefined",
)
@pytest.mark.parametrize(... |
987,874 | 01d2ca7d0da61965cd3a43687916b367a05b852f | from django.contrib import admin
from .models import Manager,Roles,Property,Badges,Channel,ContactInformation,Location,Distances,Login,Registrations,AddOnes,ExternalCertificates,Gallery,Rents,Reviews,G_R_P_R,Add_External,M_B_R_C_R_L,L_C,P_E_R,P_D_L
admin.site.register(Manager)
admin.site.register(Roles)
admin.site.reg... |
987,875 | 469145af1461ae50cd598bb1acc57462d514099d | import json
from datetime import date
from django.core.serializers.json import DjangoJSONEncoder
from django.urls import reverse
from rest_framework.test import APITestCase, APIClient
from rest_framework.views import status
from urllib.parse import urlencode
from .models import Todos
from .serializers import TodosSeria... |
987,876 | e39e34522bdc2b430a3803105d76ef03e40b2098 | from django.shortcuts import render
from django.http import HttpResponse
from books.models import Book
from myfirstsite.forms import ContactForm
from django.http import HttpResponseRedirect
from django.core.mail import send_mail
# Create your views here.
def search_form(request):
return render(request, 'search_form.h... |
987,877 | f09e2d33bf46360285f9a60566eddf96487f9802 | bind = ['0.0.0.0:80']
logconfig = 'config/logging.conf'
|
987,878 | a14e015ceab743e7a2e4ef8aaebd36e4ad8f34e3 | import sys
f = open("data.txt", "r")
number = int(f.readline())
dict = {}
count_p = 0
count_n = 0
# phone_book = dict(input().split() for _ in range(n))
# while count_p<number:
numbers = [f.readline().split(" ") for _ in range(number)]
dict[a] = b
count_p += 1
number_1 = 5
# while count_n<number_1:
... |
987,879 | f177fb04fff0c002f98b9ec5a6dea8c455a43b5e | ii = [('RogePAV2.py', 45), ('RogePAV.py', 8), ('RennJIT.py', 9), ('WestJIT2.py', 11), ('KirbWPW2.py', 8), ('WestJIT.py', 6), ('BellCHM.py', 1)] |
987,880 | 818c38e9be44c351a07457c26bd8f3ac54cf5edc | from data_importer.importers import CSVImporter
from core.models import .
class CSVImporterHistory(CSVImporter):
class Meta:
delimiter = ";"
model = History |
987,881 | fe65f53bb7a723c508eae381e366234eca1680c9 | #!/usr/bin/env python3.6
import sys
import math
import random
import pandas as pd
def dataFrameNames():
return [
"x1", # 1 gamma detected x position [cm]
"y1", # 1 gamma detected y position [cm]
"z1", # 1 gamma detected z position [cm]
"t1", # 1 gamma detection time [ps]
"... |
987,882 | 4601b3cac5c46657ce5be0e4bb27d27b51ebd0aa | from __future__ import print_function
from collections import deque
from Symboltable import *
from io import StringIO
import sys
import tokenize
import re
class Scope:
def __init__(self,):
self.variables_scope = {}
self.name = ""
self.param = 0
self.num_param = 0
def get_input(*ar... |
987,883 | 7cc3f6d5255a514bacd6691786f810e00e0f7bcf | from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
#讓celery使用django環境裡的設定
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'shop.settings')
app = Celery('shop')
#namespace: 從settings讀取所有'Celery'開頭的參數
app.config_from_object('django.conf:settings', namespace='CELERY')
#從djan... |
987,884 | 73447c4722488f60715400b46299d9fc1685169b | # Generated by Django 2.1.7 on 2020-05-13 07:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('taskmanager', '0014_auto_20200513_0700'),
]
operations = [
migrations.AlterField(
model_name='lastlogin',
name='curr... |
987,885 | 873b3fc986955037ad1875b7ba4b4bf64715286e | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 19 12:23:22 2019
@author: thomas
"""
import matplotlib.pyplot as plt
import numpy as np
font = {'family' : 'serif',
'weight' : 'normal',
'size' : 16}
plt.rc('font', **font)
# time axis
Tmax=3.0
N=1024
n=np.arange(-N/2.0,N/2.0,1... |
987,886 | 0af8c28451a502ef78d5b7d0ad7443e8de5fee34 | import socket
import sys
import hashlib # used to compute checksum of files
from PIL import Image # used to display images
# function returns checksum of a given file
def getChecksum(filename):
with open(filename, "rb") as f:
bytes = f.read()
# creates a hash code using md5 encryption and puts it in hexadecimal... |
987,887 | 814221e98d5e65c2e1b572f46649600f5dfe5c94 | s = "Salam Almaty. We are are from Dushanbe. Aga"
myDict = {}
def isGoodWord(word):
numOfvowels = 0
for i in word:
if i == "a" or i == "e" or i == "i" or i == "o" or i == "u":
numOfvowels += 1
if numOfvowels > (len(word) - numOfvowels):
return True
else:
retu... |
987,888 | f2108b73858a8aca43e7a1f8360abbb9a73fd7c9 | """
Contains relevant methods for removing stopwords during preprocessing phase
"""
stopwords_list = {'i', 'me', 'my', 'myself', 'we', 'us', 'our', 'ours', 'ourselves', 'you', 'your', 'yours', 'yourself', 'yourselves', 'he', 'him', 'his', 'himself', 'she', 'her', 'hers', 'herself', 'it', 'its', 'itself', 'they... |
987,889 | ec1ac472d4cd3521755a26d8207b15c77bf7103a | ## 3.Реализовать базовый класс Worker (работник), в котором определить атрибуты:
## name, surname, position (должность), income (доход).
# Последний атрибут должен быть защищенным и ссылаться на словарь, содержащий элементы:
# оклад и премия, например, {"wage": wage, "bonus": bonus}.
## Создать класс Position (должност... |
987,890 | 2ddba794c5ab16dd5f491973260dfcb439446559 | # -*- coding: utf-8 -*-\
import os
import sys
import json
import codecs
from datetime import datetime, date
import time
import requests
import random
import threading
from flask import Flask, request, render_template
from flask_sqlalchemy import SQLAlchemy
import tweepy
import discover
import worldProcessing
import di... |
987,891 | 0b41ddcdb567dc34123d05007368680af1b98fb5 | def solution(n):
answer = []
for i in range(1, n + 1):
lst = [0 for j in range(i)]
answer.append(lst)
answer[n - 1].append(-1)
answer.append([-1 for k in range(n)]) # row-padding
direc = [[1, 0], [0, 1], [-1, -1]]
sw = int(0)
lim = int((n * (n + 1)) / 2)
r, c = 0, 0
... |
987,892 | f0358e3df11b177676bd3526bbdd251dde6a9f03 | """ this file is used to perform helper methods."""
import os
import sys
from prettytable import PrettyTable
from common.constants import Color, Base, BackButton
from pynput.keyboard import Key, Listener
def always_true():
""" this method is used for infinite loops, so that later while unit testing we can set it ... |
987,893 | 0300c4805554c672261689c89cfbab8422753313 | import sys
import os
sys.path.append(os.environ['MLIR_LIBRARY_PATH'])
import mlir
# Test Module constructor with mlir file.
def test_constructor():
mlir.registerAllDialects()
ctx = mlir.Context()
sourcemgr = mlir.SourceMgr()
module = mlir.Module("./test_input.mlir", ctx, sourcemgr)
return module
|
987,894 | fb189a4493ee81fd2598f9d1a5d6773e5dd07c32 | import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import warnings
def creat_cross_sample():
group_galaxies = pd.read_csv('group_galaxies.csv', engine='c')
group_galaxy_type = pd.read_table('group_galaxy_type.dat', engine='c', header=None)
group_galaxies['typ'] = ... |
987,895 | 070f0f40107059c10058c5f4cd32ff3c1a80dca7 | # Compare similarity between two images by using VGG16 as a feature extractor and cosine similarity as a distance metric
# Author: Pappu Kumar Yadav
from tensorflow.keras.applications.vgg16 import VGG16, preprocess_input
from tensorflow.keras.preprocessing.image import load_img, img_to_array
from tensorflow.keras.p... |
987,896 | d8b4fde08bfa3b603cc3e288c2e7c962661a5696 |
from application import app
from application import lm
from flask import render_template
from lib.factory.StorageLocation import StorageLocation as DocFactory
from lib.config.Yaml import Yaml as Config
from lib.job.storage.MongoDB import MongoDB as JobStorage
from pymongo import MongoClient
import re
from werkzeug.sec... |
987,897 | 1c458fb70895809517d093f4015df4f3b92f05bf | o = []
e = []
i = 0
user = int(input('Введите сколько вам лет: '))
while i < user:
if i % 2 == 0:
o.append(i)
elif i % 2 != 0:
e.append(i)
i += 1
if user % 2 == 0:
print('четные числа: ', o)
else:
print('нечетные числа: ', e)
# age = int(input('Age: '))
# a = 0 if age%2==0 else 1
... |
987,898 | a6ccc227cd61aafda0ee3990b1c85a2c2d7389cc | import pickle
import copy
from TarockBasics import TarockBasics
from GameStateTarock import GameStateTarock
from MilestoneAgents import MilestoneAgents
from probamo import index
import matplotlib.pyplot as plt
from os import listdir
from os.path import isfile, join
gst = GameStateTarock([], [], [], [1,2,3], 1, [2... |
987,899 | b7de30b1c813f283204514124a13c80fcc16600b | from openpyxl import Workbook
from openpyxl import load_workbook
def write_to_excel(data):
''' function to write data to a new excel file '''
wb = Workbook()
ws = wb.active
# write data to the rows as long as there is data
for row, url in zip(ws.iter_rows(max_row=len(data)), data):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.