blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
fed1ab26fbe6fb904e0b3b69cbaad6ed15fafcac
u101022119/NTHU10220PHYS290000
/student/100000006/HW.1/7.triangle.py
339
3.953125
4
def judge_tri(): a=input('first side of triangle:') b=input('second side of triangle:') c=input('third side of triangle:') d=a-b if d<0: d=-d if a+b>c: if d<c: print 'Yes' else: print 'No' return else: print 'No' r...
612de84faae42fbdb25dee164f4804a747d2c52b
u101022119/NTHU10220PHYS290000
/student/101022129/factorial_rec.py
438
4.03125
4
def factorial_rec(n): if n<0: print 'factorial function is for positive numbers' return None elif n-int(n)!=0: print 'factorial function is for integers' return None else: if n==0: return 1 else: value=n*factorial_rec(n-1) r...
bca58e7b0ab169c6bfc2a271333a58d04d65a639
u101022119/NTHU10220PHYS290000
/student/100022127/HW2/deterministicChaos.py
380
3.53125
4
# -*- coding: utf-8 -*- """ Created on Tue Apr 29 16:59:26 2014 @author: user """ import numpy as np import matplotlib.pyplot as plt rnum=1000 r=linspace(1,4,rnum) x=ones(rnum)/2.0 def rec(arg): for i in range(rnum): x[i]=r[i]*x[i]*(1-x[i]) plt.plot(r,x,arg) for i in range(300): ...
875f83b74a7969716c2752a2aec69d04b61a542f
u101022119/NTHU10220PHYS290000
/student/101022203/hw1.EXT/triangle.py
532
3.96875
4
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> >>> import math def is_triangle(a,b,c): a=int(a) b=int(b) c=int(c) s=[a,b,c] s.sort() [x,y,z]=s t=y-z r=y+z if z>t and z<r: ...
bdf2edc215b63ba9a9637626050f2c16effe04da
u101022119/NTHU10220PHYS290000
/student/101022107/Ackermann.py
205
3.515625
4
def Ackermann(m,n): if m==0: return n+1 elif m>=0 and n==0: return Ackermann(m-1,1) elif m>=0 and n>=0: return Ackermann(m-1,Ackermann(m,n-1)) print Ackermann(3,4)
8fbb9528dab98778f88e0aaf27e05e9a9124db33
u101022119/NTHU10220PHYS290000
/student/101022134/drop_ball_time.py
260
3.921875
4
#Homewrok 1 exercise 4 h = float(raw_input('the height of the tower is(in meters):')) t = float(raw_input('the time that the ball drops is(in seconds):')) g = 9.8 H = h - 1/2.0 * g * t**2 print 'the height of the ball at time', t, 'second(s) is', H, 'meters'
78fface67a1d1b484e4dbb88c559707276b0f54f
u101022119/NTHU10220PHYS290000
/student/101020021/hw3/sorting.py
2,954
3.6875
4
# -*- coding: utf-8 -*- """ Created on Tue May 20 16:38:35 2014 @author: user """ #import random from random import randint import time import copy import numpy as np from pylab import * def random_list(N,a,b): lst=[] for i in range(N): lst.append(randint(a,b)) return lst def selection_sort(lst...
e6f1a89786828d01e05ae99d6a3bdcad3cd8715d
u101022119/NTHU10220PHYS290000
/student/101022113/HW1/is_triangle.py
252
4.0625
4
def is_triangle(a,b,c): a = int(a) b = int(b) c = int(c) if a+b<=c or a+c<=b or b+c<=a: print 'No' else:print 'Yes' return is_triangle(1,1,1) ##T is_triangle(1.4,1.4,2) ##F is_triangle(1,2,2) ##T is_triangle(3,4,5) ##T
ab74efe5f6803502cf971679fdce57ebbab0f609
u101022119/NTHU10220PHYS290000
/student/101022171/hw1/satellite.py
366
4.25
4
#File: satellite.py #HW1_EX5_Altitude_of_a_satellite #Due: 3/25/2014 #Author: 101022171 import math G = 6.67 * 10**-11 M = 5.97 * 10**24 R = 6417.0 t = float( input('Enter the period T of the satellite in seconds. >:')) h = ((G*M*t**2)/(4*math.pi**2))**(1.0/3) - R print "The satellite is about %.2f km above the Ea...
de2f58544959533ad5464dcb3cb08f6639c806ba
u101022119/NTHU10220PHYS290000
/student/101022110/madelung.py
416
3.5
4
import math def potential(i, j, k): if i==0 and j==0 and k==0: return 0 else: if (i+j+k)%2==0: return 1/math.sqrt(i**2+j**2+k**2) elif (i+j+k)%2==1: return -1/math.sqrt(i**2+j**2+k**2) L=100 i=L M=0 while i>=L*-1: j=L while j>=L*-1: k=L wh...
65435a10b58a425374364b345ef8b4e642ce4795
u101022119/NTHU10220PHYS290000
/student/101020021/hw1/convert_polar.py
189
3.953125
4
import math x=float(raw_input('enter x : ')) y=float(raw_input('enter y : ')) print 'r = ',(x**2+y**2)**(1.0/2) print 'theta(degree) = ',math.asin (y/(x**2+y**2)**(1.0/2))/math.pi*180
98b833c37e7fd869191bc116a953345c4d1935b9
u101022119/NTHU10220PHYS290000
/student/101022119/convert_polar.py
196
3.515625
4
import math def a(b,c): t=c/b t=math.atan(t) t=t*180/math.pi r=(b**2+c**2)**(1.0/2) return [r,t] x=float(raw_input('x=')) y=float(raw_input('y=')) print '[r,degree]=',a(x,y)
5054cebdc68437373ef11265777c9d82d0f5cbb0
u101022119/NTHU10220PHYS290000
/student/9820128/ack.py
250
3.578125
4
def ack(m,n): if m==0: s=n+1 return s elif m>0 and n==0: s=ack(m-1,1) return s elif m>0 and n>0: s=ack(m-1,ack(m,n-1)) return s else: return 'None' print "A(3,4) is ", ack(3,4)
f379c6215abad877be4d2c5baa22e7f2003e9a10
u101022119/NTHU10220PHYS290000
/student/9930125/homework1/8_factorial_rec.py
342
4.09375
4
import math n = float(raw_input('ENTER THE VALUE OF THE N: ')) def factorial_rec(n): if n < 0: return None elif n != int (n): return None else: if n == 0: return 1 else: s = int(n) return s * factorial_rec(n-1) print 'THE FACTORIAL N IS ',...
6849504f903f2361fedfec3b31168e7122aa7e62
u101022119/NTHU10220PHYS290000
/student/101022210/hw1/drop_ball_height.py
287
3.84375
4
# -*- coding: utf-8 -*- """ Created on Sun Apr 13 21:31:25 2014 """ h=float(raw_input('Please input the high of the tower:')) t=float(raw_input('Please input the time interval of the ball falling:')) h1=h-4.9*t*t print 'The height of the ball above the ground at',t,'is',h1,'meters'
0d0ce9f11a8baec53a8a83d475b0c07eaa301c66
u101022119/NTHU10220PHYS290000
/student/101022217/hw1/satellite.py
195
3.84375
4
t = float(raw_input('enter a value of period of the satellite: ')) import math h=((t*t*6.67*(10**(-11))*5.97*(10**24)/4.0/3.14/3.14)**(1.0/3.0))-6417000 print 'the altitude of a satellite',h
034c084055637a5c567c8c6b25e6ccd6c25a302e
u101022119/NTHU10220PHYS290000
/student/100021216/myclass.py
734
4.125
4
import copy import math class point(object): '''Represents a point in 2-D space.''' class rectangle(object): """ Represents a rectangle. attributes: width, height, corner. """ a=point() a.x=0.0 a.y=0.0 b=point() b.x=3.0 b.y=4.0 box=rectangle() box.width=100.0 box.height=200.0 box.corner=point()...
1e15d535e21053e35ac6f96452f983d4ad681472
u101022119/NTHU10220PHYS290000
/student/101022132/HW3/sorting.py
584
3.90625
4
import random def random_list(N,a,b): p = [] for i in range(N): p.append(random.randint(a,b)) return p def selection_sort(p,N): print random.sample(p,N) def insertion_sort(p,N): for i in range(N): p.append(random.randint(a,b)) print p def bubble_sort(p): for i in range(len(...
7eaa58edb5efbb91efdb606349764498497cdec6
u101022119/NTHU10220PHYS290000
/student/100022135/HW3/mytime.py
1,614
3.875
4
class Time: def __init__ (self,h,m,s): self.hour = h self.minute = m self.second = s def to_second(self): s = self.hour * 3600 s += self.minute * 60 s += self.second * 1 return s def print_time(self): a,b,c = self.hour,self.minute,self.second ...
f0eef715e9b3a03e41faf183f0caa83a6fedd421
u101022119/NTHU10220PHYS290000
/student/101022102/HW 3/mt time.py
1,376
3.921875
4
# -*- coding: utf-8 -*- """ Created on Tue Jun 10 15:51:44 2014 @author: user """ + class Time(object): + def print_time(time): + print '%.2d:%.2d:%.2d' % (time.hour,time.minute,time.second) + + def time_to_int(time): + return time.hour*3600+time.minute*60+time.second + + de...
5a191d808c82c594fb83d4145b18dc29be92b260
u101022119/NTHU10220PHYS290000
/student/101011238/HW2/prime.py
251
3.5625
4
import math prime=[2] n=3 while n<=10000: i = 1 while i<=math.sqrt(n): if n%(i+1)==0: i=i+1 break elif i == int(math.sqrt(n)): prime.append(n) i=i+1 n = n+1 print prime
79bc60fc8f8d8ac7753f2a3c2fc96f44306c40e1
u101022119/NTHU10220PHYS290000
/student/101022107/factorial_rec.py
302
3.84375
4
import math n=float(raw_input('n= ')) def factorial_rec(n): if int(math.fabs(n))!=n: print 'n has to be a nonnegative integer' return None elif n==0: return 1 else: m=factorial_rec(n-1) p=n*m return p print factorial_rec(n)
e4e4eea17174509aa69209fc13daa9e93b0e6939
u101022119/NTHU10220PHYS290000
/student/101022142/class_exe/distance_between.py
597
3.71875
4
# -*- coding: utf-8 -*- """ Spyder Editor This temporary script file is located here: C:\Users\user\.spyder2\.temp.py """ class Point(object): """Represents a point in 2-D space.""" print Point blank=Point() blank.x=3.0 blank.y=4.0 print '("%g,%g")'%(blank.x,blank.y) def distance_between_points(point1,point...
774c4e3b1a48ccc755b3bf69d2768305b353113e
u101022119/NTHU10220PHYS290000
/student/101022125/convert_polar.py
170
3.8125
4
import math x = float( raw_input("Enter x: ") ) y = float( raw_input("Enter y: ")) r = math.hypot(x,y) theta = math.acos(x/r) d=theta*180/math.pi print "r=", r, "d= ", d
3cb126f6da8f9d6749a9f14bf554fc09e21328ef
u101022119/NTHU10220PHYS290000
/student/100021216/sorting.py
715
3.734375
4
import random import copy l=[] def list_swap(l,a,b): l[a],l[b]=l[b],l[a] def random_list(N,a,b): for i in range(N): r=random.randint(a,b) l.append(r) return l def selction_sort(l): for j in range(len(l)): imin=j for i in range(j,len(l)): if l[i]<l[imin]: ...
fd7217d12bac4e69e122f1684a306dda737b4cc6
u101022119/NTHU10220PHYS290000
/student/101022204/HW 2/catalan.py
208
3.5625
4
def catalan(n): if n == 0: return 1 else: return int((4*n-2.0)/(n+1.0)*catalan(n-1)) x = int(raw_input('Enter an integer:')) for i in range(x+1): print catalan(i)
358dd7474d1a7debb6107e3cbfcdb50c1be74de0
u101022119/NTHU10220PHYS290000
/student/101022216/h3/my date.py
1,603
4.0625
4
class Date : def __init__(self,mm,dd,yy): self.day = int(dd) self.month = int(mm) self.year = int(yy) def print_date(self): print '{0} / {1} / {2}'.format(self.month,self.day,self.year) def increment_date(self,n = 0): dd , mm , yy = self.day , self.month , self.year ...
7adf817f8a36012384292b6a1383b3b614387ee3
u101022119/NTHU10220PHYS290000
/student/101022109/convert_polar.py
239
3.953125
4
import math x=raw_input('I need the x coordinate!\n') y=raw_input('I need the y coordinate!\n') x=float(x) y=float(y) s=math.atan(y/x)/math.pi*180 r=math.sqrt(x**2+y**2) print 'the radius is ---->',r print 'the angle in degree is ---->',s
6ccb13e3c4047dbb7c75485cdf20a8515486bb14
u101022119/NTHU10220PHYS290000
/student/101022218/Homework 1/#Exercise 4-drop_ball_time.py
153
3.734375
4
h=float(raw_input("enter the height of the tower h(m):\n")) t=float((h*2/9.8)**0.5) h print"the time the ball takes until it hits the ground is",t,"(s)"
97d8599240ee0c4085b94129162fc6a11d16e01a
u101022119/NTHU10220PHYS290000
/student/100022108/hw2/Catalan.py
174
3.515625
4
def catalan(n): if n==0: return 1 if n==1: return 1 else: return catalan(n-1)*(4*n-2)/(n+1) for n in range (1,19): print catalan(n)
fd2716fde15b9ebe41f0446c8cab555f61cd75d6
u101022119/NTHU10220PHYS290000
/student/101022204/HW1/is_triangle.py
306
3.859375
4
a = float(raw_input('Enter the first stick length:')) b = float(raw_input('Enter the second stick length:')) c = float(raw_input('Enter the third stick length:')) def is_triangle(a,b,c): if a+b > c and b+c > a and a+c > b: print 'Yes' else: print 'No' is_triangle(a,b,c)
f8d87215fa95f018a040748e40710d33b09cca1f
u101022119/NTHU10220PHYS290000
/projects/P東木白中白巾/Shockmaze.py
16,071
4.03125
4
""" Simple graphics demo Sample Python/Pygame Programs Simpson College Computer Science http://programarcadegames.com/ http://simpson.edu/computer-science/ """ import pygame, sys from pygame.locals import * import os pygame.init() pygame.mixer.init() windowsurface=pygame.display.set_mode((1200,600),0,32) ...
8011b7665859d13c42363b54b563b66e9e61d52e
u101022119/NTHU10220PHYS290000
/student/101022119/is_triangle.py
188
3.84375
4
print 'whether sticks can form a triangle?' x=float(raw_input('x=')) y=float(raw_input('y=')) z=float(raw_input('z=')) if x+y>z and y+z>x and x+z>y: print 'yes' else: print 'no'
243799d1ae4aa88d66311d0caea9d1fad7239703
u101022119/NTHU10220PHYS290000
/student/101022109/fibonacci_rec.py
301
4.09375
4
def fibonacci_rec(n): if n==0: return 0 elif n==1: return 1 elif n>0 and n==int(n): return fibonacci_rec(n-1)+fibonacci_rec(n-2) else: return 'None!!!' def give_fibonacci(n): k=n n=0 while n<=k: print fibonacci_rec(n) n=n+1
e60826ea3b85f4863786a36c6e62c3fc377a2072
u101022119/NTHU10220PHYS290000
/student/101022137/hw3/TIME.py
1,944
4
4
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import random def random_list(N,a,b): c = [] for i in range(N): c.append(random.randint(a,b)) return c def selection_sort(c,N): print random.sa...
b2c7097abaa47cd7728d62ba64412e59a518e525
u101022119/NTHU10220PHYS290000
/student/9922112/hw1/satellite.py
363
3.734375
4
# -*- coding: utf-8 -*- """ Created on Fri May 09 10:26:42 2014 @author: Administrator """ import math from fractions import Fraction T =float(raw_input("Please enter the period(seconds) of the satelite:")) G=6.67e-11#m.k.s M=5.97e24#kg R=6417000#m h=math.pow(G*M*T**2/(4*math.pi**2),Fraction(1,3))-R print "the height ...
1e5db69463f504e1af3c365593013f801b4024c2
u101022119/NTHU10220PHYS290000
/student/101022108/homework 1/HW1-4 drop ball time.py
166
4.03125
4
h = float(raw_input('Input the height of the tower.\n')) g = 9.8 t = (2*h/g)**(1.0/2) if h>=0: print t if h<0: print 'The height of tower is not exist.'
7cdcd4e070448d14b08f474378610322e9f568e3
u101022119/NTHU10220PHYS290000
/student/101020031/HW1/drop_ball_height.py.py
268
3.828125
4
g = 9.8 h = input("the height h(meter) of the tower :") t = input("the time intrval t(second) :") s= 1.0/2.0 * g * t ** 2 H= h - 1.0/2.0 * g * t ** 2 #the height above the ground print "the height of the ball above the groud after time interval is",H,"meters"
b4c91e374d3f96a5512584e4e422a5af5b2b1118
u101022119/NTHU10220PHYS290000
/student/101022215/hw1/droping fxck ball .py
435
4.03125
4
g = 9.8 h=float(raw_input("Enter the initial height(m) you'd like it to be.")) t=float(raw_input("Enter the interval(s) you'd like it to be.")) def drop_ball_height(h,t): x = 0.5*g*(t**2) s = h-x if s>0: print 'At t seconds later, it will fall to the height of',h2,'above ground.' else: t...
73a465b867ac3d51f2319dabc02c8581084e6cf7
u101022119/NTHU10220PHYS290000
/student/100022223/is_triangle.py
207
4.125
4
def is_triangle(a,b,c): if (a+b)>c and(a+c)>b and(b+c)>a: print 'Yes' else: print 'No' x=float(raw_input('x:')) y=float(raw_input('y:')) z=float(raw_input('z:')) is_triangle(x,y,z)
a02965edbacb5cfa5ad0636817719faa7cfe9f10
u101022119/NTHU10220PHYS290000
/student/101022108/homework 1/HW1-6 convert polar.py
205
3.796875
4
import math x = float(raw_input('Input x:')) y = float(raw_input('Input y:')) print 'Cartesian (', x,',',y, ')' r = (x**2+y**2)**(1.0/2) theta = math.acos(x/r) print 'Polar (r=',r,', theta=',theta ,')'
e475d166817fdc439de6a25dacac57b3457d31ab
u101022119/NTHU10220PHYS290000
/student/101022117/is_triangle.py
179
3.734375
4
a=raw_input('J̪:') b=raw_input('JĤG:') c=raw_input('J̵u:') a=float(a) b=float(b) c=float(c) if a<b+c: print 'yes' else: print 'no'
b5b09233690a943dd2ff5b044dac4aafbbba67c3
u101022119/NTHU10220PHYS290000
/student/101022132/HW1/factorial_rec.py
248
3.671875
4
import math def factorial_rec(n): if not isinstance(n,int): print 'ADoOƹ' else: x=1 answer=1 while x<=n: answer=answer*x x=x+1 print answer
af3bf55e273e543d6d18a1e2d7347115a8fed3ea
u101022119/NTHU10220PHYS290000
/student/101022207/dop_ball_height.py
198
3.640625
4
def drop_ball_height(): h1=float(raw_input("Put the height of the tower: ")) t=float(raw_input("Put the time interval: ")) h2=h1-0.5*9.8*t*t return h2 print drop_ball_height()
7c4c6b1f6cd1bd6204418144bc6028c0f7b628bf
u101022119/NTHU10220PHYS290000
/student/101022129/convert_polar.py
260
4.0625
4
import math def cartesian_coordinate(): x=float(raw_input('Put the x component: ')) y=float(raw_input('Put the y component: ')) r = (x*x+y*y)**0.5 angle = math.atan(y/x) print "polar_coordinate(",r,",",angle,")" cartesian_coordinate()
a1273b5c9275bca1b59693407d7bfbdeec634dbe
u101022119/NTHU10220PHYS290000
/student/101020031/polar coordinates.py
196
4.15625
4
import math x=input('Please enter x:') y=input('Please enter y:') r=(x**2+y**2)**(0.5) angle=math.atan(y/x)*180/math.pi print 'In polar coordinates,your r is',r,',your angle is',angle,'degrees'
63ae8397c96d90bdcf33cba26c48db5972399b5b
u101022119/NTHU10220PHYS290000
/student/101022205/drop_ball_height.py
126
3.75
4
import math h =float(raw_input('ENTER THE VALUE OF THE HEIGHT: ')) t= math.sqrt(2/9.8*h) print ' THE TIME THE BALL TAKES ', t
b2ead3732dd7dd31a34aa136f23908a5f4680a95
u101022119/NTHU10220PHYS290000
/student/101020021/hw3/mytime.py
1,551
3.734375
4
# -*- coding: utf-8 -*- """ Created on Tue May 13 15:58:32 2014 @author: user """ class Time(object): '''''' def print_time(t): print '(%.2d : %.2d : %.2d)' % (t.hour,t.minute,t.second) def is_after(t1,t2): greater_smaller_equal((t1.hour-t2.hour)*3600+(t1.minute-t2.minute)*60+(t1.second-t2.seco...
2feec4ad9eb66c27f88ecf6ea0f5f0547bd1838a
u101022119/NTHU10220PHYS290000
/student/101020031/HW1/is_triangle.py.py
297
4.09375
4
def is_triangle(x,y,z): a=int(x) b=int(y) c=int(z) if a+b <= c : print "NO" elif b+c <= a: print "NO" elif a+c <= b: print "NO" else: print "YES" is_triangle(3.5456,4.654,5.65465) #YES is_triangle(2.65465,6.54654,100.65465) #NO
3d5618e63fb39817b30401547bec76648cdf1721
u101022119/NTHU10220PHYS290000
/student/101022213/homework3-class.py
1,116
4.09375
4
class Point(object): """Represents a point in 2-D space.""" blank1 = Point() blank2 = Point() def print_point(p): print '(%g, %g)' % (p.x, p.y) class Rectangle(object): """Represents a rectangle.attributes: width, height, corner.""" box = Rectangle() box.width = 100.0 box.height = 200....
b411dacd5547dc23c890717b6be2f31f01c0ed59
u101022119/NTHU10220PHYS290000
/student/101022139/convert polar.py
289
4.28125
4
import math x=float(raw_input('enter the value of the x coordinate:')) y=float(raw_input('enter the value of the y coordinate:')) r=math.sqrt(x**2+y**2) theta=math.atan(y/x)*180/math.pi print 'the corresponding polar coordinates (r,theta) is:','(',r,',',theta,')','theta given in degrees'
165e9d94fe445ddca87ce8bc150a02865436d3b5
u101022119/NTHU10220PHYS290000
/student/102022191/sorting.py
1,889
3.6875
4
import random import time import matplotlib.pylab def random_list(N,a,b): res = [] for i in range(N): res.append(random.randint(a,b)) return res def binary_search(s,l,r,value): while(l<r): mid = (l+r)/2 if(s[mid]>value): r = mid else: l = mid +1 ...
9cb687f9ceb1d777be4fcb4320b814a6a966fd24
u101022119/NTHU10220PHYS290000
/student/101020021/hw1/satellite.py
314
3.671875
4
# G*M*m/((h+R)**2)=m*4*(pi**2)*(R+h)/(T**2) => (h+R)**3=G*M*(T**2)/(4*(pi**2)) #=> h+R=(G*M*(T**2)/(4*(pi**2)))**(1/3) => h=(G*M*(T**2)/(4*(pi**2)))**(1/3)-R import math T=float(raw_input('enter the T you want : ')) print "the attitude is : ", (6.67*10**-11*5.97*10**24*T**2/4/math.pi**2)**(1.0/3)-6417000
3ae3fcdcd82204f55c00ded58a7d3bc54e277e48
u101022119/NTHU10220PHYS290000
/student/101020031/HW1/satellite.py.py
273
3.625
4
import math T=input("enter the value of the period T(second):") R=6417000.0 #:m G=6.67 * 10 **(-11) #:m**3/(kg*s**2) M=5.97 * 10 **24 #:kg A=G * M * (T **2) /4.0/math.pi**2 h=A ** (1.0/3.0) - R print "the attitude is",h,"meters"
711fc6630da621da351393c6b4fbbac5ab78db4b
u101022119/NTHU10220PHYS290000
/student/101022219/dropping_ball_height.py
325
3.90625
4
h = float( raw_input("Enter the height of the tower:")) t = float( raw_input("Enter the time interval:")) s = 9.8*t**2/2.0 print "The height of the ball is", h-s, "meters" h = float( raw_input("Enter the peight of the tower:")) t = (2*h/9.8)**0.5 print "The time interval it takes until hitting the ground", t, "met...
127ef1a60941b1f1f4ea9b3dc39c840ef1afb128
u101022119/NTHU10220PHYS290000
/student/9922112/hw2/mandelbrot.py
335
3.984375
4
# -*- coding: utf-8 -*- """ Created on Tue May 20 13:44:11 2014 @author: Administrator """ import cmath def mandelbrot(c,n): z=0 while n>0: z=z**2+c n=n-1 return abs(z) x=range(-2,3,1) y=range(-2,3,1) for a in x: for b in y: k=complex(a,b) if mandelbrot(c...
7f42a82eeaaf9c9e62cfac0cebbe5b4a0e53ef9a
u101022119/NTHU10220PHYS290000
/student/101022206/HW1/ackermann.py
311
3.859375
4
# -*- coding: utf-8 -*- """ Created on Tue Jun 17 15:51:54 2014 @author: user """ def Ackermann( m , n ): if m == 0: return n+1 elif m > 0 and n == 0: return Ackermann( m-1 , 1 ) elif m > 0 and n > 0: return Ackermann( m-1 , Ackermann( m , n-1 ) ) print Ackermann( 1 , 2 )
11459cd787ed2bbb8e78cce636e9677ac36b1c87
u101022119/NTHU10220PHYS290000
/student/101022142/class_exe/copy_box move.py
594
4
4
# -*- coding: utf-8 -*- """ Created on Tue Apr 22 16:59:48 2014 @author: user """ class Point(object): """Represents a point in 2-D space.""" class Rectangle(object): """Represents a rectangle. attributes: width, height, corner. """ box = Rectangle() box.width = 100.0 box.height = 200.0 box.corn...
8a6188201bbbb2991472cac385ad33da1197df12
u101022119/NTHU10220PHYS290000
/student/101022122/hw1/fibonacci series.py
580
4.1875
4
n=input('enter the fibonacci number:') def fi(n): if n<0: pass elif not isinstance(n,int): pass else: if n==1: return 1 elif n==2: return 1 else: return fi(n-1)+fi(n-2) def print_fi(n): f1=1 f2=1 if n<0: print ...
7980fc1e8e0f65dc6907528d8e5b5c14cdd08777
Aishat-Odekunle/Mini_Project
/Mini_Project.py
12,365
3.765625
4
import sys, csv import database_functions as db # print('\n') fp = db.fetch_products() # print(fp) fc = db.fetch_couriers() # print(fc) fo = db.fetch_orders() # print(fo) def instructions(): print("\n Hi, welcome to Aishat's Delight \n") print(' Please follow the instructions stated below.') def main_men...
a856fb36597912de35ac0cbce90aadb781d63599
bria051/Game
/Tic_tac_toe/choose.py
345
4.21875
4
def choosing(): print("Choose O or X to play the Game:") while (True): user = input() if (user == 'O'): computer = 'X' break elif (user == 'X'): computer = 'O' break else: print("You chose the wrong one. Choose again") ...
28a3763715f5405f8abe2de17ed5f9df1019278b
LeadingIndiaAI/Comprehensive-Evaluation-of-Multivariate-Chaotic-Time-series-using-Neural-Networks
/Mackey glass/ANN/mackey glass with mse.py
2,103
3.5625
4
import numpy as np import matplotlib.pyplot as plt import pandas as pd dataset = pd.read_csv('mgdata.dat.csv') training_set = dataset.iloc[:1100, 1:2].values X_train=[] y_train=[] for i in range(20,1090): X_train.append(training_set[i-20:i,0]) y_train.append(training_set[i,0]) X_train=np.asarray...
daefa7800aef6ad3d56e363f1c7837cb20b7f4f2
jiuash/python-lessons-cny
/code-exercises-etc/section_04_(lists)/ajm.lists04_range.20170218.py
173
3.53125
4
print range(5) # [0, 1, 2, 3, 4] ten_numbers = range(10) # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] print ten_numbers print range(1,13) # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
0ea3841eabe387f8c6b2698b03655e4486664c71
jiuash/python-lessons-cny
/code-exercises-etc/section_05_(loops)/ajm.loops03_calendar.20160220.py
453
4.0625
4
days_of_week = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] ##for day in days_of_week: ## print day for month in months: print month for...
a14edfef1f97b1c76c91c80a455d259f9b96916a
jiuash/python-lessons-cny
/code-exercises-etc/section_02_(strings)/z.ajm.strings-methods.20161029.py
553
3.890625
4
twitter = "@alisonjo2786" #print twitter.replace("@", "#") #twitter.replace("@", "#") #print twitter twitter = twitter.replace("@", "#") print twitter #last_name = "oppedibango" #print last_name.find("a") #print last_name.find("c") #print last_name.find("z") #print last_name.find("E") name = "Alison ...
881c561f1e8ca930a70a4c7a35be7df48b8bbc04
jiuash/python-lessons-cny
/code-exercises-etc/section_04_(lists)/ajm.lists01_attendees.20170218.py
983
4.125
4
##things = [] ##print things attendees = ['Alison', 'Belen', 'Rebecca', 'Nura'] #print attendees print attendees[0] ##name = 'Alison' ##print name[0] print attendees[1:3] print attendees[:3] #print attendees[4] #print len(attendees) number_of_attendees = len(attendees) print number_of_attendees attendees.append(...
354f916119e4f3f4ca7dd83d70bacde8bc032b8a
jiuash/python-lessons-cny
/code-exercises-etc/section_04_(lists)/ajm.lists01_attendees.20160220.py
927
4
4
attendees = ['Shannon', 'Jenn', 'Grace'] print attendees[0] print len(attendees) attendees.append('Kate') print attendees attendees[1] = 'Jen' print attendees attendees.insert(2, "alison") print attendees print '\n' attendees_ages = [] print attendees_ages print len(attendees_ages) at...
4be8157b8628f6ab5affe154e866b6cea5af4d08
nigamarpit/ProjectEuler
/Solutions/Euler24.py
281
3.640625
4
import itertools as it def lexicographicPermutations(): l=list(range(10)) r=[''.join(map(str,x)) for x in list(it.permutations(l))] #print(len(r)) print("Millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9: "+r[999999]) lexicographicPermutations()
3155a38c8284c686f0ac8989c05cefb5ba32cbe2
AndrewLu1992/lintcodes
/119_edit-distance/edit-distance.py
988
3.515625
4
# coding:utf-8 ''' @Copyright:LintCode @Author: hanqiao @Problem: http://www.lintcode.com/problem/edit-distance @Language: Python @Datetime: 16-06-08 10:02 ''' class Solution: # @param word1 & word2: Two string. # @return: The minimum number of steps. def minDistance(self, word1, word2): # ...
d06e104d4345ea6184eaed572b0c4dbefb53792a
AndrewLu1992/lintcodes
/155_minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.py
842
3.84375
4
# coding:utf-8 ''' @Copyright:LintCode @Author: hanqiao @Problem: http://www.lintcode.com/problem/minimum-depth-of-binary-tree @Language: Python @Datetime: 16-05-18 13:27 ''' """ Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, No...
92f92b145ee56dd9c0a8cda36fb0499a35b39ecc
basithh/Python-Hangman
/Hangman.py
3,123
3.609375
4
import random from os import system def hangman(point): if point == 5: print(" ") print("||| ") print("||| ") print("||| ") print("||| ") print("||| FIVE LIFE LEFT TO HANG") ...
3278f3b191b07105bfe6d1127dcad2cb66268e82
ellacoleman42/hello_world
/random_number_guesser.py
632
3.984375
4
import random import time number = random.randint(1,100) guess = 0 count = 0 while number != guess: while guess != number: guess = int(input("I'm thinking of a number between one and one hundred. Can you guess what it is?")) if guess > number: print("That is too big. Please guess again....
d6b3ac764ab65c3acd356ada9742d3f77148b07a
adohmen42/PythonProject
/module.py
127
3.609375
4
print("input a number") x = int(raw_input()) print("input another number") y = int(raw_input()) print((x+ y) * (x + y))
4eddbd328b63e58c485cfa0727aa2bb473ec7697
andersonamaral/Djean_project
/Djean_Project_Master.py
2,545
3.890625
4
# coding: utf-8 # ### ETL Aggregating by Country to Djean Axt Swiss Company # ### Author : Anderson Amaral , email : luis.anderson.sp@gmail.com # ### LinkedIn: https://www.linkedin.com/in/andersonlamaral/ # # In[46]: import pandas as pd # Below I read the Excel file into a Pandas DataFrame. Realise I have delet...
495f7f47477d142d149095c3c84906575ab22bdd
Austin306/Python-Assessment
/prob2.py
704
4.3125
4
def comparator( tupleElem ) : '''This function returns last element of tuple''' return tupleElem[1] def main(): '''This function takes the tuple as input and sorts it''' final_list = [] lines = input('Enter the list of tuples separated by , : ') for tup in lines.split('),('):#This For Loop is us...
3e0ddfa7513c609ecbc2c87604767f846ea6d1b8
karanchavan26/math-operation-using-python
/Quadratic_Equation.py
475
4.125
4
#FINDING THE ROOT OF ax^2+bx+c=0 import cmath a=int(input('ENTER coeffient of x^2 : ')) b=int(input('ENTER coeffient of x : ')) c=int(input('ENTER coeffient of 1 : ')) ''' To find the value of x following is the formula, x=( -b +ro- sqrt(b^2 - 4ac))/(2*a) ''' # (b^2 - 4ac) z=(b*b)-(4*a*c) # s...
68be769dc94cb9fd3c68e228d97c939602541fa5
AmayraniDominguez2009/POO
/Programa de operadores lógicos que dice si ganas un voleto de cine Amayrani Dominguez.py
630
4
4
#programa que decide si ganas un voleto de cine #Amayeani Dominguez Badillo 3F print("Premio de un boleto") pelicula_Cenicienta = int(input("Introduce cuantas peliculas de la Cenicienta haz visto: ")) print(pelicula_Cenicienta) pelicula_Sirenita = int(input("Introduce cuantas peliculas de la Sirenita haz vis...
af15f22fc8e6d241a938dc6daf52a67cd3195eec
AmayraniDominguez2009/POO
/Prueba de la Matricula carro Amayrani Dominguez Badillo 3F.py
295
3.578125
4
#programa de seleccion simple que dice si la matricula del carro es verdadera #Amayrani Dominguez Badillo 3F key = "matricicula carro" password = input("Introduce tu matricula carro : ") if key == password.lower(): print("La matricula carro coincide") else: print("La matricula carro no coincide")
bc66b6d1bf04cd45665374d0ff78a75fe95dc54b
AmayraniDominguez2009/POO
/celular.py
1,135
3.640625
4
#Programa Orientado a Objetos #Amayrani Dominguez Badillo 3F class Celular: tamaño=15 #centimetros memoria=32 #GB camaras=2 internet=False def jugar(self): self.internet=True def comunicar(self): ...
ed4f3c4652890259e661f9cf3b1b0992edecf9b3
AmayraniDominguez2009/POO
/celular con constructor y encapsulamiento.py
981
3.609375
4
#Clase Celular con constructor y encapsulamiento #Amayrani Dominguez Badillo 3F class Celular: def __init__ (self): self.__tamaño=15 #valor encapsulado self.memoria=32 #GB self.camaras=2 self.prender=False #constructor def jugar(self, prendido)...
1f3a481a2e4a27b14cf9d032b9353cee49c12487
ayubbeck/algorithm
/minimum_spanning_tree/prim.py
2,351
3.8125
4
import sys class Edge: def __init__(self, weight, node): self.w = weight self.n = node def __str__(self): return str(self.w) class Vertex: def __init__(self, id, key): self.id = id self.key = key # weight to get to this node self.adj = [] # edges se...
13ea05d64ec594f3c1c2921b5c659869708d84cc
ayubbeck/algorithm
/all_pairs_shortest_path/floyd_warshall.py
1,740
3.53125
4
import sys class Graph: def __init__(self, vertices, edges): self.size = len(vertices) if vertices else 0 self.vertices = vertices self.edges = edges self.dist = [[sys.maxint for _ in range(self.size)] for _ in range(self.size)] self.next = [[None for _ in range(self.size)] ...
238bc9a331de5bedc33e76ead8227816fda2166b
ayubbeck/algorithm
/binary_search_tree/binary_search_tree_tests.py
905
3.671875
4
import unittest from binary_search_tree import BST class BSTTests(unittest.TestCase): def setUp(self): self.bst = BST() self.bst.insert(10) self.bst.insert(5) self.bst.insert(8) self.bst.insert(12) self.bst.insert(15) def test_print(self): self.bst.inord...
66dadfe5273461d1d4aa20212487bcf133f7545e
ayubbeck/algorithm
/linked_list/doubly_linked_list.py
1,157
3.625
4
class Node: def __init__(self, key): self.key = key self.right = None self.left = None class DoublyLinkedList: def __init__(self): self.head = Node(None) self.head.right = self.head self.head.left = self.head def add(self, key): node = Node(key) ...
3ec9fbdd816e0714534f8e2ec1365bbfc4f88f9a
ayubbeck/algorithm
/multithreaded_algorithms/fib.py
525
3.671875
4
import threading from Queue import Queue class Fibonacci: def __init__(self, sequence): self.q = Queue() self.fib = self.fib(self.q, sequence) def fib(self, q, n): if n <= 2: q.put(n) else: x = threading.Thread(name='fib', target=self.fib, args=(q, n - 1...
d21a430ae5934c78d76f53edaec07a933bf7df2c
ktc312/assignment9
/ktc312/read_file.py
583
3.765625
4
__author__ = 'ktc312' import pandas as pd '''import data''' countries = pd.read_csv('/Users/Leo/PycharmProjects/assignment/assignment9/countries.csv') income = pd.read_excel('/Users/Leo/PycharmProjects/assignment/assignment9/indicator gapminder gdp_per_capita_ppp.xlsx').T def merge_by_year(year): # merge the co...
9820e89337973f88c938d6fb4a5e461c91b5c074
Mario-Zuniga/Bank
/main.py
861
4
4
import Bank def main(): # We create the classes savings_account = Bank.SavingsAccount(100) checking_account = Bank.CheckingAccount(500) # The current balance of each class is shown print("Savings account: $", savings_account.get_balance()) print("Checking account: $", checking_account...
c5a91f799c26bf86da1127d699a45fe8bfb85983
Elmioor/tumanov_lesson_1
/main.py
4,716
4.25
4
#1. Поработайте с переменными, создайте несколько, выведите на экран, запросите у пользователя несколько чисел и строк и сохраните в переменные, выведите на экран. # print("enter something") # user_input_one = input() # print(user_input_one) #2. Пользователь вводит время в секундах. Переведите время в часы, минуты и с...
d1dca23c414d69b4382d87148964df032fcbe083
yuntaochn/DsaProject
/sort/sort.py
667
3.796875
4
""" 排序算法实现 """ """ 插入排序 直接插入 折半插入排序 希尔排序 """ def insert_sort(li): for i in range(2, len(li)): if li[i] < li[i-1]: li[0] = li[i] # 复制为哨兵 li[i] = li[i-1] j = i-1 while li[0] < li[j]: li[j+1] = li[j] j = j-1 l...
005190413f39c873a288cd4c2c96a07b24dd779a
DhruvinDPatel/ProgrammingPractice
/ll_detect_cycle.py
211
3.671875
4
def has_cycle(head): c = head n = head.next while c is not n: if c is None or n is None: return False c = c.next n = n.next return True
bcf6cc01615591b36df9c3822ae51821c684d6ff
nicholaskarlson/Object-Oriented-Programming-in-Python
/off day.py
2,170
4.125
4
# creating a class of my class. class Science: form ="c" num_student=0 def __init__(self,name,college_num,fav_sub): self.name=name self.college_num=college_num self.fav_sub=fav_sub Science.num_student+=1 def introduce(self): print(f"Hey! I am {self.name}.My...
4d66e3ddd7a89eb57912cb91328fb0d8fe7f71a8
nicholaskarlson/Object-Oriented-Programming-in-Python
/oop17 (__slots__).py
7,701
4.5625
5
# __slots__ dunder method in python # here we will demonstrate in code why using __slots__ results faster instant attributes access. # and space in memory become more and more relevent as the number of instant creation grows. # first lets create two classes identical in may ways. class Planet: def __init__(self,c...
cb7f5c6493b5b950268423924dbe0d0413648505
dbernstein1/interpreter
/eval.py
8,404
3.5
4
import re import math class Tokenizer: def tokenize(self): tokens_value = [] tokens_enum = [] file = open("test_input.txt", "r") f = open("output.txt", "w+") data = file.read().splitlines() compile = re.compile(r'[-+=()/^*;.{}]|[+-]?[0-9]*\.?[0-9]+|([a-z]|[A-Z])+[0-9]*') ...
3c201bc4d449732eed9e90952548f7d967502579
nakayumc0278/NetworkProgramming_2
/sample73.py
646
3.546875
4
# sample73.py # coding: utf-8 import sqlite3 as sql conn = sql.connect("sample.db") c = conn.cursor() c.execute("drop table if exists products") c.execute("create table products(name char(30),price int)") c.execute("insert into products values('空気清浄機',20000)") c.execute("insert into products values('冷蔵庫',170000...
983841c32850c35df34ec5126c570206aec5d2d1
nakayumc0278/NetworkProgramming_2
/sample57.py
429
4.0625
4
#sample57.py #coding: utf-8 str = input("文字列を入力") key = input("検索する文字列を入力") res = str.find(key) #検索文字列判定 if res != -1: print(str,"の中に",res,"の位置に",key,"が見つかった") else: print(str,"の中に",key,"が見つからない") #検索文字列が存在するかどうかだけ確認する if key in str: print(str,"の中に",key,"が見つかった")
e5f71ab2d4434397b0b2e8c8b474239ed143811c
chengchaos/watchlist
/mytrain/script4.py
342
3.609375
4
# -*- coding:utf-8 -*- import fileinput def main(): for line in fileinput.input(): if not line.startswith("##"): print(line, end="") if __name__ == '__main__': """如果被当作脚本调用,运行时的当前模块名称将会是 __main__""" main() else: print("") # 本模块的初始化代码
2a6c9b5513ca4e27a60a4da232000fbbb29a463f
chengchaos/watchlist
/mytrain/bicycles.py
1,069
3.96875
4
# -*- coding:utf-8 -*- bicycles = ['trek', 'cannondale', 'redline', 'specialized' ] print(bicycles) print(bicycles[0]) print(bicycles[0].title()) print(bicycles[-1].title()) print("My first bicycle was a "+ bicycles[0].title() + ".") motorcycles = ['honda', 'yamaha', 'suzuki'] print(motorcycles) motorcycles[0] = 'duca...
e5a5f3fe35fe34ab7a03d5f5ea01cc7d4e755144
tjsingh786/Assignment-6
/6.py
796
3.828125
4
#Q.1 def sphere(radius): area=4*3.14*radius*radius print(area) radius=int(input('Enter Radius:')) sphere(radius) #Q.2 def perfect(num): sum=0 i=1 while i<num: if(num%i==0): sum=sum+i i+=1 if num!=1 and sum==num: print (num) ...
7d86c047e57331e0a51431533a4e3d6a37bce586
juliasaenz/ScrabbleAR
/Funciones/leaderboard.py
1,959
3.625
4
import json from operator import getitem def entra_en_top(puntaje): """ Calcula si el puntaje de la partida es mayor al último de los mejores 10 puntajes """ try: leaderboard = open("Archivos/leaderboard", "r", encoding="utf-8") partidas = json.load(leaderboard) if len(partidas) < 10: ...
c5a843dcde005492ffaec0e7c686d2f4a5ed6937
juliasaenz/ScrabbleAR
/Funciones/Niveles.py
7,464
3.984375
4
""" Trabajo para Seminario de Python 2020 - Alumna Saenz Julia """ import json """Diccionario de elementos que configuran un nivel""" # Tablero tablero: { } # Tiempo de la partida tiempo = { "fácil": 180, "medio": 120, "difícil": 60 } # Cantidad de letras letras = { "fácil": dict(fácil={"a": 12, "e"...