blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
3e0202ec693932788455ae8647d07ecb0c52377d | evan0725/0611 | /test.py | 487 | 3.625 | 4 | from tkinter import *
window=Tk()
window.title("label")
window.geometry("500x400+100+15")
lab=Label(window,text="Savage love Did somebody, did somebody Break your heart? Lookin' like an angel But your savage love When you kiss me I know you don't give two fucks But I still want that"
,anchor=N,width=30,heigh... |
5b98ae43e166918cea8ba41661c33db6a26e36dd | HAlsalman/Graph_Theory--Weighted_Graph | /Weighted_Graph.py | 3,365 | 3.875 | 4 | #reference to Professor R. Davila
"""
Created on Thu Apr 19 16:42:36 2018
@author: randydavila
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 14 20:36:37 2017
author: Randy R. Davila
course: MATH 2305 - Discrete Mathematical Structures
In this python script we define a simple and weighted... |
d691c4794a45ea5b3d377a02d730ac4296078fc2 | gkanwar/maslab-2012-team-6 | /src/simulator/vector.py | 1,098 | 3.703125 | 4 | import math
class VectorValueError( ValueError ):
pass
class Vector:
def __init__( self, x, y ):
self.x = float( x )
self.y = float( y )
def __str__( self ):
return '(' + str(self.x) + ', ' + str(self.y) + ')'
def __add__( self, other ):
return Vector( self.x + other.x, self.y + other.y )
def __sub__( se... |
550341b44ae92b8c241dfc5ae58f142d09a335af | gyandhanee/fsdse-python-assignment-105 | /build.py | 324 | 3.59375 | 4 | def find_diff(s1, s2):
if s1 is None or s2 is None:
return None
else:
l1 = []
l2 = []
for item in s1:
l1.append(item)
for item in s2:
l2.append(item)
s1 = set(l1)
s2 = set(l2)
return list(s1.union(s2) - s1.intersection(s2))... |
c02b5859363accf2e2b3ff14c7fad86b2aa16be0 | AlAaraaf/leetcodelog | /offer/offer60.py | 1,184 | 3.765625 | 4 | """
把n个骰子扔在地上,所有骰子朝上一面的点数之和为s。输入n,打印出s的所有可能的值出现的概率。
你需要用一个浮点数数组返回答案,其中第 i 个元素代表这 n 个骰子所能掷出的点数集合中第 i 小的那个的概率。
1 <= n <= 11
"""
class Solution:
def dicesProbability(self, n: int) -> list:
"""
max_value = n * 6
init prob(val, 1), val = 1 - max_value
prob(val, n) = sum_i=1-6{prob(val-... |
c8db7c9c5b4ab6a57a9f656f41416fc81498f45b | AlAaraaf/leetcodelog | /offer/offer49-pending.py | 1,573 | 3.828125 | 4 | """
我们把只包含质因子 2、3 和 5 的数称作丑数(Ugly Number)。求按从小到大的顺序的第 n 个丑数。
输入: n = 10
输出: 12
解释: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 是前 10 个丑数。
1 是丑数
n 不超过1690
"""
class Solution:
def nthUglyNumber(self, n: int) -> int:
numList = [1]
listIdx = 0
multiByItem = [[2],[3],[5]]
multiItem = [2,3,5]
... |
7bdeb5d08846aa519e816baad0a12a29cc740f9d | AlAaraaf/leetcodelog | /offer/offer48.py | 1,510 | 3.53125 | 4 | """
请从字符串中找出一个最长的不包含重复字符的子字符串,计算该最长子字符串的长度。
输入: "abcabcbb"
输出: 3
解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。
输入: "bbbbb"
输出: 1
解释: 因为无重复字符的最长子串是 "b",所以其长度为 1。
输入: "pwwkew"
输出: 3
解释: 因为无重复字符的最长子串是 "wke",所以其长度为 3。
s.length <= 40000
动态规划 - maxSubString[i] = maxSubString[i-1] + 1 if NOT INCLUDE else 1
"""
class Solution:
de... |
6d060fecece1d659b7b3fcae8a019d1d7d09ad54 | AlAaraaf/leetcodelog | /offer/offer03.py | 1,232 | 3.578125 | 4 | """
找出数组中重复的数字。
在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。
数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。
请找出数组中任意一个重复的数字。
输入:[2, 3, 1, 0, 2, 5, 3]
输出:2 或 3
限制 2 <= n <= 100000
解法1 - 哈希表
解法2 - 原地哈希(使用for循环的时候会报错,因为会漏掉一些不能+1的条件)a
"""
class Solution:
def findRepeatNumber1(self, nums: list) -> int:
dict = {}
f... |
3073470eeae2e820e64b48300d45e65a09fc7590 | AlAaraaf/leetcodelog | /normal/leetcode844.py | 2,220 | 3.609375 | 4 | """
给定 S 和 T 两个字符串,当它们分别被输入到空白的文本编辑器后,判断二者是否相等,并返回结果。 #代表退格字符。
注意:如果对空文本输入退格字符,文本继续为空。
输入:S = "ab#c", T = "ad#c"
输出:true
解释:S 和 T 都会变成 “ac”
输入:S = "ab##", T = "c#d#"
输出:true
解释:S 和 T 都会变成 “”
输入:S = "a##c", T = "#a#c"
输出:true
解释:S 和 T 都会变成 “c”
输入:S = "a#c", T = "b"
输出:false
解释:S 会变成 “c”,但 T 仍然是 “b”
提交1 - 超时 (GoBack... |
6d0f2099428dbf61f0a3594fb6d3b4578ebb6299 | AlAaraaf/leetcodelog | /offer/offer32-2.py | 1,124 | 3.9375 | 4 | """
从上到下按层打印二叉树,同一层的节点按从左到右的顺序打印,每一层打印到一行。
"""
from util import createTreeNodeByLayerSeq
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def levelOrder(self, root: TreeNode) -> list:
... |
69c26ce7865aa4a932640d015346db14ee0fb4bb | AlAaraaf/leetcodelog | /offer/offer22.py | 1,272 | 3.796875 | 4 | """
输入一个链表,输出该链表中倒数第k个节点。
为了符合大多数人的习惯,本题从1开始计数,即链表的尾节点是倒数第1个节点。
例如,一个链表有 6 个节点,从头节点开始,它们的值依次是 1、2、3、4、5、6。
这个链表的倒数第 3 个节点是值为 4 的节点。
给定一个链表: 1->2->3->4->5, 和 k = 2.
返回链表 4->5.
"""
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
clas... |
724dcffc20a4c77c234bea6bcaa2d68e56c11f82 | AlAaraaf/leetcodelog | /offer/offer39.py | 550 | 3.53125 | 4 | """
数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。
你可以假设数组是非空的,并且给定的数组总是存在多数元素。
"""
class Solution:
def majorityElement(self, nums: list) -> int:
index = {}
listLen = len(nums)
for i in range(listLen):
index[nums[i]] = index.get(nums[i], 0) + 1
if index[nums[i]] > listLen ... |
5701fd0260648b50bfd33043a0dfa62ce76821fe | DiogoBerti/communicator | /socket_server.py | 2,666 | 3.515625 | 4 | #!/usr/bin/python
# import sqlite3
import socket
import threading
class ThreadedServer(object):
def __init__(self, host, port):
self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADD... |
e876c9fe18ca56438ae85bae1cece27b6f682b28 | Sunset-wrkshp/mobile_robot_19 | /navigation.py | 1,782 | 3.71875 | 4 | #from wall_following import follow_right, follow_left
from robot_class import Robot
import random
def navigate(rob):
wall_samples = 10
while True:
available_directions = []
num_t = 0
num_f = 0
for i in range(wall_samples):
if rob.distance_sensor.get_right_inches() <... |
7c433aed2143e08c1d0ccd9c741d9bb5974286a3 | razzaksr/SasiPython | /handling/MultiExcept.py | 1,215 | 3.765625 | 4 | # handling multiple exception
history=(20,120,50,70,0,300,60,10)
try:
liters = int(input("Tell us liters you filled: "))
pos = int(input("Tell us index to find travelled km to calculate fuel consumption: "))
kms = history[pos]
print("fuel consumed per km", (liters / kms))
except ValueError as verror:
... |
3c5264de23e395628e63f58fb76c9f89b6e89231 | razzaksr/SasiPython | /basics/Patterns.py | 2,480 | 3.921875 | 4 | # patterns: 8 basic:
'''
12345
12345
12345
12345
12345
'''
'''for step in range(1,6):
num=1
for stone in range(1,6):
print(num,end="")
num+=1
print()'''
'''
Floyds: left upper
a
ab
abc
abcd
abcde
'''
'''for step in range(1,6):
let=97
for stone in range(1,step+1):
print(chr(... |
f42b31605cf4205d0df2fa4221b35f61bc6c904c | razzaksr/SasiPython | /oop/Complete.py | 2,764 | 3.890625 | 4 | # class with constructor and inner creation
# Contructors:
# priority to execute before any other functions to be called
# it will be initiated while creating object itself
# to initialise members
#__str__,__del__,operator overloading,.....
class Loan:
__loanAmt=0.0
__loanNumber=0
__loanIntrest=0.0
_... |
4dfcb2c9e04d88b2f07c119bb0de2d5256fc55a4 | razzaksr/SasiPython | /oop/Multiple.py | 1,897 | 3.984375 | 4 | # Multiple Inheritance: two or more base class for one derived
# hybrid: combination of more than one form of inheritance
# here Hierarchy and multiple
# s>> c
# s>> d
# u>>c,d
from array import *
class Source:
def __init__(self):
self.transactions = array('f', [])
def __str__(self):
strs="... |
1e4ae4f4ad0e9d14c56043eda13518a3cb1c5635 | tayyabmalik4/MatplotlibWithTayyab | /10_Subplot_matplotlib.py | 2,709 | 4.03125 | 4 | # (10)**************************Subplot in matplotlib*************************
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# /////this is the subplot function arguments first arg is rows, 2nd arg is colmns and 3rd arg is indexs
# plt.subplot(2,2,1)
# plt.pie([1])
# plt.subplot(2,2,2)
# plt... |
e586823eeefba2af033ed2438a9f4e38ba3a80c3 | tayyabmalik4/MatplotlibWithTayyab | /12_image_show_colorbar_matplotlib.py | 3,348 | 3.875 | 4 | # (12)*********************Show Image And colorbar in matplotlib********
# //////if we want to read the image data than we use image using matplotlib in python
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
# /////we use imread function to showing the image
img=mpimg.imread('11.2_Figure_2.png')
img1... |
33776268b66e584ea5a9d71f713f051f6b3dc3eb | seshgirik/python-practice | /.ipynb_checkpoints/real_python_super.py | 1,362 | 4.25 | 4 | class Rectangle:
def __init__(self, length, width):
print(f'rectangle constructor')
self.length = length
self.width = width
def area(self):
return self.length * self.width
def perimeter(self):
return 2 * self.length + 2 * self.width
class Square(Rectangle):
de... |
518aca01049a58719cc4fe2c7008a571e24bc11d | seshgirik/python-practice | /RestAPI_Pandas_Numpy_Programs/numpy/numpyTutorial06VectorMatrix.py | 2,345 | 3.734375 | 4 | import numpy as np
from scipy import linalg
# Create a vector as a row
vectorRow = np.array([1, 2, 3])
print(vectorRow)
# Create a vector as a column
vectorColumn = np.array([[1], [3], [6]])
print(vectorColumn)
# Vector multiplication
vector_a = np.array([[1, 4], [5, 6]])
vector_b = np.array([[4, 1], [2, 2]])
res =... |
49a7fed041bec84ea6615b531d3da47f42bbbd35 | seshgirik/python-practice | /classMethod.py | 1,299 | 3.921875 | 4 |
class Pizza:
default_size = 100
def __init__(self, size, ingredients):
self.size = size
self.ingredients = ingredients
@staticmethod
def area(size):
print(f'area for {size} is {size*size}')
return size*size
@classmethod
def italian(cls, size):
# re... |
df525cb48e4590b3a574feb40d30fce3ecba75d4 | seshgirik/python-practice | /sort-insertion.py | 1,608 | 4.25 | 4 | # Hello World program in Python
a=[7,2,4,1,5,3]
#a=[1,2,3,4,5]
#a=[5,4,3,2,1]
print (a)
for i in range(1,len(a)):
print ("i is ", i)
#print ("\n")
for j in reversed(range(0,i+1)):
''' To optimize insertion sort, compare element with previous element, to achieve this use j in reversed range as show... |
4ce0833aaefb44e0d0e1940b2619fda360a996c4 | seshgirik/python-practice | /RestAPI_Pandas_Numpy_Programs/pandas/tutorial02/myPandas07_Merge.py | 1,422 | 3.546875 | 4 | import pandas as pd
def p(d):
print(d)
dict01 = {
'city': ['delhi', 'jaipur', 'shimla', 'mumbai'],
'temperature': [23, 31, 11, 34]
}
dict02 = {
'city': ['jaipur', 'delhi', 'bangalore', 'chennai'],
'humidity': [68, 91, 86, 98]
}
df01 = pd.DataFrame(dict01)
df02 = pd.DataFrame(dict02)
p(df01)
p(df0... |
8a492485ffd4c0cd41ea92fa7eb4e170b9ba5b9f | asgaria/CS325 | /implementation1Old/divideandconquer.py | 2,125 | 3.734375 | 4 | import sys
import numpy as np
def calculate_dist(x,y):
calc1 = (x[0] - y[0])**2
calc2 = (x[1] - y[1])**2
calc3 = (calc1 + calc2) ** 0.5
return calc3
def print_to_file(cur_min, minimum_points):
cur_file = open("output_bruteforce.txt", "w")
cur_file.write(str(cur_min) + "\n")
sort_list = sorted(minimum_points)... |
5a1739f671389b8a0aca2cae1b0d50d18007d3d2 | dimashtasybekov/algorithms-and-data-structure | /Queue.py | 501 | 3.890625 | 4 | class Queue:
def __init__(self):
self.queue = list()
def addtoq(self, dataval):
if dataval not in self.queue:
self.queue.insert(0,dataval)
return True
return False
def size(self):
return len(self.queue)
def remove(self):
if(len(self.q... |
9dce79800f92e21da72004e6e25410c8d23e3587 | LeeRHuang/PythonSprider | /System/system.py | 2,592 | 3.578125 | 4 | # coding=utf-8
# import sys
# def readfile(filename):
# f = file(filename)
# while True:
# readline = f.readline()
# if len(readline) == 0:
# break
# print readline,
# f.close()
#
# #Script start from here
# if len(sys.argv) < 2:
# print 'No action specified.'
# s... |
20ae72e47fa9885a0bad86d0d141001b5d842d5e | RickyLiTHU/codePractice | /657.py | 256 | 3.5 | 4 | class Solution(object):
def judgeCircle(self, moves):
"""
:type moves: str
:rtype: bool
"""
return False if len(moves) % 2 or moves.count('U') != moves.count('D') or moves.count('L') != moves.count('R') else True |
31e83a5042e9bb847333b1a724bae1fe8baf7321 | RickyLiTHU/codePractice | /105.py | 1,325 | 3.71875 | 4 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def buildTree(self, preorder, inorder):
"""
:type preorder: List[int]
:type inorder: List[int]
... |
b73570a0916e671bf82a6fd7394b053c2abed412 | RickyLiTHU/codePractice | /543.py | 1,163 | 3.78125 | 4 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def twoReturnTree(self,root):
#first get the diameter, then return the largest length
if(root==None):
... |
7cea949c6bf6d58898cd127ca0b36c984cce105a | RickyLiTHU/codePractice | /106.py | 871 | 3.9375 | 4 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def buildTree(self, inorder, postorder):
"""
:type inorder: List[int]
:type postorder: List[int]
... |
88de1a8d682675044c868e9926dca183fe3e0add | Greek-and-Roman-God/Apollo | /baekjoon/3_for/6_print_reverse_n.py | 64 | 3.5625 | 4 | # 기찍 N
n = int(input())
for num in range(n,0,-1): print(num) |
86ba895ed88e756e5a31a5e8ddd101a1ad09ed98 | Greek-and-Roman-God/Apollo | /baekjoon/data_structure/2164.py | 249 | 3.53125 | 4 | # 카드2
# https://www.acmicpc.net/problem/2164
from collections import deque
n = int(input())
queue = deque()
for i in range(1, n+1):
queue.append(i)
while len(queue) > 1:
queue.popleft()
queue.append(queue.popleft())
print(queue[0])
|
91536a3d3ea8fbc54bde2e8adaf7faf6bc4723d5 | Greek-and-Roman-God/Apollo | /이것이 코딩테스트다/part3/chap11그리디/02.곱하기혹은더하기.py | 509 | 3.578125 | 4 | # 곱하기 혹은 더하기
numbers = list(map(int, list(input())))
print(numbers)
result = numbers.pop(0)
while numbers:
number = numbers.pop(0)
print(result, number)
if result and number:
result *= number
else:
result += number
print(result)
# 2021-07-18
numbers = list(map(int, list(input())))
pri... |
c2705b5162e8403de0b52a621bba295f1eeb8f0f | Greek-and-Roman-God/Apollo | /baekjoon/7_function/2_self_number.py | 972 | 3.515625 | 4 | # 셀프 넘버
# 1
result = [i for i in range(10001)]
for num in range(1,10001):
# temp에 self num를 계산해서 넣어줌
temp = num + sum([int(n) for n in str(num)])
# print(temp)
# temp가 10000이 넘으면 저장하지 않음
if temp > 10000:
continue
# self number를 인덱스로 가지는 원소를 0으로
result[temp] = 0
# result 배열을 돌면서 원... |
d8f67138623f15ace42af2fea1427b1e37a3231d | fcaramia/melbootcamp | /functions.py | 470 | 3.953125 | 4 | import sys
num = int(sys.argv[1])
def fib(x):
if x<2:
return 1
else:
return fib(x-1) + fib(x-2)
print fib(num)
def factorial(n):
'''Returns the factorial of a positive integer
F(N) = N * F(N-1)
F(0) = 1
>>> factorial(0)
0
>>> factorial(1)
... |
b42f28a67189e58057044aaa217f91cd5cdf8335 | larryrun/leetcode | /src/solution/algorithms/al_008_string_to_integer.py | 1,516 | 3.546875 | 4 | class Solution(object):
def myAtoi(self, str):
"""
:type str: str
:rtype: int
"""
MAX_INT = 2147483647
MIN_INT = -MAX_INT - 1
stat = 'BEFORE'
sign = 1
result = 0
for c in str:
if c != ' ' and stat == 'BEFORE':
... |
d0708d8e008246ef07521dbc85041c96ba7be758 | p-enel/PyRates | /pyrates/simobjects/simulation_object.py | 7,070 | 3.796875 | 4 | """Base class of all object processed in the neural simulation
Any simulation object class that inherit from this class will be registered to
be part of the simulation. Objects within the simulation must be registered in
ordered to be part of the simulation.
Furthermore, basic information on the objects are saved for ... |
23dd63d338a19ca1a1312046634e38d9d9aaeea9 | allisonhilbig/WorkOrderLETU | /BackEnd/smtp.py | 3,677 | 3.515625 | 4 | from socket import *
from infoFromDb import InfoFromDatabase
class SMTP:
endmsg = "\r\n.\r\n"
info = InfoFromDatabase()
# Choose a mail server (e.g. Google mail server) and call it mailserver
mailserver = ("smtp.letu.edu", 25)
# Create socket called clientSocket and establish a TCP con... |
ecd00aba6dd94c9040b5f19efe5ce2ae519354d5 | mollyStark/code_snipets | /python/halfplane_intersection.py | 2,988 | 3.640625 | 4 | # -*- coding: utf-8 -*-
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def cross(self, point):
return self.x * point.y - self.y * point.x
def minus(self, point):
return Point(self.x - point.x, self.y - point.y)
def plus(self, point):
return Point... |
7551bb468623e478106976905da748f56c5d81e7 | Zoxas/Test | /Leetcode/Substring with Concatenation of All Words.py | 3,153 | 3.734375 | 4 | # -*- coding: utf-8 -*-
"""
You are given a string, s, and a list of words, words, that are all of the same length.
Find all starting indices of substring(s) in s that is a concatenation of each word in words
exactly once and without any intervening characters.
For example, given:
s: "barfoothefoobarman"
words: ["fo... |
02de6e83940017f68ee93919b716be5f3d6e615f | Zoxas/Test | /Leetcode/4Sum.py | 2,239 | 3.546875 | 4 | # -*- coding: utf-8 -*-
"""
For example, given array S = {1 0 -1 0 -2 2}, and target = 0.
A solution set is:
(-1, 0, 0, 1)
(-2, -1, 1, 2)
(-2, 0, 0, 2)
要用到哈希表的思路,這樣可以空間換時間,以增加空間複雜度的代價來降低時間複雜度。
首先建立一個字典dict,字典的key值為數組中每兩個元素的和,每個key對應的value為這兩個元素的下標組成的元組,元組不一定是唯一的。
如對於num=[1,2,3,2]來說,dict={3:[(0,1),(0,3)], 4:[(0... |
f3950046cfe202b151a03a544ccad49bbb8c16c3 | Zoxas/Test | /DataStructures/mergesort.py | 929 | 3.953125 | 4 | # -*- coding: utf-8 -*-
"""
需要用到遞迴的概念
"""
def mergesort(lst):
print "spilit",lst
if len(lst) > 1 :
mid = len(lst)//2
left = lst[:mid]
right = lst[mid:]
mergesort(left)#先遞迴左半邊
mergesort(right)#由小-->大-->小-->大(由結果去思考比較容易理解)
i=0
j=0
k... |
8d68ce68e2223b90639a018429537e546fa8403e | bankaboy/WebMiningLab | /LAB2 PAGE RANK 10.12.18/pgrank.py | 1,324 | 3.671875 | 4 | import numpy as np
# Function to calculate the PageRank
def calculate_PageRank(outlinks):
"""
A function that returns the PageRank of the various nodes
Parameters:
-----------
outlinks: (nxn) int matrix that contains the outlinks for each node
Returns:
--------
page_ranks: list, containing the PageRank fo... |
283227891c55fdfaad38e9b328015e86fa62c63e | sonukushwaha403/protectPdf | /pdfProtect.py | 403 | 3.5 | 4 | from PyPDF2 import pdfFileWriter, PdfFileReader
pdf_file_path="path of file"
pdf_file_path_encrypted="Path of encrypted file"
pdfwriter=PdfFileWriter()
pdf=PdfFileReader(pdf_file_path)
for page_num in range(pdf.numPages):
pdfwriter.addPage(pdf.getPage(page_num))
password="FOLLOW"
pdfwriter.encrypt(password)
with... |
5a72c1eafb853e83d3422bd6f36ea81b717ebd76 | psnavega/Games_in_py | /jogos.py | 521 | 3.953125 | 4 | import forca
import adivinhacao
print('*-'*10)
print('ESCOLHA O SEU GAME')
print('*-'*10)
choice = int(input("Digite o jogo que você quer jogar: [1] - Adivinha/ [2] - FORCA "))
def escolhe_jogo():
if choice == 1:
print("Jogando adivinhacao")
adivinhacao.jogar_adivinhacao()
elif choice == 2:
... |
23340f54a8f85e903d6451e6e2cec2ff95959b5a | roblivesinottawa/object_oriented_code_python | /code/Student.py | 471 | 4.03125 | 4 | class Student:
def __init__(self, fname, lname, age, grade):
self.fname = fname
self.lname = lname
self.age = age
self.grade = grade
def __str__(self):
return f"The student's name is {self.fname} {self.lname} and they are {self.age} years old. Their grade is {self.gr... |
8d11f4d36c8b73e4db33925b856c71e5959a5380 | roblivesinottawa/object_oriented_code_python | /code/Robot.py | 288 | 3.8125 | 4 | class Robot:
def __init__(self, name, build_year):
self.name = name
self.build_year = build_year
def __str__(self):
return f"The robot {self.name} was built in {self.build_year}"
x = Robot("Marvin", 1979)
y = Robot("Caliban", 1993)
print(x)
print(y)
|
129454dbddcc841706ea32e95593fb0efe7e2a83 | xiaoxinxin003/tf | /plotfigure.py | 489 | 3.84375 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed May 9 22:06:25 2018
练习使用matplotlib
@author: focus
"""
#引入matplotlib子包pyplot
import matplotlib.pyplot as plt
import numpy as np
#创建数据
x = np.linspace(-4, 4, 60)
#y = 3 * x + 4
y1 = 3 * x + 4
y2 = x ** 2
#创建第一个图像
plt.figure(num = 1, figsize=(5, 5))
plt.plot(x, y1)
plt.plot(x... |
ac54745f91d8bd65e2885ca5961bd80538813797 | ausbru87/python-playground | /umich-py3/sentiment_classifier/sentiment_classifier.py | 2,428 | 3.75 | 4 |
punctuation_chars = ["'", '"', ",", ".", "!", ":", ";", '#', '@']
# list of positive words to use
positive_words = []
with open("positive_words.txt") as pos_f:
for lin in pos_f:
if lin[0] != ';' and lin[0] != '\n':
positive_words.append(lin.strip())
# list of negative words to use
negative_wo... |
4691d96d17fb5468acfa070752ffe8373a0efa35 | Space2Move/python | /turtle_spirograph.py | 447 | 3.640625 | 4 | import turtle
painter = turtle.Turtle()
win = turtle.Screen()
painter.speed(0)
painter.pencolor("blue")
for i in range(50):
painter.forward(50)
painter.left(123) # Let's go counterclockwise this time
painter.pencolor("red")
for i in range(50):
painter.forward(100)
painter.left(123)
painter.penco... |
8e7b918b23cd9110a6fdd59ee2243593ab5dddf1 | GabrielVSMachado/42AI_Learning | /00/recipe/recipe.py | 2,359 | 3.96875 | 4 | cookbook = {
'sandwich': {
'ingredients': ['ham', 'bread', 'cheese', 'tomatoes'],
'meal': 'lunch',
'prep_time': 10
},
'cake': {
'ingredients': ['floor', 'sugar', 'eggs'],
'meal': 'dessert',
'prep_time': 60
},... |
036ea847c81f70ba73acbe712e784f53333c6943 | Botchie/PythonCodes | /hard.py | 120 | 3.953125 | 4 | A = ['A', 'B', 'C']
c = raw_input('Type letter to search: ')
print ('index of ' + c + ' is ' + str(A.index(c.upper())))
|
ab1076df2bac81033b2ae5e3c7e3e9f5ddd99ae7 | AwesomeCoder30/Python_Pratice | /Functions.py | 473 | 3.5 | 4 | def hello_function():
print("Hello Function")
hello_function()
def hello_function():
return "Hello Function return"
print(hello_function())
def hello_function2(value1):
return "Hello Function return " + value1
print(hello_function2("Parth"))
print(hello_function2("Neeraj"))
def hello_function2(value... |
c68fa2d32124f0c9ef7a25b15aa11428c6457e35 | AwesomeCoder30/Python_Pratice | /Strings.py | 803 | 4.28125 | 4 | #singleLine
message = "Hello World"
print(message)
#multiline
message ="""
Hello World
next line hello world
bye"""
print(message)
message = "Hello World"
#Length of string
print("Length of string:", len(message))
#print based on index
print(message[0])
print(message[10])
print(message[0:5])
print(message[:5])
pri... |
ff7458db00e032b7d9ee86260af3d91b8d5056ce | AwesomeCoder30/Python_Pratice | /Hot_Cold.py | 782 | 4 | 4 | import random
target = random.randint(1,100)
print(target)
Guess = 0
difference = 0
Predifference = 0
while Guess != target:
Guess = input("Enter a number between 1-100: ")
Guess = int(Guess)
difference = abs(Guess - target)
if Guess == target:
print("You won the game.")
break
if d... |
3b4f971df6bd17302f977405cae14f008b649f60 | JoseTarinT/PasswordManager | /PasswordGenerator.py | 1,771 | 4.15625 | 4 | import secrets
import string
# We ask the users how many characters they want in the password
lenght = "How many characters do you want in your password?: "
combinations = ["A: Just letters", "B: Just numbers/digits", "C: Numbers and letters", "D: Letters and special characters", "E: Numbers and special characters", ... |
9c1da0d90bd5dd67585197b30dd922624aae5600 | tarun2797/mentorapp | /onlineapp/threads_with_queue.py | 766 | 3.53125 | 4 | from queue import Queue
from threading import *
import requests
from requests import request
class my_Thread(Thread):
def __init__(self,name,queue):
Thread.__init__(self)
self.name = name
self.queue = queue
def run(self):
while True:
if queue.empty():
... |
c1a57a6ea2b0cf55b734d3fdeff047b7b402e391 | KoKoKotlin/RustQRCodeGenerator | /exponents_to_rust.py | 450 | 3.53125 | 4 |
with open("exponents.txt", "r") as f:
lookup1 = list()
lookup2 = list()
for line in f:
get_elems = lambda line: line.strip().split()
x, y, z, w = get_elems(line)
lookup1.append((x, y))
lookup2.append((z, w))
for l in [lookup1, lookup2]:
for i, elem in enum... |
389697b6398750b54537206be37a16eae322e16d | Pallavi2000/adobe-training | /day1/p4.py | 258 | 4.375 | 4 | #Program to find the count of digits in a number
number = int(input("Enter a number "))
temp = number
count = 0
while number != 0:
remainder = number % 10
number //= 10
count += 1
print("The count of digit of the given number",temp,"is",count) |
9bcfa4ce9f5c54bb8bb363c88772825db7fbea98 | Pallavi2000/adobe-training | /day2/p1.py | 442 | 4.15625 | 4 | #Program to find nth prime number
import os
number = int(input("Enter a number s"))
if number == 1:
print("The ",number,"th prime number is 2")
exit("Program Ends ..")
i = 3
count = 1
while count < number:
flag = True
for j in range(2, (i // 2) + 1):
if i % j == 0:
flag = False
... |
e1fa18dd11848b9e62322b48550350d1fe567e36 | chokkuu1998/chockalingam | /sfsfff.py | 138 | 3.96875 | 4 | import sys, string, math
a = input()
if a == 'Sunday' or a == 'Saturday' : print('yes')
else : print('no')
|
011a65e6363bd778ef2d7d0642798b3652e43365 | otaviocv/spin | /spin/utils.py | 2,400 | 3.5625 | 4 | """Utility functions to support other modules."""
import numpy as np
def check_distance_matrix(distances):
"""Perform all tests to check if the distance matrix is correct.
Check if the distances matrix provided respects all constraints a distance
matrix must have.
Parameters
----------
dist... |
448555f23f23599f366404121f69beba09f65a8c | total-blue/exceptionhw | /exc.py | 3,864 | 3.609375 | 4 | #1
while True:
units = list(input().split())
print(eval(units[0].join(units[1:])))
#2
units = input().split()
assert units[0] in '+-*/', 'Invalid string'
try:
if len(units) > 3:
raise IndexError
else:
print(eval(f'{units[1]}{units[0]}{units[2]}'))
except ZeroDivisionError:
print("do... |
eab085bd9e648d294b088c990659c220ad0c1baa | blacksea3/network | /cn-toptodown/UDPtest_C2P2_server.py | 1,340 | 3.53125 | 4 | """
SERVER
在这个编程作业中,你将用 Python 编写一个客户 ping 湿序 【 该客户将发送一个简单的 pmg 报文,接
收一个从服务器返间的对应 pong 报文,并确定从该客户发送 ping 报文到接收到 pong 报文为止的时延 。
该时延称为往返时延 (RTI) Q Fh该客户和服务器提供的功能类似于在现代操作系统中可用的标准 pLng 程
序 然而,标准的 ping 使用互联网控制报文协议 (IC!l1P) (我们将在第 4 ì言巾学习 ICMP) 。 此时我们将
创建一个非标准(但简单)的基于 UDP 的 ping 瞿序 。
你的 pi吨程序经 UDP 向日标服务然发送 10 个 ping 报文 。 对于... |
642012136e80bfc1b68f9283370e95962f6a36c1 | PlumpMath/poser2egg | /utils.py | 1,918 | 3.75 | 4 | # -*- coding: utf-8 -*-
import string
import math
STRF = lambda x: '%.6f' % x
# some code from chicken exporter
def egg_safe_same(s):
"""
Function that converts names into something suitable for the egg file format - simply puts " around names
that contain spaces and prunes bad characters,... |
8b8d039f9863db4b00c41c6003d824375f87829a | daanishrasheed/Data-Structures | /singly_linked_list/singly_linked_list.py | 1,908 | 3.8125 | 4 | class Node:
def __init__(self, value=None):
self.value = value
self.next = None
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
def __str__(self):
if self.head is None:
return('Empty list')
else:
curren... |
16699960fe7dbbd5b208dd5c63a2f8345b7c0c7d | joycecodes/problems | /DFS and BFS.py | 3,375 | 3.859375 | 4 | import collections
class Queue:
def __init__(self):
self.array = []
def enqueue(self, item):
self.array.insert(0, item)
def dequeue(self):
if self.array != []:
return self.array.pop()
def peek(self):
return self.array[-1].value
def size(self):
... |
4ad53c6f96ee66f4d04063486fe11498a147c879 | joycecodes/problems | /leetcode/238. Product of Array Except Self.py | 655 | 3.78125 | 4 | """
Given an array nums of n integers where n > 1,
return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].
"""
class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
left = [None] * len(nums)
left[0] = 1
right = [N... |
d743459404729857bd7af0293536ec649ece3a80 | joycecodes/problems | /factorial.py | 366 | 4.25 | 4 | # compute factorial of a number both recursively and iteratively
# iterative
num = 10
factorial = 1
for x in range(1, num + 1):
factorial = factorial * x
print(factorial)
# recursive
def factorial(value):
if value == 0:
return 1
elif value == 1:
return value
else:
return value... |
668d1e078f7b92d1cf9b0513d0e318e9a5e8a783 | joycecodes/problems | /leetcode/79. Word Search.py | 1,179 | 3.84375 | 4 | """
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally
or vertically neighboring. The same letter cell may not be used more than once.
"""
class Solution:
def exist(self, board: Lis... |
e05daec972f0d747c3a9daf9005424b754a2bbd8 | joycecodes/problems | /graph.py | 598 | 3.75 | 4 | import collections
graph ={"Panda": ["Towel", "Sand"],
"Sand": ["Case", "Bottle"],
"Case": ["Death", "Medicine"],
"Medicine": ["Shirt", "Doodle"]
}
start = "Panda"
end = "Doodle"
def path(graph, start, end):
q = collections.deque()
visited = set()
q.append([start, 0])
while len(q) > 0:
n,... |
6c91864046ac1f3af66464d0223f8debc0e565f1 | viggen-aero/PythonTraining | /LogManager/logMen.py | 3,677 | 4.25 | 4 | '''
Program:
- takes a valid email address and password or exit,
- allows to read the file "data.txt" and change a password,
- allows user to type a pattern word(s) that will be changed for some other word(s), also typed by user,
- saves the file "data.txt" and gives a choice to logout or make another word change.
'''
... |
0ecff3a4e64cc4394b938e51a5e5084a7403a9e8 | yohn-dezmon/algo_nd_data_struc | /chapter_4_psads/reverse_str.py | 351 | 4.125 | 4 | # write a recursive function that reverses a string
# base case ...
#
def reverse_Str(string):
# I used <= to account for if the person enters a blank space! :D
if len(string) <= 1:
return string
else:
return string[-1] + reverse_Str(string[:-1])
print(reverse_Str("TALK"))
# reverse_Str(... |
84f7faa9c63731e16fb75e02d529f7378ef54f63 | yohn-dezmon/algo_nd_data_struc | /chapter_5_psads/ex3.py | 2,567 | 4.21875 | 4 | # Implement the binary search using recursion without the slice operator.
# Recall that you will need to pass the list along with the starting and ending
# index values for the sublist. Generate a random, ordered list of integers and
# do a benchmark analysis
# RESULTS: yay! as predicted, the binary search without sli... |
61d350fe85a8e7320ef61c88f12ed24325c3509b | Matthew0425/Python-code | /esperantoCyrillic.py | 1,441 | 3.625 | 4 | import keyboard
#Diacritics are formed with ` key and latin key with the exception of ĵ which is formed with the q key
latin = ['b',
'c',
'd',
'f',
'g',
'h',
'i',
'k',
'l',
'm',
'n',
'p',
'r',
... |
14eb604e287db7e6ccc16852568cde84ef82d085 | CornellDataScience/PneumoniaDetection | /overlap.py | 885 | 3.625 | 4 | class Rectangle:
def __init__(self, min_x, max_x, min_y, max_y):
self.min_x = min_x
self.max_x = max_x
self.min_y = min_y
self.max_y = max_y
def is_intersect(self, other):
if self.min_x > other.max_x or self.max_x < other.min_x:
return False
if self.m... |
13a7afe549922ccb321df4902f2d59df5fa587aa | mairzy/class-work | /lettercount10.py | 759 | 3.71875 | 4 | import string
fname = input('Enter the file name: ')
try:
fhand = open(fname)
except:
print('File cannot be opened:', fname)
exit()
counts = 0
lettercounts = dict()
for line in fhand:
line = line.translate(str.maketrans('', '', string.punctuation))
line = line.translate(str.maketrans('', '', stri... |
a287722d245adfb1467572bfceaaf70e42c74c09 | Vitor178/titulos_de_noticias | /main.py | 1,245 | 3.53125 | 4 | """
Arquivo responsável por realizar a interação com o usuário
"""
import parserHTML
import actions
def main():
# Escolhe a ação a se fazer sobre as notícias
while True:
print('\nEscolha a ação desejada:')
for acao in actions.available_actions.keys():
print('Para %s digite %s' % ... |
9b36cb3095a030b2ced03d48c76589b10d922f4b | almcd23/python-textbook | /ex3.py | 668 | 4.4375 | 4 | #print statement
print "I will now count my chickens:"
#adds up hens and roosters
print "Hens", 25 + 30 / 6.0
print "Roosters", 100 - 25 * 3 % 4.0
#statement of counting eggs
print "Now I will count the eggs:"
#adding up the eggs
print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6.0
#posing a question
print 'Is it true that 3 + 2 ... |
67c7c2337bad893bd2ee4a03a364a2b9e4cf471e | AugPro/Daily-Coding-Problem | /Stripe/e004_missing_int.py | 652 | 3.984375 | 4 | """This problem was asked by Stripe.
Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well.
For example, the input [3, 4, -1... |
ebc683a476b21fee9dddc6b782b93079e22e1b25 | SleezusJ/neuralOCR | /src/classExample.py | 5,216 | 3.859375 | 4 | trainingset = [ [[0,0],0], [[0,1],1], [[1,0],1], [[1,1],0] ]
# net = Perceptron(2)
# net.train([0,1], 1] #input array and desired output
# net.predict([0,1]) #gives me an output
# net.trainUntilPerfect(trainingset) #learn everything in that trainingset
NOISEMAGNITUDE = 0.4 #used for initial weights will... |
441e91d3f937ace9e979c917b56a00298e2ca5dc | zongjie233/liaoxuefengPython3 | /错误,调试,测试/mydict_test.py | 2,231 | 3.84375 | 4 | # 为了编写单元测试,我们需要引入Python自带的unittest模块
import unittest
from mydict import Dict
class TestDict(unittest.TestCase):
def test_init(self):
d = Dict(a = 1, b = 'test')
self.assertEqual(d.a, 1)
self.assertEqual(d.b, 'test')
self.assertTrue(isinstance(d, dict))
def test_key(self):
... |
477d23083f490d2d118746c71d08c641dd64457d | zongjie233/liaoxuefengPython3 | /面向对象高级编程/hello.py | 224 | 3.953125 | 4 | #动态语言和静态语言最大的不同,就是函数和类的定义,不是编译时定义,而是动态创建的
class Hello():
def hello(self, name = 'world'):
print(f'Hello {name}')
print(type(Hello)) |
8e18836b0be0f317a45a4603cf0ca61f26bae1dd | zongjie233/liaoxuefengPython3 | /函数式编程/匿名函数.py | 684 | 4.125 | 4 | #lambda表示匿名函数。只能有一个表达式,不用写return,返回值便是该表达式的结果
#eg
print(list(map(lambda x: x * x, [1, 2, 3, 4, 5, 6, 7, 8])))
'''
这里的lambda实际上就是
def f(x):
return x * x
匿名函数也是一个函数对象,可以吧函数赋值给一个变量,利用变量调用函数
'''
# eg
f = lambda x: x + x
print(f(5))
#同样可以吧匿名函数作为返回值返回
def build(x, y):
return lambda: x + x - y + y
# ex 请用匿名函数改造... |
d2450e4fdd7972d65c6791c9f38ab78398ec9f69 | zongjie233/liaoxuefengPython3 | /高级特性/切片操作.py | 376 | 4.15625 | 4 | # 利用切片操作,实现一个trim()函数,去除字符串首尾的空格,注意不要调用str的strip()方法:
def trim(s):
if s[0] == " ":
return s[1:]
elif s[-1] == " ":
return s[:-1]
else:
return s
print(s)
print(trim(' hello'))
#字符串为不可变对象
s = ' hello world'
print(s.split(" "))
print(s)
|
fe43ac09dcac32264cb2c2c3c05f79f34bae1a2d | zongjie233/liaoxuefengPython3 | /面向对象编程/面向对象编程.py | 1,544 | 4.46875 | 4 | # 面向对象编程——Object Oriented Programming,简称OOP,是一种程序设计思想。
# 在Python中,所有数据类型都可以视为对象,当然也可以自定义对象。自定义的对象数据类型就是面向对象中的类(Class)的概念。
#为了表示学生的成绩,面向过程的程序可以用一个dict表示
std1 = {'name':'hs','score':100}
std1 = {'name':'zyy','score':90}
#处理学生成绩可以通过函数实现,比如打印学生的成绩
def print_score(std):
print(f"{std['name']} {std['score']}")
'''
面向对象... |
88c72213b8075d027c9a3b3e5b70722a559cd699 | Frankkie/Thesis-Project-IF-Game | /dialog_events.py | 4,028 | 3.765625 | 4 | """
This file includes the DialogEvent class. DialogEvents are events that are triggered specifically by
Topics.
Classes:
DialogEvent(Event)
"""
import random
from events import Event
class DialogEvent(Event):
"""
DialogEvents are events that are triggered specifically by Topics. They can also have e... |
1c2804a4edf66020a0099b54baa3d564e4d3d064 | Frankkie/Thesis-Project-IF-Game | /space_things.py | 3,020 | 3.546875 | 4 | from things import Thing
class SolarSystem(Thing):
def __init__(self, *args, name_seed, star_names, star_types,
habitable, num_planets, distance, num_stars, **kwargs):
"""
"""
super().__init__(*args, **kwargs)
self.num_planets = num_planets
self.num_stars ... |
2fc02e00be0df6939e45d3ee3e1d39437ad2b97a | Frankkie/Thesis-Project-IF-Game | /conditions.py | 2,420 | 3.875 | 4 | from numbers import Number
from game_queries import GameQuery
class Condition:
"""
Conditions are essentially object - value pairs that are to be evaluated either as true or false.
"""
def __init__(self, key, attribute_path, values, not_=False):
"""
:param key: String, the key of the ... |
84cf30eb728df43283bc4b7df0fc6009fb442f27 | joshschusterman/cs50problemsets | /dna.py | 2,454 | 3.78125 | 4 | import csv
import sys
# Check to see if all necesary arguments are typed into command line.
if len(sys.argv) != 3:
print("Usage: python3 dna.py database/size sequences/#.txt")
sys.exit() # FYI 'break' can't be used in an if statement, only loops.
# Open the databse file, add each row to a dictionary.
with ope... |
23dffd365fc5870ce9dfcb457ad540a3349c5e54 | ieesejin/algorithm_study | /SWEA/쥬스 나누기.py | 424 | 3.609375 | 4 | # https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AWXGAylqcdYDFAUo&categoryId=AWXGAylqcdYDFAUo&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=PYTHON&select-1=3&pageSize=10&pageIndex=9
T = int(input())
for test_case in range(T):
N = int(input(... |
f45e2f083afc388fbbd470211bd07c465b1ed2f5 | ieesejin/algorithm_study | /programmers/신규 아이디 추천.py | 1,236 | 3.75 | 4 | # https://programmers.co.kr/learn/courses/30/lessons/72410
def solution(new_id):
answer = ''
# 1단계
new_id = new_id.lower()
# 2단계
for i in new_id:
# if c.isalpha() or c.isdigit() or c in ['-', '_', '.']:
if 'a' <= i <= 'z' or '0' <= i <= '9' or i == '-' or i == '_' or i == '.':
... |
e980620e326b891e9f39f793c8ffe21a63f287d9 | ieesejin/algorithm_study | /programmers/셔틀버스.py | 1,333 | 3.578125 | 4 | # https://programmers.co.kr/learn/courses/30/lessons/17678
def time2min(time):
h, m = time.split(":")
return int(h) * 60 + int(m)
def min2time(min):
div, mod = divmod(min, 60)
return "%02d:%02d" % (div, mod)
def shuttleTime(n, t, start="09:00"):
shuttle = [time2min(start)]
for i in range(n... |
bc2b4d2fc97b575f5d2ab8173bfa87c99ca530fe | ieesejin/algorithm_study | /programmers/캐시.py | 900 | 3.546875 | 4 | # https://programmers.co.kr/learn/courses/30/lessons/17680
def solution(cacheSize, cities):
answer = 0
cache = []
if cacheSize == 0: # 캐시가 0 일때
return len(cities) * 5
for city in cities:
city = city.lower() # 대소문자 구분 안함
if city in cache: # city 가 캐시에 있을 때
cache.rem... |
1ec17dbb7e82b4d0a1cad6681a199890daeafa12 | ieesejin/algorithm_study | /Baekjoon/Divide and conquer/색종이 만들기.py | 983 | 3.609375 | 4 | # https://www.acmicpc.net/problem/2630
def check(b):
res = 0
for row in b:
for i in range(len(b)):
if row[i] == 1:
res += 1
if res == len(b)**2 or res == 0:
return True
return False
def divide(b, n):
global one
global zero
if n == 1 or check... |
c72068241478a2c69898d88a8901aaeb9a786bd5 | khuonghieu/PA2-CIS4526 | /.ipynb_checkpoints/pa2_template-checkpoint.py | 1,910 | 3.953125 | 4 | '''
In PA 2, you might finish the assignment with only built-in types of Python 3.
However, one may choose to use higher level libraries such as numpy and scipy.
Add your code below the TO-DO statement and include necessary import statements.
'''
import sys
import csv
def main():
'''
Get the first comman... |
301e0ecb5a13052fe2b77e2aaeaf9baacc01767e | aprilyichenwang/auction_projects | /AucSim.py | 3,351 | 3.53125 | 4 | import numpy as np
import matplotlib.pyplot as plt
def price_1st_BF_uniform0_1(N):
V = np.random.uniform(0, 1, N) # V is an array
B_1= V- V/N
Revenue_1 = max(B_1)
return np.mean(V),np.mean(B_1), Revenue_1
def price_2nd_BF_uniform0_1(N):
V = np.random.uniform(0, 1, N) # V is an array
B_2= V... |
8d49ca7d2c38f21e1e6be8b64b3688cc0742abb3 | dkuzmyk/Machine-Learning-testing | /Machine Learning Lab_1.py | 21,348 | 3.984375 | 4 | import numpy as np
#import matplotlib.pyplot as plt
np.random.seed(1)
#Problem 1
# Problem 1.1
def my_euclidean_dist(X_test, X_train):
"""
Compute the distance between each test example and each training example.
Input:
- X_test: A numpy array of shape (num_test, dim_feat) containing test data
- X... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.