blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
aea93632ba3bf5e9b969c0dc848c0e0bfb07f3cb
DimasK169/RESPONSI_PDKP_MOD4_KEL08
/RESPONSI_PDKP_MOD4_KEL08/RESPONSI_PDKP_MOD4_KEL08.py
982
3.796875
4
import decryption abjad = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] key = 8 print("Enkripsi = 1") print("Dekripsi = 2") kode = int(input("Masukkan fungsi yang ingin digunakan :")) def encode(kalimat,cipher_key): kalimat = kalimat.lower() hasil_enco...
ac05fd0c24781b9211f68fabd9274d9d80352ac0
annadorzhieva/lesson_3
/HW_2_lesson_3.py
1,211
3.671875
4
''' Реализовать функцию, принимающую несколько параметров, описывающих данные пользователя: имя, фамилия, год рождения, город проживания, email, телефон. Функция должна принимать параметры как именованные аргументы. Реализовать вывод данных о пользователе одной строкой.''' def user_func(name, surname, birth, city, pos...
e05cb9b2b48437300b459db8525eaf4e20c9d352
Parul127/laughing-sniffle
/exerciselists.py
379
3.625
4
#Lists cool_cows = ["Winnie the Moo", "Moolan", "Milkshake", "Mooana"] print(cool_cows[2]) print(cool_cows[0]) print(tuple[3]) cool_cows = ["Winnie the Moo", "Moolan", "Milkshake", "Mooana"] cool_sheep = ["Baaaart", "Baaaarnaby"] cool_pigs = ["Chris P. Bacon", "Hamlet", "Hogwarts"] cool_animals = [cool_cows, cool_she...
ade089f66daa5fcc949443e21c16f1cc1e30759e
yassineaboub/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/0-add_integer.py
650
4.25
4
#!/usr/bin/python3 """ This is the "0-add_integer" module. The example module supplies one function, add_integer(a, b) """ def add_integer(a, b=98): """ addition = a + b """ if type(a) is not int and type(a) is not float: raise TypeError("a must be an integer") if type(b) is not int and ty...
40e7e3d610055a57308e2f7c8c2cce9d34b800a7
wmastersonV/mapReduce
/linearReg/mapper.py
1,702
3.984375
4
#!/usr/bin/python ''' formula: y = BX y = B0 + B1 * x1 + B2 * x2 + B3 * x3 This script is the first step in creating matrix A, or computing coefficients in the linear regression: B0, B1, B2, B3 Mappers calculate matrix A by emitting two types of tuples, combined for form a matrix: Type 1: matrix A (row1, x * transp...
4f3ba4f485e1db19fe1de8fba64e5a2d81b17406
DawidPL/uniquePass
/main.py
4,605
3.578125
4
from tkinter import * import random import string def description(): print(""" Witaj w programie. Odpowiednie hasło to niezwykle ważna rzecz podczas korzystania z internetu. Powinno być trudne lub wręcz nawet niemożliwe do złamania. Niestety wiele osób obawiając się, że je zapomni stosu...
64dbea036fadc2cc492b34937d6c54cac3ee3cb2
athulanish/Python_Practise
/sample_threading.py
400
3.640625
4
import time import threading def func(): #print("this is a sample line") time.sleep(4) #print("Waited for 4 sec") start_time = time.time() for i in range(3): x = threading.Thread(target=func) x.start() end_time = time.time() print (end_time - start_time) start_time2 = time.time() for i in r...
57e60fbc93a49ae987547812547bf82f2d9d9671
elaesiana/Pembelajaran-Mesin
/tugas3.py
5,137
3.640625
4
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.utils import shuffle # load dataset data = pd.read_csv('data_iris.csv') data = data[:100] #data yang diambil hanya 100 data, yaitu setosa dan versicolor data = shuffle(data) #karena data dalam kondisi terurut, maka perlu di shuffle ter...
d84dd69b09f4ddefef9e595b3876cec2f366c6a5
intellect82/venkateswarlu_SVAP_Asmt_R3
/STREAM_DEMAND_PREDECTION.py
8,997
3.65625
4
# coding: utf-8 # In[69]: # imports import pandas as pd import matplotlib.pyplot as plt # this allows plots to appear directly in the notebook get_ipython().magic('matplotlib inline') # In[70]: # read data into a DataFrame data = pd.read_csv("DataSet1000N.csv", index_col=0) data.head() # In[71]: data.colu...
a1530627543e214541bef81a52ab2c283db5bfd8
Cuspian/PUI2015_dkhryashchev
/Lab1-dk2926-assignment3-extra.py
2,082
3.609375
4
# Including libraries # Numpy to store arrays of values of functions + random numbers generator import numpy as np from numpy import random # MatPlotLib to do basic generating and exporting graphs import matplotlib.pyplot as plt # SeaBorn to decorate graphs, generated by MatPlotLib import seaborn as sns import os impo...
b1f3d88fdf8b94ceb59680eff58a1946fa7d158f
matt-sm/geek
/python/app/binary_tree.py
728
3.609375
4
class BNode: def __init__(self, val): self.left = None self.right = None self.val = val def __str__(self): ''' Preorder traversal ''' s = '{}{}'.format(str(self.val), ' ') if self.left is not None: s += str(self.left) if self.right i...
90a6fee49422e035a7493358e2252ac34638dde7
edsonfsousa/information_python_bot_
/main.py
1,454
3.515625
4
import os def processar_resposta(resposta, nome): if resposta == '1': print(f'{os.linesep}{nome}, seu nome completo é Edson Fernandes de Sousa e ele é natural de Fortaleza no Ceará.{os.linesep}') elif resposta == '2': print(f'{os.linesep}{nome}, ele tem conhecimento em Java, JavaScript, PHP e P...
b2e7cced307dd3d5ae4994d6a5f78d2a615a59b8
Gabriel-Arimatea/python-designs
/gof/structural/facade.py
3,241
4.125
4
from abc import ABC, abstractmethod class Account(ABC): @abstractmethod def deposit(self, amount): raise NotImplementedError("Método não implementado") @abstractmethod def withdraw(self, amount): raise NotImplementedError("Método não implementado") @abstractmethod def transf...
09b337621b0ae48d5e9cba3820bb211dd7166a66
hashansl/pytorch-tutorials
/python-engineer/PyTorch Tutorial 02 - Tensor Basics.py
2,228
4.125
4
#2Tensor basics import torch import numpy as np #creating empty tensor x = torch.empty(2, 3) # print(x) #creating tenspr from random values x = torch.rand(3, 4) # print(x) x = torch.zeros(3, 4) # print(x) x = torch.ones(3, 4) # print(x) #We can give specific datatype x = torch.ones(3, 4, dtype=torch.float32) # pr...
8e5ee4ade833321cc1e6b9d0531a1ab08f73ee63
sarahjin/PythonClass-2015
/Class5-API/twitter.py
2,241
3.890625
4
#Register an app: https://dev.twitter.com/ #pip install tweepy import tweepy import time #Check the documentation page #http://docs.tweepy.org/en/v3.2.0/ #check the documentation for new methods #Get access to API #get authorization #never share the consumer key, secret, access token, secret auth = tweepy.OAuthHand...
8878a6affd8b160dd48e47ef3b90c4e89b8e0cbd
luolan-677/louPlus
/python3函数.py
5,790
4.4375
4
函数 (1)定义一个函数 def 函数名(参数): 语句1 语句2 编写一个两个整数求和的函数: def sum(a,b): return a + b 调用方法: res = sum(234234,34453546464) res = 34453780698 回文检查: #! /usr/bin/env python3 def palindrome(s): return s == s[::-1] if __name__ == '__main__': s = input('Enter a srting: ') if palindrome(s): print('Yay a p...
a134263881b6d0383c033e6f46b7583fefb1859a
j-chat/Tenable_CTF_solutions
/2021/ParseyMcparser.py
774
3.765625
4
''' :param blob: blob of data to parse through (string) :param group_name: A single Group name ("Green", "Red", or "Yellow",etc...) :return: A list of all user names that are part of a given Group ''' import re def ParseNamesByGroup(blob, group_name): username_list = [] brackets_list = re.findall('\[.*?\]',bl...
ba367570029281c34c11be78ba85548d4865a838
webstradev/rCn_RandomDiceGenerator
/RandomDiceGenerator.py
1,504
4.25
4
import random class RandomDiceGenerator(): """ Represents a random dice roll generator which has an amount of dice and a number of sides per dices. Includes methods to generate the rolls and getters and setters. also includes a result and a sum variable which represent the results of each roll "...
e9cdc8169fa05f3c56606d8c24d29f831b0ab4df
EdersonLuiz/Lista_Estudo_Dirigido01
/Exercicio7.py
176
3.9375
4
celsius = int (input ("Digite a temperatura atual:")) fahrenheit = 9 * celsius / 5 + 32 print ('valor em Celsius: ', celsius) print ('valor em Fahrenheit: ', fahrenheit)
abb4312c350aa6c0b68f1fdd60810a7f402946f8
EdersonLuiz/Lista_Estudo_Dirigido01
/exercicio4.py
262
3.796875
4
salario = float ( input ("Digite seu salário: R$ ")) porcentagem = float ( input ("Porcentagem de aumento: ")) print ("Você teve um aumento de: R$", salario * porcentagem / 100) print ("Seu salário agora é: R$",(salario + (salario * porcentagem / 100)))
13c8e547e33e40ff85b769f410b7e8e69d9e0985
zhaofeng-shu33/neural_net_basic
/neural_net_cross_entropy.py
13,602
3.640625
4
#!/usr/bin/python3 # -*- coding:utf-8 -*- # author: Stanford cs231n 2016 winter assignment teaching-assistant, Justin Johnson # modified by zhaofeng-shu33 # file-description: implementation of a two-layer neural-network with cross-entropy loss # the first layer uses tanh as activation function # the second layer uses s...
76ec3efe1e61f046e2f42593f1cc599e3e6c0e0f
cutewindy/CodingInterview
/LintCode_Python/trailingZeros.py
383
3.78125
4
# Write an algorithm which computes the number of trailing zeros in n factorial. # Have you met this question in a real interview? Yes # Example # 11! = 39916800, so the out should be 2 # Challenge # O(log N) time def trailingZeros(n): if not n: return n count = 0 while n != 0: count += ...
28ac14e800ae7cb2db16f9c6897a64c6fa66ee7e
cutewindy/CodingInterview
/LintCode_Python/sortList.py
2,473
4.21875
4
# Sort a linked list in O(n log n) time using constant space complexity. # Have you met this question in a real interview? Yes # Example # Given 1-3->2->null, sort it to 1->2->3->null. from ListNode import ListNode # Method2: quick sort def sortListI(head): if head == None or head.next == None: return h...
273421087bbe47b4df08e21bc663ade91cec848f
cutewindy/CodingInterview
/LintCode_Python/jumpGameII.py
1,273
3.875
4
# Given an array of non-negative integers, you are initially positioned at the # first index of the array. # Each element in the array represents your maximum jump length at that position. # Your goal is to reach the last index in the minimum number of jumps. # Have you met this question in a real interview? Yes # E...
36c05db33a02eb42d3deed81000935cf2ff00554
cutewindy/CodingInterview
/LintCode_Python/topologicalSorting.py
2,335
4.40625
4
# Given an directed graph, a topological order of the graph nodes is defined as follow: # For each directed edge A -> B in graph, A must before B in the order list. # The first node in the order can be any node in the graph with no nodes direct to it. # Find any topological order for the given graph. # Have you met t...
6b916410d3fffc6b8be009d1db95d86893a34174
cutewindy/CodingInterview
/LintCode_Python/longestConsecutiveSequence.py
887
4.0625
4
# Given an unsorted array of integers, find the length of the longest consecutive # elements sequence. # Have you met this question in a real interview? Yes # Example # Given [100, 4, 200, 1, 3, 2], # The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length: 4. # Clarification # Your algorithm sho...
aaf8749b2b26d36f3ae0b12000bd67c029fb0beb
cutewindy/CodingInterview
/LintCode_Python/NQueensII.py
877
3.734375
4
# Follow up for N-Queens problem. # Now, instead outputting board configurations, return the total number of distinct # solutions. # Have you met this question in a real interview? Yes # Example # For n=4, there are 2 distinct solutions. def isValid(col, cols): row = len(cols) for i in range(row): if...
f2f1de6f367106274fefd5229be3b5b6ec150551
cutewindy/CodingInterview
/LintCode_Python/threeSumClosest.py
1,267
3.90625
4
# Given an array S of n integers, find three integers in S such that the sum is # closest to a given number, target. Return the sum of the three integers. # Have you met this question in a real interview? Yes # Example # For example, given array S = {-1 2 1 -4}, and target = 1. The sum that is closest # to the target...
8a8935a0524594757bdac1c8659a99589239cdc7
cutewindy/CodingInterview
/LintCode_Python/topKFrequentWords.py
2,529
4.0625
4
# Given a list of words and an integer k, return the top k frequent words in the # list. # Have you met this question in a real interview? Yes # Notice # You should order the words by the frequency of them in the return list, the most # frequent one comes first. If two words has the same frequency, the one with # ...
2130171693b3b8c493605cbd00d899c9dfdce02b
cutewindy/CodingInterview
/LintCode_Python/fourSum.py
2,113
3.84375
4
# Given an array S of n integers, are there elements a, b, c, and d in S such # that a + b + c + d = target? # Find all unique quadruplets in the array which gives the sum of target. # Have you met this question in a real interview? Yes # Example # Given array S = {1 0 -1 0 -2 2}, and target = 0. A solution set is: ...
b8dc56663d2d5cb3a6c3abc7f808441de7294e52
cutewindy/CodingInterview
/LintCode_Python/singleNumberII.py
802
3.828125
4
# Given 3*n + 1 numbers, every numbers occurs triple times except one, find it. # Have you met this question in a real interview? Yes # Example # Given [1,1,2,3,3,3,2,2,4,1] return 4 # Challenge # One-pass, constant extra space. def singleNumberII(A): if not A: return None bits = [0 for i in range(3...
2fbdf03cec735f157e4abec530210c683c42158c
cutewindy/CodingInterview
/LintCode_Python/removeDuplicatesfromUnsortedList.py
822
4.0625
4
# Write code to remove duplicates from an unsorted linked list. # Have you met this question in a real interview? Yes # Example # Given 1->3->2->1->4. # Return 1->3->2->4 # Challenge # (hard) How would you solve this problem if a temporary buffer is not allowed? # In this case, you don't need to keep the order of no...
fa63513741042889ec3000fc38de63e461b81864
cutewindy/CodingInterview
/LintCode_Python/LongestCommonSubsequence.py
1,064
4
4
# Given two strings, find the longest common subsequence (LCS). # Your code should return the length of LCS. # Have you met this question in a real interview? Yes # Example # For "ABCD" and "EDCA", the LCS is "A" (or "D", "C"), return 1. # For "ABCD" and "EACB", the LCS is "AC", return 2. import sys def longestCommo...
50bdff982fc312d58f31fb33ce40aa3a32145b0f
cutewindy/CodingInterview
/LintCode_Python/middleofLinkedList.py
579
4.09375
4
# Find the middle node of a linked list. # Have you met this question in a real interview? Yes # Example # Given 1->2->3, return the node with value 2. # Given 1->2, return the node with value 1. from ListNode import ListNode def middleofLinkedList(head): if head == None: return head slow = head ...
08fe4434e923bceab39cfe48890955d7f0d29dc0
cutewindy/CodingInterview
/LintCode_Python/linkedListCycleII.py
830
3.984375
4
# Given a linked list, return the node where the cycle begins. # If there is no cycle, return null. # Have you met this question in a real interview? Yes # Example # Given -21->10->4->5, tail connects to node index 1, return 10 # Challenge # Follow up: # Can you solve it without using extra space? from ListNode i...
c92bbb0b0e5c2c9c749e24ba78cb899ee0013c3c
cutewindy/CodingInterview
/LintCode_Python/removeDuplicatesfromSortedListII.py
921
3.84375
4
# Given a sorted linked list, delete all nodes that have duplicate numbers, # leaving only distinct numbers from the original list. # Have you met this question in a real interview? Yes # Example # Given 1->2->3->3->4->4->5, return 1->2->5. # Given 1->1->1->2->3, return 2->3. from ListNode import ListNode def remov...
0ef03afdb2a1450feb63a1f5645e93770305f4eb
qi90mufeng/first-python
/numtest.py
2,895
3.546875
4
import numpy as np # ---------------------------------------------------------------------------------------------------------------------- a = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) print(a) # 结果返回一个tuple元组 (2L, 5L) print(a.shape) # 获得行数,返回 2 print(a.shape[0]) # 获得列数,返回 5 print(a.shape[1]) # 默认从0开始到10(不包括10),步...
570f4fd121b45c50be4137d16d41e95f7059da3a
doppelmarker/epam_python
/homework9/task1/merge_files_iterator/merge_files_iterator.py
1,627
4.03125
4
""" Write a function that merges integer from sorted files and returns an iterator file1.txt: 1 2 3 file2.txt: 4 5 6 >>> list(merge_sorted_files(["file1.txt", "file2.txt"])) [1, 2, 3, 4, 5, 6] """ import os from typing import Iterator class FilesIterator: def __init__(self, file_names): self.file_names = ...
08235176c338abeab13f1eb8e86b3355ee175f49
doppelmarker/epam_python
/homework5/practice_hw5/oop.py
569
3.8125
4
class Customer: attr = "Python is awesome!" def __init__(self, first_name): self.first_name = first_name def __del__(self): print("I was not deleted!") cust1 = Customer("customer1") cust2 = Customer("customer2") print(cust1.__dict__, cust2.__dict__) print(cust1.attr, cust2.attr) cust1....
9d6893c09f446d672e0df9304bf0df7bc66a906e
LukePaulSkinner/OpenCV-Meteors
/main.py
11,861
4.34375
4
# --------------------------Program Summary-------------------------- # # This is a program used to detect calculate the distance of an object # The program should be run from command line # Inputs should be in the form of # number of images # Template of left image # Template of right image # Using this informa...
0931a8048f4d2fc9986aac100a32823e3be8e779
iheb719/deep-learning-toolkit
/machine_learning/svm.py
3,922
3.5625
4
""" https://stats.stackexchange.com/questions/95340/comparing-svm-and-logistic-regression Angrew NG : https://www.youtube.com/watch?v=hDh7jmEGoY0 n nb of features, m nb of training examples if n is large (relative to m) use logistic regression or svm without a kernel (linear kernel) if n is small and m is interme...
fea3c9fae3ea5eae24c459ce2ff5219ce633e28f
umair-s5/Python-Projects
/part_C.py
328
4.46875
4
# Umair Sayeed # circleArea, 25 October 2017, Chapter 1 Lab # Caculates the area of a circle using a radius value input by the user. # Input: Number for radius. # Output: Area of circle. import math radius = eval(input("Enter the radius of the circle: ")) area = math.pi*(radius**2) print("The area of the circ...
ffc93956a901ee5203ccacc33f6b0e2a3032e342
SPranathi/Games
/Tictactoe.py
3,869
4
4
import random #Displaying the board def display_board(board): print(board[7]+'|'+board[8]+'|'+board[9]) print('-----') print(board[4]+'|'+board[5]+'|'+board[6]) print('-----') print(board[1]+'|'+board[2]+'|'+board[3]) #Taking input from the player def player_input(): marker='' while marker!...
01d691404209fc72b233384c91f55e19d239fa91
andreasuarezc/Funciones_enPython
/9.py
699
4.1875
4
"""Elaborar una función que reciba tres enteros y nos retorne el valor promedio de los mismos""" def promedio(suma): return suma/3 #Bloque principal num1=int(input("Ingresar el primer valor")) num2=int(input("Ingresar el segundo valor")) num3=int(input("Ingresar el tercer valor")) suma=num1+num2+num3 print("El pr...
e228501165bbad52affa105f3d5238fff85c996f
andreasuarezc/Funciones_enPython
/10.py
1,247
4.03125
4
"""Cargar por teclado una lista de enteros en el bloque principal del programa. Elaborar tres funciones, la primera recibe la lista y retorna la suma de todos sus elementos, la segunda recibe la lista y retorna el mayor valor y la última recibe la lista y retorna el menor""" def suma(lista): suma=0 for x in ra...
d25edad719f29dc730ab2555cc633c2396339dab
cuppss/RezParse
/Code/extractPhone.py
476
3.8125
4
import re # using a regular expression with the re package to find the phone number in the resume def extract_phone(text): phone = open(text, "r") phone = phone.read() phone = re.findall(re.compile(r"\(?\b[0-9][0-9][0-9]\)?[-. ]?[0-9][0-9][0-9][-. ]?[0-9]{4}\b"), phone) if phone: number = '...
bd85181700cd235d164cc987d0e9993cb9fc3b18
aknowxd/python_cursoemvideo_1
/pythonProject/ex002.py
75
3.765625
4
name = input('Qual e seu nome? ') print("{}, seja bem-vindo!".format(name))
d9ab7fa8381ab8dce3eadd6c918ae51b6605ba55
aknowxd/python_cursoemvideo_1
/pythonProject/ex028.py
225
4.03125
4
import random n1 = random.randint(0,5) n2 = int(input('Digite um numero: ')) print("O numero do computador foi {}".format(n1)) if n2==n1: print("Voce acertou! Parabens!") else: print('Voce errou! Tente novamente!')
e9523c5c485bda5ad078c677d3118b896154069c
aknowxd/python_cursoemvideo_1
/pythonProject/ex022.py
403
3.875
4
name = str("Andre Luiz Pereira Oliveira") upper = name.upper() lower = name.lower() count = len(name) - name.count(" ") split = len(name.split()[0]) print("Seu nome eh: {}".format(name)) print("Nome com letras maisculas eh: {}".format(upper)) print("Nome com letras minusculas eh: {}".format(lower)) print("Quantidade d...
54cc71dc0b29e20569f52502c8eb37cd60d54dcc
aknowxd/python_cursoemvideo_1
/pythonProject/ex025.py
105
3.671875
4
nome = str ("CARLOS ALBERTO DA silva OLIVEIRA") nomex = nome.lower() x = 'silva' in nomex print("Tem silva no nome? {}".format(x))
7f958c67705bc489ac8001d929234c35eca7caf5
snebotcifpfbmoll/DAMProgramacion
/A01/P06/P06E11.py
870
4.0625
4
# P06E11: # Escribir un programa para jugar a adivinar un número (el ordenador "piensa" el número y el usuario lo ha de adivinar). El programa empieza pidiendo entre qué números está el número a adivinar, se "inventa" un número al azar y luego el usuario va probando valores. El programa va decidiendo si son demasiado g...
5dd34b7afa860ae0850d4e67bbda6e4ba8d5d647
snebotcifpfbmoll/DAMProgramacion
/A01/P05/P05E03.py
337
3.9375
4
# P05E03 # Escribe un programa que pida dos números y escriba la suma de enteros desde el primero hasta el último. num_1 = int(input("Escribe un numero: ")) num_2 = int(input("Escribe otro numero mayor: ")) total = num_1 for i in range(num_1 + 1, num_2 + 1): total += i print("La suma de", num_1, "hasta", num_2, "e...
3e36bd9835eda33ac3515a9c9bdd7f87dc424cda
snebotcifpfbmoll/DAMProgramacion
/A01/P06/P06E08.py
716
3.984375
4
# P06E08: # Escribe un programa que te pida primero un número y luego te pida números hasta que la suma de los números introducidos coincida con el número inicial. El programa termina escribiendo la lista de números. limite = int(input("Escribe el limite: ")) lista = [] suma = 0 while suma != limite and suma <= limite...
eefd9f6aeb29c35d565857819d325e7edd22106d
snebotcifpfbmoll/DAMProgramacion
/A01/P05/P05E08.py
349
4.125
4
# P05E08: # Escribe un programa que pida la anchura de un triángulo y lo dibuje de la siguiente manera: altura = int(input("Altura del triangulo: ")) for i in range(altura + 1): for j in range(0, i): print("*", end='') print("") for i in range(altura - 1, 0, -1): for j in range(0, i): print...
d8ed0c7ca4c75c9d4b136c2c921aa132abf60ca5
snebotcifpfbmoll/DAMProgramacion
/A01/simulacro-python-A01/SerafiNebotGinard.py
5,182
3.734375
4
# Serafi Nebot Ginard - Examen 1º DAM # Variables globales id_anterior = 0 total_copias = 0 lista_peliculas = [] # Añadir peliculas def anadir_peliculas(lista_peliculas): global total_copias global id_anterior print("="*24) print("Dar de alta nueva pelicula\n") ncopias_pelicula = int(input("Intro...
bb558b942130ccec628f3aeb551044c80744c276
snebotcifpfbmoll/DAMProgramacion
/A01/P03/P03E06.py
501
3.609375
4
# P03E06: Serafi Nebot Ginard # Pida al usuario el precio de un producto y el nombre del producto y muestre el mensaje con el precio del IVA (21%). Por ejemplo: “ Tu bicicleta vale 100 euros y con el 21 % de IVA se queda en 121 euros en total”. nombre_producto = input("Introduzca el nombre de un producto: ") precio = f...
0f38580736a44aac03d9f3aa23e910e9e7c958de
snebotcifpfbmoll/DAMProgramacion
/A01/P05/P05E09.py
430
3.84375
4
# P05E09: # Escribe un programa que pida la anchura y la altura de un rectángulo y lo dibuje de la siguiente manera: altura = int(input("Altura de un rectangulo: ")) anchura = int(input("Anchura de un rectangulo: ")) for i in range(altura): for j in range(anchura): if j == 0 or j == anchura - 1 or i == 0 o...
8532928e753be5e4f55f2d3c8c48d88804a9e229
snebotcifpfbmoll/DAMProgramacion
/A01/P04/P04E04.py
503
4.15625
4
# P04E04: Serafi Nebot Ginard # Pida al usuario tres números y un cuarto número, y compruebe si éste último es divisor de los tres números primeros. print("Introduzca tres numeros:") num_1 = int(input("1: ")) num_2 = int(input("2: ")) num_3 = int(input("3: ")) divisor = int(input("Ahora introduzca otro numero: ")) if n...
633d4d450984426f3e017cb8c1b4ca385670ef12
keelymo/bfs_ex
/ex.py
3,422
4.03125
4
#info from: https://www.youtube.com/watch?v=vzjg3T72tRs #reference: https://github.com/joeyajames/Python/blob/master/bfs.py class Vertex: def __init__(self, n): self.name = n self.neighbors = list() self.distance = 9999 self.color = 'black' def add_neighbor(self, v): if v not in self.neighbors: self...
3f64670cf0c6fb23ffc3252059463f1d34befeee
DSoutter/functions_lab
/start_point/src/python_functions_practice.py
1,003
4
4
def return_10(): return 10 def add(num_1, num_2): return num_1 + num_2 def subtract(num_1, num_2): return num_1 - num_2 def multiply(num_1, num_2): return num_1 * num_2 def divide(num_1, num_2): return num_1 / num_2 def length_of_string(string): return len(string) def join_string(string1, ...
065dab797bcd57bb9be5cbe14b9d28bd553e0b6d
hongsungheejin/Algo-Study
/ganta/brute_force/9663_N-Queen.py
886
3.578125
4
ans = 0 N = 0 column_check = [] diagonal_check1 = [] diagonal_check2 = [] def dfs(n): global N global ans global cloumn_check global diagonal_check1 global diagonal_check2 # row n, column i if n == N: ans += 1 return else: for i in range(N): ...
57b2746be6f86e35741e889f0acca705d5cb6697
hongsungheejin/Algo-Study
/songbae/Algo/TEST/upstage5.py
1,116
3.78125
4
from collections import Counter from collections import defaultdict def nth_lowest_selling(sales, n): """ :param elements: (list) List of book sales. :param n: (int) The n-th lowest selling element the function should return. :returns: (int) The n-th lowest selling book id in the book sales list. "...
a8b8bd2cc9088c9fb8dae947f344e2191504c34c
hongsungheejin/Algo-Study
/songbae/Algo/TEST/upstage7.py
312
3.828125
4
from collections import defaultdict def find_unique_numbers(numbers): temp=set(numbers) arr=defaultdict(int) temp1=set() for i in numbers: arr[i]+=1 if arr[i]>1: temp1.add(i) return temp-temp1 if __name__ == "__main__": print(find_unique_numbers([1, 2, 1, 3]))
c76aa22a4ef7b208215be78cee852b0a065eba4c
hongsungheejin/Algo-Study
/ganta/brute_force/2580_스도쿠.py
1,417
3.78125
4
board = [] search_point = [] check_list = [[[0 for i in range(9)] for j in range(3)] for k in range(10)] # 10, 3, 9 -> (1 ~ 10 까지), (행,열,사각형 체크), 9개씩 def search(depth): # 끝까지 돌았으면 if depth == len(search_point): for row in board: print(*row) # 혼난 부분 exit() r, c = search_poi...
a1e28ed1b6e1c3ec3d6e3f649ebefb25122cd550
SeokgyuHong/personal_study
/이것이취업을위한코딩테스트다/이진탐색/부품찾기.py
578
3.921875
4
import sys def binarySearch(array,target,start,end): if start>end: return print("No") mid = (start+end)//2 if target == array[mid]: return print("Yes") else: if target<array[mid]: binarySearch(array,target,start,mid-1) else: binarySearch(array,ta...
623e40300c8ba061b0aa86e5c67eaf1eed2408e8
JDUO61299/COM404
/0-setup/main.py
223
3.984375
4
name = input("please enter a name") age = int(input("please enter an age") height = 1.8 initial = 'J' isAwesome = True age = age+1 print("Hello, " + name + " you are " + int(age) + " years old ") print("yay "*10)
42c25ca679fba14adb6f7b71fb36359986ec2e21
JDUO61299/COM404
/1-basics/4-repetition/1-while-loop/7-factorial/bot.py
173
4.15625
4
print("please enter a number:") num = int(input()) total = num count = num-1 while count > 0: total = total*count count -= 1 print("the factorial is" + str(total))
4f878caa6f4db19561cd37ed3fa41f541f056b83
JDUO61299/COM404
/1-basics/4-repetition/1-while-loop/1-simple/bot.py
145
4.0625
4
print("how many cables should i remove?") cables = int(input()) removed = 0 while removed < cables: print("removed cable") removed +=1
411a281ae6f4077e1ee3504f347a6627a840d5ef
zqkal/Exercism
/python/pangram/pangram.py
291
3.71875
4
def is_pangram(sentence): sentence_given = str(sentence).lower() letters = "abcdefghijklmnopqrstuvwxyz" result2 = [l for l in letters if l in sentence_given] print(result2) print(len(result2)) if len(result2) == 26: return True else: return False
006d210b436e1014d0d1564d489d2b7dafe3ed7e
ZoeCD/Mision-02
/coordenadas.py
406
3.71875
4
# Autor: Zoe Caballero Dominguez, A01747247 # Descripcion: Dada la velocidad por el usuario, se calcula cuanta distancia es recorrida en 7 y 4.5 horas; y el tiempo que lleva recorrer 791Km # Escribe tu programa después de esta línea. x1 = int(input("x1:")) y1 = int(input("y1:")) x2 = int(input("x2:")) y2 = int(input(...
62c83fe47a86e8126407850e420638503d6a8eb7
Yuhjiang/CompleteProgram
/设计模式/行为模式/State.py
2,663
3.703125
4
""" 状态模式 """ from abc import abstractmethod, ABCMeta # class State(metaclass=ABCMeta): # @abstractmethod # def handle(self): # pass # # # class ConcreteStateA(State): # def handle(self): # print(f'{type(self).__name__}') # # # class ConcreteStateB(State): # def handle(self): # ...
5a54ee7f31839316c86b77de494fd45ef3d23966
Yuhjiang/CompleteProgram
/算法/树/binary_tree.py
1,260
4.09375
4
""" 二叉搜索树 """ from typing import Optional class TreeNode: def __init__(self, element: int): self.element: int = element self.left: Optional[TreeNode] = None self.right: Optional[TreeNode] = None def find_min(self): temp = self while temp.left: temp = temp.l...
ad5164a40db7d92c269e3817682a73bfc065eee4
himalayaashish/ML
/Python General/feature_scaling.py
3,253
3.53125
4
import numpy as np import pandas as pd import pandas as pd from sklearn import preprocessing import matplotlib import matplotlib.pyplot as plt import seaborn as sns ################################################## #"https://jovianlin.io/feature-scaling/" #"https://towardsdatascience.com/scale-standardize-or-normaliz...
b87def088fb770e9fe79fe37d6e85a1f24d384b9
BM-Rohith/Learn-DataStructures-and-Algorithms-with-Hackerrank-Solutions
/LearnAlgorithms/Sorting Algorithms/InsertionSort/InsertionSortP2.py
669
3.875
4
#complete insertion sort import math import os import random import re import sys # Complete the insertionSort2 function below. def insert(n, arr, var): inserted = False for i in range(n-1, 0, -1): if arr[i-1] > var: arr[i] = arr[i-1] else: inserted = True ...
6fff48cfcd6deec5c98135a7b2a73ebf40e253d0
BM-Rohith/Learn-DataStructures-and-Algorithms-with-Hackerrank-Solutions
/Data Structures Problems(python)/Stack/MaxEle.py
495
3.65625
4
# Enter your code here. Read input from STDIN. Print output to STDOUT from queue import LifoQueue # Initializing a stack maxq = [] n = int(input()) for i in range(n): Intype = (input().split(' ')) ty = int(Intype[0]) if ty == 1: ele = int(Intype[1]) if len(maxq) == 0: maxq...
8aa3b60ec6ea65f913d029258e0ce7f3162b265a
h-varma/Team-11
/src/unit3/transform.py
445
4.34375
4
import numpy as np def area_circ(r_in): """ Calculates the area of a circle with given radius. :Input: The radius of the circle (float, >=0). :Returns: The area of the circle (float). """ if r_in < 0: raise ValueError("The radius must be >= 0.") area_out = np.pi * r_in ** 2 pri...
05d015f235579bc0157206ec1578f0b1c531cf98
Ninja1729/CRF
/ghj.py
134
3.609375
4
arr = [1,2,3,4,5] c = 0 tot = len(arr) for i in arr: c += 1 if tot == c: print("yes") else: print("no")
e5ffde9108259fa4ec328e138c6067365df9c38a
demirezenmert/python_miniProject
/math_Game/main.py
859
3.765625
4
# Created by Mert Demirezen # Copyright © 2019 Mert Demirezen. All rights reserved. from game import game gm = game() def menu(): print(''' Which level do you want to keep game (For Exit please Enter : -1) ? For Easy Press 1 For Middle Press 2 For Hard Press 3 ...
e81606c9e0cb75fabfa9306cce4e1854d13b6b69
balafuente/ProgrammingLanguages
/ProgrammingLanguages/pythonProject.py
10,667
4.25
4
#Blake LaFuente #COSC 341 Assignment 9 #Python Project #value of pi returned based on term in infinite series def compute_pi(n): answer = 0.0 denominator = 1 for k in range(0,n): if k % 2 == 0: #Even terms are added answer = answer + (1.0/denominator) else: #odd te...
221c34c3485e3e8bbcd51748fe7a3897154bb798
davidfabian/46excercises
/excercises/task_13.py
521
4.28125
4
__author__ = 'd' ''' The function max() from exercise 1) and the function max_of_three() from exercise 2) will only work for two and three numbers, respectively. But suppose we have a much larger number of numbers, or suppose we cannot tell in advance how many they are? Write a function max_in_list() that takes a list ...
56f8d8094e9249574a2bde41a291a6e1e9d8fa7e
davidfabian/46excercises
/excercises/task_37.py
1,509
4.1875
4
__author__ = 'd' ''' Write a program able to play the "Guess the number"-game, where the number to be guessed is randomly chosen between 1 and 20. (Source: http://inventwithpython.com) This is how it should work when run in a terminal: >>> import guess_number Hello! What is your name? Torbjörn Well, Torbjörn, I am thi...
d813672c8d39d48f4198053d805ff7e0e71a4dbe
davidfabian/46excercises
/excercises/task_27.py
769
4.21875
4
__author__ = 'd' ''' Write a program that maps a list of words into a list of integers representing the lengths of the correponding words. Write it in three different ways: 1) using a for-loop, 2) using the higher order function map(), and 3) using list comprehensions. ''' # simple for loop def lenlist1(lista): ...
01ebb72d048c44e519e9e99aadb939f42eea093f
davidfabian/46excercises
/excercises/task_6.py
471
3.953125
4
__author__ = 'd' ''' Define a function sum() and a function multiply() that sums and multiplies (respectively) all the numbers in a list of numbers. For example, sum([1, 2, 3, 4]) should return 10, and multiply([1, 2, 3, 4]) should return 24. ''' def summ(a): result = 0 for i in a: result += i pr...
aa49e2a97926a848012ed465d4e38fd19d44c7cd
RikiishiSuzunosuke/aloha
/basic37_2.py
289
3.8125
4
list = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]] #flatten = [list[i][j] for i in range(len(list)) for j in range(len(list[1]))] flatten = [i for data in list for i in data] # listの要素をdataに代入する # dataの要素をiに代入する # iをflattenに格納する print(flatten)
fe8d7184b7f470db23b0275f93b0a885de84a4b1
wlwl1011/minzzl
/py_lab/aver_num.py
172
4.03125
4
#!/usr/bin/python3 input1 = int(input("Please input the number")) mysum=0 element=0 for i in range(0,input1): element=int(input()) mysum+=element print(mysum/input1)
f3c453f60bc0502004e556926aeaf5b5165a1772
lis17/m02_boot_0
/perro.py
525
3.78125
4
class Perro(): #el nombre de la clase siempre empieza en mayuscula def __init__(self, nombre, edad,peso):#función constructora, crea la instancia self.nombre = nombre self.edad= edad self.peso= peso def ladrar(self):#siempre poner self aunq luego no se pone cuando se invoca el métod...
16ff7e2a508be902c468fc631af2ea81d6d77e8d
rodrigorahal/advent-of-code-2017
/2/checksum_part_1.py
591
3.640625
4
def row_min_max(row): nums = row.split() smallest = min(int(num) for num in nums) largest = max(int(num) for num in nums) return smallest, largest def checksum(spreasheet): diffs = [] for row in spreasheet: smallest, largest = row_min_max(row) diffs.append(largest - smallest) ...
d10050f0e861d20ca96954d7d390fe8944cc78f3
rodrigorahal/advent-of-code-2017
/12/digital_plumber_part_2.py
1,145
3.75
4
from collections import defaultdict from digital_plumber_part_1 import bfs def add_connection(graph, vertices, row): nodes = row.split() parent = nodes[0] vertices.add(parent) for child in nodes[2:]: graph[parent].append(child.strip(',')) vertices.add(child.strip(',')) def make_graph(c...
bc845bd8b9d031714933b64d6669384d60e2e949
themagpimag/magpi-issue111
/SensoryWorld1/fire_gas_alarm.py
624
3.609375
4
from gpiozero import Button, LED, Buzzer from time import sleep flame = Button(21) gas = Button(14) led = LED(16) buzzer = Buzzer(25) def fire_alarm(): print("Fire! ", end = "\r") for i in range (10): led.toggle() buzzer.toggle() sleep(0.5) def gas_alarm(): print("Gas leak!...
1977291402c9b000adf4c5490197f893b01fca27
andersonlemos/PythonForZombies
/Task List/exercise2.py
380
3.5
4
# coding: utf-8 import os, math tamanhoMetrosQuadrados = float(raw_input("Digite o tamanho em m2: ")) litrosDeTinta = tamanhoMetrosQuadrados / 3.00 latasDeTinta = math.ceil(litrosDeTinta / 18.00) valorLatasDeTinta = latasDeTinta * 80.00 print ('Litros de tinta %5.2f ' % litrosDeTinta) print ('Latas de tinta %5.2f ' %...
b4e3b81bc21ee7889021e934da9f35d421c8e8c1
andersonlemos/PythonForZombies
/Modules/modules1.py
209
3.6875
4
# coding: utf-8 def embaralha(palavra): import random lista = list(palavra) random.shuffle(lista) return ''.join(lista) frase = raw_input("Digite uma palavra : ") print(embaralha(frase))
98be9976a9b74b08cc1fe82203bdc21cf66594cb
andersonlemos/PythonForZombies
/Classes and Object/classes1.py
472
3.84375
4
#!/usr/bin/python # -*- coding: utf-8 -*- import datetime class Pessoa(): def __init__(self, nome, nascimento): self.nome = nome self.nascimento = nascimento def idade(self): dataAtual = datetime.date.today() - self.nascimento return int(dataAtual.days/365) def __str__(self...
d07c3526f87b0689baeb94e9ec113b6538777ea7
andersonlemos/PythonForZombies
/Task List/exercise1.py
290
4.09375
4
# coding: utf-8 import os contador = 1 maiorNumero = 0 while contador <= 3: inputNumber = int(raw_input("Digite um número inteiro: ")) if inputNumber > maiorNumero: maiorNumero = inputNumber contador += 1 print('O maior número digitado foi : %d' % maiorNumero)
bccb90c2ff95d7c740ca178a76e9ac2878bbf102
andersonlemos/PythonForZombies
/Task List/exercise6.py
266
4.21875
4
# coding: utf-8 maiorNumero = 0 contador = 1 while contador <= 3: numero = int(raw_input('Digite o %s º número : ' % str(contador))) if numero > maiorNumero: maiorNumero = numero contador += 1 print ('Maior número é %d ' % maiorNumero)
dc317ff2f1467669bbb60460fc88c29ce66f01dd
coolzosel/ncs-python
/step1_oop/grade.py
1,190
3.9375
4
''' 클래스에 학생의 이름을 입력하면 해당 학생이 얻은 '국어','영어','수학' 3과목의 평균 점수에 따라 A-F까지 출력하시오. 해당 문제를 해결하기 위해서는 72페이지의 리스트를 참조하세요. ''' class Grade: def __init__(self, name): self.name = name self.marks = [] # list로 초기화 def addMarks(self, mark): self.marks.append(mark) def avg(self): return su...
82795f366606c36b4dbb00ead95ccd1d54f56cea
andraderaul/estatistica-aplicada
/modamediamediana.py
2,199
3.5
4
#!/usr/bin/python # -*- coding: utf-8 -*- import math as mp #leitura do arquivo def readArq(): arquivo = open('dados.txt','r') vector = [] line = arquivo.readline() while len(line) is not 0: aux = line.split('-') for i in aux: vector.append(float(i)) line = arquivo....
2bc54ab017c80723076faa7419566fb3d4ff8605
amukherjee01/Complete-Python-Tutorial-and-Notes-master
/32. Recursive Vs Iterative Approach.py
892
4.1875
4
def print2(str1): # print2("Aditya") #Recursion happens print("This is " + str1) print2("Harry") # output: Recursion error [Previous line repeated 996 more times] #Iterative approach def factorial_iterative(n): fac = 1 for i in range(n): fac = fac * (i+1) return fac inp = int(input("Ent...
9c53c0b0d5634a22cfad58b0a701fdf01d272223
amukherjee01/Complete-Python-Tutorial-and-Notes-master
/37. args and kwargs In Python.py
2,709
4.46875
4
# def function_name_print(a, b, c, d): # """ Prints name of name """ # print(a, b, c, d) # function_name_print("Harry", "Rohan", "Aditya", "Larry") # Args also known as variable argument. Type of args is tuple. # Now we can pass any number of arguments in funcargs function. def funcargs(normal, *args): ...
532027f9f569d695d1a57a78cffc11c5787d2f0a
AitorDeveloper/mit6.00x
/exam1/problem10.py
440
3.703125
4
def numPens(n): """ n is a non-negative integer Returns True if some non-negative integer combination of 5, 8 and 24 equals n Otherwise returns False. """ for x in range(n / 24 + 1): for m in range(n / 8 + 1): for s in range(n / 5 + 1): if x * 24 + m * 8 + s ...
3b6c11a45d43812d8d31644f2c265cb407b3fd6e
soumitra9/Linked-List-1
/delete_n_node_from_end.py
892
3.703125
4
# Time Complexity : Add - O(n) # Space Complexity :O(1) # Did this code successfully run on Leetcode : Yes. # Any problem you faced while coding this : No ''' 1. fast is moved upto n location 2. Then both slow and fast is moved untill fast == None 3. Now slow.next = slow.next.next is performed which forms a skip con...