blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
2c9f1270d8fca97ffcf774cf5f7c86c1f01186d7
sinomiko/reading
/source/Python/begining python from noviceto professional/2329/Chapter05/for.py
79
3.671875
4
words = ['this', 'is', 'an', 'ex', 'parrot'] for word in words: print word
cb7c0a80a34b7da4721fa973dc11a5303b4d3a5c
LeoPlese/AlphaRandomGenerator
/AlphaRandom.py
6,148
3.765625
4
# -*- coding: utf-8 -*- """ Project: Alpha Random - Alpha Particles Random Number Generator Version: 1.0 Author: Leo Plese e-mail: plese.leo@gmail.com Web: alpharandom.info Abstract: This script is used to generate a random number of one of the next types: true(1)/false(0), number from 0 to 1 (range [0,1...
1a97308788f3899a896008b2db96afe530fd654a
micropop1989/python-file
/time1.py
1,422
3.796875
4
from time import time from random import randint #time() #print("time %-5.5ss" %time()) #x = randint(0,9) #print('temp %s' %x) #for _ in range(5): # value = randint(0, 10) # if value < 5: # print('small') #else: # print('big') #print(value) guass = randint(1,99) minimun = 0 maximun = 99 t1 =...
0b1ba18925bc89c7564a8cfb61c18749eeb5f168
sh-am-si/numerical_python
/asteriks.py
499
4.125
4
''' :author: Volodya :created: 16/12/2019 Introduction to Python Lecture 3, Functions and comprehensions Asteriks ''' lst = [1, 2, 3] print('calling without asteriks', lst) print('calling with asteriks', *lst) def my_sum(a, b, c): return a + b + c lst = [1, 2, 3] print(my_sum(*lst)) dic = ...
48d2e55f4511a91fa39709360bf055cf8bbc968c
sh-am-si/numerical_python
/pesel_check.py
438
3.6875
4
""" pesel consisits of 11 numbers abcdefghjN where the last 11-th number is verifier of the number N = (9*a + 7*b + 3*c +1*d + 9*e + 7*f + 3*g +1*h + 9*i + 7*j ) mod 10 """ pesel1 = '44051401358' pesel2 = '44051401359' def check_pesel(st): assert isinstance(st, str) assert len(s...
d78b3934f1942ac4fca65a9e8e0dc3bab8c12946
sh-am-si/numerical_python
/functions/function_factory.py
429
3.71875
4
import matplotlib.pylab as plt import numpy as np def trigonometrical_function(n): if n % 2 == 0: return lambda x: np.cos(n // 2 * x), f'$\cos({n // 2}x)$' else: return lambda x: np.sin(n // 2 * x), f'$\sin({n // 2}x)$' arg = np.linspace(0, 2 * np.pi, 200) for n in range(2, 12): ...
080a9ec42a77c949038747e0db9bc9aadd392e96
sh-am-si/numerical_python
/generators/generator_class.py
654
3.75
4
from generators.generator_prime_number import is_prime class PrimeGenerator: def __init__(self, final): self.final = final self.current = 2 def __iter__(self): return self def __next__(self): if self.current == 2: self.current = 3 ...
e50644d6941b590435ed037722ee3038f7ae8e92
msholsve/triptrackr
/gpswrapper/gpspoller.py
3,256
3.65625
4
__author__ = 'Max' # GPSPpller is a (thread) object that constantly updates a global variable # (in this case gpsd) with the current GPS data. The core software can now access the current # location through the global variable 'gpsd'. For example: gpsd.fix.latitude import os, time, sys import threading sys.path.appen...
e3c217f79478ea89de35f9f7b761d19fbfdde837
x223/cs11-student-work-Karen-Gil
/Countdown2.py
438
4.28125
4
countdown = input('pick a number') number= countdown while number>0: #number has to be grater than zero in order for it to countdown duh!!! print number number= number-1 #In order for there to be a countdown it has to be number-1 print('BOOM!!!') # I origanaly wrote print boom as showen below but it pri...
50d8f152cb85c4236966355beae22af7caf029e3
nevercast/serial-port-sdr
/square_wave.py
701
3.65625
4
#!/usr/bin/env python3 """Output a square wave on serial port TX line""" import argparse import serial def main(): """Generate square wave using serial port.""" parser = argparse.ArgumentParser(description='Generate square wave from' + ' serial port') parser.add_argum...
54ef4273db7cba4f002ab22695c32a5d1b7f1450
PatrickFang05/PythonToGit
/Homework/dict_hw1.py
183
3.828125
4
dictionary = {} dictionary['a'] = 0 dictionary['b'] = 0 print(dictionary['a']) print(dictionary['b']) dictionary2 = {'a' : 0, 'b' : 0} print(dictionary['a']) print(dictionary['b'])
497778c0b0e465ee09d1192cfbe08b8af5253f06
PatrickFang05/PythonToGit
/Classwork/ClassExercise8.py
1,020
3.734375
4
class Student: domain = 'gmail.com' def __init__(self, first, last, grade): self.first = first self.last = last self.grade = grade def getEmail(self): email = self.first + '.' + self.last + '.' + '05' + self.domain return email def compareGrade(self, anotherStud...
ea55618271ed98b23ddeea4d738907c0ad2c36be
PatrickFang05/PythonToGit
/Homework/class_movie.py
600
3.71875
4
class Movie: ratings = {'G': 'kids', 'PG13': 'teenage', 'R': 'adult'} def __init__(self, title, year, genre, rating): self.title = title self.year = year self.genre = genre self.rating = rating def goodForKids(movie): if movie.rating == 'PG-13' or 'G': r...
d5ed02f7a77dcea6057ae705e9f0be4a7f62cf20
chuckball/nxn-tictactoe
/start_game.py
913
3.796875
4
from game.player import Player from game.board import Board SYMBOLS = ['o', 'x'] def create_player_prompt(player_number: int) -> Player: while True: name = str(input("\nEnter name for Player {}: \n>> ".format(player_number))) if len(name) > 0: return Player(name=name, symbol="{}".form...
61f96619a58a4f5511aeada1940fdf91fb7437ad
Tlr150130/Salary-Prediction
/notebooks/function_scripts/Baseline_functions.py
3,175
3.546875
4
###### libraries ################################################ import pandas as pd from sklearn.model_selection import KFold from sklearn.metrics import mean_squared_error ###### Classes and Functions ################################################# class avg_per_industry_degree(): """ Creates a mo...
29816c7d282d55a7d7943610289e7146541cbb74
yosshor/generator_iterator_oop
/iterator_and_iterable.py
4,207
3.703125
4
""" @author: Yoss """ freqs = {"la": 220, "si": 247, "do": 261, "re": 293, "mi": 329, "fa": 349, "sol": 392, } notes = "sol,250-mi,250-mi,500-fa,250-re,250-re,500-do,250-re,250-mi,250-fa,250-sol,250-sol,250-sol,500" split_notes = [(i) for i ...
92e3d24491f18a68efcd4c7efe8bce1dd5c18ea2
yosshor/generator_iterator_oop
/id_check.py
9,051
3.75
4
""" @author: Yoosi """ import numpy as np class globalException(Exception): """ That class inherit from global Exception class, and build the structure for another classes who want to inherit that structure for another exception class. """ def __init__(self, id_number): sel...
1d1e3de23b345dcad8d54d63bf261e998ea364ee
lvfrazao/adventcode2018
/day6/day6.py
4,663
3.609375
4
class Grid(object): def __init__(self, points): self.points = points self._bounds = None self._area_points = None for point in self.points: self.is_infinite(point) @property def bounds(self): if self._bounds is not None: pass else: ...
d50968987468a7fd1ac886ace6ca45dd8cb0a167
sanket-khandare/Python-for-DS
/Stage 1.py
710
4.25
4
# Task 1 - Hello World print('Hello World!') # Task 2 - basic operations name = 'sanket' print('Hello '+ name) # Task 3 - using lists name_list = ['Sanket','Abhay','Pravin',['Friends', 3]] print(name_list[3][1]) # Task 4 - copy & update list new_name_list = name_list[:] new_name_list[3][0] = 'Total Friends' print(ne...
e761b4a404664ed9b674b28c5c85cdd2423ef930
Farheen2302/ds_algo
/data_structures/linear/stack.py
481
3.609375
4
from linked_list import UOLinkedList class Stack: def __init__(self, first=None): self.list = UOLinkedList(first) def push(self, item): self.list.add(item) def pop(self): self.list.delete(0) def size(self): return self.list.getSize() def peek(self): return self.list.head.getValue() #Test Cases s...
3ab2c1620f10f94f55adadf9f7d4cde295a6fbe6
Farheen2302/ds_algo
/algorithms/sorting/bubblesort.py
248
3.75
4
def bubblesort(arr): maxi = len(arr) for i in range(0, maxi-1): for j in range((len(arr))-1): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j] maxi -= 1 return arr arr = [6,5,4,3,2,1] assert bubblesort(arr) == [1,2,3,4,5,6]
0da6b491db0b5599895b81f1fd57a72df49b1393
Farheen2302/ds_algo
/algorithms/sorting/quicksort.py
1,223
4.25
4
def quicksort(arr, start, end): if start < end: pivot = _quicksort(arr, start, end) left = quicksort(arr, 0, pivot - 1) right = quicksort(arr, pivot + 1, end) return arr def _quicksort(arr, start, end): pivot = start left = start + 1 right = end done = False while n...
ad9193a2ec15c3230dd9708fbf117d760de65770
eliciaauduong/python
/09-oopsbasics/03-programmer.py
542
3.5625
4
class Programmer: def setName(self, n): self.name = n def getName(self): return self.name def setSalary(self, s): self.salary = s def getSalary(self): return self.salary def setTechnologies(self, t): self.technologies = t def getTechnologies(self): ...
d93796115a3d6a74789e6dcf737dd85d2bf14dea
eliciaauduong/python
/07-functions/08-cubelambda.py
85
3.546875
4
''' def cube(n): return n**3 print(cube(2)) ''' f = lambda n: n**3 print(f(2))
d4c97dbc850cf836b03e5c4028df21d37ce2a2ec
IntroToCompBioLSU/week10
/assignments/MeganGuidry/demographySim.py
9,330
4.0625
4
#!/usr/bin/env python # Simulation to model demography on a landscape. This simulation # will include: # - birth # - death # - dispersal # First Version # - Asexual reproduction # - Annual generation times # - Poisson-distributed number of offspring # - Discrete landscape # - Max dispersal of 1 grid # - No diagonal ...
167f86f6a9acd7aa1f8db55287759bf357e60c68
IntroToCompBioLSU/week10
/assignments/EthanBartel/week10.py
1,861
3.59375
4
#!/usr/bin/python import numpy as np import numpy.random as nr import matplotlib.pyplot as plt # Defining Class "Organism" class organism: """Class to hold information about organisms I collect.""" common = "" species = "" #latin name color = "" popgrow = 0.0 carrycap = 0 startpop = 0 ...
06588c320222bc764037ec8b338b8d7b1a139cb9
huan/python-facenet
/tutorial/opencv-tutorial/loading-image.py
403
3.5625
4
""" https://pythonprogramming.net/loading-images-python-opencv-tutorial/ """ from matplotlib import pyplot as plt img = plt.imread('brothers.jpg') plt.imshow(img, cmap='gray', interpolation='bicubic') # to hide tick values on X and Y axis # plt.xticks([]) # plt.yticks([]) plt.axis("off") plt.plot([200, 300, 400], ...
21f0515925afbe3371cb8bb3572286c375fdacf8
huan/python-facenet
/tutorial/opencv-tutorial/ui.py
1,734
3.75
4
#!/usr/bin/python3.6 """ ZetCode PyQt5 tutorial In this example, we create a simple window in PyQt5. author: Jan Bodnar website: zetcode.com last edited: January 2015 """ import sys from typing import Tuple from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QLabel from PyQt5.QtGui import QPainter, QCol...
c46c6dc68108ad9a691bd88b44a54f28472de50f
myfatemi04/tj-physics
/Cart_Simulator.py
4,676
3.765625
4
# Made by Michael Fatemi (c) 2021 import pygame import time # A cart contains position, mass, velocity, and color, in that order POSITION = 0 MASS = 1 VELOCITY = 2 COLOR = 3 carts = [ # (-2, 1, 2, (255, 0, 0)), # (2, 1, 0, (0, 0, 255)), # (-3, 1, 2, (255, 0, 0)), (-4, 2, 25, (0, 0, 255)), (-2, 0.5, 0, (255, 0,...
275d769b8822504e98538c5b38749604f06c5c33
fmatray/MAT
/daemon/alarm.py
1,091
3.609375
4
#!/usr/bin/python import time import datetime from sensor import * class AlarmSensor(Sensor): def __init__(self, Date, Hours, WeekDays, Argument3 = "", Argument4 = ""): Sensor.__init__(self) self.Date = Date.split("/") + Hours.split(":") self.WeekDays = WeekDays.split(":") def Update(self): return...
87311e8176fb607247dbc4aaa2805d3c33a2172b
shibinafarbink97/PythonPrograms
/functionalProgramming/listcomprehensive.py
263
3.6875
4
lst1 = [1,2,3] lst2 = [4,5,6] # lst = [(i,j) for i in lst1 for j in lst2] # print(lst) # lst = [(i+j) for i in lst1 for j in lst2] # print(lst) # SQUARE # lst = [(i**2) for i in lst1] # print(lst) # EVEN NUMBER lst = [(i) for i in lst1 if i%2==0] print(lst)
903b5ea6b6d654deb446dd7a1e2eac28d6d7e576
shibinafarbink97/PythonPrograms
/oop/simpleinheritance.py
364
3.703125
4
# class Base: # def m(self): # print("inside Base class") # # class Derived: # def m2(self): # print("inside derived") # # ob = Derived() # ob.m2() #single inheritance class Base: def m(self): print("inside Base class") class Derived(Base): def m2(self): print("inside...
c31a5d3de35da0648525938e70538c54d1e0ed11
shibinafarbink97/PythonPrograms
/flow control/student.py
404
3.9375
4
m1 = int(input("enter mark")) m2 = int(input("enter mark")) m3 = int(input("enter mark")) sum=(m1+m2+m3) print("sum = ",sum) if(sum>140): print("grade = A") elif(sum>130) and (sum<140): print("grade = B") elif(sum>120) and (sum<130): print("grade = C") elif (sum > 110) and (sum < 120): print("grade = D") e...
badf4c56daa66123b7ffca5deec6349a7f4b00cd
kerkira96/uses_cases
/clustering.py
1,206
3.5625
4
# Carga las dependencias de Spark MLlib from pyspark.mllib.clustering import KMeans, KMeansModel from pyspark import SparkContext import matplotlib.pyplot as plt import random as rnd import numpy as np import colorsys # Carga el conjunto de datos de clustering en 2D sc = SparkContext(appName="KMeans") text = sc.textFi...
627c3b27a34f31a5f15bb7bb780c0f968b694f69
iamaaditya/Project-Euler
/080.py
1,921
3.8125
4
# -*- coding: utf-8 -*- """ Created on Mon Jan 4 22:59:00 EST 2016 @author: aaditya prakash """ from __future__ import division from utilities import is_square from time import clock problem_number = '080' problem_statement = """ For the first one hundred natural numbers, find the total of the digital sums of the f...
75305f9b4419aed3768be578d53a6b0b10acf6a1
iamaaditya/Project-Euler
/005.py
1,119
3.921875
4
# -*- coding: utf-8 -*- """ Created on Fri Apr 04 23:07:47 2014 @author: aaditya prakash """ import utilities import math problem_number = '005' problem_statement = """ 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive...
9aee8e049678c6bffcf9c7d6787fbf1164561f99
iamaaditya/Project-Euler
/033.py
2,242
3.8125
4
# -*- coding: utf-8 -*- """ Created on Tue Apr 15 19:50:34 2014 @author: aaditya prakash """ import time import numpy as np from fractions import Fraction problem_number = '033' problem_statement = """ The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorr...
f772fc98fc0fbfafb255b19365b7768ac8f65be7
iamaaditya/Project-Euler
/052.py
773
3.8125
4
""" Created on 4/23/14 1:28 AM @author: aaditya prakash """ import utilities as u import time problem_number = '0' problem_statement = """ Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits. """ def Multiple_Product(num): for multiple in range(2,7): sProd...
92e686bd4cbffaad39efb8c94deb3a02b553f5b0
iamaaditya/Project-Euler
/039.py
1,541
3.59375
4
# -*- coding: utf-8 -*- """ Created on Wed Apr 16 22:42:14 2014 @author: aaditya prakash """ import utilities import math import time from fractions import gcd from collections import Counter problem_number = '039' problem_statement = """ For which value of perimeter, p ≤ 1000, is the number of solutions for right ...
3d0a45fa8e5b3886336057a9efc393bf6e0548fe
iamaaditya/Project-Euler
/037.py
754
3.703125
4
# -*- coding: utf-8 -*- """ Created on Wed Apr 16 12:49:43 2014 @author: aaditya prakash """ import utilities import math import time problem_number = '037' problem_statement = """ Find the sum of the only eleven primes that are both truncatable from left to right and right to left. """ def Sum_All_Trunctable_Prime...
cda3fdcbabcc60e895ef7f85b6bd2f69858e6e27
iamaaditya/Project-Euler
/112.py
1,094
3.703125
4
# -*- coding: utf-8 -*- """ Created on Sat Apr 4 18:07:25 EDT 2015 @author: aaditya prakash """ from __future__ import division from time import clock from utilities import GetDigits problem_number = '112' problem_statement = """ Find the least number for which the proportion of bouncy numbers is exactly 99%. Where ...
44d3c3920a15947d6af10ff760f71d9e0205a1d3
iamaaditya/Project-Euler
/062.py
463
3.546875
4
def cube_permuations(): i = 1 cube_dic = {} while True: #if not i % 10 : continue i3 = i**3 i3s = ''.join(sorted(str(i3))) #print type(i3s), ''.join(i3s) if i3s in cube_dic: cube_dic[i3s].append(i3) if len(cube_dic[i3s]) >= 5: p...
c0aa47d08a16504363177a799dea53ee63c230cf
iamaaditya/Project-Euler
/044.py
1,193
3.609375
4
# -*- coding: utf-8 -*- """ Created on Thu Apr 17 23:14:26 2014 @author: aaditya prakash """ import utilities import math import time problem_number = '044' problem_statement = """ Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference are pentagonal and D = |Pk − Pj| is minimised; what i...
26ba767c26370a46d7c5998cd0bff03a9e4ea7af
soli1101/python_workspace
/d20200720/test7.py
685
4.1875
4
print('------- 문제3 -------') # 태어난 년도를 입력하면 띠 출력 # 년도를 12로 나눈 나머지를 구한다 # 자축인묘진사오미신유술해 # 4,5,6,7,8,9,10,0,1,2,3 year = input("출생년도는?") year = int(year) mod = year%12 if mod == 4: print('쥐띠') if mod == 5: print('소띠') if mod == 6: print('호랑이띠') if mod == 7: print('토끼띠') if mod == 8: print('용띠') ...
154cb057141929a6089c8c1866300d45b0ee8b0a
soli1101/python_workspace
/d20200720/test12.py
400
3.84375
4
print('------- while 무한반복 -------') while True: # 무한반복 value = int(input("숫자를 입력:")) #5의 배수인가요? if value%5 == 0 : continue # 아래 처리할 문장이 있어도 # 다음으로 넘어감 else: print(str(value)+ "는 5의 배수가 아닙니다.") print("이제 그만~~~") print()
4187e253c151dd1a85f8022dadcb8f200d18bbac
soli1101/python_workspace
/d20200722/hw.py
2,318
3.859375
4
print('----#hw1: 세계최초의 암호화 ----') # setEncryption(문자열) 함수 생성 # 1. 사용자로부터 단어를 입력받는다 # 2. 글자를 불러와서 아스키코드 값으로 바꾸고 # 3. 그것에 3을 더해서 출력한다. # 4. 끝에 3자는 다시 a,b,c가 될 수 있도록 # 5. 3번째 뒤에 글자를 출력한다. # 6. getDecode(~~~암호값) 함수 생성 data = input("암호화 할 메세지를 입력하세요!: ") def setEncryption(msg): w=[] for i in range(len(msg)): ...
f848f6056e3889de2add8f50ab54343300c23aff
soli1101/python_workspace
/d20200730/test06.py
1,698
3.671875
4
class Weapon: # Weapon 이라는 부모 클래스 만든다 def __init__(self): pass def use(self): pass def reuse(self): pass class Gun(Weapon): # Gun에 Weapon의 속성을 부여한다 def __init__(self,name,bullet): print("Gun") self.namme=name self.bullet=bullet ...
00bfc65e84367d479bfc7d417f97699db3a87bf1
soli1101/python_workspace
/d20200720/test14_hw.py
152
3.703125
4
import turtle as t m = int(input('몇각형?')) t.shape('turtle') t.color('#cc9900') for i in range(m): t.forward(100) t.rt(360/m) t.mainloop()
db2c3ced4fba47e00cc2627f91355f3135d6a896
soli1101/python_workspace
/d20200721/test1.py
381
3.71875
4
import turtle as t # t.color("#6633ff") # t.shape('turtle') # t.shapesize(2) # # t.delay(100) # t.speed(0) # t.fd(50) # dis = 50 # rad = 90 # for i in range(100): # for문을 100번 돌리는데 # dis += 5 # 반복 될 때 마다 dis를 3씩 증가시켜 # rad += 2 # rad를 2씩 증가시켜서 움직여 # t.rt(rad) # t.fd(dis) # t.mainloo...
76d1b1a58c0f5a13b2348170a56f1284fdcfbeba
soli1101/python_workspace
/d20200715/test9.py
1,703
3.578125
4
#문제4 숫자를 입력 받아 2로 나눈 나머지를 출력 #x = int(input("숫자를 입력해"))#input받은 값을 정수로 변환해 x에 대입 #x %= 2 #x변수를 2로 나눈 나머지 값을 x에 대입 #print(x%2) #x변수를 2로 나눈 나머지 값을 x에 대입 #x, y = input("두개의 숫자를 입력해").split() #입력받은 문자열을 #공백을 기준으로 분리함 #print("x:",x,"y:",y) ...
2fa91c26ee7cc843484f443c4118cdef9ef2ff7b
soli1101/python_workspace
/d20200715/test8.py
1,075
3.9375
4
#문제 a: 100, b: 200, c:300 --> a:300, b:100, c:200 a,b,c = 100,200,300 print("before a:",a,"b:",b,"c:",c) a,b,c = c,a,b print("after a:",a,"b:",b,"c:",c) #문제 각변수의 값에서 10씩 증가 a += 10 b += 10 c += 10 print("a.after a:",a,"b:",b,"c:",c) #사칙연산 a, b = 10, 20 print(a+b) print(a-b) print(a*b) print(a/b) # int 연산 int ==>...
7d3d677a9a0a4253fa9f176b3e38c40fb374cbcb
soli1101/python_workspace
/d20200721/test3.py
1,064
3.5
4
print('------- # 가위바위보 -------') # 1. 가위바위보 라는 글자를 가진 리스트를 선언 # 2. 0, 1,2 중 한개를 리턴하는 랜덤인트를 사용해서 # 3. 리스트의[]번호로 삼고 출력! import random li = ["가위", "바위", '보'] idx = random.randint(0,2) print(idx, li[idx]) print('-------------------------') print('1. 가위 2. 바위 3. 보') userinput = int(input("가위바위보 중 선택하세요!")) userinput-=1...
49ddf3c421aeb7539843cbac81f46e3d0bc25252
jabaier/iic1103.20152.s4
/recursion/recursion0.py
259
3.578125
4
def EnL(x,L): if L==[]: return False if x==L[0]: return True if type(L[0])==type([]) and EnL(x,L[0]): return True return EnL(x,L[1:]) print(EnL(2,[1,[2],3])) print(EnL(2,[1,[[[[[[[2]]]]]]],3])) print(EnL(8,[1,[2],3]))
c3aa8d4af3c24780d082a471bafafac537dccc04
jabaier/iic1103.20152.s4
/bigramas/lee_archivo.py
491
3.65625
4
def sin_puntuacion(palabra): puntuacion=",.!¡?¿:;" resp = "" for c in palabra: if not c in puntuacion: resp = resp + c return resp nombre_archivo=input("ingrese el nombre del archivo: ") f = open(nombre_archivo,"r") entrada='' for linea in f: entrada = entrada + linea f.clos...
bc67f181b689a1c7579169b7b0ce07f24f217f51
jabaier/iic1103.20152.s4
/strings_listas01.py
1,229
3.65625
4
def sumalista(l): i=0 suma=0 while i < len(l): suma = suma + l[i] i = i + 1 return suma def sumalista_cool(l): suma = 0 for elemento in l: suma = suma + elemento return suma def desafio_google(l): i = 0 while i < len(l): if sumalista(l[:i]) == sumal...
371fce2fe0a1feabc6d5a2fe3b61ea61216d7b41
jabaier/iic1103.20152.s4
/fracciones.py
1,163
3.671875
4
def mcd(a,b): div = min(a,b) # retorna el minimo entre a y b while div > 1 and (a%div!=0 or b%div!=0): div = div - 1 return div class fraccion: def __init__(self,numerador=0,denominador=1): den=abs(denominador) num=abs(numerador) MCD=mcd(num,den) self.denominador...
b23387e4aac9aa42c2e51b6529311894b70697b7
Deathupriser455/cis193
/Exam 1 Part 2.py
331
4.03125
4
#Kevin Craig #2/17/20 #Exam 1 Part 2 pizza = int(input('How much pizza are you getting? ')) price = 10.99 foodTotal = pizza * price taxRate = 0.085 Tax = foodTotal * taxRate billTotal = foodTotal + Tax print('Your order:', pizza,'at',price,'each') print('Food total:',foodTotal) print('Tax amount:',Tax) print('Your bi...
e749028dba668306be4afba488e05fae22ef49e3
Tania-Aranega/Python
/Módulo 8/Ejercicio2_Generadores&Potencias.py
431
4.1875
4
# def potencia(base): # """Documentación""" # exponente=1 # while True: # yield base**exponente # exponente+=1 # i = 0 # it = potencia(2) # while i < 100: # print(it.__next__()) # i += 1 def potencia(base, exponente): i = 0 result = 1 while i < exponente: resu...
9cb52eed799afe18b8bfec9f745652c17b2b4805
Tania-Aranega/Python
/Módulo 8/rango_numeros_generador.py
1,340
3.96875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Solución para el Ejercicio / demo "generadores y range" del Módulo 8 import time # Caso de partida, con una función normal def my_range(inicio, fin, salto=1): """Función similar a range() pero que devuelve una lista""" res = [] i = inicio while i < fi...
9d98102ef7e5e3c52ba238f92ef14295f3051dce
Tania-Aranega/Python
/Módulo 5/Ejercicio6_PotenciadeunNumero.py
226
3.78125
4
def potencia(base, exponente): if exponente == 0: return 1 elif exponente < 0: return 1 / potencia(base, -exponente) else: return potencia(base, exponente - 1) * base print(potencia(2,8))
8319b01c91295b9d074d2f2ffbe20a2dda522c51
Tania-Aranega/Python
/Módulo 4/T4/diccio_class.py
1,960
3.71875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Solución para el Ejercicio / demo "recorrer diccionarios" del Módulo 4 dicc1 = { "Naranjas": {"cantidad": 25, "proveedor" : "p1"}, "Manzanas": {"cantidad": 1, "proveedor": "p2"}, "Fresas": {"cantidad": 240, "proveedor": "p3"}, "Kiwis": {"cantidad": 15.3...
154bea5f04b647a345e6644613afb356643f4cc9
AntoineRichard/Deep-Model-Identification-Toolbox
/networks/samplers.py
12,941
3.640625
4
import numpy as np class UniformSampler: """ An epoch based uniform sampler. This object is based on python's generators. It keeps in memory 4 generator objects: + The generator for the training steps + The generator for the evaluation of the training + The generator for the evaluation o...
84ca28e60c3cf654895f259f759baed055ebfe6d
lmbaeza/aes-gf
/aes_matrix.py
2,746
3.5
4
#/usr/bin/python3 # aes_matrix.py: code for shifting rows # shift rows # data is stored in array of arrays # first index is row, second is column from aes_mult import multiply, modz, hex # convert strig to matrix def strToMat(data): ret = [[],[],[],[]] # copy values into the matrix for i in ra...
b3e5bff0defbbe2321c2d45dc0900776607d8da1
KellieAndersen/hackbright-project
/model.py
5,064
3.53125
4
"""Model for Recipe App""" from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class Recipes(db.Model): """A recipe""" __tablename__ = 'recipes' recipe_id = db.Column(db.Integer, primary_key = True, autoincrement = True,) ...
0bb37602e0531c8d9340ce0f9335d817c0730b97
donato/notes
/interviews/2017/practice/linked-list-palindrome.py
1,265
4.15625
4
def find_middle(head): """FInd meddle of linked list using 2 runner strategy and return if it's an odd length list return middle_node, is_odd(Bool) """ r1 = head r2 = head while r2.next: if not r2.next.next: return r1, False r1 = r1.next r2 = r2.next.next ...
cc828a6e6e0f733f7012e54c72eae2a12e6eed92
katini123/Python
/ac1_4_1_20190908.py
104
3.9375
4
print("program to add and multiply two numbers, 2 and 3:") add = 2 + 3 print(add) mul=2*3 print(mul)
e26935deff0f94c96597db717faf61b1f6f4fc51
Frizby777/all_files
/files_py/String.py
1,144
3.9375
4
author = "Чехов" print(author[0] + "\n" + author[1] + "\n" +author[2] + "\n" +author[3] + "\n" +author[4] + "\n") a = input("Что вы писали вчера? ") b = input("Куда ходили? ") result = "Вчера я написал {}. Вчера я ходил {}!".format(a, b) print(result) result = "олдос Хасксли родился в 1894 году.".capi...
b45be9c3214c28bfbe333564fdadfa2b22a382e3
Frizby777/all_files
/files_py/Loops.py
1,857
3.859375
4
music_list = ["Комната", "Там где нас нет", "Лакоста", "Дура"] name = "Ted" i = 0 for i, show in enumerate(music_list): music_list[i] = show.upper() print(music_list) print("\n") for i, show in enumerate(music_list): music_list[i] = show.lower() print(music_list) for i in range(1, 6): print(...
d72f60d1a9f03ef593280eab97dc1d7a638f0f14
Scottycags/Scott-Cagnard---CSC201----Program05
/Scott Cagnard----CSC201----Program05.py
6,561
4.125
4
#Scott Cagnard #Program Assignment 5 class Treasure(): #Create a parent class called treasure def __init__(self, name): #Create an instane function given the name of a treasure self.name = name def value_is(self): return self.value def look_at(self): return "%s %...
cc15d570ecb9c172ffffe6140a8e4423193f5f10
robinovitch61/edX_6.00.1x_Python
/OLD_FALL2016_VERSION/ps1/ps1a.py
1,265
4.09375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 18 18:29:103 2017 @author: Leo """ ''' Defined Variables: ****************** total_cost: Total house cost portion_down_payment: portion of cost needed for down payment (0.25 assumed) current_savings: current savings (assumed $0) r: annual return ra...
fbe1af03bf84bdbd10d4f46f665c19443291d278
danielzhou/Rainflux
/rainflow-master/src/rainflow.py
6,693
3.5
4
# coding: utf-8 """ Implements rainflow cycle counting algorythm for fatigue analysis according to section 5.4.4 in ASTM E1049-85 (2011). """ from __future__ import division from collections import deque, defaultdict import functools import math __version__ = "2.2.0" def _get_round_function(ndigits=None): if ndi...
e4c4b20d3a5f514e2034fcec676c1e1321d4641b
gsanchez13/pythonpractice
/python_refresher/integers_floats.py
340
3.890625
4
# INTEGERS AND FLOATS x = 15 # right side happens first and left side happens next # stored in memory to the variable price = 9.99 # integers are whole numbers and floats are numbers with a floating/decimal point discount = 0.2 result = price * (1 - discount) # follows PEMDAS # functions perform actions or calculate op...
fdf64cbe2094a9c86ddd1caf4a111baca77d2c23
Shivashankar101/PycharmProjects
/ProjectEuler/enumerator2.py
292
3.640625
4
mylist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15] for i, num in enumerate(mylist): if num % 3 == 0 and num % 5 == 0: mylist[i] = 'fizzbuzz' # for i in range(len(mylist)): # if mylist[i] % 3 == 0 and mylist[i] % 5 == 0: # mylist[i] = 'fizzbuzz' print(mylist)
3720bc50f9c310d8cbb2f867a0319366b0d16dfa
Shivashankar101/PycharmProjects
/ProjectEuler/Euler3i.py
466
3.84375
4
# What is the largest prime factor of the number 600851475143 ? def prime_max(x): num = 3 primes = [] if x <= 2: print(2) else: while num <= x: for n in range(int(num*.7), num): if num % n == 0: num+= 2 break ...
839104d6b5f352023171f9b607d34eba389e9cbe
Shivashankar101/PycharmProjects
/automation/Happy_no.py
676
3.6875
4
def happy_no(num): while num != 1: happy_count = 0 my_list = [] trials = 1 for digit in str(num): digit = int(digit) my_list.append(digit) for n in my_list: happy_count += n ** 2 if happy_count == 1: print(f"{num} is...
b3cfa877d0e3ae4cfdcfbe89eb8279d0abaeeb13
Shivashankar101/PycharmProjects
/ProjectEuler/Euler7.py
337
3.9375
4
#10001st prime def next_prime(): x = 3 while x > 2: for i in range(2, x): if x%i == 0: x += 2 break else: yield(x) x += 2 def the_prime(num): y = next_prime() for n in range(num): x = next(y) print(x) the_...
a3b946805b652a74e22e5a4994d06dd9b44eec3b
Klaus-Analyst/Python-projects
/simpson_smethod.py
780
4.0625
4
import math #area=dx/3*{f(x0)+4**f(x1)+2*f(x2).....4*f(xn-1)+f(xn)} def function(x): #enter the function here return eval(s) def dx(): return int((b-a)/n);#without the int it will return a string type def fab(): #find the sum of the 2 f(x) that are not multiply by 2 or 4\ return function(a) + function(b) ...
8119e4f50eb6818c6ffa6299cb1a6dd41813e64c
bkucukala/demorepo
/02_20_2021 _Pyhthon _Work.py
1,214
3.5625
4
number=tuple(range(1,11)) print(number) no1=1,[1,2,3],4 no1[1].append(5) print(no1[1],type(no1[1]), no1) dict_by_dict = dict(animal='dog', planet='neptun', number=40, pi=3.14, is_good=True) print(dict_by_dict) dict_by_dict = dict({'animal':'dog', "planet":'neptun', "number":40, "pi":3.14, "is_good":True}) print(dict_...
e76c9beb0a3fbc6eb3dd4c618508c187e7633642
jtvkw2/Sorting-Algorithms
/PA2a/Main.py
5,908
3.828125
4
from LinkedList import LinkedList import numpy as np import pandas as pd import matplotlib.pyplot as plt def main(): selection = [] bubble = [] insertion = [] shell = [] list_type = ["Ascending", "Descending", "Random"] list_num = ["500", "1000", "5000", "10000"] for y in range(3): ...
8c0cf4f81e474e9ddbc409bcd235e6013dde6cf0
SadeghShabestani/8_time
/8_time.py
301
4.21875
4
hour = float(input("Enter Hour: ")) minute = float(input("Enter Minute: ")) second = float(input("Enter Second: ")) print(f"{hour} : {minute} : {second}") result_hour = hour * 3600 result_minute = minute * 60 result = result_hour + result_minute + second print(f"Seconds: {result}")
eb79bd1cc01f50f268b84780d3fbd1780fd9cc9b
jtrob704/Bikeshare
/bikeshare_2.py
7,476
4.25
4
import time import calendar import pandas as pd import numpy as np from click._compat import raw_input CITY_DATA = { 'chicago': 'chicago.csv', 'new york city': 'new_york_city.csv', 'washington': 'washington.csv' } def get_filters(): """ Asks user to specify a city, month, and day t...
0e870376c5c7c5cf83cfbb61b895603f76e9da35
Lithak/GUI-Tkinter
/example.py
1,195
4.03125
4
import tkinter as tk # Declare global variables temp_c = None temp_f = None # This function is called whenever the button is pressed def convert(): global temp_c global temp_f # Convert Celsius to Fahrenheit and update label (through textvariable) try: val = temp_c.get() temp_f.set((...
18b63334d4abb6881f713842c9bd43a4f5e07e4e
SophSM/LCGEJ_python
/strings_and_lists.py
214
3.671875
4
# Rosalind Strings s = input("Dame el string: ") a = int(input("Dame a: ")) b = int(input("Dame b: ")) c = int(input("Dame c: ")) d = int(input("Dame d: ")) output = s[a:(b + 1)] + ' ' + s[c:(d + 1)] print(output)
204379350c0a0bc81ceaa3743afbb327ef1d9658
aizan0/python
/hangman.py
3,645
4
4
import random def hangman(): word = random.choice(["animals","vegetables","fruits","food","foodlover","cusine","fan","pc","laptop","monitor"]) valid_letters = "abcdefghijklmnopqrstuvwxyz" turns = 10 guesses = '' while len(word) > 0: main = "" missed = 0 # loop fo...
6df318d7ca006994d1cd820a2188de161880468d
valentynbez/practicepython-solutions
/06_string_lists.py
369
4.125
4
# https://www.practicepython.org/exercise/2014/03/12/06-string-lists.html def pal_check(): pal = input('Please add sentence: ') new_pal = [n.lower() for n in pal if n.isalpha()] rev_pal = ''.join(new_pal[::-1]) new_pal = ''.join(new_pal) if new_pal == rev_pal: print("It's palindrome!") e...
73233eb3a04c4d793aae9e1f6491fc0124764550
tangmessi/pycharm_git_practice
/Tkinter_滑动条.py
588
3.546875
4
import tkinter as tk master = tk.Tk()#生成主窗口 master.title('小洛') thelabel = tk.Label(master,text='hello world') thelabel.pack() scroll = tk.Scrollbar(master)#生成滚动条 scroll.pack(side='right',fill='y')#滚动条在右 LB = tk.Listbox(master, yscrollcommand = scroll.set)#,height = 5) for item in range(1,200 ): ...
79dda52f63f44dbe6fd4ba782b2426a5db1b84fe
tangmessi/pycharm_git_practice
/描述符练习.py
2,659
3.84375
4
""" class TempC: def __init__(self,fget=None,fset=None,fdel=None): self.fget = fget self.fset = fset self.fdel = fdel def __get__(self,instance,owner): return self.fget(instance) def __set__(self, instance, value): self.fset(instance,value) def __delete__(self, in...
f16444ccd31eeaba6bcec97442982c7422b22e87
TejasviniK/LeetCode
/FindAnagrams.py
677
3.65625
4
class Solution: def findAnagrams(self, s: str, p: str): op_list = [] p_hash = [0] * 26 s_hash = [0] * 26 for i in range(len(s)-len(p)+1) : print("list check :", s[i:i+len(p)]) if self.isAnagram(s[i:i+len(p)],p) : op_list.a...
c89ca330ecbdc97cbfa30bf6f49da265da9849bc
kshithijiyer/eulersolutionsPy
/6.py
1,095
3.953125
4
#Euler 6 #Problem: #The sum of the squares of the first ten natural numbers is, #12 + 22 + ... + 102 = 385 #The square of the sum of the first ten natural numbers is, #(1 + 2 + ... + 10)2 = 552 = 3025 #Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum...
4f564ca2b289eec35959fc57670e570789082cfa
kshithijiyer/eulersolutionsPy
/7.py
960
3.96875
4
#Euler 7 #Problem: #By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. #What is the 10001st prime number? #Author: Kshithij Iyer #Date of creation: 15/1/2017 import time #Recording start time of the program start=time.time() #Calculating the 10001st prime...
72d4699df84a1d7776185f448f3d6aa2f8d05107
Sitarko/learn-homework-2
/1_date_and_time.py
900
4.28125
4
""" Домашнее задание №2 Дата и время 1. Напечатайте в консоль даты: вчера, сегодня, 30 дней назад 2. Превратите строку "01/01/20 12:10:03.234567" в объект datetime """ from datetime import datetime, timedelta def print_days(date_now): try: dt1 = timedelta(days = 1) yesterday = date_now - dt1 ...
b2d62d3a6671672b47fed7626bf4dbea608d91dc
shamPJ/learning
/python/argparse/myls2.py
2,200
3.5
4
import argparse import os import sys # Create the parser my_parser = argparse.ArgumentParser(prog='myls', # With the prog keyword, spec. name of the program that used in help usage='%(prog)s [options] path', # define how myls is used # will show...
cc56421e0b0e7572654880c6b10157cda6cc94ad
chhhaya/standard_library
/unittest_mock/02_mock_class.py
2,610
3.546875
4
from unittest.mock import Mock # ----------------------------- # assert_called_with # assert_called_once_with # assert_any_call mock = Mock() mock.method(1, 2, 3, test='wow') mock.method.assert_called_with(1, 2, 3, test='wow') mock.method.assert_called_once_with(1, 2, 3, test='wow') mock.method(1, 2, 3, test='wow') #...
4701dc2609fcbc88935c0a52dca736fd40fa5099
Ricardo-Sillas/Project-1
/Main.py
964
4.21875
4
import hashlib def hash_with_sha256(str): hash_object = hashlib.sha256(str.encode('utf-8')) hex_dig = hash_object.hexdigest() return hex_dig # starts numbers off with length 3, increments the number by one, then increments length by one at the end of that length def getNum(s, n): if len(s) == n: check(...
44d3db8fbac2bd029e72864401c5195e1b29e57b
CarlosJaramilloDesarrolloSoftware/AlgoritmosP2NTD201
/CamiloTobonFlorez/punto17.py
290
3.984375
4
numero = 0 numero = input("Digite un número de dos cifras: ") largo = len(numero) - 1 lista = [] for i in str(numero): lista.append(i) print("Número de unidades: " + lista[largo]) print("Número de decenas: " + lista[largo - 1] print("Número de centenas: ") + lista[largo - 2]
d28da0ed98b2f9b61a8fa93e3bcfd970f48cb89d
simple2source/macugEx
/macugEx/a-iter-generator/__init__.py
1,643
3.578125
4
# -*- coding:utf-8 -*- # a iter object # 参考资料 # http://mp.weixin.qq.com/s?__biz=MzAxMjUyNDQ5OA==&mid=2653552192&idx=1&sn=47475d265c5360bf2ac23789dd5e7fe2&chksm=806dd0fdb71a59ebf035922bd58550c2989fc898f3e486b14b1c6ef9f0f4bcb2727e5d6e96d1&mpshare=1&scene=23&srcid=0710HtJtvVfM9JGBi7cva6we#rd # http://codingpy.com/article...
795979147914ef731e1a331174035def44ec225b
simple2source/macugEx
/macugEx/datastruct/Link_list.py
1,677
4.15625
4
# -*- coding:utf-8 -*- """ python 实现数据结构-链表 """ class Node(object): """定义节点和指针,指针指向下一个节点的值 """ def __init__(self, data): self.data = data self.next = None class LinkList(object): def __init__(self): self.head = None self.tail = None def append(self, data): node = Node(data) if self.head is None: ...
36c1582e5506b363c7663aae2a667635e47188e9
simple2source/macugEx
/macugEx/src/python_circle/008/stack.py
911
3.796875
4
class Node: def __init__(self, value): self.value = value self.next = None class Stack: def __init__(self): self.top = None def push(self, value): node = Node(value) node.next = self.top self.top = node def pop(self): node = self.top se...
c12295ae7f494a67fa97ae8e15a1a8629df2caaa
khushalk77/khushal-kumar
/khushal 2k18csun01066 PT3 .py
1,290
4.4375
4
#!/usr/bin/env python # coding: utf-8 # # 1. What is the syntax to call a constructor of a base class from child class # # ans: class parentclassname: # def _init_(self,var): # self.var=var # print(self.var) # class childclassname(parentclassname): # pass # ...
94db753f1353e1e880f93ee0d1775a7a812c24dc
erhant/musical-plots
/src/util.py
3,908
3.640625
4
import numpy as np _FLAT = "b" _SHARP = "#" # This is the major scale interval matrix. M[a][b] shows the number of semitones to reach from a to b. It is 1-indexed. For higher values such as 3 to 11, do 3 to 8 then 1 to 11-8=3 _M = [ [-1, -1, -1, -1, -1, -1, -1, -1, -1], # 0 [-1, 0, 2, 4,...