blob_id stringlengths 40 40 | repo_name stringlengths 5 119 | path stringlengths 2 424 | length_bytes int64 36 888k | score float64 3.5 5.22 | int_score int64 4 5 | text stringlengths 27 888k |
|---|---|---|---|---|---|---|
152821db50499e66c2e0db9b5ecdd0b69e3ae2df | SarahJaine/Python_Exercises | /HMC_Playtime/Lesson02_99bottles_v2.py | 628 | 3.921875 | 4 | beer_first=99
beer_second=beer_first-1
beer_store=beer_first
def plural(x):
if x==1:
return ""
else:
return "s"
while beer_second>-2:
if beer_second>-1:
print """{0} bottle{2} of beer on the wall, {0} bottle{2} of beer!
Take one down, pass it around, {1} bottle{3} of beer on the wall!""".format(beer_first,... |
89aaf42d7885675b5e0e75d9ec12594bd8bd6fd1 | nishitpatel01/Data-Science-Toolbox | /algorithm/BinarySearch/69_sqrtx.py | 485 | 3.609375 | 4 | class Solution(object):
def mySqrt(self, x):
"""
:type x: int
:rtype: int
"""
l, r = 0, x
while l <= r:
m = (l + r) // 2
if m ** 2 <= x:
l = m + 1
ans = m
else:
r = m - 1
retu... |
2f9b57e6e96ab437cf1d23172d2e4e4f8baed739 | Grazifelix/Python3-World-One | /ex008.py | 319 | 3.890625 | 4 | # Metro para centrimetro e milimetro
# 18/02/21
# OK
m = float(input("Insira um valor em metros:")) # float é numero de ponto flutuante, em outras palavras um numero real como casas decimais depois do ponto.
cm = m*100
mm = m*1000
print("O valor {} em centimetros é {}, e em milímetros é {}.".format(m, cm, mm))
|
41fb6959e1a0fb5c4b5469ac87f8745db978d569 | Hildayutami/tentara | /tugas3.py | 5,338 | 3.703125 | 4 | class dataOperasi:
def __init__(self, operasi, sulit):
self.operasi = operasi
self.sulit = sulit
def __str__(self):
return ("operasi "+self.operasi+self.sulit)
class dataTentara:
def __init__(self, nama, umur, kekuatan):
self.nama = nama
self.umur... |
f28d28c592daad25aba51a0168ffa4e9152d4495 | Nikunj-Gupta/Python | /palindrome.py | 119 | 3.8125 | 4 | n = input("Enter the number: ")
a = list('n')
b = a.reverse()
if(b.join(a) == n):
print True
else:
print False
|
f4fea9bc48959b2897a8e340c0319b51dc1b6adc | stuycs-softdev/submissions | /7/01-python/yu_rong/practice.py | 1,100 | 3.75 | 4 | def array123(nums):
i = 2
while i < len(nums):
if nums[i]==3 and nums[i-1]==2 and nums[i-2]==1:
return True
i+=1
return False
def array_front9(nums):
i = 0
while i<len(nums) and i < 4:
if nums[i] == 9:
return True
i+=1
return False
def array_count9(nums):
i = 0
occur = 0
... |
62a07f350ad0ccb8fa610d599bf89466fe6e2fd7 | ViejoSantii/CNYT | /pruebas.py | 5,685 | 3.609375 | 4 | import unittest
from calculadora import *
class TestCases (unittest.TestCase):
"""--------------------Pruebas numeros complejos--------------------"""
def test_adicion (self):
result = adicion ((2, 5), (3, 3))
self.assertEqual (result, (5, 8))
def test_producto (self):
... |
8047fb5202fbe8cddbb8eb7a90f38e4ee7306b49 | sl2631/rwet | /hw3/hw3.py | 1,169 | 3.78125 | 4 | #!/usr/bin/env python
from __future__ import print_function
import nltk
import nltk.tokenize
import random
import sys
from pprint import pprint
text_path = 'kipling.txt'
text = open(text_path).read()
# both flat and nested will hold the entire poem
lines = [] # accumulate each line
for para in text.split('\n\n'):
... |
d1c20d7c78db56559c2f6f9664ddd4c2d68f81af | PablOCVi/Mastery | /Mastery18.py | 463 | 3.921875 | 4 | print("Si el numero ingresado es par y mayor a 10, lo mltiplicare por 4")
x=int(input("Ingresa un numero par: "))
while (x%2!=0)or(x<10):
if x%2!=0:
print("El numero"+" "+str(x)+" "+"es par")
if x<10:
print("El numero"+" "+str(x)+" "+"es menor a 10")
x=int(input("Ingresa un numero par mayor a 10: "))
print("El n... |
bca634c94179e812c79840248875061b50a140d0 | waddlefluf/advent-of-code-2020 | /02/day2.py | 814 | 3.5625 | 4 | lines = open("input.txt", "r").readlines()
def part1(passwords):
valid = 0
for line in passwords:
password = line.split(" ")[-1]
letter = line.split(":", 1)[0].split(" ")[1]
min = int(line.split(" ")[0].split("-")[0])
max = int(line.split(" ")[0].split("-")[1])
if min ... |
45564c401bfca8273afaf98e33a8c3db72f3b8b1 | Afanasieva-m/infa_2019_afanasieva | /picture_16_2.py | 5,307 | 3.8125 | 4 | import math
from graph import *
def ellipse(x0, y0, a, b): #возвращает массив точек для построения эллипса
lst = []
fii = 0.01
c = (a*a-b*b)**(1/2)
exc = c/a
point(x0+a, y0)
while fii <= 360:
ro = (a - exc*c)/(1+exc*math.cos(fii))
x = math.floor(x0 + c + ro*math.cos(f... |
d491f1431caf3eb5973dce9f0c874662fa67541a | AirVan21/Python | /Stepik/Basics/ending.py | 294 | 3.765625 | 4 | #! /usr/bin/env python3
body = 'программист'
number = int(input())
if 10 < (number % 100) < 20:
print(number, body + 'ов')
elif number % 10 == 1:
print(number, body)
elif (number % 10) in set([2, 3, 4]):
print(number, body + 'а')
else:
print(number, body + 'ов') |
97e87e9eb726b2a2fb1915e76710b8ad6a4ebe08 | nehageorge/Clueless-Recreated | /Display/slideshow.py | 3,598 | 3.765625 | 4 | ''' Adapted from vegaseat's Tkinter slideshow (published 03dec2013)
'''
from itertools import cycle
from PIL import Image, ImageTk
#import PIL.Image
#from PIL import ImageTk
try:
# Python2
import Tkinter as tk
except ImportError:
# Python3
import tkinter as tk
#from tkinter import *
class App(tk.Tk):
... |
ac7bd89ba9b2a77895980e46880710d0b5f3744a | bencastan/udemy-Python_Bible | /pig_latin.py | 880 | 4.1875 | 4 | # Ask user for sentence
original = input("Enter a sentence to convert to Pig Latin:").strip().lower()
# Split sentence into words
words = original.split()
# Loop through words and convert to pig latin
new_words = []
vowels = "aeiou"
for word in words:
# If it starts with a vowel, just add yay
if word[0] in vow... |
aaf77cdd1892df2529257e8c2e7029267b9d08d4 | littlea1/IS211_Assignment9 | /football_stats.py | 4,404 | 3.734375 | 4 | from bs4 import BeautifulSoup
import urllib2
__author__ = 'Patrick Abejar'
'''This function will find the column number of a given header title with the
left most column being represented as 0 incremeted by 1 in the rightward dir-
ection. It does this by searching for the given header title for all the
string conten... |
b59611c0286f8142a97e424202ef5f3290745d1c | prathamkaveriappa/PythonAssignments | /gettingstarted.py | 108 | 3.71875 | 4 | start=1
end=10
while(start<=end):
print(start)
start+=1
for i in range(20,10,-1):
print(i) |
8d9752224aae2030f96912235bf83a691ed881cb | JoachimFavre/RegexRightToLeft | /main.py | 7,483 | 4.4375 | 4 | # -*- coding: utf-8 -*-
r"""
Inverses a regex expression in order to have it working for a reversed string.
Use deep_reverse(regex) to reverse a regular expression and
find_last(regex, string) to have an example of a use for reversed expressions.
Do not hesitate to use r-strings (with a r before the ": such as r... |
9d7a993407d296c0400727a0220bdae124841415 | SaiSudhaV/coding_platforms | /permutation_sequence.py | 467 | 3.59375 | 4 | from math import factorial as fact
class Solution:
# @param A : integer
# @param B : integer
# @return a strings
def getPermutation(self, A, B):
tem, res = [i for i in range(1, A + 1)], ""
while tem:
n = len(tem)
i = B // fact(n - 1)
if (B % fact(n - ... |
d8c99557a1844dbefe2c447b081f58470da92f3f | MidAutumn10100101/leetcode_everyday | /6-27-剑指12-矩阵中的路径/exist.py | 1,208 | 3.5625 | 4 |
#将矩阵视为图,则找矩阵中的路径就是深度搜索。先将第一个字符所在位置全存储起来,后依次从第一个字符处深度搜索
class Solution:
def exist(self, board, word: str) -> bool:
def dfs(i, j, k):
if not 0<=i<len(board) or not 0<=j<len(board[0]) or board[i][j]!=word[k]:
return False
if k == len(word)-1:
return Tru... |
45dd16d1d3df5d7a0f001a3ef95ccf97d27f0f5d | seanlobo/fb-msg-mining | /functions/customdate.py | 8,445 | 3.609375 | 4 | from math import ceil
from datetime import date, timedelta
import re
class CustomDate():
MONTHS_TO_INDEXES = {'January': 1, 'February': 2, 'March': 3, 'April': 4, 'May': 5, 'June': 6, 'July': 7,
'August': 8, 'September': 9, 'October': 10, 'November': 11, 'December': 12,}
MONTH_INDEXES_TO_MONTHS... |
1ec3e0ddd918dda4328ffb281993459adeda9bc8 | sunzid02/fun-with-python | /basic/index.py | 648 | 3.671875 | 4 | # print('hi')
# x = 2
# print(x)
# x = x + 2
# print(x)
# Using conditional statement
# x = 2
# if x < 5:
# print('smaller')
# else:
# print('bigger')
# # While loop
# # i = 10
# # while( i > 0):
# # print(i)
# # i = i-1
# # print('Boom')
# # array
# a = [ 10, 20 ]
# i = 0
# while( i < len(... |
28096afdfb80b6f722b1c6caf74d72884b9d6f99 | beccacauthorn/cs-module-project-hash-tables | /applications/word_count/word_count.py | 695 | 3.96875 | 4 |
def word_count(x):
wordFreq = {}
lower = x.lower()
bad_chars = ['"', ":", ";", ",", ".", "-", "+", "=", "/", "\\", "|", "[", ']', '{', '}', '(', ')', '*', '^', '&']
for i in bad_chars:
lower = lower.replace(i, '')
list_words = lower.split()
for word in list_words:
if word not ... |
2539bab3a48cdcad79af31f0bb1a90f9deb84966 | Shtvaliev/ICT-HSE-Project | /programm-of-data-analysis-master/Project/Work/Scripts/bar_flights.py | 3,906 | 3.546875 | 4 | # данный скрипт выводит зависимость
# количества рейсов в каждом городе от дня или месяца вылета
import csv
import matplotlib.pyplot as plt
from main import FLIGHTS
from data_import import graphs
def plotting(file, title, width, height, sizee):
fig, ax = plt.subplots(1, 1)
x = file.keys()
y = file.values... |
6665f7fa1a6339ac0a722f27272fef6befa13c4a | VGasparini/ICPC | /2017.1 Local/C.py | 389 | 3.875 | 4 | for i in range(int(input())):
conjunto = list(map(int,input().split()))
print("Conjunto: {} {} {}".format(conjunto[0],conjunto[1],conjunto[2]))
for j in range(conjunto[2]):
if (conjunto[0] > conjunto[1]):
conjunto[0] = int(conjunto[0]/2)
else:
conjunto[1] = int(conjunto[1]/2)
del conjunto[2]
con... |
a8e770c0dc5dffb095697d3fb5173b217b1eda2e | PirieD704/pygame_first | /hero.py | 1,583 | 3.921875 | 4 | import pygame#duh
class Hero(object):
def __init__(self, screen):
self.screen = screen # give the hero the ability to control the screen
# Load the hero image, get it's rect
self.image = pygame.image.load('ball.gif')
self.rect = self.image.get_rect() #pygame makes give us get_rect on any object so we can get... |
197014528de4c35e7a550bef53592db68a1e567a | amanlalwani007/important-python-scripts | /counting sort.py | 618 | 3.890625 | 4 | #counting sort is based upon hashing and in this element are not compare with each other
def countingsort(arr):
max1=0
for i in arr:
if i>max1:
max1=i
b=[0 for i in range(max1+1)]
for i in arr:
b[i]=b[i]+1
for i in range(1,len(b)):
b[i]=b[i]+b[i-1]
c=["" for i... |
6869d350507603e55f4f2a3963a4ce81514473bb | AlexandruCabac/Rezolvarea-pr.-IF-FOR-WHILE | /Prob2.py | 93 | 3.53125 | 4 | import math
n=int(input())
s=0
for i in range(1,n+1):
s=math.factorial(i)+s
print(s) |
d3db22252d78bc2c56878abe4b3488577c7333a3 | thinkphp/seeds.py | /monte_carlo_pi.py | 370 | 3.90625 | 4 | '''
Monte Carlo simulation to approximate PI.
'''
import math
import random
def PI(repeats = 10**5):
count = 0
for _ in range( repeats ):
x, y = random.random(), random.random()
if((x**2 + y**2) <= 1):
count+=1
return float (4 * count) / repeats
print '... |
709d1e0379ebea730c22d604a31320ab5e580829 | milkacaduke/Interview | /search/binarysearch.py | 484 | 3.984375 | 4 | def binarySearch(array, left, right, x):
while right >= left:
mid = left + (right - left) // 2;
if array[mid] == x: # found it
return mid
elif x < array[mid]: # <-
right = mid - 1
elif x > array[mid]:
left = mid + 1
return False
# main
array = [4,35,2,6,3,66,45,8,1,34,78,43,23,22]
array.sort... |
999dc52647c588857b3046a6b0009568ec1ee5a7 | KatsuPatrick/advent2019 | /day20/Part1.py | 4,988 | 3.59375 | 4 | import math;
import re;
import random;
def adjacentTraversablePoints(point):
global traversableSet;
returnVar = []
if (point[0] + 1, point[1]) in traversableSet:
returnVar.append((point[0] + 1, point[1]));
if (point[0] - 1, point[1]) in traversableSet:
returnVar.append((point[0] - 1, po... |
cebe84bd2f08c4c1e807d9f60f69df1e6e76c949 | Wedyarit/SchoolBot | /utils/Dates.py | 423 | 3.5625 | 4 | import datetime
def weekday(day):
return {0:"Понедельник", 1:"Вторник", 2:"Среда", 3:"Четверг", 4:"Пятница", 5:"Суббота", 6:"Воскресенье"}.get(day, "Invalid month")
def today():
return datetime.date.today()
def tomorrow():
return datetime.date.today() + datetime.timedelta(days=1)
def after_tomorrow():
return da... |
95608818d523c940376117b0a7bb6096edd0cecc | michellexyeo/DailyProgrammer | /Dynamic/coin_change.py | 560 | 3.59375 | 4 | # Hackerrank coin change problem: https://www.hackerrank.com/challenges/coin-change
# Enter your code here. Read input from STDIN. Print output to STDOUT
# using this: http://www.ideserve.co.in/learn/coin-change-problem-number-of-ways-to-make-change
n, m = map(int, raw_input().strip().split())
coins = map(int, raw_inpu... |
f59ead3a084224a33a6e8bb427fc4d5179c9f0ce | eren-memet/Python-Starter- | /type-conversion.py | 636 | 4.0625 | 4 | """
x = input ('1.sayı ')
y = input ('2.sayı ')
print(type(x))
print(type(y))
toplam = int(x) + int (y)
print(toplam) """
x = 5 #int
y = 2.5 #float
name = 'Çınar' #str
isOnline = True #bool
# print(type (x))
# print(type (y))
# print(type (... |
ee864436866bba25781063c4f9294fba9999748b | chyt123/cosmos | /coding_everyday/lc500+/lc820/ShortEncodingofWords.py | 581 | 3.640625 | 4 | from typing import List
class Solution:
def minimumLengthEncoding(self, words: List[str]) -> int:
new_words = sorted([i[::-1] for i in words], reverse=True)
l = len(new_words)
s = '#' + new_words[0]
for i in range(1, l):
if not new_words[i-1].startswith(new_words[i]):
... |
3c639bf5bd4c671a7174b9c60abac8c2ff82d241 | luisemaldonadoa/ejemplos | /listbox.py | 507 | 3.640625 | 4 | from Tkinter import *
def agregar():
lista1.insert(END,"ENTRADA")
#lista1.insert(END,)
def remover():
lista1.delete(0,END)
ventana=Tk()
ventana.title("listbox")
ventana.geometry("700x400+10+10")
lista1=Listbox(ventana)
lista1.insert(1,"Python")
lista1.insert(2,"PHp")
lista1.insert(3,"java")
lista1.insert(4,"c++")
li... |
e1248bf30ed6e8915d3ed802566b36a1b5364063 | curatorcorpus/FirstProgramming | /Python/input files.py | 370 | 3.75 | 4 | # count how many a there are in a txt document
def count_a(document, strng):
reading = document.read()
count = 0
for char in reading:
if char == strng:
count += 1
return count
import os
os.chdir('C:\Users\Jung Woo Park\Desktop')
document = open("document.txt")
strng = "a... |
ec7106faff2677d421fe8b417fc54fc3171cd5ec | aclissold/CodeEval | /problem004/solution.py | 764 | 4.03125 | 4 | #!/usr/bin/env python3
"""Problem 4: Sum of Primes
Challenge Description:
Write a program to determine the sum of the first 1000 prime numbers.
Input sample:
None
Output sample:
Your program should print the sum on stdout.i.e.
3682913
"""
def main():
"""Prints the sum of the first 1000 prime numbers."""
... |
69bdba133a00266ace3d21661cfc462f0751a003 | jig4l1nd0/PythonFirsts | /ex36.py | 2,712 | 4.0625 | 4 | # - - coding: utf- 8 - -
#### Key words in python ####
### None
def improper_return_function(a):
if a % 2 == 0:
return True
x = improper_return_function(3)
print x
### and, or, not
print True and False
print True or False
print not False
### as
import math as myAlias
print myAlias.cos(myAlias.pi)
### ... |
2137fc037c3e02b35b039548f27740b1893fe79f | HelenDeunerFerreira/exercicios_para_praticar | /1.py | 1,750 | 3.84375 | 4 | # Crie uma função que recebe uma lista de números e
# a. retorne o maior elemento
# b. retorne a soma dos elementos
# c. retorne o número de ocorrências do primeiro elemento da lista
# d. retorne a média dos elementos
# e. retorne a soma dos elementos com valor negativo
def listaNumeros():
n1 = int(input('Primeiro... |
f7e595d619ca3e0482c01f4f14e8fe63cc3fe5f4 | ikekou/python-exercise-100-book | /78.py | 124 | 3.5 | 4 | d = {'b':222,'a':111,'d':444,'c':333}
key_to_get_min_value = min(d.keys(), key= lambda k: d[k])
print(key_to_get_min_value) |
93e1df28b83f8e84eb9908981796c26e5b7473c5 | kepich/Swarm | /Bug.py | 4,924 | 3.625 | 4 | from math import sqrt
import pygame
import random
from Display import Display
class Bug(pygame.sprite.Sprite):
SIZE = 5
MOVEMENT_SPEED = 2
HEAR_RANGE = 50
FOOD_TARGET = 1
QUEEN_TARGET = -1
def __init__(self, x, y, speed_offset):
pygame.sprite.Sprite.__init__(self)
# self.my... |
bef8b3230ae6aaa8ccd7d558a902ac91c6457ab8 | clivejan/python_basic | /data_type/birthdays.py | 414 | 4.21875 | 4 | birthdays = {'Clive': 'Aug 12', 'Carrie': 'Jul 13', 'Tzuyu': 'Jun 14'}
while True:
name = input('Enter a name (blank to exit): ')
if name == '':
break
if name in birthdays:
print(f"{birthdays[name]} is the birthday of {name}.")
else:
print(f'I do not have birthday information for {name}.')
bday = input(f'... |
a60d1a4dcab1116cbf67c7017e5b3d2864027260 | burkharz9279/cti110 | /M2HW2_Tip Tax and Total_Burkhardt.py | 335 | 4.03125 | 4 | #CTI 110
#M2HW2 - Tip, Tax, and Total
#Zachary Burkhardt
#9/10/17
print("Input your meal cost to find your tip, tax, and total")
meal_cost = float(input("Meal cost: "))
tip = meal_cost * 0.18
print("Tip is", tip)
tax = meal_cost * 0.07
print("Tax is", tax)
total_cost = meal_cost + tip + tax
print("Your tot... |
6353c1cfff07ad2ab843f12752c25019ab615aa9 | muhtarkasimov/PythonBot | /MyTime.py | 2,697 | 3.984375 | 4 | import time
from _datetime import datetime
import time
class Time:
def __init__(self):
self.current_time = datetime.now()
# format dd.mm.yyyy hh:mm:ss
self.current_time_string = datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S")
self.current_date = self.current_time_string[:10... |
e75b4e0671e49037b728cef644c1e0383e0946de | rahuldesai02/LeetCode-Solutions | /py/118.PascalTriangle.py | 553 | 3.71875 | 4 | '''
Question
Given an integer numRows, return the first numRows of Pascal's triangle.
Input: numRows = 5
Output: [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]
'''
class Solution:
def generate(self, numRows: int) -> List[List[int]]:
ll = [[]]
tmp = []
for i in range(numRows):
... |
3776283dbb9b380eb7b4b1b4b124bac8839a4b20 | ricardo64/Over-100-Exercises-Python-and-Algorithms | /src/further_examples/trees_graphs/binary_tree.py | 15,992 | 4.125 | 4 | #!/usr/bin/python3
# mari von steinkirch 2013
# http://astro.sunysb.edu/steinkirch
''' Implementation of a binary tree and its properties. For example, the following bt:
1 ---> level 0
2 3 ---> level 1
... |
cb57484eeef35b091ff32342b4600c992f390e96 | tillderoquefeuil-42-ai/bootcamp-ml | /day01/ex05/fit.py | 1,782 | 3.765625 | 4 | import numpy as np
def fit_(x, y, theta, alpha, max_iter):
"""
Description:
Fits the model to the training dataset contained in x and y.
Args:
x: has to be a numpy.ndarray, a vector of dimension m * 1: (number of training examples, 1).
y: has to be a numpy.ndarray, a vector of dime... |
db56c96d54eb9271ef43798a367fb3de51661cb2 | Petuxpetuxov/GeekBrains | /Homework(Algorithms)/task_3.py | 621 | 4.1875 | 4 | """
По введенным пользователем координатам двух точек вывести уравнение прямой вида
y = kx + b, проходящей через эти точки.
"""
print("Введите координаты 1 точки (x1; x2) :")
x1 = float(input("x1 = "))
y1 = float(input("y1 = "))
print("Введите координаты 2 точки (x2, y2) :")
x2 = float(input("x2 = "))
y2 = float(input... |
8bd5ad3343910560aef1e0a9ca30fb5e23aa79a7 | foolOnTheHill/ml | /scripts/part2/mlp_data_proccessing.py | 3,586 | 3.625 | 4 | import random
random.seed(58)
def normalize(X, Y, num_classes=0):
""" Pre-processes the data that will be used to train the network creating bit lists for the classes. """
for i in range(len(X)):
c = [0 for k in range(num_classes)]
c[Y[i][0]] = 1
Y[i] = c
return (X, Y)
def getCla... |
3461a2f5fffa58b8afd2a43a1093da34f62319d7 | SWEETCANDY1008/algorithm_python | /ch02/quicksort.py | 548 | 3.71875 | 4 | S = [9, 8, 7, 6, 5, 4, 3, 2, 1]
def quicksort(low, high):
if high > low:
pivotpoint = partition(low, high)
quicksort(low, pivotpoint)
quicksort(pivotpoint+1, high)
def partition(low, high):
pivotitem = S[low]
j = low
for i in range(low+1, high):
if S[i] < pivotitem:
... |
52d0e619f91554a302e2d59da6ce4073018c6ae3 | insidescoop/sandbox-repo | /carter/sand.py | 364 | 4.3125 | 4 | print ('ben is a ugly boy')
print ('ben is not loved')
x=23*12356789
print (x)
# This is an example of a string data type
x="5*5*5*5*5*5*5*5*58"
print (x)
# Get a value from user and display it
name=input("Name of company: ")
print (name)
#example of conditional statement
z=25
if z>1:
print ("buy")
elif z==25:
... |
18bb0bcc5b310ec85e8aed6a75ac5a89775d52bc | kresged/pytut | /03/lesson_03_loops.py | 6,325 | 4.65625 | 5 | #
# Lesson 03: Loops
#
# I'm going to define a little helper function that will allow me to pause/resume the
# program while I'm doing the presentation. Don't worry about this for now. If you
# are running this program in "non-presentation" mode, then set PRESENTATION_MODE to False.
PRESENTATION_MODE = True
def paus... |
82aa359e55b2bd1983c263e2c38cc0a1419717ca | ptiwari/Housing-Price-Prediction | /housingregression.py | 796 | 3.625 | 4 | from sklearn.linear_model import LinearRegression
import numpy as np
import pandas as pd
values = list(map(int,input().strip().split(' ')))
labels = np.zeros(shape=(values[1]))
x_train = np.zeros(shape=(values[1],values[0]))
#print(values[1]);
#print(range(0,values[1]))
for i in range(0,values[1]):
#print(i)
v... |
2241f6f280cd21c13983b96ee3da0b8feaef1873 | STW59/biophys3 | /Homework3/Hw3_3[5]_STW59.py | 559 | 3.515625 | 4 | """
Kirill and Stephen worked together on the coding part.
Kirill: math parts
Stephen: recursive algorithms
"""
import numpy as np
def ave_r(r, kt):
return np.exp(-r / kt)
def main():
for kt in range(1, 11, 1):
if kt in [1, 2, 5, 10]:
top_sum = 0
bottom_sum = 0
f... |
21d8b2b25adb4241d0771122a0d8b45b6241d09c | rishinkaku/Software-University---Software-Engineering | /Python Fundamentals/Final_Exam_Prep/01. Movie Profit.py | 235 | 3.796875 | 4 | movie = input()
days = int(input())
tickets = int(input())
price = float(input())
total = days * tickets * price
cinema_profit = float(input())*total/100
print(f"The profit from the movie {movie} is {total - cinema_profit:.2f} lv.") |
dab5fe10b45e2cf297bf201c74e46e4282765623 | Friction6/TITAN | /v0 2.5/cards.py | 1,399 | 3.625 | 4 | import random
class Card:
def __init__(self, rank_id, suit_id):
self.rank_id = rank_id
self.suit_id = suit_id
if self.suit_id == 1:
self.suit = "Spades"
elif self.suit_id == 2:
self.suit = "Hearts"
elif self.suit_id == 3:
self.sui... |
06a6ba6d5cd6c19e2b4cbec7b4f83432ea5e995a | iteong/comp9021-principles-of-programming | /quizzes/quiz_7/extended_linked_list solution.py | 1,413 | 3.640625 | 4 | # Written by Eric Martin for COMP9021
from linked_list import *
class ExtendedLinkedList(LinkedList):
def __init__(self, L = None):
super().__init__(L)
def rearrange(self):
node = self.head
length = 1
index_of_smallest_value = 0
smallest_value = node.value
whil... |
de532285cd38db59111bd31e8ab0149dc4394249 | msanchezzg/AdventOfCode | /AdventOfCode2020/day12/ships.py | 4,370 | 3.828125 | 4 | #!/usr/bin/python3
import math
from directions import Direction, Instruction
class Waypoint():
def __init__(self, horizontal=0, vertical=0):
self.hor_axis = horizontal
self.vert_axis = vertical
def move(self, instruction):
"""
Move the waypoint in a given direction.
... |
96f697e2dc6ec8a84537bd0ffa8d4e8bc9d02acc | jinmanz/twitter | /mexico earthquake/rt_counter_per_day.py | 1,595 | 3.65625 | 4 | # -*- coding: utf-8 -*-
import csv
from os import listdir
import re
def read_file(filename):
"Read the contents of FILENAME and return as a string."
infile = open(filename) # windows users should use codecs.open after importing codecs
contents = infile.read()
infile.close()
return contents
... |
58cc92256c8187f24e3d8ee8857df49333b8136f | bhuwanadhikari/ajingar-plays | /2d-array-hourglass.py | 956 | 3.78125 | 4 | # Complete the hourglassSum function below.
def hourglassSum(arr):
largestSum = 0
sums = []
for x in range(4):
for y in range(4):
# loop in the hourglass:
sum = 0
for i in range(x, x + 3):
for j in range(y, y + 3):
if i == x + 1... |
5e9615fbedbc7c35297ad29735c3bd3fb964ddbd | jinrunheng/base-of-python | /python-basic-grammer/python-basic/02-python-variables-and-string/string_find_replace.py | 345 | 3.96875 | 4 | # print("nice to meet you".find("ee"))
# print("nice to meet you".find("ee",0,7))
str = "nice to meet you,I need your help"
print(str.find("ee")) # 返回第一个找到的位置
print(str.find("ee",11,len(str) - 1))
is_exist = "ee" in str
print(is_exist)
str1 = "hello world"
print(str1.replace("world","kim"))
print(str1.replace("o","O... |
5ad081f27c5e4e59394b29df1c85639059ffcb78 | dralee/LearningRepository | /PySpace/time/time5.py | 723 | 3.796875 | 4 | #!/usr/bin/python3
# 文件名:time5.py
"""
Python 程序能用很多方式处理日期和时间,转换日期格式是一个常见的功能。
Python 提供了一个 time 和 calendar 模块可以用于格式化日期和时间。
时间间隔是以秒为单位的浮点小数。
每个时间戳都以自从1970年1月1日午夜(历元)经过了多长时间来表示。
Python 的 time 模块下有很多函数可以转换常见日期格式。如函数time.time()用于获取当前时间戳, 如下实例:
"""
'''
Calendar模块有很广泛的方法用来处理年历和月历,例如打印某月的月历:
'''
import calendar
cal = calen... |
7d68e06b3951e8b20ca075737dc5024975dfe93f | Haasha/RandomForest | /weakLearner.py | 10,236 | 3.5625 | 4 |
#---------------Instructions------------------#
# You will be writing a super class named WeakLearner
# and then will be implmenting its sub classes
# RandomWeakLearner and LinearWeakLearner. Remember
# all the overridded functions in Python are by default
# virtual functions and every child classes inherits all the... |
91892203497861c90b842a53b5861777e5f30d3a | MarcPartensky/Pygame-Geometry | /pygame_geometry/manager.py | 21,018 | 3.921875 | 4 | from .context import Context
from pygame.locals import *
import pygame
class SimpleManager:
"""Manage a program using the context by many having functions that can be
overloaded to make simple and fast programs.
This process allow the user to think directly about what the program does,
instead of focu... |
5855be39b71849dc0e3b1ecde6a5220371731fcc | bergercookie/src_utils | /python/euler_problems/adderdict.py | 268 | 4.15625 | 4 | #!/usr/bin/env python
def addDict(dict1 ,dict2):
"""
Computes the union of two dictionaries
"""
final_dict = {}
for (i,j) in dict1.items():
final_dict[i] = j
for (i,j) in dict2.items():
final_dict[i] = j
return final_dict
|
552de5be2c373cd4aa9932fef8f25802cda9c0e4 | gpeFC/sistParDist | /proyectoMPI/version2/respaldo_perceptron.py | 8,918 | 3.546875 | 4 | """
Modulo que contiene las clases necesarias para crear objetos de redes
neuronales artificiales de tipo perceptron multicapa y ser entrenadas
con un algoritmo de retropropagacion.
"""
from funciones import *
class Neurona:
"""
Neurona artificial tipo perceptron.
"""
def __init__(self, total_args):
"""
to... |
e972c8650d55169fbce011e612015dd437ce7785 | Celot1979/Proy_Person | /Adivina el nunero.py | 849 | 4.125 | 4 | import random
intentosRealizados = 0
print("Hola! ¿ Cómo te llamas? ")
miNombre= input()
numero = random.randint(1,20)
print(" Bueno " + miNombre + " estoy pensando un numero entre 1 y 20 ")
print(" Escribe el número que piensas... ")
while intentosRealizados < 6:
print(" Intenta adivinar ")
estimacion = input()
est... |
b6653ff6ac1c6dd5522fbbcc553db6d28ec0c00f | darsovit/AdventOfCode2017 | /Day24/Day24.py | 2,219 | 3.765625 | 4 | #!python
def read_input():
input=[]
with open('input.txt') as file:
for line in file:
input.append(line.strip())
return input
def read_sample():
input=[]
input.append('0/2')
input.append('2/2')
input.append('2/3')
input.append('3/4')
input.append('3/5')
inpu... |
9100da26f42152870c1b069209baa5ec8d166a6a | dws940819/DataStructures | /DS_Introduction/DS1_introduction.py | 5,329 | 3.6875 | 4 | # 注册牛客网,LettCode(必刷)
# 如果a+b+c = 1000,并且a^2 + b^2 = c^2,求出所有a,b,c可能的组合
# 第一种算法,三层循环
# import time
# start_time = time.time()
# for a in range(0,1001):
# for b in range(0,1001):
# for c in range(0,1001):
# if a+b+c == 1000 and a**2+b**2 == c**2:
# print('a,b,c:%d,%d,%d'%(a,b,c))... |
32088286c46bc1711dbc9a232bbf6b650b80f4ff | jz33/LeetCodeSolutions | /Google Onsite 03 Minimum Modification on Matrix Route.py | 2,228 | 3.875 | 4 | from typing import List, Tuple
from heapq import heappush, heappop
'''
https://leetcode.com/discuss/interview-question/476340/Google-or-Onsite-or-Min-Modifications
Given a matrix of direction with L, R, U, D, at any point you can move to the direction which is written over the cell [i, j].
We have to tell minimum numb... |
769ad966b6394e4184a6e2caa7b76adc96e326d3 | AsterWang/leecode | /不分行从上往下打印二叉树.py | 1,290 | 3.75 | 4 | '''
从上往下打印出二叉树的每个结点,同一层的结点按照从左到右的顺序打印。
样例
输入如下图所示二叉树[8, 12, 2, null, null, 6, null, 4, null, null, null]
8
/ \
12 2
/
6
/
4
输出:[8, 12, 2, 6, 4]
算法:
1. 我们从root开始按照bfs(宽度优先) 顺序遍历整棵树,首先访问left child, 然后是right child
2. 然后在从左到右扩展第三层节点
3. 一次类推
时间复杂度
BFS时每个节点仅被遍历一次,所以时间复杂度... |
194ffaff14302cc3758f8498eaf609b4261d2900 | jookimmy/BravesDataAnalysis | /analyze/analyzelib.py | 2,806 | 3.578125 | 4 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#using pandas to read excel file given
data = pd.read_excel("batData/BattedBallData.xlsx")
#making different functions to call
def histogram(variable1):
#converting recieved values into a python list
list1 = data[variable1].values.tolist()
#mat... |
65ef3623b0bd01fd07c62239414f9961c9243ce2 | Aman-dev271/Pythonprograming | /7thfoor.py | 422 | 4.25 | 4 | # for loop
list = ['amandeep','mandeep','singh']
for item in list:
print(item)
# list in list
list1 = [['amandeep' ,4],["deep" ,5],["singh" ,6]]
for item,number in list1:
print("item is:" ,item +','+"number is:", number)
# by the dictionary
dict1 = dict(list1)
print(type(dict1))
for key,number in... |
9582c251fee5df6c926327e539909710672410ac | nirvaychaudhary/Python-Assignmnet | /data types/question32.py | 298 | 4.09375 | 4 | # write a python script to generate and print dictionary that contains a number (between 1 and n) in the form(x, x*x).
# Sample Dictionary (n=5)
# Expected Output : {1: 2, 2: 4, 3: 9, 4: 16, 5:25}
n = int(input("ENter any number: "))
d = dict()
for x in range(1,n+1):
d[x] = x * x
print(d)
|
6e1da209e12a6f316e17119bae89e6a34e074274 | Gscsd8527/python | /面试题/阿里-巴巴/算法/选择排序.py | 722 | 3.6875 | 4 | # 初始时在序列中找到最小(大)元素,放到序列的起始位置作为已排序序列;
# 然后,再从剩余未排序元素中继续寻找最小(大)元素,放到已排序序列的末尾。
# 以此类推,直到所有元素均排序完毕。
lst = [7, 2, 3, 8, 11, 22, 5, 1]
for i in range(len(lst)):
for j in range(i+1, len(lst)):
if lst[i] > lst[j]:
lst[i], lst[j] = lst[j], lst[i]
print(lst)
#
# [1, 7, 3, 8, 11, 22, 5, 2]
... |
3d038303b6569c4e3f9960965fac283ed8682941 | betty29/code-1 | /recipes/Python/499347_Automatic_explicit_file_close/recipe-499347.py | 1,343 | 3.59375 | 4 | def iopen(name, mode='rU', buffering = -1):
'''
iopen(name, mode = 'rU', buffering = -1) -> file (that closes automatically)
A version of open() that automatically closes the file explicitly
when input is exhausted. Use this in place of calls to open()
or file() that are not assigned to a name and ... |
25a5d0483244e05787436460ec912e263da46c41 | GuillaumeLab/-fluffy-garbanzo | /addsalaries.py | 3,785 | 3.5 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 12 10:11:45 2019
@author: Celia
"""
import numpy as np
import pandas as pd
import re
df = pd.read_csv('df_pymongo.csv')
#on prends seulement les colonnes pertinents
#df = df.loc[41:]
#on reset l'index
#df = df.reset_index()
df.drop(['index'], axis... |
91c8016997d6b4c3dce7dd0ae0991fcf0a454a7e | Eldersev/LibExcel | /Forca.py | 3,472 | 3.8125 | 4 | import os
class forca:
def __init__(self, secret_word, tips):
self.secret_word = secret_word.upper()
self.secret_word_size = len (secret_word)
self.secret_word_found = ('_'*len(self.secret_word))
self.tips = tips
self.error_count = 0
self.try_quantity = len(self.sec... |
60c216e3867d11a2ddaaf974812344a33093e64d | acusp/dotfiles | /scripts/security/crypto/caesar.py | 5,337 | 4.125 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
# a的ANSI码是97, z的ANSI码是122。
# A的ANSI码是65, Z的ANSI码是90。
def caesar_encry():
cipher = ""
plain = raw_input("Please input plain text: ")
shift = raw_input("Please input key: ")
plain_list = list(plain)
try:
shift=int(shift)
except sh... |
84ce37c62bd4a60502e9ba4cd10ea8ac85bfb16c | frankdoylezw/Learn-Python-The-Hard-Way | /ex12c.py | 315 | 3.640625 | 4 | from sys import argv
AGE = raw_input("How old are you? ")
HEIGHT = raw_input("How tall are you? ")
WEIGHT = raw_input("How much do you weigh? ")
print "So, you're %r old, %r tall and %r heavy." % ( AGE, HEIGHT, WEIGHT)
SCRIPT, FIRST, SECOND = argv
print "You also entered two variables: ", FIRST + " and", SECOND
|
642f8b12faaeb3dcff5b9cb7b9a95e3b0ba60d93 | lixinchn/LeetCode | /src/0100_SameTree.py | 1,833 | 3.796875 | 4 | class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
@staticmethod
def create(arr):
head = None
this = None
left, right = False, False
prev_nodes = []
for val in arr:
node = TreeNode(val)
... |
868669d40230716eb8e164f4ca7a2ea096f5ea2b | ritikapatel1410/Python_Data_Structure | /List/create_copy_list.py | 2,031 | 3.640625 | 4 | '''
@Author: Ritika Patidar
@Date: 2021-02-26 18:35:10
@Last Modified by: Ritika Patidar
@Last Modified time: 2021-02-26 18:35:38
@Title : create duplicate list of original list
'''
import sys
import os
sys.path.insert(0, os.path.abspath('LogFile'))
import loggerfile
def duplicate_list(user_defind_list):
""... |
1ecc9313213bc1d48925cf65d7cf322e3f5e0a12 | VictorVrabie/PythonIntroduction | /NewFile.py | 2,034 | 3.875 | 4 | #1st exercise
"""def Median(numbers):
ln = len(numbers)
srt = sorted(numbers)
return numpy.median(numpy.array(x))
print(Median([1,2,15,16]))
#2nd exercise
city = input("Where you are going ? ")
d = int(input("How many days you are staying"))
def Hotel_cost(d, city):
if city == "Paris":
retur... |
ccbc908e0d0deb4e206892572b2c52ab83cc882d | Milan-Chicago/ds-guide | /binary_tree_pruning.py | 1,675 | 3.953125 | 4 | """
Binary Tree Pruning
Given the root of a binary tree, return the same tree where every subtree (of the given tree) not containing a 1
has been removed.
A subtree of a node node is node plus every node that is a descendant of node.
Example 1:
Input: root = [1,null,0,0,1]
Output: [1,null,0,null,1]
Explanation:... |
56869ad0190c29282d3001208ef4dd56a5a6b49c | CodeInDna/Algo_with_Python | /04_Random/51_Miscellaneous/coinChange.py | 891 | 4.03125 | 4 | # ---------------------- PROBLEM 2 (RANDOM) ----------------------------------#
# Write a function called coinChange which accepts two parameters: an array of
# denominations and a value. The function should return the number of ways you can
# obtain the value from the given collection of denominations. You can think... |
1a372144dc2dadb31e3a26596186404bddc4b712 | guard1000/Everyday-coding | /190115_위장.py | 725 | 3.53125 | 4 | def solution(clothes):
answer = 1
n = len(clothes)
alist=[]
#각 의상 종류별 몇개의 옷이 있는지를 저장한 리스트 alist
clothes =sorted(clothes, key=lambda x : x[1])
i = 0
while i < n:
j = i
while j < n and clothes[i][1] == clothes[j][1]:
j += 1
alist.append(j-i)
i = j
... |
0a408ab0043115d976f01e83340bd7e41872b0b3 | claudiordgz/coding-challenges | /heapsort.py | 1,337 | 3.609375 | 4 | from heapq import heappop, heappush
def heapify(arr):
for root in range(len(arr) // 2 - 1, -1, -1):
rootVal = arr[root]
child = 2 * root + 1
while child < len(arr):
if child + 1 < len(arr) and arr[child] > arr[child + 1]:
child += 1
if rootVal <= arr... |
fc6f42ba074d2ef914cf2b55d9e9cd459e0c7a79 | rafaelperazzo/programacao-web | /moodledata/vpl_data/59/usersdata/215/34948/submittedfiles/testes.py | 237 | 4.15625 | 4 | # -*- coding: utf-8 -*-
a=float(input('digite a'))
b=float(input('digite b'))
if a<b:
q=a*a
print (a)
elif b<a:
q=b*b
print (q)
elif a>==0 and a>b:
r=a**0.5
print(r)
elif b>==0 b>a:
r= b**0.5
print (r)
|
77385595847249d0d0629bea81a0bc1d1172b274 | adilahiri/Udemy_Algorithm | /Python_Basic/String_Functions.py | 3,581 | 4.53125 | 5 | ## Methods and functions we can use on String objects
# Official documentation: https://docs.python.org/3/library
# We ran the following functions on strings
# len(), type(), id(), dir()
# We ran the following string methods
# capitalize(), upper(), lower(), strip(), find()
# split(), join()
# Test them out on the vari... |
0f8ddcaa26bcdf914b2bce9c0f61b193206f2466 | devmacrile/notebook | /bioinformatics/rosalind/simple_transcription.py | 560 | 4.28125 | 4 | # -*- coding: utf-8 -*-
"""
Given a DNA string tt corresponding to a coding strand, its transcribed RNA
string u is formed by replacing all occurrences of 'T' in t with 'U' in u.
Given: A DNA string t having length at most 1000 nt.
Return: The transcribed RNA string of t.
"""
from franklin import clock
def load_d... |
f8806552f3eb3ea5514a3546e5180f2adaf38978 | huseyin4334/Python-Education | /Numpy/indekslemeParcalama.py | 841 | 3.671875 | 4 | import numpy as np
#numpy vektörleride indislerle çalışılırken pythondaki listeler gibi çalışırlar.
sayilar = np.array([12,45,6,8,34,6,5,3,56,3,44,55,66,77,8])
print(sayilar[0])
print(sayilar[6])
#Hata!!
print(sayilar[19])
print(sayilar[0:3])
print(sayilar[::2])
print(sayilar[::-1])
sayilar2 = sayilar.reshape(3,5)... |
0ab4a32a56a017085b72245893d09f8fa9beaa4e | qimanchen/Algorithm_Python | /python_interview_program/python数据类型_字典.py | 731 | 3.765625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
python面试问题
数据类型-字典
36-
"""
"""
36. 字典操作中del和pop有什么区别
del可以根据索引来删除元素,没有返回值
pop可以根据索引弹出一个值,然后接收它的返回值
"""
"""
37. 按字典内的年龄排序
d1 = [
{'name': 'alice', 'age':38},
{'name': 'bob', 'age':18},
{'name': 'Carl', 'age':28}
]
sorted(d1, key=lambda x: x['age'])... |
6f8e819c6bfe8be8b2a0a8d38e0813565c547875 | BrianMath-zz/ExerciciosPython | /Exercicios - Mundo2/Ex. 043.py | 450 | 3.640625 | 4 | # Ex. 043
massa = float(input("Digite sua massa (kg): "))
alt = float(input("Digite sua altura (m): "))
imc = massa/(alt**2)
print(f"\nSeu IMC é de {imc:.1f}")
if imc < 18.5:
print("Você está ABAIXO DO PESO! Cuidado!")
elif imc < 25:
print("Você está com o PESO IDEAL. Parabéns")
elif imc < 30:
print("Você está SOBR... |
51d22a8fc8c55486972ac2cefc6d90d2261fad20 | rupali23-singh/list_question | /level_1ex_.py | 116 | 3.734375 | 4 | i=0
empty=[]
while i<10:
user=int(input("enter the number"))
empty.append(user)
i=i+1
print(empty)
|
3c6424b24f9fbf178360b5f0eb5322b0002174dd | swynnejr/bank_account | /bank_account.py | 1,211 | 3.875 | 4 | class BankAccount:
def __init__(self, int_rate, balance):
self.int_rate = int_rate
self.balance = balance
# self.name = User
def deposit(self, amount):
self.balance += amount
return self
def withdrawl(self, amount):
if self.balance < amount:
prin... |
ee00b90fb4ff5512a78a14d359a0f4f72bb69982 | g95g95/Examination | /Electoral_Montecarlo.py | 2,695 | 3.71875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 30 17:12:33 2019
@author: Giulio
"""
import numpy as np
import random as rd
import string
Results2018={'Movimento 5 stelle':0.327,'Centrosinistra':0.22,'Centrodestra':0.37,'LeU':0.03}
#ResultsHyp1 ={'Movimento 5 stelle':0.18,'Centrosinistra':0.20,'Lega':0.35,'Centrodest... |
c5181d56e6dd93d380311f473c62990f767a8879 | awan1/double_space_tracker | /double_space_tracker.py | 2,526 | 3.71875 | 4 | """
This is a background application that will alert a user when they input two
spaces (instead of one) after a sentence-ending punctuation mark.
It exhibits interesting functionality:
- Monitoring keyboard inputs on OSX
- Displaying OSX alerts
Algorithm: if a space is seen after a sentence-ending punctuation mark an... |
ab1f83666b24f3ce63ddf52092b00a471ff69052 | benediktwerner/AdventOfCode | /2016/day09/sol.py | 1,042 | 3.671875 | 4 | #!/usr/bin/env python3
from os import path
def decompressed_length(line, start=0, end=None, recurse=True):
count = 0
i = start
if end is None:
end = len(line)
while i < end:
if line[i] == "(":
marker = ""
while True:
i += 1
if l... |
c5f27d819d48e4f68234854d1c2a891dd0ae703a | Abdul-Rehman1/Python-Assignment1 | /guessNumber.py | 816 | 3.671875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 12:30:33 2019
@author: Abdul Rehman
"""
import random
lst=("first","second","third","fourth","fifth")
print("Guess Number from [1 to 10]\n You have to guess the number with in 5 trials")
numToGuess = random.randint(1, 10)
count=0
guessedNum = int(input("E... |
092ddceda7961bc746b1ebdfbb4ec0d7a0a60cd6 | kyeeh/holbertonschool-machine_learning | /math/0x00-linear_algebra/13-cats_got_your_tongue.py | 274 | 3.75 | 4 | #!/usr/bin/env python3
"""
Module with function to Concatenate two matrices
"""
import numpy as np
def np_cat(mat1, mat2, axis=0):
"""
Concatenates two matrices along a specific axis
Returns the new matrix
"""
return np.concatenate((mat1, mat2), axis)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.