blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
1a12b83379e2c6e852a488518171264afa2272f5 | shaoweigege/hello-world-python3 | /exercicio_py/ex0090_maior_menor_de_tres.py | UTF-8 | 3,631 | 4.28125 | 4 | [] | no_license | #!/usr/bin/env python3.8
'''
Usuário informa 3 números inteiros e programa retorna o maior e o menor deles.
'''
import sys
sys.path.append('/home/danielle8farias/hello-world-python3/meus_modulos')
from mensagem import ler_cabecalho, rodape, ler_resposta
from numeros import ler_num_int
#função para caso os 3 números... | true |
d7410c1cc689624726750b4583954f37ed1db182 | xiaopingzhong/AlgorithmAndDataStructure | /LeetCode/1_两数之和.py | UTF-8 | 1,640 | 3.609375 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
************************************************
@Time : 2019-06-18 12:41
@Author : zxp
@Project : AlgorithmAndDataStructure
@File : 1_两数之和.py
@Description: ==================================
two number sum
@license: (C) Copyright 2013-2019.
*************... | true |
bb95167799b98abe6d5640ba38aac58391431b0e | Gyagya00/algorithm | /study/1986_지그재그숫자/sol1.py | UTF-8 | 392 | 3.421875 | 3 | [] | no_license | import sys
sys.stdin = open("input (1).txt")
T = int(input())
# 1부터 N까지의 숫자에서 홀수는 더하고 짝수는 뺀다
for tc in range(1, T+1):
# N 정수
N = int(input())
# 계산결과
res = 0
for n in range(1, N+1):
# 홀수이면
if n % 2:
res += n
else:
res -= n
print("#{} {}".format... | true |
9710358d2cc305dbf4235fd124dd14e69d539228 | lolpatrol/LeetCode | /15.py | UTF-8 | 996 | 2.96875 | 3 | [] | no_license | # https://leetcode.com/submissions/detail/231812392/
# Messy and slow
class Solution:
def threeSum(self, nums: list):
nums.sort()
res = []
for i, v in enumerate(nums):
if i > 0 and v == nums[i-1]:
continue
p = self.find(i, v, nums)
if p:
... | true |
2a921bf88f80f2094913c0e872517a67b40f456f | nickmoop/Pool | /Ball.py | UTF-8 | 9,223 | 3.15625 | 3 | [] | no_license | from math_helper import vector_length, calculate_ball_direction, \
calculate_ball_sign
class BallField:
def __init__(self, canvas=None, board_wide=0):
self.item = None
self.point_of_hit = None
self.rotation_axle = None
self.canvas = canvas
self.top_point = [0, 0, 0]
... | true |
19c920ef4869795886de8857209b71eecb4245c9 | FilipovichSv/PythonHomeTasks | /Task3Issue1.py | UTF-8 | 146 | 2.921875 | 3 | [] | no_license | from random import randint
A = []
a = 1
n = int(input(5))
while a <= n:
A.append(randint(0, 99))
a += 1
print(A)
list.pop(a)
| true |
2570d53f4f2aa4d1e25b85a02c6defaeda534e26 | siddhism/leetcode | /graphs/evaluate_division.py | UTF-8 | 1,734 | 3.546875 | 4 | [] | no_license | from collections import defaultdict
class Graph:
def __init__(self):
self.graph = defaultdict(dict)
def add_edge(self, u, v, value):
self.graph[u] = {v: value}
self.graph[v] = {u: float(1) // value}
def dfs_util(self, u, v, visited, product):
# traverse dfs upto v and get ... | true |
3fb64209aa2a3a176e4d55c4211760cd461af1c1 | VNXtreme/Ultimate-Facebook-Scraper | /7saturday-api.py | UTF-8 | 728 | 2.765625 | 3 | [
"MIT"
] | permissive | import os
import requests
start_index = 0
end_index = 4000
gap = 20
# gather list data
data = []
while start_index < end_index:
response = requests.get(f"https://discovery.7saturday.com/api/v1/top_influencers?filters=%7B%22start_index%22:{start_index},%22end_index%22:{start_index+gap},%22random_index%22:20%7D").... | true |
a86091fa2f00b2f88b244bc3ccc86eb1bf9c6bb9 | KenshinTang/learn-python3 | /src/functionalProgramming/highOrderFunction.py | UTF-8 | 187 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# 函数作为另一个函数的参数. 高阶函数
def high_order_func(x, y, f):
return f(x) + f(y)
print(high_order_func(-1, 1, abs))
| true |
11b68a72822eca60ff784165a66b76a54aeab20f | piyush2896/CapsuleNetworks | /utils.py | UTF-8 | 2,349 | 2.6875 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def squash(tensor, epsilon=1e-7, axis=-1):
squared_norm = tf.reduce_sum(tf.square(tensor), axis, keepdims=True)
scale = tf.divide(squared_norm, tf.add(1., squared_norm))
unit_vectors = tf.divide(tensor, tf.sqrt(squared_norm+... | true |
b877703cc6433e52dcbb64ad17fb4d23c7bb439b | jj1here/ATBS-backupToZip | /similar/mostSpace.py | UTF-8 | 817 | 3.46875 | 3 | [] | no_license | #! python3
# search folders for the files using the most disk space
import os, shutil
def mostSpace(folder) :
#folder path
folder = os.path.abspath(folder)
# for size of each file
space = 0
#size of largest file
maxSize = 0
#path of bigeest file
bigFile = ""
# walks through the... | true |
189c7349887e21f083eb2dd252dce45fe23cb980 | chu4ng/cyberlab | /misc/__init__.py | UTF-8 | 300 | 3.578125 | 4 | [
"MIT"
] | permissive | # Threshold for the sign function
THRESHOLD = 0.000000001
def sgn(num):
"""
Produce the sign of the number
:param num: signed number
:return: sign of the number
"""
if num > THRESHOLD:
return 1
elif num < - THRESHOLD:
return -1
else:
return 0 | true |
a13f0132c3679f59811ed5aaa2d50f430d53cb5b | alexhowgego/sudoku | /sudokuBot.py | UTF-8 | 9,092 | 3.53125 | 4 | [] | no_license | # Define a function which counts the number of non zero entries in a list
def countNonZero(list):
result = 0;
for item in list:
if (item):
result += 1
return result;
def getCell(x, y):
userInput = input(f'Enter the value at ({x},{y}): ')
if (userInput):
return int(userInput)
else:
re... | true |
30d2a64fb8a996a8c8e329bec6ae9b87aea545a5 | kimba97/oftal | /sigemof/oftal/choices.py | UTF-8 | 267 | 2.625 | 3 | [] | no_license |
SEX_CHOICES =(
(1,("--------")),
(2,("Masculino")),
(3,("Femenino"))
)
STATUS_CHOICES=(
(1, ("Entregado")),
(2, ("No Entregado"))
)
ESTADO_CHOICES=(
('Programado', ("Programado")),
('Realizada', ("Realizada")),
('Reprogramado', ("Reprogramado"))
) | true |
dfc8e6d77e35c600ce569bf1c898f3ff5ed035cd | dwijenchawra/SleepLab2021 | /imputation.py | UTF-8 | 1,740 | 2.609375 | 3 | [] | no_license | false | |
e07bb0e9dd01dfdafb275f6f71be18643dc4a1b8 | MichaelWheeler202/SortingAlgorithms | /SortingAlgorithms.py | UTF-8 | 3,175 | 3.953125 | 4 | [] | no_license |
import time
def insertion_sort(list_to_sort):
start_time = time.clock()
for i in range(1, len(list_to_sort)): # 0 starts as organized, this is the index of our value to insert
for j in range(i, 0, -1): # iterate through sorted list, swapping until we hit an element less than
... | true |
8204bd4e3b9516d80d743b425a93c14cc6f60cae | GalSim-developers/GalSim | /galsim/shapelet.py | UTF-8 | 11,536 | 2.96875 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | # Copyright (c) 2012-2022 by the GalSim developers team on GitHub
# https://github.com/GalSim-developers
#
# This file is part of GalSim: The modular galaxy image simulation toolkit.
# https://github.com/GalSim-developers/GalSim
#
# GalSim is free software: redistribution and use in source and binary forms,
# with or w... | true |
af982c9fb38e13cda012aa58e541636ad9d99f2e | daisystar/ALGCN | /model.py | UTF-8 | 5,418 | 2.65625 | 3 | [] | no_license | import torch
import math
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
from torchvision import models
from util import *
class GraphConvolution(nn.Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, in_features, out... | true |
b077ab992b3f6e51dbccba30800f41a88155b81e | georgiedignan/she_codes_python | /Session2/conditionals_playground.py | UTF-8 | 137 | 2.65625 | 3 | [] | no_license | is_sunny = False
have_shoes = True
is_gym_open = True
print(is_sunny or have_shoes)
print(is_sunny or is_gym_open)
print(not is_sunny)
| true |
c69283ccd733ddda87fbc5d53f4efecec2abd39d | Submersible/columnar-query-language | /dsl/pipe.py | UTF-8 | 3,755 | 3.03125 | 3 | [] | no_license | from abc import ABC, abstractmethod
from functools import wraps
from typing import Union, Callable, TypeVar, Generic, Sequence, Dict
import inspect
T, A, B, C = TypeVar('T'), TypeVar('A'), TypeVar('B'), TypeVar('C')
def pipe_context(f):
"""
Must check type (must be typed with Union):
def foo(a, *res... | true |
f3bf6ca14d7367bb45b2bb31e565bbc957112e66 | vinodbellamkonda06/myPython | /sorttttttttttttt/b_sort.py | UTF-8 | 1,700 | 4.34375 | 4 | [] | no_license | def bubblesort(arr):
n = len(arr)
# Traverse through all array elements
for i in range(n):
# Last i elements are already in place
for j in range(0, n - i - 1):
# traverse the array from 0 to n-i-1
# Swap if the element found is greater
# than the next e... | true |
3f267023a6972967649c45950cce8f96fc695ae7 | cloudsecuritylabs/pythonclassaug2021 | /functions-class5/18.recursion2.py | UTF-8 | 264 | 4.15625 | 4 | [] | no_license | def Print_Numbers(item_list):
for item in item_list:
if type(item) == int:
print(item)
else:
if type(item) == list:
Print_Numbers(item)
items = [1,2,"a",3,[4,"b",5,6],[7,[8,"c",9]]]
Print_Numbers(items) | true |
4a4ec4dd2ece20779b4a594f52e771b6de8cbf41 | CaptainYin/MaliciousCodeClassification2016 | /data_inputs.py | UTF-8 | 6,440 | 2.984375 | 3 | [] | no_license | import numpy as np
import re
import os
import itertools
from collections import Counter
files =['1.txt', '2.txt', '3.txt', '4.txt', '6.txt', '7.txt','8.txt', '9.txt']#
def clean_str(string):
"""
Tokenization/string cleaning for all datasets except for SST.
Original taken from https://github.com/yoonkim/C... | true |
92bf9c1aa5c4281f315b070e9624a33452e4c4cb | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_135/3741.py | UTF-8 | 670 | 3.15625 | 3 | [] | no_license | cases= int(raw_input())
i=''
printList=[]
cur=0
while (cur<cases):
guess1=int(raw_input())
i=0
while(i<4):
if(i+1==guess1):
listOfWords1=raw_input().rsplit(' ')
else:
raw_input()
i+=1
guess2=int(raw_input())
i=0
while(i<4):
if(i+1==guess2):
listOfWords2=raw_input().rs... | true |
534af538bcc76e190af3153be03024a01980797a | amritbhanu/fss16591 | /code/5/Sym.py | UTF-8 | 935 | 2.828125 | 3 | [] | no_license | from __future__ import division
import math
import sys
sys.dont_write_bytecode = True
class Sym:
def __init__(i, name):
i.counts, i.most, i.mode, i.n, i.name = {}, 0, None, 0, name
def add(i, x):
i.n += 1
new = i.counts[x] = i.counts.get(x, 0) + 1
if new > i.most:
... | true |
aab15661b861dc2d0dad4f7c59e13a668522d85b | z-oz/ATM | /main.py | UTF-8 | 9,215 | 2.6875 | 3 | [] | no_license | # STANDARD LIBRARY
import tkinter
# USER-CREATED LIBRARY
import atm
# GLOBALS
root = tkinter.Tk()
root.geometry("500x500")
root.resizable(0, 0)
menu = None
prompt = None
SUBMISSIONS = ("Pin", "Withdrawal", "Deposit", "View")
machine = atm.ATM(atm.globals.accounts)
# arbitrary card; we can't insert a card into ou... | true |
d121385dab9f87ee2d854229c1d7e22a5e017a0a | junjungoal/robosuite | /robosuite/models/objects/composite_body/hinged_box.py | UTF-8 | 4,593 | 2.8125 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import numpy as np
from robosuite.models.objects import BoxObject, CompositeBodyObject, CylinderObject
from robosuite.utils.mjcf_utils import BLUE, RED, CustomMaterial, array_to_string
class HingedBoxObject(CompositeBodyObject):
"""
An example object that demonstrates the CompositeBodyObject functionality. T... | true |
a0d58689493948dcc215df163442dbd207b4f257 | Infoleading/demo-spark | /SQL/demoDataFrameWriteToMysql.py | UTF-8 | 1,163 | 2.65625 | 3 | [] | no_license | from pyspark import SparkContext, SparkConf
from pyspark.sql import SparkSession, Row
from pyspark.sql.types import *
def main():
studentRDD = sc.parallelize(["3 ZhangJin M 21","4 Wangwei F 26","5 Lijia M 38","6 Huhu F 33"])\
.map(lambda x:x.split(' '))
rowRDD = studentRDD.map(lambda p:Row(int(p... | true |
98136410bc9329c687a044cabb7a8b5f4b0a2ab0 | lanec/detect-recruiter-spam | /recruiterspam/unpackmbox.py | UTF-8 | 3,427 | 2.671875 | 3 | [
"MIT"
] | permissive | import argparse
import json
import logging
import mailbox
import quopri
from pathlib import Path
from typing import Any, Dict, List, Optional, Set
def _get_labels(message: mailbox.Message) -> Set[str]:
if "X-Gmail-Labels" in message:
return set(message["X-Gmail-Labels"].split(","))
return set()
def ... | true |
7091546675867b3d870d280fd269e68c51dc8859 | Axenu/AdventOfCodeSolutions | /2016/021.py | UTF-8 | 7,827 | 3.53125 | 4 | [] | no_license | input_data = '''move position 0 to position 3
rotate right 0 steps
rotate right 1 step
move position 1 to position 5
swap letter h with letter b
reverse positions 1 through 3
swap letter a with letter g
swap letter b with letter h
rotate based on position of letter c
swap letter d with letter c
rotate based on position... | true |
4a7104c35965d9ac751e47c80304d17675704b77 | zupercat/python-projects | /weektwo/day1/zodiaccalc.py | UTF-8 | 1,957 | 4.125 | 4 | [] | no_license | print("Hello and welcome to zupercat's almighty zodiac calculator.")
while True:
birth_year = input("Please state your birth year.")
if birth_year.isdigit():
break
print("Calculating...Beep boop...")
def calculate_zodiac(birth_year):
remainder = int(birth_year)%12
if remainder == 0:
zodiac = "Monkey"
elif ... | true |
41f497257db63ee2a09c1376753e84cca71c91f6 | soakoak/PythonChat | /src/utils/oma_tzinfo.py | ISO-8859-1 | 1,296 | 2.671875 | 3 | [] | no_license | # coding: iso-8859-15
import datetime
class EE_tzinfo(datetime.tzinfo):
def __init__(self): pass
"""tzinfo Suomen aikavyhykkeelle"""
def utcoffset(self, dt):
return datetime.timedelta(hours=+2) + self.dst(dt)
def _FirstSunday(self, dt):
"""Ensimminen sunnuntai dt:n tai se... | true |
e572b9aff3dda27d7f85ebbac44870623b65ed87 | saubbie23/Bootcamp-Work | /python_stack/python/fundamentals/insertion-sort.py | UTF-8 | 299 | 3.6875 | 4 | [] | no_license | array = [8,3,5,7,0,2,1]
def insertionSort(arr):
for i in range(1,len(arr)):
compVal = arr[i]
j = i - 1
while j >= 0 and compVal < arr[j]:
arr[j+1] = arr[j]
j -= 1
arr[j+1] = compVal
return arr
print(insertionSort(array)) | true |
e701e26cb9de5653b71e503e036886417b1762ed | LennartElbe/codeEvo | /StudentProblem/10.21.12.1/7/1569578357.py | UTF-8 | 864 | 4.03125 | 4 | [] | no_license | import functools
import typing
import string
import random
import pytest
## Lösung Teil 1.
def divisors(x: int):
"""This function recieves a positive Integer n and returns a list of its divisors
Examples:
A poitive Integer d is a divisor from n, if n divided by d has no rest.
divisors(10) == [... | true |
7d3b396eb0755ffb8aa6e165ff0e4b79b2a91d03 | mattg317/canvas_conversion_tools | /md_merge/merge.py | UTF-8 | 2,025 | 3.25 | 3 | [] | no_license | from pathlib import Path
from read_json import get_titles
import re
def get_markdown():
p = Path('Markdowns/.')
mds = list(p.glob('*.md'))
md_names = []
for md in mds:
md_names.append(md.name)
md_names.sort()
return md_names
output_file = "output_1.md"
def create_markdown(file_name,... | true |
be55eccbbcf359883daa1529255086e0a60dc77b | Sofien1945/Fake_News_Prediction | /main.py | UTF-8 | 1,444 | 3.03125 | 3 | [] | no_license | """"
Fake news prediction using passive agressive classifier
Part of the https://data-flair.training/ machine learning course
Date:27.10.2021
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import itertools
from sklearn.model_selection import train_test_split
from sklear... | true |
2dad6a77dfeac24cdb14f726f74c700bd1bc595f | XanaduAI/blackbird | /blackbird_python/blackbird/auxiliary.py | UTF-8 | 9,360 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2019 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | true |
f6984fbb38ca5385f7c1e4562fb47cc928ff823c | hustlrr/leetcode | /accepted/House Robber.py | UTF-8 | 366 | 2.953125 | 3 | [] | no_license | # coding=utf-8
#coding=utf-8
class Solution(object):
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
#yes:盗窃了上一家所获得的收益
#no:未盗窃上一家所获得的收益
yes,no=0,0
for profit in nums:
yes,no=no+profit,max(yes,no)
return max(yes,no)
| true |
a4c2f692a4a8ab50355d3541439675c8c3f0ce98 | 4kumano/culturebot | /cogs/memes.py | UTF-8 | 9,009 | 2.625 | 3 | [] | no_license | from __future__ import annotations
import asyncio
import io
import os
import random
from concurrent.futures import ThreadPoolExecutor
from typing import List, Optional
from utils.types import GuildContext
import discord
from discord.ext import commands, tasks
from pydrive2.auth import GoogleAuth, LoadAuth, RefreshErro... | true |
4d22d1655bac79eecddbb8bf68b3caec4b7b01e8 | jsygal/TrainPy | /Python/exercise/Udemy/FIleOperations/files.py | UTF-8 | 376 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
'''
Requirement:
Create a program that opens file.txt. Read each line of the file and prepend it with a line
number.'''
import os
with open('/Users/jishnusygal/VSCode/myCode/pythonBegin/exercise/Udemy/FIleOperations/file.txt') as file:
lineNum=1
for line in file:
print('{}:{}'.... | true |
af6beabc6a0e88032970f5077b2bd71ee2aeb353 | washingtoncandeia/PyCrashCourse | /10_Arquivos/file_reader5.py | UTF-8 | 298 | 2.796875 | 3 | [] | no_license | ##-------------------------------
# Cap.10 - Arquivos e exceções
# Python Crash Course
# Autor do livro: Eric Matthes
# Autor: Washington Candeia
# file_reader.py, p.259
##-------------------------------
with open('pi_digits.txt') as file_object:
for line in file_object:
print(line.rstrip())
| true |
4a40009cf8eb478a7c22afa7bc0b830b833143ef | LemonPi/GACK | /cell.py | UTF-8 | 2,649 | 3.1875 | 3 | [] | no_license | import os
from cspbase import Variable
colorRed = 0
colorOrange = 1
colorYellow = 2
colorGreen = 3
colorBlue = 4
colorViolet = 5
colorsDom = [0, 1, 2, 3, 4, 5] # roygbv
colorsDom.reverse()
heightDom = [0, 1, 2, 3, 4]
class Cell:
"""represent a spacial region with all the plant properties that are allowed there"""
... | true |
37fa4951fab701623f0a6f13cffae7ba826642f1 | ivanmbur/metodos_computacionales | /clase11/fft.py | UTF-8 | 709 | 3.03125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
n = 128
f = 200.0
dt = 1/(f*32)
t = np.linspace(0, (n-1)*dt, n)
y = np.cos(2*np.pi*f*t)
#plt.plot(t,y)
#plt.plot(t,y, "ko")
#plt.show()
y = np.cos(2*np.pi*f*t) - 0.4*np.sin(2*np.pi*2*f*t)
#plt.plot(t,y)
#plt.plot(t,y, "ko")
#plt.show()
from scipy.fftpack import ff... | true |
46893c7fe2b42ba69c8c8be0c857e193e51ac65d | weitaishan/PythonPractice | /Base/Finished/Test50.py | UTF-8 | 1,961 | 4.59375 | 5 | [] | no_license | # *_*coding:utf-8 *_*
'''
题目:输出一个随机数。
程序分析:使用 random 模块。
'''
'''
Python中的random模块用于生成随机数。
'''
# 1.用于生成一个0到1的随机浮点数:0 <= n < 1.0
# random.random()
import random
a = random.random()
print(a)
# 2.用于生成一个指定范围内的随机浮点数,两个参数其中一个是上限,一个是下限。如果a > b,则生成的随机数n: b <= n <= a。如果 a <b, 则 a <= n <= b。
# random.uniform(a, b)
impor... | true |
b98201c8a35d10c45f5dcc26bcb14fd6a3243c0f | kirandapkar/CS-765-Blockchain-assignments | /seed.py | UTF-8 | 2,859 | 2.8125 | 3 | [] | no_license | import socket
from threading import Thread
file_name = "outputseed.txt"
class Seed(Thread):
def __init__(self, host, port):
Thread.__init__(self, name="seed_thread")
self.host = host
self.port = port
self.peer_list = []
def register_peer(self, address):
self.peer_list... | true |
261aa04d72d0e12a7456c0e71a68dc324ced79b8 | ThomasJackDalby/experimental | /cubes/reddit.py | UTF-8 | 6,790 | 2.734375 | 3 | [
"MIT"
] | permissive | import json, random, numpy, os
from isometric_renderer import IsometricRenderer
DEFAULT_DATA_FILE_PATH = "reddit.json"
FILLS = [
[(202, 114, 188), (130, 56, 115), (62, 18, 43)],
[(203, 137, 224), (160, 100, 188), (64, 42, 63)],
[(175, 143, 242), (105, 73, 196), (37, 22, 87)],
(114, 116, 237),
(54, ... | true |
ac43910c4fcae6fec378e70ff44aea579a9f5357 | evanraalte/AdventOfCode2019 | /day8.py | UTF-8 | 868 | 2.921875 | 3 | [] | no_license | f = open("day8.input","r")
stream = [char for char in f.readline()]
width = 25
height = 6
layerSize = width*height
layers = []
numZeroes = []
# print(len(stream))
for i in range(0,len(stream)-1,layerSize):
layer = stream[i:i+layerSize]
# print(layer)
layers.append(layer)
numZeroes.append(layer.count... | true |
f5112e5f2e0ab3ec7bc1477d6e6ae5e6677c93af | chintan97/twitter-search-stream | /Scripts/search.py | UTF-8 | 2,131 | 2.9375 | 3 | [] | no_license | import tweepy
import csv
import re
auth = tweepy.OAuthHandler("", "")
auth.set_access_token("",
"")
api = tweepy.API(auth)
query_keyword = "Halifax"
max_count = 2000
per_query_count = 100
# Initially set max_id to max. It will be used in getting the tweets
max_id = 9999999999999999999
# We wi... | true |
6f7070d3223d71fdd9e0c55b548193676e17a829 | niladell/unsupervised-medical-learning | /src/util/image_preprocessing.py | UTF-8 | 725 | 2.734375 | 3 | [] | no_license | """ Set of functions to adapt the data, as croping, resizing, formatting, etc.
Some functions related to downloading and adapting the celebA dataset have been modified from 'nmhkahn/DCGAN-tensorflow-slim' (Github repo)
"""
import scipy
def center_crop( im,
output_height,
output_width )... | true |
b05356c8ea3abb50b6b6ff1c0e21623b690cd6f3 | shaditio/PhasedOutAI | /phasedoutAI.py | UTF-8 | 29,075 | 3.53125 | 4 | [] | no_license | from itertools import combinations
from collections import defaultdict
""" This code is to check which play made is the best by using functions
from Q1, Q2, Q3"""
def phasedout_play(player_id, table, turn_history, phase_status, hand,
discard):
# -- Q 1 CODES --
def phasedout_group... | true |
7f1691419dba830393a0d89a9fef35fcbf4a6ee3 | ebbsanchez/ebbtools | /practicezone/practicezone/extras.py | UTF-8 | 824 | 2.515625 | 3 | [] | no_license | from django.contrib.auth.models import User, Group
import random
#### It is broken ####
def init_guest_instance():
# G1 = User(username='Guest1')
# G2 = User(username='Guest2')
# G3 = User(username='Guest3')
# G4 = User(username='Guest4')
# G1.save()
# G2.save()
# G3.save()
# G4.save... | true |
6ffa7073292b87cc43d1d565860e58a8063ac617 | mmsbrggr/diofant | /diofant/plotting/plot_implicit.py | UTF-8 | 8,862 | 2.90625 | 3 | [] | permissive | """Implicit plotting module for Diofant
The module implements a data series called ImplicitSeries which is used by
``Plot`` class to plot implicit plots for different backends.
See Also
========
diofant.plotting.plot
"""
from ..core import Dummy, Eq, Symbol, Tuple, sympify
from ..core.relational import Equality, G... | true |
19cff44c9c79cccec330c4918a4fb34f3d1a9522 | javigarcia1981/Sass4Dash | /src/views/index/callbacks.py | UTF-8 | 875 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from dash.dependencies import Input, Output
import pandas as pd
df = pd.read_csv(
'https://raw.githubusercontent.com/plotly/datasets/master/hello-world-stock.csv')
def register_index_callbacks(app):
@app.callback(Output('my-graph', 'figure'),
[Input('my-dropdown', 'v... | true |
b3cc8b736e95a5bda1ce64257fa5e642de952b02 | momofor/nvim | /plug-config/pycool.py | UTF-8 | 175 | 3.1875 | 3 | [] | no_license | class student :
def __init__(self,name,age,grade):
self.name = name
self.grade = grade
self.age = age
std1=student("nathan",19,90)
print(std1.age)
| true |
8f2eb8ef803d993d672a46010294b05ad1e584a9 | nimbusproject/kazoo | /kazoo/sync/sync_threading.py | UTF-8 | 2,365 | 3.296875 | 3 | [
"Apache-2.0"
] | permissive | import threading
# sentinal object
_NONE = object()
class TimeoutError(Exception):
pass
class _AsyncResult(object):
"""A one-time event that stores a value or an exception.
Uses gevent's AsyncResult API
"""
def __init__(self):
self.value = None
self._exception = _NONE
... | true |
c332cecc0d0e89ba23c5107b05dc7cb555670fbe | cshintov/python | /anand-python/chapter6/ex06json.py | UTF-8 | 1,297 | 3.765625 | 4 | [] | no_license | '''exercise 6.6 implements the json encoder'''
def enjson(data):
if isinstance(data,bool):
if data : return "true"
else : return "false"
elif isinstance(data,(int,float)):
return str(data)
elif isinstance(data,str):
return escape_string(data)
elif isinstance(data,list... | true |
1fd07e95fe07f75bdc8b25ebdb26e2d90e781567 | hungrytech/Practice-code | /python/UniversityProject7.py | UTF-8 | 3,336 | 3.875 | 4 | [] | no_license | stdNumber_name = {"20198800":"KIM H.G.", # 학번과 이름 딕셔너리
"20199906":"SONG D.G.",
"20198801":"LEE S.Y.",
"20198934":"TAE J.A.",
"20198903":"PARK C.H."}
name_address = {"KIM H.G.":"seoul", # 이름과 주소 딕셔너리
"SONG D.G.":"daegu",
"LEE S.... | true |
ab738d4e629602c25ddb4fc4aed5d614e9940812 | cggcaio/Computacao_Evolutiva | /Mutation_and_Crossover.py | UTF-8 | 1,019 | 3.078125 | 3 | [] | no_license | from Population import createIndividual
import random
populacao = createIndividual()
parent1 = random.choice(populacao)
parent2 = random.choice(populacao)
mutation_prob = 0.2
crossover_prob = 1 - 0.2
r = random.randint(0,1)
r = 0.3
n_permutacoes = 1
print('P1 Original: ', parent1, '\n')
print('P2 Original: ', par... | true |
54db47b3743c5c71fc381a02728a628a7ce02596 | Aasthaengg/IBMdataset | /Python_codes/p02633/s530644342.py | UTF-8 | 79 | 3.28125 | 3 | [] | no_license | x = int(input())
mul = 1
while (mul*360) % x != 0:
mul += 1
print(mul*360//x) | true |
be14507a6436b26193d8c6982f0085eb1561b402 | AlienLau17/News-Recommendation | /api_connection/mysocket.py | UTF-8 | 380 | 3.296875 | 3 | [] | no_license | import socket
TCP_IP = "localhost"
TCP_PORT = 9999
conn = None
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print('Socket created')
s.bind((TCP_IP, TCP_PORT))
print('Socket bind complete')
s.listen(1)
print('Socket now listening')
print("Waiting for TCP connection...")
print(s.connect())
conn, addr = s.accep... | true |
939d24c8eb1f5586d96ceacc46caae9c8afb5041 | gabeabrams/robotmanipulation | /gabe_rick_sarah_proj1/scripts/robot_interface.py | UTF-8 | 22,405 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import random
from gabe_ricky_sarah_proj1.srv import*
from gabe_ricky_sarah_proj1.msg import*
from geometry_msgs.msg import (
PoseStamped,
Pose,
Point,
Quaternion,
)
from std_msgs.msg import Header
from baxter_core_msgs.srv import(
SolvePositionIK,
SolvePositionIKRequest,
)
i... | true |
4898dfde2369e8324568a7a7201b1dff697c96b5 | adafruit/Adafruit_CircuitPython_CLUE | /examples/clue_slideshow/clue_slideshow.py | UTF-8 | 739 | 3.046875 | 3 | [
"MIT",
"CC-BY-SA-4.0"
] | permissive | # SPDX-FileCopyrightText: 2019 Kattni Rembor, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Display a series of bitmaps using the buttons to advance through the list. To use: place
supported bitmap files on your CIRCUITPY drive, then press the buttons on your CLUE to advance
through them.
Require... | true |
35440241133eca4afcc7a0547cb1becf1629c216 | bashwork/twatter | /bin/pre-prepare.py | UTF-8 | 6,183 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
usage: partition_clusters.py -c <cluster-results> -i <original files> -o <results created here> -n 3
example: partition_clusters.py -c ./twatter-results -i ./twatter/ -o ./ -n 30
This will scan the cluster-results file to identify the clusters, randomly
select n% of the tweets in each cluste... | true |
25233cf60330c49fdc2c9548387dbfc4bcc32aea | sandywen/Weibo | /水军判别/用户分类/normalize.py | UTF-8 | 2,072 | 3.09375 | 3 | [] | no_license | #this script aims for normalizing the features of the data after data cleaning
#!/usr/bin/python
import os
import sys
from numpy import *
reload(sys)
sys.setdefaultencoding('utf-8')
def norm(data_set):
dataset_matrix = matrix(data_set)
column_num = dataset_matrix.shape[1]
for i in range(1, column_num): # f... | true |
2a2e3177301741e5d502663727b451f56664215c | XiaoMutt/qingting | /core/basis/protected.py | UTF-8 | 723 | 3.171875 | 3 | [] | no_license | class ProtectedClass(type):
def __setattr__(self, key: str, value):
if (not key.startswith('_')) and (getattr(self, key, Ellipsis) is not Ellipsis):
raise Exception(f'{self} is protected: public attribute {key} is already set to {value}')
super(ProtectedClass, self).__setattr__(key, valu... | true |
a17015c7f7b4428f6f56553f88650375ed9e65a5 | SeldomQA/seldom | /seldom/appium_lab/switch.py | UTF-8 | 1,664 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | """
switch app context
"""
from seldom.logging import log
class Switch:
"""
switch context by appium
"""
def __init__(self, driver):
self.driver = driver
def context(self):
"""
Returns the current context of the current session.
"""
current_context = self.... | true |
05e552cbf1d99e42c234b6a67d33c965a55a7be9 | Kumaken/Seleksi-2019-Tugas-1 | /src/data_organizer.py | UTF-8 | 1,398 | 2.921875 | 3 | [] | no_license | #Dependencies-------------------------------------------------------------------------------------------------------
import csv
import json
import sys #to accept bash input parameter
#-------------------------------------------------------------------------------------------------------------------
#Static Variables:--... | true |
55610299af4415852575c3b50cef50323b027567 | yxd-hde/lambda-poll-update-delete | /py-tornado-botocore/poll.py | UTF-8 | 1,125 | 2.8125 | 3 | [
"MIT"
] | permissive | from tornado import gen
from calculate import Sum
batch_count = 10
wait_time = 1
class Poll(object):
def __init__(self, loop):
self.fetch_count = 0
self.message_count = 0
self.loop = loop
self.cal = Sum()
@gen.coroutine
def _one_request(self, sqs_receive_message, queu... | true |
23b1d6218944cc698870f7d28a31b0bcf910e9eb | fengkai29/leetcode | /数组/leetcode_78_子集.py | UTF-8 | 436 | 3.3125 | 3 | [] | no_license | class Solution(object):
def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
ans = []
ans.append([])
self.back(nums,ans)
return ans
def back(self,temp,ans,res = []):
for j in range(len(temp)):
ans.append... | true |
b662e177c4cd5e06fcd438960c2c80e56dbdcf77 | eepLearning/federated-learning | /flmod/models/models.py | UTF-8 | 9,810 | 2.53125 | 3 | [] | no_license | import numpy as np
from torch import nn
import torch
import torch.nn.functional as F
import math
class Logistic(nn.Module):
def __init__(self, in_dim, out_dim, weight_init=torch.nn.init.xavier_uniform):
super(Logistic, self).__init__()
self.layer = nn.Linear(in_dim, out_dim)
# 初始化, 这个初始化和 ... | true |
8e7e158385eb6f89858fbb65718b7653ddb1c8a2 | Windows87/superhero-akinator | /app/algorithm/convert.py | UTF-8 | 2,390 | 2.609375 | 3 | [] | no_license | import pandas
pandas.options.mode.chained_assignment = None
data = pandas.read_json('https://raw.githubusercontent.com/akabab/superhero-api/master/api/all.json')
data = data.drop(columns = ['slug'])
data = data.assign(intelligence=0, strength=0, power=0, combat=0, speed=0, gender=0, is_good=0, is_tall=0, is_short=0... | true |
5792e93499bc1905c5267f23624a0f80f6da2a46 | ShijiZ/Intermediate_Python_HW | /week_7_homework.py | UTF-8 | 2,136 | 3.625 | 4 | [] | no_license | import numpy as np
def list_is_in(list1, list2):
'''
returns a list that contains boolean values showing whether element in
list1 is shown in list2.
Parameters
----------
list1 : list
the target list to be checked
list2 : list
the whitelist
Returns
---... | true |
4af016b4f1ab7e5a1741d64d874f900478649665 | neizod/problems | /codejam/14/0q/d-deceitful.py | UTF-8 | 721 | 3.3125 | 3 | [
"MIT"
] | permissive | from collections import deque
def normal_war(ns, ks):
c = 0
while ns:
n = ns.pop()
if ks[-1] < n:
ks.pop(0)
c += 1
else:
i = 0
while n > ks[i]:
i += 1
ks.pop(i)
return c
def deceitful_war(ns, ks):
while... | true |
099d523607d87b8d7131461aa5877f3b3df04005 | abuss/ECE420_W20 | /hadoop/streaming/inverseMap.py | UTF-8 | 186 | 3.28125 | 3 | [] | no_license | #!/usr/bin/python
import sys
# input comes from standard input STDIN
for line in sys.stdin:
line = line.strip()
word,count = line.split()
print("{}\t{}".format(int(count),word)) | true |
6d6c5d6aefff328113c03c66777e88ba204a15e5 | mkhai9x/comp3331 | /ass/OLD_WORKING/utility.py | UTF-8 | 3,103 | 2.78125 | 3 | [] | no_license | '''
# Python 3
# Author: z5147986
'''
def authenticate(credential):
if len(credential) < 2 or len(credential) > 2:
return 'Invalid Username. Please try again!'
credentials = 'credentials.txt'
with open(credentials, 'r') as reader:
line = reader.readline()
while line != '': # EOF
... | true |
2ec61b877fd6dfe47be2eb297906be3cbe3351eb | quanghuy1258/NLP | /splitSentences.py | UTF-8 | 1,336 | 3.171875 | 3 | [] | no_license | import codecs
from nltk.tokenize import sent_tokenize
import re
#list of delimiters
delim = []
#get the list of numeric and special characters
for i in range(65):
delim.append(codecs.decode(chr(i),'utf-8'))
for i in range(91,97):
delim.append(codecs.decode(chr(i),'utf-8'))
for i in range(123,127):
delim.a... | true |
1f6b97f5c9860ba6502a6389300da3a224cf025f | shangam/iw-bootcamp-data-types-and-functions | /data types/15.py | UTF-8 | 289 | 4.1875 | 4 | [] | no_license | # Write a Python function to insert a string in the middle of a string.
# Sample function and result :
# insert_sting_middle('[[]]<<>>', 'Python') -> [[Python]]
# insert_sting_middle('{{}}', 'PHP') -> {{PHP}}
def mid_st(x, val):
return x[:2] + val + x[2:]
print(mid_st("[[]]","python")) | true |
2e0af011d46df3df8382122eca0346dbbef68a1a | blreams/collegefootballpick10 | /functional_tests/test_basic.py | UTF-8 | 3,677 | 2.703125 | 3 | [] | no_license | from .base import FunctionalTest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chain... | true |
7b1610fe33349e5cd2a67060037f1cafba8bec82 | bandoche/ChromeUpdate | /ChromeUpdate.py | UTF-8 | 3,419 | 2.5625 | 3 | [] | no_license | import sys, time, platform
sys.path.insert(0, './modules')
from inform_currentVersion import checkAllUsers, checkCurrUser, get_CurrentVersion
from inform_newVersion import get_page, parse_page, get_NewVersion
from get_Chrome import download_Chrome, install_Chrome, remove_file
platf=platform.architecture()[0]
print('... | true |
56eec70a6f14dd78dd23c2e7e61b8202dc364e22 | rupendrab/LPHY | /rabbitmq/basic_get.py | UTF-8 | 299 | 2.53125 | 3 | [] | no_license | import pika
connection = pika.BlockingConnection()
channel = connection.channel()
method_frame, header_frame, body = channel.basic_get('task_queue')
if method_frame:
print(method_frame, header_frame, body)
channel.basic_ack(method_frame.delivery_tag)
else:
print('No message returned')
| true |
b20eb6c22fe4ecae2e55388c8e0d02c3a19400f0 | BonHyuck/Python | /Baekjoon/10816.py | UTF-8 | 254 | 2.734375 | 3 | [] | no_license | N = int(input())
sang = list(map(int, input().split()))
dic = {}
for s in sang:
dic[s] = dic.get(s, 0) + 1
M = int(input())
check = list(map(int, input().split()))
result = []
for number in check:
result.append(dic.get(number, 0))
print(*result) | true |
d05a1bf1634980a58cac6995a341e04ae35b3757 | hannah-rae/neutrons | /compute_results.py | UTF-8 | 1,325 | 2.515625 | 3 | [] | no_license | import sys
import csv
import re
from glob import glob
file_dir = sys.argv[1]
# Take totals out of CSV files for each composition, wt % WEH, and altitude
count_totals = []
results_files = glob(file_dir + '/*.csv')
newfn = 'end_results.csv'
resfile = open(newfn, 'w')
writer = csv.writer(resfile)
writer.writerow(['compos... | true |
f6e74bfa90b2bb167aa4317864a9affc2104b883 | aaspeel/optiMeasRL | /estimators/rnnEstimator.py | UTF-8 | 7,763 | 2.625 | 3 | [] | no_license | """
Class rnnEstimator
"""
from estimators.estimator import Estimator
from utils.sequences_treatment import generateSequence
import numpy as np
import tensorflow as tf
# used in function convert_to_inference_model
import json
from keras.models import model_from_json
class RnnEstimator(Estimator):
def __ini... | true |
52bb315bccd7d649720d323163e9825ff29b731f | aojugg/leetcode | /88_merge_sorted_array.py | UTF-8 | 843 | 3.296875 | 3 | [] | no_license | #merge sorted array
class Solution:
def merge(self, nums1, m, nums2, n):
"""
:type nums1: List[int]
:type m: int
:type nums2: List[int]
:type n: int
:rtype: void Do not return anything, modify nums1 in-place instead.
"""
if m==0:
nums1.clea... | true |
bf13d219a83c506d634d4c5dae318401cdbff71b | eline-91/WebMappingDemo | /geocities/apis.py | UTF-8 | 853 | 2.734375 | 3 | [] | no_license | import requests
def get_latlong(query):
"""Get latitute and longitude from Google api for a place.
Args:
query (str): place to geocode
Returns:
location in latlong
"""
result = requests.get('http://maps.googleapis.com/maps/api/geocode/json?address={}'.format(query))
locat... | true |
a1b0f0fb21c0a4e5363ed426c4df40678d546763 | assemtynyshtybay/Python | /informatics/vyvody/D.py | UTF-8 | 61 | 3.1875 | 3 | [] | no_license | a = int(input())
b = int(input())
c = b / a
print(b-int(c)*a) | true |
945c622e766484b5de46a5f996752f2746058bef | SeerLabs/name-disambiguation | /author-name-disambiguation-legacy/disamseer/train_blocking.py | UTF-8 | 14,904 | 2.65625 | 3 | [] | no_license | import copy
import math
import operator
import os
import pickle
import sys
import time
import pandas as pd
import generate_label_for_blocking
def calc_stat(pairs, learned_blocking, type):
RR = 0.0
PC = 0.0
F = 0.0
if type == 'CNF':
Pos = pairs['match'] == True
result = pd.Series([Tr... | true |
0e92cc427f02a471426456cda791d18135e49f8e | sepidmnorozy/backup-crawler | /idf_calculate.py | UTF-8 | 1,964 | 2.75 | 3 | [] | no_license | import math
def make_six_digit_num(input):
six = input/(100000)
five = input/(10000)
four = input / (1000)
three = input / (100)
if six > 1 :
return str(input)
elif five > 1 :
return '0'+str(input)
elif four > 1 :
return '00'+str(input)
elif three > 1 :
re... | true |
fbf6d12dd8b5f0553b83610b55af7b7c0854a26b | scadder-cu-boulder/spacecraft_cyberSec | /MIL_STD_1553_Simulation/Bus_Controller/Message_Layer/Data_Link_Layer/Data_Link_Layer_Decoder_BC.py | UTF-8 | 3,311 | 2.765625 | 3 | [] | no_license | class DataLinkLayerDecoderBC:
message_error_bit = ''
instrumentation_bit = ''
service_request_bit = ''
reserved_bits = ''
brdcst_received_bit = ''
busy_bit = ''
subsystem_flag_bit = ''
dynamic_bus_control_accpt_bit = ''
terminal_flag_bit = ''
rt_address = ''
def decode_stat... | true |
67db1b32a8c5d393cfc0778047772243d9f5acdf | xkuang/nlptutorial | /download/02-bigramlm/train_n_gram.py | UTF-8 | 1,348 | 2.96875 | 3 | [] | no_license |
# coding: utf-8
# In[26]:
import sys, math
from collections import defaultdict
# In[27]:
def gen_corpus_list(f_name):
with open(f_name, "r", encoding="UTF-8") as f:
corpus_list = [line.split() for line in f.readlines()]
for line in corpus_list:
line.append("<s/>")
line.insert(0, "... | true |
32de40c6fd8bb4e1c0e4c0ee79d90224082499ea | YTLogos/my_python_learning | /exchange.py | UTF-8 | 501 | 3.6875 | 4 | [] | no_license | #!/home/taoyan/anaconda3/bin/python3
# -*- coding: UTF-8 -*-
# filename:exchange.py
# author by:taoyan
# 用户输入
x=input("请输入x的值: ")
y=input("请输入y的值: ")
#创建临时变量用以交换
temp=x
x=y
y=temp
print("交换后的x的值为:{}".format(x))
print("交换后的y的值为:{}".format(y))
#还有一种更简洁的方法,可以不使用临时变量
'''
x,y=y,x
print("交换后的x的值为:{}".format(x))
print("交换后... | true |
53271bf926af19954ac7f312ea93b133cd8390da | latchr/teachinglab | /phys308utils.py | UTF-8 | 10,128 | 3.28125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pint
import numpy as np
import plotly
import plotly.plotly as py
import plotly.graph_objs as go
from scipy.optimize import curve_fit
plotly.offline.init_notebook_mode(connected=True)
units=pint.UnitRegistry()
def make_figure():
"""Make a matplotlib plot object to be populat... | true |
075afbcbe33e0237b85527cbd02d7caefef22dbc | assign-span/ranking | /ranking.py | UTF-8 | 2,703 | 3.546875 | 4 | [] | no_license | #!/bin/env python
import sys
def get_score(team_str):
"""
Get score from partial result string
:param team_str:
:return: dict representing team name and score
"""
last_space = team_str.rfind(" ")
score = int(team_str[(last_space+1):])
return score
def get_team_name(team_str):
""... | true |
128cc085b7c9f9bc3b6130bd8e2f7afbf3be12bc | Fjolnirr/spamClassifier | /main.py | UTF-8 | 2,068 | 3.140625 | 3 | [] | no_license | import pandas as pd
import re
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import confusion_matrix
from skle... | true |
1bd7f9f693fde75e29096777e626ef6b30a232b2 | ganbatz/python2 | /dasgal6.py | UTF-8 | 89 | 2.515625 | 3 | [] | no_license | # ugugdsun temdegt muriin bvh vsegiig tom bolgo
name = "Bold"
print(name.upper())
| true |
0e6d5ed5c16500f1890ece2c962fdcc772f12f8d | aabhishek-chaurasia-au17/MyCoding_Challenge | /assignments/week03/day5/star.py | UTF-8 | 3,967 | 4.25 | 4 | [] | no_license | # Assignment Week 3
# [All questions need to be solved using both for and while loop]
# 1. Write code for the following sequence by taking line number as user input:
n = int(input("Please enter Odd number of line. : "))
# By using for loop
def by_for_loop():
print("By using for loop")
a = -1
for i in ran... | true |
1e68f6ef383667822086f913754a3b387229b42f | nobswolf/PythonIntFloat | /test_intfloat.py | UTF-8 | 679 | 3.515625 | 4 | [] | no_license | #!/usr/bin/python3
from intfloat import *
from decimal import *
from fractions import *
a = Fraction (321)
b = Fraction (123)
c = Fraction (345, 87)
d = Fraction (3, 77)
z = IntFloat ()
print (z, z.periodic())
z = IntFloat (a)
print (z, z.periodic())
z = IntFloat (a, 3)
print (z, z.periodic())
z = IntFloat (a, -4... | true |
ac931887aa35f435a7a8b91b63d803f9e73faaa1 | mahsasadeghi/Organic-Thin-Film-OTFT-Transistor-Characterization | /mobility-distribution.py | UTF-8 | 2,149 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#https://towardsdatascience.com/data-visualization-with-mathplotlib-using-python-a7bfb4628ee3
"""
Created on Mon Nov 11 19:28:35 2019
@author: mahsasadeghi
"""
# Import the libraries
#mobility=[1.710085,1.622626,1.477711,1.480233,1.477355,1.208531,1.229979,1.451601,1.3994... | true |
30eb5cacebb204e296f66cef976fe05b41255207 | Mayr0n/NeuralNetworkTest | /layer.py | UTF-8 | 1,071 | 3.25 | 3 | [] | no_license | from matrix import Matrix
from neuron import Neuron
class Layer:
def __init__(self, size, number_entries, function=None, df=None):
if function is not None and df is not None:
self.neurons = [Neuron(number_entries, function=function, dfunction=df) for i in range(size)]
else:
... | true |
e328ee3d20e5eb9f146fc9a7b6ed00d4bfdf8321 | mageshrocky/PycharmProjects | /pythonProject/class obj practice.py | UTF-8 | 181 | 2.5625 | 3 | [] | no_license | class com1:
def __init__(self, cpu, ram):
self.cpu = cpu
self.ram = ram
def config(self):
print(self.cpu, self.ram)
a = com1('i5', 4)
a.config()
| true |