blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
d316867cb53d1a2e563d8dc8ec620e0e4f2aafb6
jmanchuck/make_24_py
/tests.py
589
3.5625
4
import unittest import math from game import * class TestAll(unittest.TestCase): def test_get_pair(self): arr = [1, 2, 3, 4] pair_list = set() for x, y, lst in get_pair_and_remaining(arr): tpl = (x, y, lst[0], lst[1]) pair_list.add(tpl) self.assertEqual(le...
74f810ff145b1b764437d2ffa79d1b5473bd886b
benny83324/driving
/driving.py
417
4.15625
4
country=input("Which country were you from(Taiwan or US):") age=int(input("How old are you:")) if country == "Taiwan": if age >= 18: print("you are able to apply a license") else: print("you are not able to apply a license") elif country == "US": if age >= 16: print("you are able to apply a license") else: ...
0f9638b73f515a93f74853828e3c9a586fc0756e
bdugersuren/exercises
/cses/chessboard.and.queens.py
501
3.796875
4
""" https://cses.fi/problemset/task/1624 Example input: ........ ........ ..*..... ........ ........ .....**. ...*.... ........ Example output: 65 """ arr=[input(),input(),input(),input(),input(),input(),input(),input()] #No queen can be in the same column, row a=arr[:] for y in range(8): a+=[''.join([x[y] for x i...
054344ad6611a541da731fb36e2a345d04c26d55
bdugersuren/exercises
/cses/coin.piles.py
429
3.734375
4
# https://cses.fi/problemset/task/1754 #readable version """ n=int(input()) l=[input().split() for x in range(n)] l=[list(map(int,x)) for x in l] for x in l: if (sum(x)%3!=0) or (x[0]*2<x[1] or x[1]*2<x[0]):print("NO");continue print("YES") """ #short version: for x in [list(map(int,x)) for x in [input().split(...
fcedbec4c9a23133431637dd7bcd5be84a4d783d
vkushwaha/Titanic_Data_Analytics
/Titanic/GetData1.py
1,375
3.890625
4
#The first thing to do is to import the relevant packages # that I will need for my script, #these include the Numpy (for maths and arrays) #and csv for reading and writing csv files #If i want to use something from this I need to call #csv.[function] or np.[function] first import csv as csv import numpy as np #Op...
3d3cbd11a58547b2708751471214e56da6a9e573
narendrai1211/basic_programs
/basic_python_programs/list_user_input.py
320
3.859375
4
list_superheros = [] def user_input_superheros(): while True: user_input = str(input("Enter name PRESS q to finish:")) if user_input == 'q' or user_input == 'Q': break else: list_superheros.append(user_input) return list_superheros list_super = user_input_superheros() print('The list is', list_super)
259a9cbebe905fdcc2f2274c8fe15e75b09b8496
narendrai1211/basic_programs
/basic_python_programs/generator_tutorial.py
340
3.625
4
def csv_reader(file_name): for row_ in open(file_name, "r"): yield row_ if __name__ == '__main__': row_count = 0 csv_gen = csv_reader('../hadoop_concepts/input_file_to_map.txt') for row in csv_gen: print(row) if row != '\n': row_count += 1 print(f"Row count...
d76bf564d4e29e7070ebe67b3c9701e76d76c04d
narendrai1211/basic_programs
/basic_python_programs/email_masker.py
607
3.65625
4
def str_replacer(string_): total_len = len(string_) list_ = [] for i in range(1, total_len - 1): char_ = s[i].replace(s[i], '*') list_.append(char_) return list_ if __name__ == '__main__': s = 'narendra@example.com' email_split = s.split('@') part_1 = email_split[0] par...
7cdbf060bcfb6306b1d4b1661180177deba22f9f
narendrai1211/basic_programs
/basic_python_programs/iterator_tutorial.py
295
3.828125
4
d = [1, 2, 3, 4, 5] # list of int declaration list_iterator_obj = iter(d) print(list_iterator_obj.__next__()) print(list_iterator_obj.__next__()) print(list_iterator_obj.__next__()) print(list_iterator_obj.__next__()) print(list_iterator_obj.__next__()) print(list_iterator_obj.__next__())
33e7232989d6336c884bee8a2029429cb53c8009
narendrai1211/basic_programs
/basic_python_programs/list_methods.py
1,252
4.03125
4
import random list1 = [] list_num = [] def append_sachin(): for i in range(1, 2 + 1): list1.append('sachin') def append_nums(): for i in range(1, 10 + 1): x = random.randint(1, 100) list_num.append(x) return list_num def sort_tutorial(): numbers = append_nums() print('original list ', numbers) numbers...
8306fd27ce04badb4223f7a6ddcc59ad5d483413
narendrai1211/basic_programs
/basic_python_programs/matrix_multiplication.py
1,918
3.609375
4
import copy import sys import numpy as np mat_1 = np.array( [ (1, 2, 3), (4, 5, 6), (7, 8, 9) ] ) mat_2 = np.array( [ (1, 2, 3), (4, 5, 6), (7, 8, 9) ] ) def matrix_multiplication(): f_result = mat_1 * mat_2 print(f_result) return f_result...
cc859528b69438b3e549413a7bee1bb0c5bea2b9
Roooooobin/Python-Cookbook-Practice
/Chapter2.Strings and Text.py
5,169
3.78125
4
""" # -*- coding: utf-8 -*- # @FileName: Chapter2.Strings and Text.py # @Author : Robin # @Time : 2019/12/13 19:27 """ import re def split_strings(): """ re.split(pat, string) r'[\s,;]\s*' """ line = 'asdf fjdk; afed, fjek,asdf, foo' words = re.split(r'[\s,;]\s*', line) print(words) ...
05300fcf3d4633c8e665f06f0303fbedc6b390b3
alu-rwa-dsa/week-3---dynamic-array-linda_david_calebcohort1
/testquestion4.py
970
3.71875
4
import unittest from question4 import Dictionary class TestAssociation(unittest.TestCase): # question 4(a) -- Testing if the method can add an item def testAddition(self): data = {"name": "Kamali", "age": 45} forTest = Dictionary.addition(data) self.assertNotEqual(forTest, "Karemera") # qu...
b1a990d7bbf018eab4f500f2d378781ae4fb67f4
janithbandara96/ObjectDetectionData
/renameFiles.py
887
4.03125
4
#!/usr/bin/python import os import sys # Function to rename multiple files def main(): i = 1 path = input("Enter path to bulk rename folder: ") #path="E:/Outside Fiverr/uziel/Object Identifying Project/Training/cascade_training_part2_try1/n/" #print("\nThis will rename all files at "+path) #print("...
bf341bc43079747a7afb97e6ef44633e46832499
jacobbjo/AI_A4
/Sheep.py
6,453
3.8125
4
import numpy as np import matplotlib.pyplot as plt from importJSON import Map from Animal import Animal from math import * # Global variables defining the sheep behavior SHEEP_R = 0.7 # The space the sheep wants between them SPACE_R = 3* SHEEP_R RANGE_R = 3* SHEEP_R BUMP_h = 0.2 # Value from the paper. Used in the b...
ffcf062f4fbf93059f0ba7e57a975bced54bc15a
Sarefx/Treehouse-Python
/Python Sequences/concat.py
119
3.65625
4
object1 = [1,2,3,4,5] object2 = [6,7,8,9,10] object1 = object1 + object2 print(object1) str = 'python' print(str*5)
8aae2374555853bf881134572293f6e2cc4fdeb6
manos-mark/proportional-robot-controller
/main.py
2,456
3.703125
4
import time import matplotlib.pyplot as plt import numpy as np from robot_module import Robot from controller_module import Controller # K is the constant we adjust to change robot behavior K = 0.3 # Δt - constant iteration_time_sec = 0.001 # Target position target_pos = np.array([-1, -2]) # Initialize a Robot obj...
b73665dbaf0a176f18f325033cc9f131c70acbbb
Ferretelic/TaxiControll
/set_field.py
6,315
3.609375
4
import matplotlib.pyplot as plt import numpy as np import math import random import time from fractions import Fraction class Map: roads_cost = {} roads_point = {} roads_every_cost = {} point_connection = {} def point(self, point_coordinate_x, point_coordinate_y, graph_number): self.point...
3f05cd7f304c6d230822d71bd6af8fc8ad872666
Ccode-lang/py2v
/examples/prompt.py
143
3.984375
4
while True: name = input("What's your name? (type <quit> to quit)") if name == '<quit>': break print('Hello ' + name + '!')
62d1016995fc8cb58c2406b01e25592d29fd1233
ellakcd/week-2
/wordcount.py
1,820
3.890625
4
# put your code here. """ initialize dictionary open the file split it on any space iterate over the list use .get to check if word is in the dictionary if it is, we'll increment the current value by 1 print dictionary with the format, key " " value """ from sys import argv from collections import Counter # TODO: Fi...
0fef213732294955bc59051218301920e036ff1e
santiagokazlauskas12/largest_number
/santi_number.py
551
3.875
4
""" * [1] => 1 * [1, 2] => 1 * [1, 1, 3, 3, 3, 4, 4, 4, 4] => 3""" import math lista=[1, 1,1,1,1, 3, 2, 2, 2, 2, 2, 3, 3, 4, 4, 4,4, 4] def max_repeat (list_numbers): dic={} max_list=[] for number in list_numbers: if number not in dic: dic[number]=1 elif number in d...
4953fabc1393f3d9482f7e3cc3d1425c029c1c21
felixmeyjr/PiDigitsVisualizer
/pidigitsvisualizer.py
1,424
4.0625
4
# PI digits distribution/occurrence visualizer """ Get digits of pi Calculate distribution for given interval Plot Repeat for a nice flow Later: User Input: how many digits? """ from mpmath import mp import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation def calculateDigits(limit): # U...
0ec793412d900461d73b9ad2a109fbfcf12b25ac
nicovenegas2/Grafy-Visualization
/PYC.py
1,674
3.640625
4
class Pila(): def __init__(self): self.contenido = [] self.cantidad = len(self.contenido) def revisarActual(self): return self.contenido[self.cantidad-1] def obtener(self): if self.cantidad != 0: salida = self.contenido[self.cantidad-1] self.cont...
6f405b653a7170f946f5867a50c12763d0379ad2
KivyAcademy/Kivy_training
/basic/03_custom_app.py
1,046
3.546875
4
# -*- coding: utf-8 -*- ## https://kivy.org/doc/stable/guide/basic.html#quickstart from kivy.app import App import kivy kivy.require('1.10.1') ## This class is used as a Base for our Root Widget (LoginScreen) defined later from kivy.uix.gridlayout import GridLayout from kivy.uix.label import Label from kivy.uix.textin...
5dd0acc1b3d2f1acd721f72fb63f39464124bbc4
victorliaocs/pythonTurtleInChinese
/examples/examples_tc/ryBytedesign.py
4,636
3.71875
4
''' ryByteDesign.py 呂仁園 中文程式翻譯 2014/05/19 翻譯原則: python keyword 不翻 單字母變數 不翻 ''' #!/usr/bin/env python3 """ turtle-example-suite: tdemo_bytedesign.py An example adapted from the example-suite of PythonCard's turtle graphics. It's based on an article in BYTE magazine Problem Solving with ...
ddf351cd57690dbebe29a660ba6b03c20b2f0277
berinhard/my_dojo_resolutions
/20100701_python_sueca/sueca.py
878
3.578125
4
valores = { 'A':11, '7':10, 'K':4, 'J':3, 'Q':2, '2':0, '3':0, '4':0, '5':0, '6':0, } class Carta(object): def __init__(self, naipe, nome): self.naipe = naipe self.nome = nome class Jogada(object): def __init__(self, jogador, carta): self.jogad...
6a0f6917c019957ea3953cf5ee363f6a7268b90b
battulat2/Scripts
/Set1.py
1,384
3.6875
4
# -*- coding: utf-8 -*- """ Created on Tue Feb 26 12:36:23 2019 @author: TBattula """ #set - group of elements. set elements are defined in the {}. Indexing is not permitted. aset = {10,20,30,40,10} print(aset) #removing duplicates - convert to the set alist = [10,20,30,40,10,20] print(set(alist)) #list - set c...
4c1daf1b67f7391cb62b63b7b44ac430e53d2efd
battulat2/Scripts
/ip_q2.py
649
3.75
4
# -*- coding: utf-8 -*- """ Created on Wed Feb 27 10:55:17 2019 @author: TBattula """ ''' write a program to validate the IP address. Enter any IP : 129.4.9 Status : invalid IP Enter any IP : 124.5.43.4 Status : valid IP ''' ''' ip = input("Enter the IP address:") ip_split=ip.split(".") ip_dotcnt=li...
0b3a55b76b643d026f8ff4aae212636b3e45c7dc
battulat2/Scripts
/continue.py
198
3.890625
4
# -*- coding: utf-8 -*- """ Created on Wed Feb 27 11:15:26 2019 @author: TBattula """ usip =int(input("Enter the input")) for val in range(1,10): if val==usip: continue print(val)
2e9cddfdf058f7bb8390b2b2fdae09b213a975d1
usrcoin-interesting/matasano
/set_1/2_fixed_xor.py
345
3.578125
4
def xor(in1, in2): return "".join([chr(ord(x) ^ ord(y)) for x, y in zip(in1, in2)]) def main(): in1 = "1c0111001f010100061a024b53535009181c".decode("hex") in2 = "686974207468652062756c6c277320657965".decode("hex") result = xor(in1, in2) print(result) print(result.encode("hex")) if __name__ =...
d15850436cd0effd35e03aadcc5f6e23fe1a100d
samujjwaal/OpenCV-Course
/3.Face and Feature Detection/eye_detection.py
656
3.53125
4
import cv2 img = cv2.imread("faces.jpeg", 1) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # path of pre trained model path = "haarcascade_eye.xml" # load pre trained model as cascaded classifier eye_cascade = cv2.CascadeClassifier(path) # perform face detection eyes = eye_cascade.detectMultiScale( gray, scaleFa...
0e141e2515e24669d38ed79f6e21700e5826fac1
pkrishn6/problems
/api/undirected_graph.py
1,709
3.59375
4
from collections import defaultdict class Graph: def __init__(self, edges): self.g = defaultdict(list) self.seen = [] for node, neighbor, _ in edges: self.g[node].append(neighbor) self.g[neighbor].append(node) self.vertices.append(node) def dfs(self, ...
dabe86c8430c6553775c5b7bf1f3c0fbcecf257d
pkrishn6/problems
/api/prefixTree.py
834
3.890625
4
class TreeNode: def __init__(self, v): self.left = None self.right = None self.val = v def prefixTree(expr): if not expr: return None ch = expr[0] expr = expr[1:] node = TreeNode(ch) if expr and expr[0] in ["+", "-", "*", "/"]: node.left, expr = prefi...
754c0738fe96027a7e4b9a47ceecb7a1d24aa88c
pkrishn6/problems
/api/simpifyPath.py
654
3.78125
4
def simplifyPath(input): if not input: return "" stack = [] if input[0] == '/': stack.append(input[0]) for token in input.split('/'): if token == "..": if stack and stack[-1] == "..": stack.append(token) elif stack[-1] == "/": ...
e398c95e1478cfa889153079df1dc6f5aa2320b1
NTHU-CS50-2020/week6
/lun6/credit.py
441
3.875
4
# python credit.py from cs50 import get_int h=get_int("Number:") while h<=0 : print("INVALID") h=get_int("Number:") d=1 while h//(10**(d-1))>10: d+=1 #print(d) f=h//(10**(d-2)) #print(f) if d==15 and (f==34 or f==37): print("AMEX") elif d==16 and (f==51 or f==52 or f==53 or f==54 or f...
8e0e825c49650cf50db4540a5d4788ec8ab10ee8
NTHU-CS50-2020/week6
/lun6/mario_more.py
219
3.90625
4
#h=int(input("Height:")) from cs50 import get_int h=get_int("Height:") while not(h>0) or h>8: print("invalid") h=get_int("Height:") for i in range(h): print(f" "*(h-i-1),"#"*(i+1)," ","#"*(i+1)," "*(h-i-1))
1bb434ee8f6ecce58c5c47c10df49c3b304668a6
marta0502/AI
/乘法.py
145
3.859375
4
for i in range(1, 10): for j in range(1, 10): product = i*j print("%d * %d = %2d" %(i, j, product), end = "") print()
5c16325518293a300028b6927bb5019491ca3cca
grGrimales/python
/Practicas_if.PY
304
3.84375
4
#Condicional IF print ("Inicia programa de evaluacion de alumnos") #Introducir un valor por teclado nota_alumno = input ("Introduce la nota del alumno") def evaluacion(nota): valoracion = "Aprobado" if nota < 5: valoracion = "Reprobado" return valoracion print (evaluacion(int(nota_alumno)))
a548add1c80a8ecc7494c6d40fd273d1fcd2093d
grGrimales/python
/metodosCadena.py
569
3.90625
4
#lower ponemos el nombre en minuscula, capitalize pone la priumera letra en mayuscula nombreUsuario=input("Introduce un nombre de usuario: ") print("Nombre de usuario", nombreUsuario.lower()) #isdigit es un booleano y nos sirve para indicar si se introduce numeros con fase y true edad=input("Introduce tu edad: ") pri...
ad4fdea05dd676f6ad324de6d41eda16b28010f4
grGrimales/python
/PracticaExcepciones2.py
582
3.921875
4
def evaluaEdad(edad): if edad <0: raise ValueError (" La edad no puede ser negativa") if edad <20: print("Eres muy joven") elif edad <40: print("Eres joven") elif edad <65: print("Eres maduro") elif edad <100: print("Cuidate...") evaluaEdad(108) import math def calculaRaiz (num1): if num1<0: rai...
ef0a7e34873cf9f1ac6a8c650f9b907b863ea7f7
grGrimales/python
/EjerciciComprobacionEmail.py
298
4
4
email=input("Introduce tu direccion de email: ") contador_arroba=0 for i in email: if i =="@": contador_arroba=contador_arroba+1 if contador_arroba==0 or email.startswith("@") or email.rfind("@"): print("El correo no es valido") else: print("El correo es correcto") print(email.rfind("@"))
e26dfb3d096c0a37835db0e27d741de7d301011a
grGrimales/python
/Practica bucle while.py
1,399
3.859375
4
i=1 while i<=10: print("Ejecucion" + str(i)) i=i+1 print ("Termino la ejecucion") edad=int(input("Introduce tu edad por favor: ")) while edad<0: print("Has introducido una edad negativa. Vuelve a intentarlo") edad=int(input("Introduce tu edad por favor: ")) print ("Gracias por colaborar puedes pasar") print ("E...
dc2c3b2f923986d9a798bb11d87aa994dc43f47d
grGrimales/python
/ejerciciodeverificaciondeemail.py
324
3.796875
4
email= input("Introduce tu correo electronico por favor: ") contadorArroba=0 contadorPunto=0 for i in range (len(email)): if email[i]=="@": contadorArroba=contadorArroba+1 if email [i]== ".": contadorPunto=1 if contadorPunto==0 or contadorArroba!=1: print ("email es incorrecto") else: print("Email es correct...
07ecc6cd8e6b2c9864ef001cc9a64055ab471e4f
grGrimales/python
/ejemplo_documentacion.py
1,033
3.59375
4
def areaCuadrado(lado): """calcula el area cuadrada de un cuadrado, elevando al cuadrado el lado pasado por parametro""" return "El area del cuadrado es: " + str(lado*lado) def areaTriangulo(base,altura): return "El area del triangulo es: " + str((base*altura)/2) print(areaCuadrado(3)) print(areaTriangulo(4,6)) ...
2b90cf4af2e87d2fa6f77d822d81c7cc9fa3a4cc
grGrimales/python
/PuebaasExcepciones2.py
355
4.0625
4
def divide (): try: num1=(float(input("Introduce el primer valor: "))) num2=(float(input("Introduce el segundo valor: "))) print("Este es el resultado" + str (num1/num2)) except ValueError: print("El valor introducido es erroneo") except ZeroDivisionError: print("No se puede dividir entre 0!") print("La ...
a386aebc9d75349214fc74985a414183916a7da3
islamn4/BNFO-420-Clustering-Project
/NCBI_Fasta_Functions.py
4,647
4.125
4
#Author: Stephen Shea #Created: 4/2/20 """ The functions return specific parts of a single NCBI fasta header. """ import re def check_ambiguous_bases(seq): """ A function that looks for ambiguous nucleotides. The ambiguous nucleotides include, without the quotes, the following: "N", "R", "Y", ...
632e44c06f3c7480819c849e9df59de0c7260619
Darshan110801/Simsort
/stack.py
748
3.734375
4
class Node: ele = None next = None def __init__(self, ele): self.ele = ele self.next = None class Stack: __top = None def __init__(self): self.__top = None def push(self, ele): node = Node(ele) node.next = self.__top self.__t...
6f6c0abd1a3b6842c3ab8685cc81b20f64244dd2
set123ed/KataAnagramGroup9
/Anagrams.py
835
3.59375
4
import time from typing import Dict def read_file(path): with open(path) as f: for l in f: check(l.rstrip("\n")) def sanitize(word): return str(sorted(word)) dic: Dict = {} def check(word): key = sanitize(word) match = key in dic if match: dic[key].append(word) else...
263ed09fcbd0340d7aa31848b4d08c55727243f9
javierramon23/Python-Crash-Course
/10.- Ficheros y Excepciones/common_words.py
846
3.8125
4
''' CUENTA EL NUMERO DE VECES QUE APARECE UNA PALABRA EN UN TEXTO. ''' def buscar_palabra(fichero_texto, palabra): # Se CONTROLA try: # Se ABRE EL FICHERO PARA LECTURA with open(fichero_texto) as file_object: # Se LEE el FICHERO # El METODO "read()" LEE el FICHERO COMPLE...
86d8039e38f439e43fd9b8b24e49863dfa43af75
javierramon23/Python-Crash-Course
/10.- Ficheros y Excepciones/guest.py
363
3.671875
4
file_name = 'guest.txt' name = input('What is your name: ') ''' PARAMETROS ESCRITURA FICHEROS: w: Si fichero NO EXISTE, lo CREA y ESCRIBE. Si EXISTE, SOBREESCRIBE contenido. a: Si fichero NO EXISTE, lo CREA y ESCRIBE. Si EXISTE, AÑADE A CONTINUACIÓN PERO EN LA MISMA LINEA. ''' with open(file_name, 'w') as...
0a940ea6dede6720704a13a1bf264abb727e4db9
javierramon23/Python-Crash-Course
/4.- Trabajando con Listas/pizzas.py
175
3.984375
4
pizzas = ['Serrana', 'Margarita', 'Don Topo'] for pizza in pizzas: print('Una de mis pizzas favoritas es la pizza {}'.format(pizza)) print('Ciertamente me encanta pizza.')
f480c20dc5b97efc956cab0b1386c3c9de2314b8
javierramon23/Python-Crash-Course
/3.- Introduccion a las Listas/intentional_error.py
231
3.90625
4
my_list = [1, 2, 3, 4, 5] print('El PRIMER elemento de mi lista es el {}'.format(my_list[0])) print('El elemento CENTRAL de mi lista es el {}'.format(my_list[2])) print('El ULTIMO elemento de mi lista es el {}'.format(my_list[4]))
9e94314e9ee2425afd6050262b9dc72087746159
javierramon23/Python-Crash-Course
/PARTE II/PROYECTO 1/12.- Ship That Fires Bullets/alien_invasion.py
1,776
3.796875
4
""" ESTRUCTURA BASICA DE UN JUEGO ESCRITO EN PYGAME """ import pygame # Se IMPORTA Settings para poder definir las Propiedades del JUEGO. from settings import Settings # Se IMPORTA Ship para poder utilizar la NAVE en el JUEGO. from ship import Ship # Se IMPORTA el MODULO de FUNCIONES del JUEGO. import game_functions as...
b0ef1d7226d2a5e88b331d749f9679afe6c10db5
javierramon23/Python-Crash-Course
/9.- Clases/admin_class.py
1,061
3.828125
4
class User(): def __init__(self, first_name, last_name, age, born): self.first_name = first_name self.last_name = last_name self.age = age self.born = born def describe_user(self): print('Nombre del Usuario: {} {}'.format(self.first_name, self.last_name)) pri...
7f59396938a81200604105dbb9c9d30224d43f76
javierramon23/Python-Crash-Course
/9.- Clases/ordereddict_rewrite.py
695
3.703125
4
from collections import OrderedDict def show_dictionary(diccionario): for key, value in diccionario.items(): print('Clave: {} - Valor: {}'.format(key, value)) diccionario_normal = {} diccionario_ordenado = OrderedDict() diccionario_normal['key_1'] = 1 diccionario_normal['key_2'] = 2 diccionario_normal['k...
9d9854c26374e3b09e088ef26cc51764dab7b018
javierramon23/Python-Crash-Course
/3.- Introduccion a las Listas/shrinking_guest_list.py
719
3.75
4
guest = ['michel jordan', 'steve jobs', 'bill gates', 'pau gasol'] print('Perdonar las molestias pero debido a causas externas solo quedan dos sitios libres para la cena:') print('\tPerdona {}, pero al final no vas a poder asistir a la cena, lo siento.'.format(guest.pop())) print('\tPerdona {}, pero al final no vas a...
f9dc59978fab28cacc55aebf939c03170ab730ca
javierramon23/Python-Crash-Course
/6.- Diccionarios/person.py
1,200
4.3125
4
# Se RECOMIENDA INDENTAR un DICCIONARIO para que sea mas CLARO de LEER. # Se RECOMIENDA FINALIZAR un DICCIONARIO con una COMA FINAL(,) person = { 'first_name': 'javier', 'last_name': 'ramon', 'age': 41, 'city': 'teruel', } print('Person Profile:') print('---------------') pri...
0816d8a4c67aae9131773b7d6d3ea7b7fa0fb0d6
javierramon23/Python-Crash-Course
/5.- Sentencia IF/more_conditional_test.py
2,799
4.375
4
''' TEST CONDICIONAL: Cualquier EXPRESIÓN que puede EVALUARSE a VERDADERO o FALSO (True o False). TIPO DATOS BOOLEANO: True o False. OPERADOR de IGUALDAD: == , OPERADOR de DESIGUALDAD: != Otros OPERADORES de COMPARACION: >, <, >=, <= Con los OPERANDOS 'and' y 'or' es POSIBLE realizar TEST CONDIC...
e067f2c22392074bed5cb9fc76d1ea40abd50d1c
javierramon23/Python-Crash-Course
/4.- Trabajando con Listas/more_loops.py
296
4.15625
4
my_foods = ['pizza', 'falafel', 'carrot cake','ice cream'] my_friends_foods = my_foods[:] print('Mis comidas preferidas:') for food in my_foods: print('- {}'.format(food)) print('') print('Las comidas preferidas de mis amigos:') for food in my_friends_foods: print('- {}'.format(food))
1782dac282f9c02224446a6c40c1a2e5dedef5f6
Boumaiza-kais/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/2-matrix_divided.py
1,310
4.03125
4
#!/usr/bin/python3 """ Module matrix_divided(matrix, div) have a function that divides all elements of a matrix """ def matrix_divided(matrix, div): """ Divides all elements of a matrix. """ if type(matrix) is not list: raise TypeError("matrix must be a matrix (list of lists) of integ...
af33cc14d69ca2a1a500d6ca5ed4ed66d2fbef4d
Nalmac/Earth-sPosition
/Models/Earth.py
328
3.828125
4
class Earth(): def __init__(self, date): """ This object represents the Earth at any given date. """ self.date = date self.mass = 5.9722 * 10**24 #In kilograms self.angular_speed = 2 * 10**(-7) self.coordinates = [] #In cartesian coordinates self.e = 0...
df9ccb140069cfda43856c3f0220d9144c831015
Jim-Cooke/space-realm
/star_empire_obj2.py
16,124
3.8125
4
# star empire program # import library with random function # import random import time import math player = ["XXX"] turns = [0] current_turn = 1 t_player = 0 #my random function def random_1(): r = random.random() t = time.time() # print(r, " ", t) rs = r + t # print(rs) r...
5062fa9677aa1bfe5d9a8d0ff441c795a53a8a07
mzahnd/algoritmos-mn
/Mix/powerexp.py
2,308
4.1875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def _expSum(x, iterations=1000): """Calculate e^x using power series. exp x := Sum_{k = 0}^{inf} x^k/k! = 1 + x + x^2/2! + x^3/3! + x^4/4! + ... Which can be rewritten as: = 1 + ((x/1)(1 + (x/2)(1 + (x/4)(...) ) ) ) ...
7640b0e529685f31de4cf655c90e32f9c8bf0c53
guilhermevarela/machinelearning
/nlp_2/matmul_tf.py
1,222
3.796875
4
''' Created on Dec 24, 2017 @author: Varela Tensorflow matmul tutorial ref: https://www.tensorflow.org/api_docs/python/tf/matmul https://stackoverflow.com/questions/38235555/tensorflow-matmul-of-input-matrix-with-batch-data ''' import numpy as np import tensorflow as tf a = tf.constant([1, 2, 3, 4, 5...
ac46e7be9d2c95c7ecea656622e8e702a8a85692
msu-cmse-courses/cmse202-S21-student
/code_samples/my_pandas.py
1,468
3.875
4
def my_pandas(filename): """ Takes the iris.data file and creates a list of list from the contents PARAM: filename -> Name of iris.data file RETURNS: List[list[]] -> List of list of contents of iris.data """ iris = [] # f_obj = open(filename) ...
3264d85a4e3d7b3ae644cebc765f83f32af8aff1
sergeyrudov/py1h
/algorithm_minmax.py
673
3.578125
4
#import random incorrect = ['врокоа','наокетф','поиврла'] correct = ['корова','конфета', 'правило'] #nagramma = random.choice(incorrect) #print('Начнем игру \nСоберите слово из - {}'.format(anagramma)) def main(): for i in range(0, len(incorrect)): w = list(incorrect[i]) while True: ...
5d00cac6b69f7011858560f14193efa3288a3d09
sergeyrudov/py1h
/casino.py
699
3.765625
4
from random import randint money = 100 def get_result(num, rate): global money r = randint(1,9) if num == r: print('ugadal') else: print('neugadal') if num !=r: money = money-rate else: money = money + rate *3 print ('На вашем балансе: {0} грн'.format(money))...
5ba28fc61020842a7b536e58b7b1d6786101a83e
spinachpie/erik_game
/item_handlers.py
1,317
3.953125
4
### THIS FILE CONTAINS ACTION HANDLERS FOR YOUR ITEMS ### # To add a new item handler, first create a function for your item # and then "bind" the handler to your item in the bottom section of the file. # Note that location handlers run first ... then item handlers ... then action handlers ... and then default behav...
940c52fcda309053dcaceced6df4c61ba5cd558e
SteveGongoraL/AprendaPython
/5.Nombre.py
398
4.03125
4
nombre= input("Dime tu nombre: ") apellidos= input("Dime tu apellido: ") # Se hace una concatenacioncon los valores str. # Concatenacion es juntar los datos y volverlos uno solo. # str = es una cadena o string. nombreCompleto=nombre+" "+apellidos # Se convierte la variable en mayusculas usando upper y lower p...
f556eb90df37817fae148c60a16f404fd2ed8e75
sanath1975/Python2020
/Functions_cls.py
5,232
4.25
4
# # Function - Set of Statements which perform a specific task... # # Which can be executed n number of times... # # code reusuability..... # a=4 # b=7 # # print(a+b) # # print(a-b) # # print(a*b) # # print(a/b) # a=87 # b=23 # # print(a+b) # # print(a-b) # # print(a*b) # # print(a/b) # a=23 # b=2 # # pri...
74f629a2b7f9848fcfb1dde1a5253b1acad959da
sanath1975/Python2020
/lists_cls.py
5,141
4.8125
5
# Lists -- Sequence of multiple values seperated with comma(,) declared inside [ ]... # Ex:- a = [23,45.67,'python'] a = [23,45.67,'python',34,"django"] # print(type(a)) # Accessing elments inside the list -- Indexing. # indexing will start from zero.. # Indexing is represented in [ ].. # print(a[0]) # pr...
3e6fa51e75fa50d145fe581658bad96e2c093ed6
HCP5/SchoolWork
/AI_TestsAndExamples/L1/p2.py
371
3.671875
4
import math xa = int(input("Dati x primului punct: ")) ya = int(input("Dati y primului punct: ")) xb = int(input("Dati x celui de-al doilea punct: ")) yb = int(input("Dati x celui de-al doilea punct: ")) xPatrat = (xb - xa) * (xb - xa) yPatrat = (yb - ya) * (yb - ya) distEucl = math.sqrt(xPatrat + yPatrat) print("D...
5375a4e0d42cc562203f8427d57519bd4e823a9b
HCP5/SchoolWork
/AI_TestsAndExamples/L1/p4.py
209
3.59375
4
import collections s = input("Propozitia dvs.:") s = s.split(" ") dictionar = collections.Counter() for cuv in s: dictionar[cuv] += 1 for el in dictionar: if dictionar[el] == 1: print(el)
a1b1dddc47f40515be0aeac42db041ce263a59bd
victorsaad00/URI---PYTHON
/1095.py
98
3.578125
4
i = int(1) j = int(60) while j >= 0: print('I={} J={}'.format(i,j)) i+=3 j-=5
df9592d81a36d987fe86d6a82f485039bd5e61c0
victorsaad00/URI---PYTHON
/1827.py
890
3.96875
4
def matrix(): n = int(input()) m = list() for i in range(n): m.append([]) for j in range(n): m[i].append('0') return n, m def diagonal(n, m): for i in range(n): m[i][i] = '2' for i in range(n): m[i][n - 1 - i] = '3' return m def matrix_1(n, m...
19b318e5b06ec86ab5e0b6e8c455e0d8c21bc95d
victorsaad00/URI---PYTHON
/1234.py
443
3.71875
4
while True: try: _lines = "" lines = input() uppercase = True for l in lines: if l == ' ': _lines += ' ' continue if uppercase: _lines += l.upper() uppercase = False else...
0b3351620683ce56e3e33773b281f2babc79b1de
victorsaad00/URI---PYTHON
/1174.py
216
3.625
4
array = [float]*100 i = int(0) while i < 100: number = float(input()) array[i] = number i += 1 for i in range(0, len(array)): if array[i] <= 10: print('A[{}] = {:0.1f}'.format(i, array[i]))
dfac09e8ad0db8711b3b255700fb5aefeadf980c
victorsaad00/URI---PYTHON
/1933.py
134
3.671875
4
num1, num2 = map(int,input().split()) if num1 == num2: c = num1 elif num1 > num2: c = num1 elif num2 > num1: c = num2 print(c)
62d6693b5d5877430e7457aef35fe18ee3df223f
victorsaad00/URI---PYTHON
/1074.py
486
3.75
4
max_value = int(input()) i = int(0) list = [0]*max_value while i < max_value: number = int(input()) list[i] = number i+=1 for i in range(0,len(list)): if list[i] < 0: if list[i]%2 == 1: print('ODD NEGATIVE') else: print('EVEN NEGATIVE') elif...
4696f00d7c96ae5577d3ddb3b8802793c9adf391
victorsaad00/URI---PYTHON
/1035.py
698
4.15625
4
''' Read 4 integer values A, B, C and D. Then if B is greater than C and D is greater than A and if the sum of C and D is greater than the sum of A and B and if C and D were positives values and if A is even, write the message “Valores aceitos” (Accepted values). Otherwise, write the message “Valores nao aceitos” (V...
79d0fa646e7fbd5e16a9852e6a2a6be5bd8f6af0
benjamintrevorgrenier/python
/catonatestrintimportant.py
138
3.75
4
gbp = int(input("How many GBP do you want to exchange to USD: ")) usd = gbp * 1.5 s = "You now have " p = " USD!" print(s + str(usd) + p)
fc423f30a294f85fe6e457c1f23d2cf25a094c29
benjamintrevorgrenier/python
/infinitepythinloop.py
83
3.640625
4
while True:     text = input("Enter something: ")     if(text == "quit"):break
ba189d3952892d22050128c1ac2b23f7d07a4934
lakshmikanthbyri/birthdaynotifier
/hakunamatata.py
890
3.9375
4
import xlrd file_location = "C:/Users/USER/Desktop/Life/hakunamatata.xlsx" workbook = xlrd.open_workbook(file_location) sheet = workbook.sheet_by_index(0) excel_date = sheet.cell_value(1, 0) print(excel_date) int_excel_date = int(excel_date) #Convertinng float value into integer for comparision purpose import datetime...
b26825e86789f4fdc1e5eee1b0d3736a3b8f66d0
den01-python-programming-exercises/exercise-2-22-Ju1esV3rne
/src/exercise.py
379
3.90625
4
class Example(object): """docstring fo Example.""" def __init__(self, *args): self.print_text() def print_text(self): print("In a hole in the ground there lived a method") def main(): #write your code below this line num = int(input("How many times?")) for i in range(num): ...
3def55c4dfbd41ebb0c7978bc369f48ab59bd9ca
CaduFelix/PythonWhile
/Untitled4.py
279
3.734375
4
#!/usr/bin/env python # coding: utf-8 # In[2]: contador = 0 while contador < 10: contador = contador + 1 if contador == 1 : print (contador, "item limpo") else: print (contador, "itens limpos") # In[ ]:
7f5546256273658cd36cefd45bf8afe064c00596
matvi/CodeChallanges
/CarsPassing.py
2,123
4.03125
4
# A non-empty array A consisting of N integers is given. The consecutive elements of array A represent consecutive cars on a road. # Array A contains only 0s and/or 1s: # 0 represents a car traveling east, # 1 represents a car traveling west. # The goal is to count passing cars. We say that a pair of cars (P, Q), whe...
2f6f5e072faeece6cf49da7816aa80a80fe0a3ed
matvi/CodeChallanges
/MaxProfit.py
2,663
3.828125
4
import numpy as np import unittest #This coding challange tries to find the max sum that a sub array can have #In other words try to find the consecutive indexes that will sum the max value in a given array #for example given the next array -> [5,-4,8,-10,-2,4,-3,2,7,-8,3,-5,3] #find the sub array that sumed the max ...
07687d54be1bd360856175e5105a0c1bdfdf0282
matvi/CodeChallanges
/fibonnacy.py
808
4.0625
4
def fibonacy(n): f = [] f.append(0) f.append(1) for i in range(2, n): f.append(f[i-1] + f[i-2]) return f def fibonacy_space(n): a = 0 b = 1 for i in range(2, n): c = a + b a = b b = c return c def fibonacy_reccursion(n): if(n == 2): ...
69ac2c3945ea331d3ff33f08a828137f36428bff
bridgesn5861/cti110
/P2HW1_PoundsKilograms_NadiaBridges.py
290
4.125
4
# Pounds to Kilograms. # 2/11/2019 # CTI-110 P2HW1 - Pounds to Kilograms Converter # Nadia Bridges # Pounds from user pounds = float(input(" Enter the number of pounds: ")) # kg= lb/2.2046 kilograms = pounds/2.2046 # Diplays total number of Kilograms print( " equals ", kilograms)
9156b48c162fac61dc4f0bd03b91a5bf1d68cada
rflair/481-CI-Game_Python
/Ch4challenge2.py
396
4.34375
4
# This program recieves a message from the user and prints it out backwards message = input("Enter a message: ") length = len(message) print("\nYour message has length:", length) print("Your message reversed is:") reversed_message = "" i = length - 1 for j in range(length): reversed_message += (message[i]) i ...
5af945dd5b8ee00940df8fbe81015b8b3af885ed
xiongchiamiov/python-challenge
/5.py
537
3.5625
4
#!/usr/bin/env python3 # http://www.pythonchallenge.com/pc/def/peak.html # Had to get a hint in the forums about this one. Spent a week trying to figure # out where to go from 'Yes, pickle!' >_> import pickle from pprint import pprint from urllib.request import urlopen response = urlopen('http://www.pythonchallenge.c...
63ca171763ba21cc2c5d5c082df86bc91578808a
abhis021/C-DAC
/programs/circle.py
583
4.34375
4
class circle: """ a circle consists of a center and its radius """ class point: """ """ c=circle() c.r=int(input("Eneter the radius of the circle")) print(c.r) c.center=point() c.center.x=int(input("Enter the x point of the center")) c.center.y=int(input("Enetr the y point of the center")) print(c.center...
591b59c1c354540a5a91f25b31daeb987821de81
Leyka/Advent-2017
/Day 4/passphrases.py
804
3.890625
4
# Day 4: High-Entropy Passphrases # http://adventofcode.com/2017/day/4 def check_unique_passphrases(words, check_anagrams=False): unique_words = [] for word in words: # Part two if check_anagrams: word = ''.join(sorted(word)) # sort letters a->z if word not in unique_words:...
dcf519a2343ec3cd868f57bb286773a327ac4960
gyogy/haxx
/fractions/collect_fractions.py
976
3.75
4
from simplify_fraction import simplify_fraction def sum_normalized_fractions(frac1, frac2): nom1 = frac1[0] nom2 = frac2[0] denom = frac1[1] summa = nom1 + nom2, denom return tuple(summa) def normalize_fractions(fractions): first_fraction = fractions[0] second_fraction = fractions[1] normalized_denomi...
e0bc021675912e4ce0516cff3ee3bb834f7f4222
J4s0nZhang/dataStruct_algo_practice
/linked_list.py
4,139
4.03125
4
""" Singlely linked list and node structure implementation in python practice (not sure how useful it will be with how nicely python does data structures, but it's good practice) Jason Zhang April 2020 """ class Node: # Node implemented as a class as structures do not exist in python def __init__(self, val=No...
9cf74ba50450c25dffe7c4bdff6db0409297df1c
lololipop41/DellSearchEngine
/data/userDAO.py
987
3.640625
4
from data import connection def get_user(): try: conn = connection.establish_connection() cursor = conn.cursor() cursor.execute("SELECT * FROM Customer") records = cursor.fetchall() return records except Exception as err: if conn: print("Connection F...
fc3f8e8c6091340fa87ce264d41f813ae1f71bcc
balamech92/guvi
/Check Alphabet or Not.py
209
4.28125
4
character = raw_input('enter any character :') if ((character>='a' and ch<='z') or (character>='A' and character<='Z')): print (character,'is an alphabet.') else: print (character,'is not an alphabet.')
f1a16b7f66f649febd251d92200784872ffb645b
balamech92/guvi
/count number of digits of an integer.py
97
3.578125
4
x = input('enter a number :') print 'the total counted number in integer is : ',len(str(abs(x)))
681100269b9bed029625c24b2cca6d2be9cd7a8c
hamartias/advent_of_code
/2020/day6/day6.py
743
3.71875
4
def make_groups(): groups = [] letters = "" with open("input.txt") as f: for line in f: if line == "\n": groups.append(letters) letters = "" else: letters += line groups.append(letters) return groups def get_common(grou...
ab912e06484174e40cce2162e8e5c57865fec30b
MarcosPenin/FuncionesPython
/Funciones/Funciones2.py
901
4.25
4
"""Crea una función “calcularMaxMin” que recibe una lista con valores numéricos y devuelve el valor máximo y el mínimo. Crea un programa que pida números por teclado y muestre el máximo y el mínimo, utilizando la función anterior.""" def calcularMaxMin(lista): a=max(lista) b=min(lista) return a,b list...