blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 3.06M | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 3.06M |
|---|---|---|---|---|---|---|
ab7cfe6d79b6424074d6acc8b6884f25ba35c613 | Densatho/Python-2sem | /aula3/ex2.py | 339 | 3.734375 | 4 | volume_mensal = float(input("Insira o volume de vendas mensal: "))
if volume_mensal <= 5000:
comissao = 2 / 100
elif volume_mensal <= 10000:
comissao = 5 / 100
elif volume_mensal <= 1200:
comissao = 7 / 100
else:
comissao = 9 / 100
print(f"O valor da comissão é R${round(comissao * volume_me... |
b0488b571dc4fe6b169be0bf6ecb612006bcc897 | DahlitzFlorian/article-introduction-to-itertools-snippets | /itertools_zip_longest.py | 160 | 3.71875 | 4 | from itertools import zip_longest
a = [1, 2, 3]
b = ["One", "Two"]
result1 = list(zip(a, b))
result2 = list(zip_longest(a, b))
print(result1)
print(result2)
|
18a64cd20d80d99f407c5a8de0e7c43102a6ab53 | DahlitzFlorian/article-introduction-to-itertools-snippets | /itertools_accumulate.py | 302 | 4.0625 | 4 | from itertools import accumulate
from operator import mul
numbers = [1, 2, 3, 4, 5]
result1 = accumulate(numbers)
result2 = accumulate(numbers, mul)
result3 = accumulate(numbers, initial=100)
print(f"Result 1: {list(result1)}")
print(f"Result 2: {list(result2)}")
print(f"Result 3: {list(result3)}")
|
8df3ddd0971c52ea5a918ab28b2a3ef0ac82f92c | EgorBodrov/task_6_bomberman_sapper | /sapper.py | 6,887 | 3.5625 | 4 | """
Script imitates pure console version of Sapper.
According to Wikipedia, you win only when all bombs are marked with a flag.
Copyright by Bodrov Egor, 20.09.2021.
"""
import os
import sys
import random
import datetime
import time
from sapper_input import game_input
# The signs, which are used in f... |
dd4b29077279603558c9e505a7693fb2d97d51c4 | SamuelHalsey/Chapter6_Demo | /main.py | 9,949 | 3.671875 | 4 | # Mr. Jones
# This is a sample Python script Based on CH.6 material
# ASCII text generated with http://www.network-science.de/ascii/
# Donte Jones jones_donte@dublinschools.net
# IT Academy @ Emerald Campus
#
# Notes PYCHARM users: Use 'CTRL+/' keys to uncomment or comment any selected lines of code
import random
i... |
9bb53c56b3a389ad92646729a325fb40ad009de0 | smkbarbosa/uriJudge | /1004/prod_1004.py | 797 | 4.03125 | 4 | """
Leia dois valores inteiros. A seguir, calcule o produto entre estes dois valores e atribua esta operação à variável PROD. A seguir mostre a variável PROD com mensagem correspondente.
Entrada
O arquivo de entrada contém 2 valores inteiros.
Saída
Imprima a variável PROD conforme exemplo abaixo, com um espaço em ... |
54bc1e3dfedf368fdee288918cd381129f093c6e | mlen1990/Coding-Challenges | /challenge2/jetstream.py | 2,514 | 3.890625 | 4 | #! /usr/bin/env python
import sys
import util
import datetime
input_file = open(sys.argv[1], 'r')
base = int(input_file.readline()) # Get the base weight
line = input_file.readline()
edges = [] # Store the edges from the input file in a list
distance = 0 # The distance the bird needs to travel
print "Begin Parsing In... |
38f13e72d5f0d6a38c7782f9c909e29ae4c022ab | liuwei0376/python3_toturial | /com/david/tutorial/6-oop/6.4-getObjectInfo.py | 3,665 | 3.984375 | 4 | #-*- coding:utf-8 -*-
'''
一、获取对象信息
'''
print('-----------------一、获取对象信息------------------')
# 1.1 使用type()获取对象的类型
print('-----------------1.使用type()获取对象的类型------------------')
print(type(123))
print(type('str'))
print(type(None))
#如果一个变量指向函数或者类,也可以用type()判断
print(type(abs))
class Animal(object):
def run(self):
... |
5334fa0ee22d03f6dcab4296c590217e6d6ca2e7 | liuwei0376/python3_toturial | /com/david/tutorial/test.py | 2,657 | 3.796875 | 4 | #-*- coding:utf-8 -*-
if True:
print 'true'
print 'True'
else:
print 'false'
print 'False'
days = ['monday',
'tuesday','wednesday']
word = 'word'
sentense = "这是一个句子"
paragraph = """这是一个段落。
包含了多哦语句"""
# 这是一个注释
'''
多行注释
'''
"""
双引号凡是的杜航注释
"""
#raw_input('\n\nPress the entry key to exit:')
... |
2ff1b9d0740909e080a767a39603a6e557a98b3c | liuwei0376/python3_toturial | /com/david/tutorial/1-base/1.5-loop.py | 980 | 4.0625 | 4 | #-*- coding:utf-8 -*-
##循环
# 1. for x in ... 循环是把每个元素代入变量x,然后执行缩进块的语句
names = ['David','Lily','Lucy']
for n in names:
print(n)
# 例子:计算 1+2+3。。。。+10_1-spider
sum1 = 0
for n in (1,2,3,4,5,6,7,8,9,10):
sum1 += n
print('sum1 is: ',sum1)
sum2 = 0
for n in [1,2,3,4,5,6,7,8,9,10]:
sum2 += n
print('sum1 is: ',su... |
603e12a667b8908776efbfef8d015c5e12b390c8 | Super1ZC/PyTricks | /PyTricks/use_dicts_to_emulate_switch_statements.py | 761 | 4.375 | 4 | def dispatch_if(operator,x,y):
"""This is similar to calculator"""
if operator == 'add':
return x+y
elif operator == 'sub':
return x-y
elif operator == 'mul':
return x*y
elif operator == 'div':
return x/y
else:
return None
def dispatch_dict(operat... |
a6e335092167617a97d41e84d33dd70fe4ea81b1 | hc973591409/spider | /HTTPerro.py | 1,086 | 3.875 | 4 | # 异常错误处理
import urllib.request
import urllib.error
# 没有网络连接
# 服务器连接失败
# 找不到指定的服务器
def main1():
# 构建一个不存的站点请求
request = urllib.request.Request("http://www.ajkfhafwjqh.com")
try:
# 请求站点,设置超时时间
urllib.request.urlopen(request,timeout=5)
except urllib.error.URLError as err:
# <urlo... |
ee2183047032dc318e1218524722d9a0a4fe5540 | ozkansari/python_programlama | /8_1_range.py | 374 | 3.890625 | 4 | ogrenciler = [ 'Ali' , 'Ahmet', 'Ayse', 'Fatma' ]
print("Dongu Yontem-1:")
for ogrenci in ogrenciler:
print('Merhaba ', ogrenci)
print("Dongu Yontem-2:")
for i in range(len(ogrenciler)):
print((i+1) , ' -) Merhaba ', ogrenciler[i])
print("Dongu Yontem-3:")
i = 0
while i < len(ogrenciler):
pr... |
1af51d9ed56217484ab6060fc2f36ee38e9523df | rgvsiva/Tasks_MajorCompanies | /long_palindrome.py | 560 | 4.21875 | 4 | #This was asked by AMAZON.
#Given a string, find the longest palindromic contiguous substring.
#if there are more than one, prompt the first one.
#EX: for 'aabcdcb'-->'bcdcb'
main_St=input("Enter the main string: ")
st=main_St
palindrome=[st[0]]
while len(st)>1:
sub=''
for ch in st:
sub+=ch
... |
d5bfab7278d16ed336821acfe79d8ec77afda038 | neosoumik/pythonlab | /6c.py | 161 | 3.734375 | 4 | txt = ["hello", "hi", "welcome", "oyo", "gmail", "high", "qq"]
count = 0
for x in txt:
if len(x) >= 2 and x[0] == x[-1]:
count = count+1
print(count) |
e58852b5b427d28faddafe379e4dcd4725a4247d | AIDARXAN/Python_apps_or_games | /Turtle Race/turtle_race.py | 754 | 3.765625 | 4 | from turtle import *
from random import randint
speed(10)
penup()
goto(-140, 140)
for step in range(15):
write(step, align='center')
right(90)
forward(10)
pendown()
forward(150)
penup()
backward(160)
left(90)
forward(20)
a = Turtle()
a.color('red')
a.shape('turtle')
a.penup()... |
7dfdc76333497d713fe12af7de6b8ed08adcb3ef | GandT/learning | /Python/season2/p035-036/p036.py | 324 | 3.625 | 4 | # coding: UTF-8
"""
2018.5.2
CSVファイルのリスト化
"""
import csv
def csv_matrix(name):
answer = []
with open(name, 'r') as f:
rdr = csv.reader(f)
for row in rdr:
for cell in row:
answer.append(int(cell))
return answer
print(csv_matrix("small.csv")) |
407b0dd45c54a709d6e653b2bc77bd5ca306a4a2 | GandT/learning | /Python/season2/p024-025/p025.py | 384 | 3.921875 | 4 | # coding: UTF-8
"""
2018.4.20
イテレータ関数
"""
def number_generator(x):
if (x%2):
return 3*x+1
else:
return x//2
def number_generator_generator():
yield number_generator(1)
yield number_generator(2)
yield number_generator(3)
yield number_generator(4)
yield number_generator(5)
for num... |
304537407c871035ded6d5ad316973bf1a6169b2 | GandT/learning | /Python/season2/p003-006/p005.py | 501 | 3.6875 | 4 | # coding: UTF-8
"""
2018.4.6
二次方程式 ax^2+bx+c=0 に関して判別式を求める
"""
def det(a, b, c):
return b*b - 4*a*c
print( "ax^2 + bx + c = 0" )
a = 3
b = 2
c = 1
print( "a={} b={} c={}".format(a, b, c) )
print( "判別式 D={}".format(det(a, b, c)) )
a = 1
b = 2
c = 1
print( "a={} b={} c={}".format(a, b, c) )
print( "判別式 D={}".... |
78c17dc8b972e01ea7641e37fdcd4d35222ae513 | GandT/learning | /Python/season2/p015-016/p016.py | 987 | 4.28125 | 4 | # coding: UTF-8
"""
2018.4.13
指定された月の日数を返す(閏年を考慮)
"""
def day_of_month(year, month):
# 不正な月が指定された場合Noneを返す
if type(year) != int or type(month) != int or not(1 <= month <= 12):
return None
# 2月を除くハッシュテーブル(辞書)の作成
table = {
1: 31, 2: -1, 3: 31, 4: 30, 5: 31, 6: 30,
7: ... |
33402b99fe55e4dfd871fe51b5cb51c3c5c72f84 | GandT/learning | /Python/season2/p026-027/p026.py | 403 | 3.59375 | 4 | # coding: UTF-8
"""
2018.4.20
ソート済み配列の線形探索
"""
def list_search(ilist, iitem):
seq = 0
found = False
while ilist[seq] <= iitem:
if ilist[seq] == iitem:
found = True
else:
seq += 1
return found
testlist = [-20, -7, 0, 1, 2, 8, 13, 17, 19, 32, 42, 124]
print(list... |
ccbfa98f9132324148020eeadc038cd7b426efdf | GandT/learning | /Python/season2/p028/p028.py | 292 | 3.515625 | 4 | # coding: UTF-8
"""
2018.4.20
ユークリッド距離の計算
"""
import math
from functools import reduce
def distance(list1, list2):
return math.sqrt(reduce(lambda x,y : x+y, list( map(lambda x,y : (x - y)**2, list1, list2) ) ))
d = distance([1,2,4], [3, 0, 2])
print(d, d**2) |
4a46dd08004193a35be9de64a85d95f762b37eee | ykimbiology/kim2013-positional-bias | /src/epitopemapping/mappeptides.py | 8,692 | 3.78125 | 4 | #! /usr/bin/python
import sys
import time
import os
"""
Pseudocode programming process:
GOAL: To accurately map peptides onto proteins.
If needed, takes into account homologous relationship among source and target proteins.
(1) map_peptides: Given a list of (A) peptides, (B) target proteins and (C) simil... |
5fd7af614f4f06454bd30e67acbc845532e0bc57 | gilgga/Python-Projects | /Connect_Four.py | 6,224 | 4 | 4 | '''
Created on Dec 4, 2017
@author: austr
'''
class Board(object):
def __init__(self, width=7, height=6):
self.__width = width
self.__height = height
board = self.createBoard(self.__width, self.__height)
self.__board = board
def createOneRow(self, width):
... |
42d614c608d6dddfeebc532148b3beea2a87e3a9 | Shamimasharmin/Python-code-practice | /playing_rock_paper_scissors.py | 1,674 | 4.03125 | 4 | activate = True
user_choices=['Yes', 'y', 'No', 'n']
while activate:
words=['Rock', 'ROCK', 'rock', 'Paper', 'PAPER', 'paper', 'Scissors', 'SCISSORS', 'scissors']
player1 = input('player1- Choose one: Rock, Paper or Scissors : ')
if player1 in words:
for word in words:
if player1==word:
... |
9550821d53972734b86957a92122fd5348889771 | Shamimasharmin/Python-code-practice | /addition_subtraction_multiplication_division.py | 431 | 3.5 | 4 | def dispatch_if(operator, x, y):
if operator=='add':
return x+y
elif operator=='sub':
return x-y
elif operator=='mul':
return x*y
elif operator=='div':
return x/y
else:
return None
def dispatch_dict(operator, x, y):
return{
'add':lambda:x+y,
... |
5b470b0cc142685511e8900a91306ea83510966d | BasantaChaulagain/cracking-codes-with-python | /caeserHacker.py | 425 | 3.75 | 4 | def main():
symbols="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 !?."
length=len(symbols)
message=raw_input("Enter a string:\n")
for key in range(length):
translated=""
for letter in message:
if letter in symbols:
letterIndex=symbols.find(letter)
translated=translated+symbols[(le... |
e07d9678ac7c45f2880e747c77d133fda8c2081f | dudnicp/compilateur_deca | /src/test/script/push_to_stack_generator_or.py | 1,011 | 3.546875 | 4 | #!usr/bin/python3
def or_recursive(n):
if n == 0:
return "(2 < 1) || (1 < 2)"
else:
return "(2 < 1) || ({})".format(or_recursive(n-1))
def main():
with open("test_too_much_registers_or.deca", 'w') as test_file:
test_file.write("// @result ok\n")
test_file.write("// @result ... |
be564700d52e4d29967af461fd46da72893f838d | webclinic017/davidgoliath | /Project/modelling/03_linearalgebra.py | 10,313 | 4 | 4 | # linear algebra python
# https://www.google.com/search?q=linear+algebra+python&sxsrf=ALeKk00bAclhj18xCwEbKZ27J5UMzPRTfA%3A1621259417578&ei=mXSiYPXXItqNr7wPzoSXsAY&oq=linear+al&gs_lcp=Cgdnd3Mtd2l6EAMYATIECCMQJzIECAAQQzIECAAQQzIECC4QQzICCAAyBQgAEMsBMgUIABDLATICCAAyAggAMgIILjoHCCMQsAMQJzoHCAAQRxCwAzoHCAAQsAMQQzoFCAAQkQI6... |
b6aca7b55b08724d2a922f3788cc2b15c4465f8e | webclinic017/davidgoliath | /Project/modelling/17_skewness.py | 1,280 | 4.125 | 4 | # skewness python
# https://www.google.com/search?q=skewness+python&oq=Skewness+python&aqs=chrome.0.0l4j0i22i30l6.3988j0j4&sourceid=chrome&ie=UTF-8
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.skew.html
# https://www.geeksforgeeks.org/scipy-stats-skew-python/
''' Statistical functions
In simple w... |
97f6d47ddd2ddcb59e5c5e04f7088a025f16609a | mbillingr/repotools-template-py | /pkg/mod.py | 292 | 3.765625 | 4 | """ This is a module
"""
class Number(object):
""" This is a class
"""
def __init__(self, nr=0):
self.nr = nr
def __repr__(self):
return 'Number({})'.format(self.nr)
def add(self, nr):
self.nr += nr
def mul(self, nr):
self.nr *= nr
|
920fbc4957ec799af76035cbb258f2f41392f030 | Reskal/Struktur_data_E1E119011 | /R.2.4.py | 1,096 | 4.5625 | 5 | ''' R-2.4 Write a Python class, Flower, that has three instance variables of type str,
int, and float, that respectively represent the name of the flower, its number of petals, and its price. Your class must include a constructor method
that initializes each variable to an appropriate value, and your class should
in... |
a08d7543c13ca4b2d902488bbd58123bf7d80747 | Fimba-Code/algorithm-challenge | /solutions/python/challenge_4.py | 2,017 | 3.65625 | 4 | # Challenge #4 - Probabilidade
#Constantes que representam as diferentes faces da moeda
T = "T"
H = "H"
# função para calcular todas permutações possíveis
# Todas as permutações são postas num array
#limit: é o número de lançamentos e limita o
# tamanho da string. Ex: p/ limit = 2, as strings geradas são
# HT,TT,TH,H... |
c0e7b3a5e7fe3c4d7f47c246b7f2873194520ee7 | fuckualreadytaken/ctf | /crypto/little_tools.py | 2,357 | 3.59375 | 4 | #! /usr/bin/env python
# coding=utf-8
import sys
def input_int(prompt):
sys.stdout.write(prompt)
sys.stdout.flush()
try:
n = int(raw_input())
return n
except:
return 0
def egcd(a, b):
if b == 0:
return 1, 0, a
(x, y, r) = egcd(b, a % b)
tmp = x
x = y
... |
2ea32f404f15439516fcb5678bcffb3e0f323683 | ghldbssla/Python | /자료구조/day02/연결리스트.py | 1,761 | 3.90625 | 4 | #연결리스트.py
class Node:
def __init__(self,data):
self.data = data
self.next = None#모든 타입의 초기값
class LinkedList:
def __init__(self):
self.head=Node('head')
self.count=0
#추가
def append(self,data):
newNode = Node(data)
curr=self.head
for i in range(se... |
955dd219de741389736060249815d9ce80092f36 | ghldbssla/Python | /개념 배우기/day05/method.py | 517 | 3.859375 | 4 | #method.py
'''
#f(x)=2x+1
def f(x):
return 2*x+1
'''
'''
#내 이름 10번 출력하는 메소드
def function(name):
result=""
for i in range(10):
# print(name)
result+=name+"\n"
return result
while True:
name = input("이름 : ")
print(function(name))
'''
'''
def login(userid,userpw):
if userid==... |
e5df21812c6c5107ce39ea43d4221dab17d66ca8 | ghldbssla/Python | /개념 배우기/day06/Comprehention.py | 388 | 3.765625 | 4 | #comprehention.py
#0~9가 담긴 리스트
#arData=[i for i in range(10)]
#print(arData)
#1~1000중 짝수만 담긴 리스트
#arData=[i for i in range(1,1000,1) if i%2==0]
#print(arData)
#(1,2),(1,4),(1,6),(2,2),(2,4),(2,6),(3,2),(3,4),(3,6)--1
#arData=[(i,j) for i in range(1,4,1) for j in range(2,8,2)]
#print(arData)
#arData=[(i//3+1,(i%3+1)... |
e491133990c74943fd62559ab513a3c3f9e9d2b2 | ghldbssla/Python | /자료구조/day04/후위표기법.py | 2,324 | 3.59375 | 4 | #후위표기법.py
#'문자열'.isdigit()
#'문자열'[0] : 문자열의 0번째 글자
#from 연결스택 import *
class Node:
def __init__(self,data):
self.data=data
self.next=None
class LinkedStack:
def __init__(self):
self.head=Node('head')
self.top=self.head
def push(self,data):
newNode = Node(data)
... |
2678840b71b80ee2b72750732fd68dac63db7b66 | Cogdof/OCR_backup | /CRAFT-pytorch-master/CRAFT-pytorch-master/problem.py | 234 | 3.546875 | 4 | line1 = input()
n = int(line1.split(" ")[0])
h = int(line1.split(" ")[1])
line2 = input()
line2 = line2.split(" ")
count=0
for i in range(0, n):
if int(line2[i]) <= h:
count+=1
else:
count+=2
print(count) |
de037860649e57eab88dc9fd8ae4cdab26fcb47a | sahilqur/python_projects | /Classes/inventory.py | 1,720 | 4.28125 | 4 | """
Simple python application for maintaining the product list in the inventory
"""
class product:
price, id, quantity = None, None, None
"""
constructor for product class
"""
def __init__(self, price, id, quantity):
self.price = price
self.id = id
self.quan... |
da64527b7b97a55f411a80cd31402b7fa78db6c8 | rocheers/algorithms | /tree/tree.py | 2,180 | 3.734375 | 4 | class TreeNode:
def __init__(self, val=0):
self.val = val
self.left = None
self.right = None
class Tree:
def __init__(self, arr=[]):
self.arr = arr
self.root = self.generate_tree()
def __repr__(self):
return "Tree's root = {}".format(self.root.val)
def... |
7279f2f62f5fab795ab14c5eaa8959fc8b1a1226 | gdgupta11/100dayCodingChallenge | /hr_nestedlist.py | 2,031 | 4.28125 | 4 | """
# 100daysCodingChallenge
Level: Easy
Goal:
Given the names and grades for each student in a Physics class of
students, store them in a nested list and print the name(s) of any student(s) having the second lowest grade.
[["Gaurav",36], ["GG", 37.1], ["Rob", 42], ["Jack", 42]]
Note: If there are multiple students w... |
b27f06f4d8286d4933eec47a344ae421bc9b3857 | nighthalllo/PS | /1765.py | 1,687 | 3.859375 | 4 | # union-find의 향기가 짙게 난다.
# 친구는 그냥 find해서 같으면 무조건 친구고,
# 적은 find를 했는데 같으면 친구임 -> 근데 또 본인은 아니어야 함
import sys
def find(parent, u) :
if parent[u] == u :
return u
parent[u] = find(parent, parent[u])
return parent[u]
def union(parent, u, v) :
u, v = find(parent, u), find(parent, v)
... |
b18c889179c63aa43f5935b00fd8a14e3e95b148 | neehartpt/coding_problems | /nonRepeatingCharacter.py | 274 | 3.65625 | 4 | if __name__ == "__main__":
print "Enter number of test cases:"
n = int(raw_input())
for _ in range(n):
print "Enter the string:"
s = raw_input().strip()
l = 0
for i in s:
if (s.count(i) == 1):
print i
break
l += 1
if (l == len(s)):
print "-1"
|
be3901b4d26c4b5f31b62d02642e7c4eba2d8d16 | MadhavMalhotra89/ObjectOrientedDesign | /HashTable.py | 3,241 | 3.78125 | 4 | class Item:
def __init__(self, key, value):
self.key = key
self.value = value
class MyHashMap:
def __init__(self):
"""
Initialize your data structure here.
"""
self.size = 10000
self.table = [[] for _ in range(self.size)]
def _hash_function(... |
ccfe5b8b02a41a1f1625305e019754844ff84fee | ConnorHz/PythonBankAndPollAnalysis | /PyPoll/main.py | 1,806 | 3.640625 | 4 | import os
import csv
# The total number of votes cast
# A complete list of candidates who received votes
# The percentage of votes each candidate won
# The total number of votes each candidate won
# The winner of the election based on popular vote.
totalVotes = 0
candidates = {}
winnerVotes = 0
winnerName = ''
candid... |
9e8a9994f6c5b4b600a688251b2b7aa853ba4ac2 | alexksikes/interviews | /extra/lucidchart/othello.py | 7,732 | 4.1875 | 4 | # Implement the board game Othello/Reversi on the following board.
# Alternate black and white turns, and don't allow illegal moves.
#
# Extra credit: Have one human play against a computer that always
# makes a legal move.
#
# Extra extra credit: Have the computer make at least somewhat
# strategic moves rather than j... |
0d3419443d936fae99a6d9a550c775f9d017dc8a | Lucian-N/funBits | /timeconversion.py | 907 | 3.953125 | 4 | '''
Given a time in 12-hour AM/PM format, convert it to military (24-hour) time.
Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock.
Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock.
'''
#!/bin/python3
import os
import sys
#
# Complete the timeConversion functi... |
f2ace74ebde816086a2f0a5d43f3dd977640f447 | sam-malanchuk/Algorithms | /eating_cookies/eating_cookies.py | 1,039 | 4.03125 | 4 | #!/usr/bin/python
import sys
# The cache parameter is here for if you want to implement
# a solution that is more efficient than the naive
# recursive solution
def eating_cookies(n, cache=dict()):
# check if the n has already been calculate
if n in cache:
return cache[n]
# base case, he cannot eat anymore... |
44f73780e812feef54ce64aefe473784bd5f19b8 | mediastore93/network | /time.py | 362 | 3.8125 | 4 | import time as t
import datetime
time = t.time()
date = datetime.datetime.now()
print(time)
print(date)
now = datetime.datetime.now()
print(now)
print (now.strftime("%H:%M:%S"))
t.sleep(10)
date_two = datetime.datetime.now()
time_elapsed = date_two - date
print(time_elapsed)
if time_elapsed > 20:
print('more ... |
bb6335b1d30f53f5fb046a8049d6353d54f352cc | CorentinBrtx/modvice | /server/src/models/user.py | 605 | 3.65625 | 4 | """
Define the User model
"""
from . import db
from .abc import BaseModel, MetaBaseModel
class User(db.Model, BaseModel, metaclass=MetaBaseModel):
""" The User model """
__tablename__ = "user"
username = db.Column(db.String(300), primary_key=True)
age = db.Column(db.Integer, nullable=True)
pa... |
c93d362cfdbb5d7ff952181b68dda9d2b378d0c5 | Berucha/adventureland | /places.py | 2,813 | 4.375 | 4 | import time
class Places:
def __init__(self, life):
'''
returns print statements based on the user's input (car color)
and adds or takes away life points accordingly
'''
#testing purposes:
# print('''In this minigame, the user has been walking along to Adventurland.... |
5f3ce5f268c3d457aacf496a4f69527b30087d1e | LockGit/Py | /avl_tree.py | 5,648 | 3.65625 | 4 | #!/usr/bin/env python
# encoding: utf-8
# author: Lock
# Created by Vim
"""
平衡二叉搜索树
1、若它的左子树不为空,则左子树上所有的节点值都小于它的根节点值。
2、若它的右子树不为空,则右子树上所有的节点值均大于它的根节点值。
3、它的左右子树也分别可以充当为二叉查找树。
4、每个节点的左子树和右子树的高度差至多等于1。
"""
class Node(object):
def __init__(self, key):
self.key = key
self.left = None
self.righ... |
40415732f901a2e44483c61ea3592665dc10f9bf | unupingu/CM6_control_software | /Robot_Program/get_send_data.py | 7,359 | 3.53125 | 4 | """ It can send to individual motors by adding joint prefix over commands:
Modes and commands available:
#### Commands need to be sent correctly or else it will be ignored. ####
#### replace words with numbers.Kp and speed can be float values!
1 - Go to position and hold:
h(position),speed,Kp,current... |
cef780a6d5137fc6b1d676a160e27a65f7d05760 | renyuntao/Levenshtein_Distance | /LevenshteinDistance.py | 977 | 3.671875 | 4 | #!/usr/bin/env python
def LevenshteinDistance(s,t): #要进行比较的两个字符串s,t
m,n = len(s),len(t) #m,n分别为字符串s,t的长度
#创建一个二维数组d,d[i][j]表示字符串s的前i位与字符串t的前j位之间的Leventeish Distance
#注意二维数组的元素个数是(m+1)*(n+1)
d = [[0 for j in range(n+1)] for i in range(m+1)]
for i in range(1,m+1):
d[i][0] = i
f... |
153b6bb8076ee436c6bb7828c85f3bc629733389 | HHorge/ITGK | /ITGK Øving 1/Tetraeder.py | 493 | 3.765625 | 4 | import math
hoyde = float(input("Velg høyden til tetraeden: "))
areal = hoyde*(3/math.sqrt(6))
volum = (math.sqrt(2)*areal**3)/12
overflateAreal = math.sqrt(3)*areal**2
print("Overflatearealet er: ", format(overflateAreal, ".2f"))
#print("Volumet er: ", format(volum, ".2f"))
#print("Arealet er: ", format(a... |
0ce4e939333927d007649ce44b520d9b4a009225 | HHorge/ITGK | /ITGK Øving 2/Billettpriser og rabatter.py | 2,152 | 3.640625 | 4 | #Oppgave a)
fullpris = 440
minipris = 199
miniprisDager = 14
femtiProsent = fullpris / 2
tjuefemProsent = fullpris * 0.75
alderBarn = 16
alderSenior = 60
alderSvar = 0
miniprisSvar = ""
uniformStudent = ""
dagerTilReise = int(input("Hvor mange dager er det til du skal reise? "))
if dagerTilReise >... |
85df4c8d7444e70e9fd51b440689dcd40e847c71 | HHorge/ITGK | /ITGK Øving 6/Lotto.py | 1,371 | 3.65625 | 4 | import random
numbers = list(range(1,35))
myGuess = [4, 7, 15, 33, 17, 29, 19]
lottoNum = 7
antallTilleggstall = 3
tilleggstall = []
result = []
myGuess.sort()
def compList(guess, result):
result.sort()
guess.sort()
correct = 0
for a in range(len(guess)):
for i in range(len(resu... |
6b914a2b5fed89bdc6636df808b2455b0177fae8 | HHorge/ITGK | /ITGK Øving 2/Generelt om betingelser.py | 581 | 3.90625 | 4 | tallA = int(input("Skriv inn et heltall: "))
tallB = int(input("Skriv inn et nytt heltall: "))
tallX = 3
tallY = 4
#Oppgave a)
sumAB = tallA + tallB
produktAB = tallA * tallB
produktXY = tallX * tallY
if sumAB < produktAB:
print(sumAB)
elif sumAB > produktAB:
print(produktAB)
elif sumAB == produ... |
c37571ee0c33942b085042ce422d67a5f9ccec0e | Taral-Patoliya/asssignment-1 | /asn3.py | 1,474 | 3.578125 | 4 | def readFile(filename):
from itertools import islice
data = []
with open(filename, 'r') as infile:
while True:
next_n_lines = list(islice(infile, 3))
if not next_n_lines:
break
raw = []
for line in next_n_lines:
line = l... |
d0d009499f6dd7f4194f560545d12f82f2b73db8 | starlinw5995/cti110 | /P4HW1_Expenses_WilliamStarling.py | 1,358 | 4.1875 | 4 | # CTI-110
# P4HW1 - Expenses
# William Starling
# 10/17/2019
#
# This program calculates the users expenses.
# Initialize a counter for the number of expenses entered.
number_of_expenses = 1
# Make a variable to control loop.
expenses = 'y'
# Enter the starting amount in your account.
account = float(i... |
1c1c74935df679ea35ad9b7bc962963c085e453a | morrigan-dev/python-examples | /Py4ePlus/examples/chapter12/ExercisePy4eC12.py | 5,172 | 3.671875 | 4 | '''
Created on 17.03.2020
Hier werden die Aufgaben aus dem Kurs 'Python for everbody - Kapitel 12' gelöst.
@author: morrigan
@see: https://www.py4e.com/html3/12-network
'''
import socket
import urllib.request
from examples import print_exercise
from examples import print_header
print_header("Python for everybody - ... |
6c111c506883556c342d5961c06eea7eae5c5554 | morrigan-dev/python-examples | /Py4ePlus/examples/chapter10/ExercisePy4eC10.py | 3,808 | 3.90625 | 4 | '''
Created on 12.03.2020
Hier werden die Aufgaben aus dem Kurs 'Python for everbody - Kapitel 10' gelöst.
@author: morrigan
@see: https://www.py4e.com/html3/10-tuples
'''
import string
from examples import DATA_PATH
from examples import print_exercise
from examples import print_header
print_header("Python for ever... |
640dfdc924e53dc061f44234db31c183ee705db0 | morrigan-dev/python-examples | /Py4ePlus/examples/threads/LocksAndSyncLowApi.py | 1,342 | 3.78125 | 4 | import _thread
import time
from examples import print_header
class LocksAndSyncLowApi:
def __init__(self):
self.__daten = 0
# Lock-Objekt für die Synchronisation
self.lock = _thread.allocate_lock()
def getTitle(self):
return "Threads - Locks und Synchronisation mit 'Low Leve... |
4bf380a2ccd68ec238cc4442211ae172aa74bc49 | morrigan-dev/python-examples | /Py4ePlus/examples/chapter14/ExamplesC14.py | 2,019 | 3.609375 | 4 | '''
Created on 19.03.2020
In diesem Modul sind Beispiele zu folgenden Themen enthalten:
- Objektorientierte Programmierung
@author: morrigan
@see: https://www.py4e.com/html3/14-objects
@see: https://www.linkedin.com/learning/oop-mit-python/willkommen-zu-oop-mit-python
'''
from examples.chapter14.konto.Bankenprogramm ... |
c47e419fdebe6e8968e8ab4d0ae68a7cc0a40443 | RohanGautam/My_applications | /meritnation_getanswer.py | 838 | 3.65625 | 4 | '''With this, one can get all the answers to a given question on a site called meritnation.
Meritnation is a student-oriented site where teachers answer questions and stuff.
You need to "log in"(not with facebook, google or anything), and need to give your phone number to access the full answer(s).
This is just a re... |
758b7d6b57bee60d06202439bfc5d1ceec2f70da | ManchesterMakerspace/RSServer | /RSServer.py | 2,164 | 3.53125 | 4 | #!/usr/bin/env python
import web
import schedule
import time
import threading
from threading import Thread
#This is a server meant to handle http request, web-hooks, ect. as well as trigger http requests, and run local scripts on response or schedules.
#======== -- CLASSES -- ==========================================... |
31006ce19aff9efb52bd4dc999ccb0ec0f54f4d5 | Laith967/hangman | /hangman.py | 1,410 | 3.921875 | 4 | import random
words = ('python', 'java', 'kotlin', 'javascript')
random_word = list(random.choice(words))
# help_word = random_word[:3] + (len(random_word) - 3) * '-'
word = list(len(random_word) * '-')
old_letter = set()
print("H A N G M A N")
tries = 8
while True:
play_exit = input('Type "play" to play the game... |
3a0f1e27326226da336ceb45290f89e83bb1f781 | dosatos/LeetCode | /Easy/arr_single_number.py | 2,254 | 4.125 | 4 | """
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Example 1:
Input: [2,2,1]
Output: 1
Example 2:
Input: [4,1,2,1,2]
Output: 4
Clarification ques... |
2fc808a248480a8840944c8e927ebdb2f23e854a | dosatos/LeetCode | /Easy/ll_merge_two_sorted_lists.py | 2,574 | 4.125 | 4 | """
Percentile: 97.38%
Problem:
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
Example:
Input: 1->2->4, 1->3->4
Output: 1->1->2->3->4->4
Solution:
Change "pointers" as in merge sort algorithm.
Time Complexity = O(N+M)
Sp... |
a5538a51d2b55f585e3acdf24a637d8264c469e1 | dosatos/LeetCode | /Easy/twoSum.py | 550 | 3.671875 | 4 | class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
storage = {} # where I will save difference and position; space complexity O(N)
for idx, num in enumerate(nums): # time complexity O(N)
... |
90487aa711f5127e6bd404f80014d900255f0606 | jhein1511/WD1_Homework | /Python/Guess_the_secret_number/guess_the_secret_number_1.1.py | 484 | 3.859375 | 4 | import random
def main():
secret = random.randint(1, 51)
while True:
guess = int(raw_input("Guess the secret number which is between 1 and 50: "))
if secret == guess:
print "Congratulations, you're right!"
break
elif guess < secret:
print "Sorry, y... |
e57878ba5db521e72f2db5bd5883c6f7abc13ec2 | t-ah/adventofcode-2019 | /day6.py | 1,071 | 3.703125 | 4 | from collections import defaultdict
def count_orbits(is_orbiting, o_counts, name):
if name in o_counts:
return o_counts[name]
else:
return 1 + count_orbits(is_orbiting, o_counts, is_orbiting[name])
def path_to_com(name, is_orbiting):
path = set()
node = name
while(True):
pa... |
91da2f554b9005de8297cfc33a5556b9dc2d82e4 | rpgiridharan/Ullas_Class | /Day11/email.py | 225 | 3.53125 | 4 | # email: alphanumeric chars followed by @ followed by alphabets followed by . followed by alphabets
a = ["sfsekf@segns", "sefsef", "hkopesri@sgoisg.sf"]
import re
print(list(filter(lambda x: re.match(r'\w+@[a-zA-Z]+\.[a-zA-Z]' , x), a)))
|
e0db93a72ccb67d3884507448fd15ac90622215c | rpgiridharan/Ullas_Class | /Day4/p1.py | 163 | 3.734375 | 4 | # Find sum of digits of a number
n = 12345
''' # TERRIBLE!!!
s = 0
while n:
s += n%10
n = n//10
print(s)
'''
# get all the digits of the number
# sum them up
|
2511dd499dc76d75b3c8fb7edea49c59fe8c5f3e | rpgiridharan/Ullas_Class | /Day7/quirky_for.py | 836 | 3.90625 | 4 | '''
x = 0
y = 5
for i in range(x, y):
print(i)
y = 10
print(i)
print (y)
'''
#-------------------
'''
for i in range(5):
print(i)
i = 10
print(i)
#-----------------------
'''
'''
x = [10, 20, 30]
for i in x:
print(i)
i += 100
print(i)
print(x)
'''
#-------------------------
'''
x = [[10], [20], [30]]
for i... |
f789bca691b4a9ccddb2214149f19381d7a27fff | SomaKorada07/EPAi | /session13-SomaKorada07/polygon.py | 2,153 | 3.734375 | 4 | """
polygon.py
"""
import math
class Polygon():
def __init__(self, num_edges, circumradius):
self.circumradius = circumradius
self.num_edges = num_edges
@property
def circumradius(self):
return self._circumradius
@circumradius.setter
def circumradius(self, circumradius):
... |
066769bf25ea46c40333a8ddf2b87c35bfed4fae | arvindsankar/RockPaperScissors | /rockpaperscissors.py | 1,646 | 4.46875 | 4 | import random
def correct_input(choice):
while choice != "Rock" and choice != "Scissors" and choice != "Paper":
# corrects rock
if choice == "rock" or choice == "R" or choice == "r":
choice = "Rock"
# corrects scissors
elif choice == "scissors" or choice == "S" or choice == "s":
choice = "Scissors"
... |
47a08ff18de948da3b1e1913ad30b58d84498d52 | FabioHelmer/projeto-integrador | /Adjacente.py | 541 | 3.96875 | 4 | # DESENVOLVIDO POR:
# CARLOS BARAQUIEL STEIN DE MEDEIROS
# FABIO HELMER KUHN
# GABRIEL FELIX MENEZES DA SILVA
# JOÃO BATISTA MUYLAERT DE ARAUJO JUNIOR
# WESLEY MARQUES PIZETA
class Adjacente:
def __init__(self, escola, distancia):
# objeto criado para guardar a escola que é adjascente
# e guardar ... |
704d49e1c41e8757fe1ee4f2f7fe9d961b8ec811 | pigzaza/TOTO-game | /Game1-About10 | 996 | 3.625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 16 20:19:08 2018
@author: pigzaza
"""
import random
import tkinter
import os
def clear():os.system('clear')
print('\n\n____Hello everyone, this is a game for ToTo____')
name=input('\nwhat\'s your name:')
print('Now I know You are',name,'\n')
x=... |
bb9d03050b10c79aec9ba7cd4c881bca7bb9fe03 | riteshsharma29/Pandas_tips | /set1.py | 448 | 3.546875 | 4 | import pandas as pd
'''
Splitting delimeter(, ; | etc) separated values into multiple rows with only 2 columns data
'''
df = pd.read_excel("data.xlsx",sheet_name='setI')
df_new = df['Annual Budget'].str.split(',',expand=True).set_index(df['Department']).stack().reset_index(level=0,name='Annual Budget')
df_new... |
5b3e55cfa06ac909731f5188ee737e93e1613559 | 18harsh/PythonBlog | /post_funct.py | 2,599 | 3.53125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 20 21:10:36 2020
@author: Harsh
"""
import sqlite3
from tkinter import *
import smtplib
from tkinter import messagebox
def post(author,title,content,date_posted):
args=[author,title,content,date_posted]
try:
conn = sqlite3.connect("lite.... |
e8aea765d7af7dcd37ead5358ea403a33194ed88 | AHKerrigan/Coursera-Machine-Learning | /Assignment-1/Assignment1.py | 4,937 | 3.84375 | 4 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def loadData(file):
data = pd.read_csv(file, sep = ",", header=None)
return data
def createX(data):
"""Constructs the X matrix for our data based on the dataframe
provided
"""
X = []
for index, ... |
655e89ab96f3338a7e3a94f09f06012008c4e232 | aditya2799/MovieDB | /test.py | 512 | 3.609375 | 4 | import sqlite3
conn = sqlite3.connect('temp.db')
c = conn.cursor()
c.execute("""Select * from MOVIE""")
res = c.fetchall()
movie = res[0]
aid = res[0][5]
actorname = ""
c.execute(""" SELECT FIRST_NAME,LAST_NAME FROM ACTOR WHERE AID=(?);""", (aid,))
print(c.fetchall()[0][0])
mid=res[0][0]
c.execute(""" SE... |
fd2236eaf9f68b84c79bc5ea679231c8d1678210 | charuvashist/python-assignments | /assigment10.py | 2,992 | 4.34375 | 4 | '''Ques 1. Create a class Animal as a base class and define method animal_attribute. Create another class Tiger which is
inheriting Animal and access the base class method.'''
class Animal:
def animal_attribute(self):
print("This is an Animal Class")
class Tiger(Animal):
def display(self):
pr... |
b9ab6da7d8da7faa28a764558af191e50ae6c513 | charuvashist/python-assignments | /assigment5.py | 861 | 3.71875 | 4 | if(year%400==0)or(year%4==0)and(year%100!=0):
print("year is leap")
else
print("year is not leap yaer")
l=int(input("enter any length"))
b=int(input("enter any breadth"))
if(l==t):
print("dimension are of square")
else:
print("dimension are of rectangle")
x=int(input("enter your age"))
y=int(input("enter you... |
034ad7eaf850bb1d97eb32a1d0306501e5951a82 | vatanabe/lesson1 | /scores.py | 824 | 3.71875 | 4 | scores_line = [{'school_class': '4a', 'scores': [2,4,2,4]}, {'school_class': '5b', 'scores': [3,5,3,5,3, 5]}, {'school_class': '6c', 'scores': [1,3,1,3,1,3,1,3]}]
#line1 = [2,4,2,4]
def average(list):
numbers_score = len(list)
clas_evaluation = 0
for scores in range(numbers_score):
clas_evaluation = clas_evaluatio... |
8bf6f2146b253774179f0dee4f448929b8d7a50a | Madrant/python_snippets | /static_var/class.py | 396 | 3.515625 | 4 | #!/usr/bin/python3
class Test():
def func(self):
if not hasattr(self, "counter"):
self.counter = 0
if hasattr(self, "counter"):
print("Counter: %u" % (self.counter))
self.counter += 1
if __name__ == "__main__":
test1 = Test()
test2 = Test()
test1.... |
001b5cc2e19857211728ce19e6353116860fd60e | averittk4249/cti110 | /m3hw1AgeClassifier_Averitte.py | 325 | 4 | 4 | # M3H1 Age Classifier
# 11/19/17
# Ken Averitte
# Age Classifier Python
userAge = int( input( "Please enter your age: " ) )
if userAge <= 1:
print( "You are an infant" )
elif userAge < 13:
print( "You are a child" )
elif userAge < 20:
print( "You are a teenager" )
elif userAge >= 20:
print( "You are a... |
41369f8fe9a88217707165a1bfd3b102202e1414 | IKHINtech/kumpulan_koding_python | /aplikasi sederhana hitung mahasiswa.py | 438 | 3.921875 | 4 | matakuliah = input ("Masukkan nama Matakuliah=")
nama = input ("Masukkan Nama Anda=")
nim = input ("Masukakn NIM anda=")
jawaban = "ya"
hitung = 0
while(jawaban == "ya"):
hitung += 1
jawaban = input ("ulangi lagi tidak?")
if jawaban =="ya":
matakuliah = input ("Masukkan nama Matakuliah=")
nama = input ... |
b772bfe164a2f6c2cbc16db1e164ce6fe6b8359e | IKHINtech/kumpulan_koding_python | /kelipatan 3.py | 291 | 3.828125 | 4 | n = int(input('masukkan angka= '))
i = 1
a = 0
for i in range(1, n+1):
if i%3 == 0:
print(i,end=' ')
print('merupakan bilangan kelipatan 3')
for i in range(1, n+1):
if i%3 == 0:
a = a + 1
print ('jumlah angka kelipatan 3 ada = ',a)
|
84a8a72ba5d37194e26fd69680fa7eb342687221 | simont1/softdev | /03_occupation/azrael_tungJ-tsuiS.py | 1,769 | 3.828125 | 4 | # azrael - Jason Tung and Simon Tsui
# SoftDev1 pd8
# K06 -- StI/O: Divine your Destiny!
# 2018-09-13
import csv
import random
def convert(filename):
'''converts a two column csv file with table headers and footers into a key value pair dictionary'''
#open file and parse it into a generator using csv reader
... |
a336d3cc2a6067b7716b502025456667631106d5 | joemmooney/search-text-for-words | /setup.py | 1,437 | 4.5625 | 5 | # This file is the main file for running this program.
import argparse
from fileReader import read_file
# The main function that is run when starting the program.
# It sets up argument parsing for the file name to read, the number of most common words to print,
# whether to return a json file, and the name for the js... |
f41b73b93bac460fc2b885eb62208f5e144a1352 | jason121301/Battleship-AI- | /Project/game_tree.py | 13,435 | 3.609375 | 4 | """The file that keeps track of the Game Trees that could be used.
COPYRIGHT 2021: JASON SASTRA AND MARTON KOVACS UNIVERSITY OF TORONTO."""
from __future__ import annotations
from typing import Optional
import game_code
import random
import copy
class WinningGameTree:
"""A gametree for battleship mo... |
0a5a2a20d7b2a8a4f71de1a098508a6a24610ec6 | GaoLiaoLiao/Crawler | /Python3WebSpiderTest/07-csv文件.py | 1,412 | 3.75 | 4 | import csv
import pandas as pd #利用pandas读取csv数据文件
#csv,其文件以纯文本的形式存储表格数据,相当于一个结构化表的纯文本形式
#写入
with open('data.csv','w') as csvfile: #打开csv文件,获得文件句柄
writer=csv.writer(csvfile) #初始化传入对象,传入该句柄
writer=csv.writer(csvfile,delimiter=' ') #可以修改数据之间的分隔符,默认是逗号
writer.writerow(['... |
68704578ee04cab63e82224bb1ef7c78f0ccf3c1 | JWhacheng/hangman | /main.py | 1,594 | 3.859375 | 4 | import os
import random
from sys import platform
from functools import reduce
def get_words_from_file():
words = []
with open("./data.txt", "r", encoding="utf-8") as f:
for line in f:
words.append(line.strip("\n"))
return words
def replace_accent_mark_letters(word):
replacements = (("á", "a"), ("é",... |
dd980648aa9a0b04a6cdd9b0ec62f7d1e2c69f42 | sniemi/SamPy | /astronomy/conversions.py | 13,242 | 3.640625 | 4 | """
Functions to do Astronomy related unit conversions.
:requires: astLib
:requires: NumPy
:requires: cosmocalc (http://cxc.harvard.edu/contrib/cosmocalc/)
:version: 0.4
:author: Sami-Matias Niemi
:contact: sammy@sammyniemi.com
"""
import math
import numpy as np
from cosmocalc import cosmocalc
import astLib.astCoord... |
ed96ec767162ac072948a1ccf04da851ee748729 | sniemi/SamPy | /resolve/kinematics/processVelocities.py | 7,887 | 3.59375 | 4 | """
Class to process emsao output and combine information to generate a velocity field.
Parses the input data and outputs reformatted data to a file.
Combines velocity information with the coordinate information
to generate a velocity field and outputs this information to
a comma separated ascii file.
Will also gener... |
df3b8e4f79c14872f724d2b24a972f79f16f5e83 | sniemi/SamPy | /sandbox/src1/avg.py | 2,094 | 4.03125 | 4 | #!/usr/bin/python
# avg.py
# Program to calculate the average and standard deviations
# of columns in a rectangle of numbers
print "\n avg.py Written by Enno Middelberg 2002\n"
print " Calculates the average and standard errors of"
print " columns and lines in a rectangle of numbers\n"
import math
import string
impor... |
2f089d961ae1edad6803c40977a7ea4fe609b184 | sniemi/SamPy | /astronomy/randomizers.py | 1,042 | 3.9375 | 4 | """
This module can be used to randomize for example galaxy positions.
:depends: NumPy
:author: Sami-Matias Niemi
:date: 21 May, 2011
:version: 0.1
"""
import numpy as np
__author__ = 'Sami-Matias Niemi'
def randomUnitSphere(points=1):
"""
This function returns random positions on a unit sphere. The numbe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.