blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
3d343b07f22f67a7dd67bca0c4e292b363ae3744
Mizeri/NetworksMNIST
/mnist_loader.py
2,957
3.625
4
# Libraries # Standard library import _pickle as Pickle import gzip # Third-party libraries import numpy as np def load_data(): """Return the MNIST data as a tuple containing the training data, the validation data, and the test data.""" """The ``training_data`` is returned as a tuple with two entries. ...
f0bd46fedd72b49a85a91497c117f350ea4a94ec
DanielReap/Tic-Tac-Toe
/tictactoe.py
2,969
3.859375
4
class TicTacToe: def __init__(self): self.board = [1, 2, 3, 4, 5, 6, 7, 8, 9] self.players = ['X', 'Y'] self.end = False def reset(self): self.board = [1, 2, 3, 4, 5, 6, 7, 8, 9] self.defPlayer() def defPlayer(self): self.player1 = raw_input('X ...
6493cc10c110c2511deb9ce8a769c9bdc4e8fea3
rdayala/ComputerVision
/imageslicing.py
1,561
3.5625
4
# -*- coding: utf-8 -*- """ Created on Fri Nov 29 18:33:40 2019 @author: rdayala """ # this program, we try to display different parts of an image # Using NumPy array slicing to break down the image into different parts import numpy as np import cv2 image = cv2.imread("images/messi.png"); cv2.imshow("Original", ima...
f5c5043912f53f1d50b69c893c5c57b1679a1772
davidenole/KochGeneralizedSnowflake
/genKochLib.py
2,226
3.59375
4
import turtle as t class Snowflake: nSides = 0 # number of sides of the polygon nIterations = 0 # number of wanted iterations side = 0 # length of the sides drawer = t.Turtle() # turtle to draw the figure # utils for graphical reasons angle = 0 # internal angle # ctor, takes as a...
edc401c3c699d8062963ff14620c6d286583f136
haberrj/schmeissen_v2
/Support_Classes/card.py
2,919
4.03125
4
#!/usr/bin/python3 # Author: Ron Haber # Date: 25.05.2021 # A class for creating each individual card and forming the deck. import random import os, sys class Card(object): def __init__(self, value, suit): self.value = value # The value 2, ... , 13 self.suit = suit # Clubs, Spades, Diamonds, Hea...
8e697cfe4ac18f88c7bdd4677bc25deb0e925183
udpatil-py/python-scripts
/2_fibonacci_values_to_csv_and_log_generation_as_well.py
2,760
4
4
#generate fibonacci series and write to csv file, and produce logs as well import csv import logging from functools import lru_cache import re from builtins import int LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s" logging.basicConfig(filename='2_csv_log.log', # filemode='w', ...
8d8133b4cb33d21f2acdb07df9878e26268d8dd6
mjaybaig/datavisproject
/data/reshaper.py
621
3.53125
4
#%% import pandas as pd #%% test = pd.read_csv("group_genres_year.csv") #%% test.head() #%% mydict = {"name": "genres", "children": []} for g, df in test.groupby("genres"): newdict = {} newdict["name"] = g newdict["children"] = [] for rowtup in df.iterrows(): ind, data = rowtup yeard...
02a7098f2349217c7884bd390eb76eb31d05adff
priyathamhub/coding_challenges
/series_of_primes.py
776
4.09375
4
''' A prime number is a number that is divisible by only two numbers, 1 and itself. 1 is neither a prime number nor a composite number. Hence, 2 is the first prime number, 3 is the second prime number and so on.. Your task is to write a program that takes as input an integer N and prints the Nth prime number ''' ...
2c9bc9d19f08900f99043bfc4607455f9ba7fe1b
mominfazal/SoftwareDevelopmentBestPracticePython
/staticTypingNotImplemented.py
944
3.8125
4
""" Static typing not implemented, name of file should be camelcased and not snake cased """ def get_first_name(full_name): """ Accepts a variable full_name (Type unknown) returns part of string before first space """ return full_name.split(" ")[0] # Here we assumed its string and used split function # I ...
8f96ed3b9168a50c1bc4850d97aea524970c7b89
romeovasil/2PEP01
/HOMEWORKS/H2.py
1,417
3.515625
4
"""Create a class for an object that can retrieve: - IP address from each interface on teh system and provide it as a dictionary ex: {'INTERFACE_NAME': 192.168.0.1} use command ipconfig (windows) or ifconfig (linux/macOS) - IPv4 Route Table as a list of dictionaries. ex: [{'Network Destination': '0.0.0.0', '...
6c8c89d5231707f1445eba1f4c0a2a84ef3b5a41
aya-liu/machine-learning-for-policy
/hws/hw2/pipeline.py
6,301
3.5625
4
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split from sklearn import metrics ### explore def summarize_by_group(group, var, data): ''' Get summary statistics for a variable grouped by...
065acafb4af902c0738ccb43cb8c160825fd8491
lion137/Python-Graph
/dijkstra_shortests_paths.py
677
4.0625
4
# Dijkstra algorithm to find the shortest paths in a graph; uses adjacency lists # graph implementation and sys.maxisize as maximum distance import graphs_classes as gr import sys def dijkstra(g, v): def min_dist(distance, short_path_set): minimum = sys.maxsize for v in g.V: if dista...
e0aca6e479070937ea1ba3168cba5868371d9f26
AndreasBleyel/phytonSpielereien
/SpaceRemover.py
668
3.671875
4
import re import clipboard def writedata(): newfile = open("output.txt", "w+") finaldata2 = re.sub(' - ', '', newdata) finaldata = re.sub('- ', '', finaldata2) newfile.write(finaldata) newfile.close() clipboard.copy(finaldata) print("Done\n") print(finaldata) fname = input("Dateiname...
344b8b39e0bc67f296d44b003addcdbf31415836
khayes847/dsc-object-oriented-shopping-cart-lab-dc-ds-071519
/shopping_cart.py
1,799
3.734375
4
class ShoppingCart: # write your code here def __init__(self, employee_discount=None): self.prices = [] self.total = sum(self.prices) self.employee_discount = employee_discount self.items = [] def add_item(self, name, price, quantity=1): i = 0 while i < quant...
50bd046b46d329e4a507ad548346ab4a23da5a37
sammce/housing
/main.py
8,625
3.53125
4
from visual import VisualisedData import plotly.express as px visualised = VisualisedData() # Getting 3d scatter of county, price and year (OUR DATA) # from 2010 - 2019 df = visualised.cleaned_data data = [] for year in visualised.years_from_2010: for place in visualised.places_no_national: our_averages_d...
f7c21e973d563ba634b49b35235f4593948f7d68
gravityrahul/PythonCodes
/ReturnFactors.py
3,436
4.125
4
#!/usr/bin/env python # -*- coding: UTF-8 -*- ''' Problem: Given a number print all its factors without duplication. See Example for Details The Logic behind the algorithm is recursively break the factors until prime factors are reached. Also, take care of all the duplicates. I have run all the cases in the example a...
86c03e1ae74cbaa4c25d740f0c56b983663065c7
gravityrahul/PythonCodes
/LINKEDLISTS/Solution4.py
2,752
3.625
4
""" Copyright (C) 2014: Rahul Biswas This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is ...
2f4715b8bf415a09b1c0e9ede12abce08eaf3b98
gravityrahul/PythonCodes
/LINKEDLISTS/Solution2.py
2,642
3.625
4
""" Copyright (C) 2014: Rahul Biswas This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is ...
9e4244736abc90b0325f9f9a96a391336c9f888b
vaishnavee1051/full-stack-development
/python/function/fact.py
128
3.890625
4
def fact(a): prod=1 for i in range(1,a+1): prod=prod*i print("Factorial of given number is:", prod) fact(5)
0b37da1eab5ad69aa2912ef370c5fb19a26c7031
vaishnavee1051/full-stack-development
/python/odd-sum.py
107
3.65625
4
i=1 sum=0 while(i<=50): if(i%2==1): print(i) i+=1 sum=sum+i print("sum:",sum)
485c41a345c67047e1cd90b88df9a9423775cde0
vaishnavee1051/full-stack-development
/python/palindome.py
209
4.03125
4
n=int(input("Enter a number: ")) temp=n rev=0 d=0 while(n>0): d=n%10 rev=rev*10+d n=n//10 if(temp==rev): print("Given nmber is Palindrome") else: print("Give number is not a Palindrome")
21faab7f00404067d06cc6cc3d6312bcade063ab
Luan-hmm/soluciona-sudoku
/SolucionaSudoku.py
1,824
3.859375
4
#Solucionador de Sudoku #Sudoku a solucionar tabela = [ [7,8,0,4,0,0,1,2,0], [6,0,0,0,7,5,0,0,9], [0,0,0,6,0,1,0,7,8], [0,0,7,0,4,0,2,6,0], [0,0,1,0,5,0,9,3,0], [9,0,4,0,6,0,0,0,5], [0,7,0,3,0,0,0,1,2], [1,2,0,0,0,7,4,0,0], [0,4,9,2,0,6,0,0,7] ] def resolve(ta): procura = pro...
eb00cecf451a889f74c929082791a92f59d8f290
chsunwoo1002/Leet-Code-Algorithm
/python/1026_maximum_difference_between_node_and_ancestor.py
848
3.734375
4
# 1026. Maximum Difference Between Node and Ancestor # https://leetcode.com/problems/maximum-difference-between-node-and-ancestor/ # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(obj...
2d497cd960a123a0850849416629d2f5649ad0a4
chsunwoo1002/Leet-Code-Algorithm
/python/121_longest_repeating_character_replacement.py
881
3.546875
4
# 424. Longest Repeating Character Replacement # https://leetcode.com/problems/longest-repeating-character-replacement/ class Solution(object): def characterReplacement(self, s, k): """ :type s: str :type k: int :rtype: int """ char_counts = {} most_frequency...
5976432c596337b85622e73e234e3d7992e3efcb
chsunwoo1002/Leet-Code-Algorithm
/python/543.py
809
3.859375
4
# 543. Diameter of Binary Tree # https://leetcode.com/problems/diameter-of-binary-tree/ # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def ...
bf1f097fa2c85ae0b6c584c6728c86e1bfd0fe19
chsunwoo1002/Leet-Code-Algorithm
/python/122_Best_time_to_buy_and_sell_stock_2.py
571
3.578125
4
# 122. Best Time to Buy and Sell Stock II # https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/ class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ if prices == []: return 0 profit = 0 base...
9fe22a0fb46a5417cc7202797d5b3032b39b7bb3
chsunwoo1002/Leet-Code-Algorithm
/python/1290_convert_binary_number_in_a_linked_list_to_integer.py
770
3.765625
4
# 1290. Convert Binary Number in a Linked List to Integer # https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer/ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def getD...
e18e439ee2d2c7845351bd820d57fc7348fe480f
LEEBONGHAK/basic-of-python
/chapter2/연산자(2-1).py
888
3.65625
4
# 2-1 연산자 ''' + : 덧셈 - : 뺄셈 * : 곱셈 / : 나눗셈 ** : 제곱 계산 % : 나머지 계산 // : 몫 계산 ''' print(1 + 1) # 2 print(3 - 2) # 1 print(5 * 2) # 10 print(6 / 3) # 2 print(2 ** 3) # 제곱하기 2^3 = 8 print(5 % 3) # 나머지 구하기 2 print(10 % 3) # 1 print(5 // 3) # 몫 구하기 1 print(10 // 3) # 3 print(10 > 3) # True print(4 >= 7) # Flase...
a7a29891c5ecce59adaf4dc559fe3f70c53137d6
LEEBONGHAK/basic-of-python
/chapter3/퀴즈3(3-6).py
740
3.53125
4
''' 3-6 Quiz #3) 사이트 별로 비밀번호를 만들어 주는 프로그램을 작성하시오 예) http://naver.com 규칙1 : http:// 부분 제외 => naver.com 규칙2 : 처음 만나는 점(.) 이후 부분은 제외 => naver 규칙3 : 남은 글자 중 처음 세자리 + 글자 갯수 + 글자 내 'e' 갯수 + "!"로 구성 (nav) (5) (1) (!) 예) 생성된 비밀번호 : nav51! ''' url = "http://naver.com" my...
538a3aa7bb606abde6eb79da131cb7938db55584
LEEBONGHAK/basic-of-python
/chapter5/for(5-2).py
449
4.03125
4
# 5-2 for (반복문) for waiting_nu in [0, 1, 2, 3, 4]: print("대기번호 : {0}".format(waiting_nu)) for waiting_nu in range(5): # 0, 1, 2, 3, 4 print("대기번호 : {0}".format(waiting_nu)) for waiting_nu in range(1, 6): # 1, 2, 3, 4, 5 print("대기번호 : {0}".format(waiting_nu)) starbucks = ["아이언맨", "토르", "헐크"] for customer...
8ff1ab35a309845a668631e3dc5171e3f7548f48
kishanSindhi/python-mini-projects
/minipro2.py
2,080
4.375
4
# author - Kishan Sindhi # date - 30-5-2021 # discription - This is the simple number guessing game # in this mini project the user enters a upper limit and a lower limit # the one who guess the number in less guess wins the game import random def play(ll, ul, hidden, player): print(f"{player} guess...
4202b1b21b82842df1d37a422d84cc441bdf6ea4
ajakupov/blog_code
/noise_generator.py
594
3.609375
4
import math from random import randint def noize(sequence): number_of_blocks = len(sequence)/7 temp = list(sequence) for i in range (0, number_of_blocks): end = (i+1)*7 - 1 start = (i+1)*7 -7 index = randint(start,end) print index if (temp[index]=='0'): ...
ce204abafa4f8505b383c5d1721e94ea7eb6b022
malathimbanu/linking
/linking.py
180
4.0625
4
print("hello world") print("welcome to the tutorial") print("addition") def add(a,b): c=a+b return c a=int(input("enter a:")) b=int(input("enter b:")) c=add(a,b) print(c)
ab2ee86310d7b8de5e6dd723764901dde86b3638
crh12345/Deeplearning
/chart_11_1.py
630
3.828125
4
""" 卷积神经网络RNN """ import torch batch_size = 1 seq_len = 3 input_size = 4 hideen_size = 2 #设置RNN num_layers = 1 cell = torch.nn.RNN( #参数说明 input_size 输入的size hidden 输出的size num_layers表示为 #共几层这样的RNNCell input_size=input_size,hidden_size=hideen_size,num_layers=num_layers ) inputs = torch.ra...
f51ed12c7f66fd7b2eebd5c7cef9897ec543cb13
petersheck/learningpython
/ListDictQuiz.py
128
3.625
4
L1 = [0] * 5 print(L1) D1 = {'a': 0, 'b': 0} print(D1) D2 = dict(a=0, b=0) print(D2) L1[0] = 1 print(L1) D1['a'] = 1 print(D1)
a9d4b21237c90d2e780471299d88162c039e3f0b
petersheck/learningpython
/Summation.py
948
3.609375
4
def summation(L): if not L: return 0; else: return L[0] + summation(L[1:]); n = summation([1, 2, 3, 4, 5]) print(n) def sumtree(L): tot = 0 for x in L: if not isinstance(x, list): tot += x else: tot += sumtree(x) return tot n = sumtree([1, [...
c81140cc2a0d3c925b923c2929a63d1018d7cb78
BhattMukul/MB
/TicTacToe.py
2,841
3.875
4
'''This Program Is For TIC TAC TOE Game Build Tic Tac Toe In Very Basic and Easy Way''' def winner(): '''This function is Used To Check The Winner''' global result global count global l1 global l2 global l3 #l4(just below) is the the lis of all the winning conditions for this Game l4=[...
6596770e8d6685812d8bf0e341ff80e401b04b0b
jmbg-idv18/tareas-jose-maria
/MULT.py
268
3.953125
4
def mult(base:int,factor:int,x:int,prod:int): if(x>=factor): print(prod) else: prod+=base x+=1 mult(base,factor,x,prod) base=int(input("nùmero a multiplicar")) factor=int(input("veces a multiplicar")) prod=base x=1 mult(base,factor,x,prod)
e8d199581f5e7e0384f12e59dff72480b356ee86
6hack9/python-workshop
/execut-python/functions.py
1,461
4.34375
4
def positional(x, y): """ the argument x and y is positional arguments in the function the first value you pass in will be alwayes assing to x and the second value will be assigned to the y """ return x + y print(positional(5, 3)) def defAgr(name, age=18): """ Here age is default argument if we ...
7220302d4980eec112d506481555f80a996ffc23
6hack9/python-workshop
/ConstructingPython/pet.py
414
3.71875
4
class Pet(): """ A class to capture useful information regarding my pets, just incase I lose track of them.""" def __init__(self, height=5): self.height = height self.is_human = False self.owner = 'Kanon' chubbles = Pet(5) if chubbles.is_human is False: print('Not a human') print...
1c8eeea00e35bc0d8c76b80da52d8bbcf5da9420
darrenchurchill/aipnd-project
/classifier/model_trainer.py
7,244
3.796875
4
#! /usr/bin/env python3 """ModelTrainer class definition. Given a Classifier to train and a directory of training, validating and testing datasets, the Trainer trains the Classifier's model. """ from typing import TYPE_CHECKING if TYPE_CHECKING: from typing import IO import torch.utils.data from torchvision import...
f634e8780b6d6c802ab82e749ae1315e6c6287f6
SamaiyaHoward/for-loops
/tertiary.py
702
4.5
4
# -------------------- Section 3 -------------------- # # ---------- Part 1 | Patterns ---------- # print( '>> Section 3\n' '>> Part 1\n' ) # 1 - for Loop | Patterns # Create a function that will calculate and print the first n numbers of the fibonacci sequence. # n is specified by the user. # # NOT...
db12cc4821c7e63f8bbd5adcf98901bb915d3ee7
tusharsappal/GeneralInterViewquestions
/GeeksForGeeks Questions/FindLocalMinima.py
1,402
4.0625
4
# This code finds the local minima in an array ''' Given an array arr[0 .. n-1] of distinct integers, the task is to find a local minima in it. We say that an element arr[x] is a local minimum if it is less than or equal to both its neighbors. For corner elements, we need to consider only one neighbor for comparison. ...
bd4283affb7ae4f964225c4d4e35934e3d539deb
tusharsappal/GeneralInterViewquestions
/GeeksForGeeks Questions/LinkedListPrograms/DeleteNodeFromGIvenLocationLinkedList.py
2,293
4.21875
4
# This program deletes the Node from the given position from the LinkedList class Node(object): def __init__(self, dataElement): self.data = dataElement self.next = None def getNodeData(self): return self.data def getNextNode(self): return self.next def setNodeData(s...
97e3c5a51f9d2fe83170e54dc1aecb1511281c28
tusharsappal/GeneralInterViewquestions
/GeeksForGeeks Questions/LinkedListPrograms/CheckLinkedListIsPalindrome.py
1,861
3.96875
4
class Node(object): def __init__(self, data): self.data = data self.next = None def getData(self): return self.data def getNext(self): return self.next class LinkedList(object): def __init__(self): self.head = None def isListEmpty(self): return s...
c21cfd0e51380471a411b071e3c60d443891f324
tusharsappal/GeneralInterViewquestions
/GeeksForGeeks Questions/FindSumWithSameProduct.py
816
3.71875
4
# This program prints the pairs with the same sum class PairWithSameProduct(object): def pairWithSameProduct(self): string_input = raw_input() input_list = string_input.split(',') input_list = [int(a) for a in input_list] dict= {} for index in range(0,input_list.__len__(...
8527175b55406e32173961b103a289b91aa41d47
tusharsappal/GeneralInterViewquestions
/GeeksForGeeks Questions/ArrayPrograms/IndexOfExtraElementPresentInArray.py
666
4.09375
4
class IndexOfSortedArray(object): def findtheExtraElementIndex(self, list1, list2): lower = 0 upper = len(list2) - 1 index = 0 while ( lower <= upper): mid = int ((lower + upper)/2) if list1[mid] == list2[mid]: lower = mid +1 el...
f3cfd2ff2f2ddad3590d94eb9aa3b73955091ba1
tusharsappal/GeneralInterViewquestions
/GeeksForGeeks Questions/ArrayPrograms/ImplementStackUsingList.py
1,029
3.71875
4
class StackImplementationUsingList(object): def createStack(self): stack = [] return stack def pushElement(self, stack , element): stack.append(element) def popElement(self,stack): if not stack: print "Stack underflow , not able to pop" else: ...
940b421d72f7bbe0d9390ec52e018b78a5d4eac0
tusharsappal/GeneralInterViewquestions
/GeeksForGeeks Questions/ArrayPrograms/FindSmallestAndSecondSmallestNumberInArray.py
621
3.90625
4
class SmallandSecondSmall(object): def findValues(self, list): smallest = list[0] secondSmall = list[0] for index in range(0, len(list)): if list[index] < smallest: smallest = list[index] if list[index] > smallest and list[index] < secondSmall: ...
a31a2b9f3df4a6721fde61c596aa06310a9f1d3d
PiyushKumar186/programming
/dynamic_button.py
481
3.734375
4
import Tkinter as tk counter = 0 def counter_label(label): counter = 0 def count(): global counter counter += 500 label.config(text = str(counter)) label.after(1000,count) count() root = tk.Tk() root.title("Counting seconds") label = tk.Label(root, fg="dark green") label.pa...
7e49c7809ebc57c092592ecad287a03a1da36438
Antonio-Onyx/tip-calculator-start
/main.py
836
4
4
#If the bill was $150.00, split between 5 people, with 12% tip. #Each person should pay (150.00 / 5) * 1.12 = 33.6 #Format the result to 2 decimal places = 33.60 #Tip: There are 2 ways to round a number. You might have to do some Googling to solve this.💪 print("Welcome to the tip calculator.") bill = input("What wa...
2050a2401d71ee32f2945512427ce3c59726471b
danil-tr/CS_4
/Platformer/functions.py
2,263
4.125
4
""" The function module: contains the necessary functions for working with the World class and displaying text on the screen """ import json from os import path from world import World from constants import * def draw_text(text, font, text_col, x, y): """ Draws text to the screen when the function is called...
49271079bbe70f6b0d0c6487c17c39cf30a35d77
AlpriElse/UIUC-CS-196-Files
/20171003 Lecture Code/character-counts.py
261
4.15625
4
def count_characters(input_string): dict = {} for character in input_string: if character in dict: dict[character] += 1 else: dict[character] = 1 return dict test = "AABCCHELLO" print(count_characters(test))
4559ba7458acd4970c8306dded35bd496b322c43
keithoneill/SSL
/python.py
137
3.765625
4
import sys #name = raw_input("What is your name?") f = open("myfile.txt","r") print(f.read()) #f.write("New Line " + name) #f.close()
4e4bf0c19775a02c0e873fe0e878e452ec56d058
Kaustubh72/first
/e1.py
187
3.578125
4
class Employee: def __init__(self,fname,lname,pay): self.fname=fname self.lname=lname self.pay=pay emp1=Employee("panitosh","mahajan",80000) print(emp1.fname)
b7b1a96531e3234c8290e3746d1bc4f51ef4774d
Saqib29/Data-Structure-and-Algorithms
/Dynamic Programing/Fibonacci/Python/fibonacci_in_iterative.py
223
3.640625
4
def fib(num): f = [0, 1] while len(f) <= num: f.append(0) for n in range(2,num+1): f[n] = f[n-1] + f[n-2] return f[num] while(True): n = int(input()) if n<=0: break print(fib(n))
c6d26835649f3206a2688562b212f72bc2197435
Clara-Roig/python_unsam
/fileparse.py
2,939
3.703125
4
import csv def parse_csv (file, select = None, types = None, has_headers = True, silence_errors = False): ''' Parsea un archivo CSV o un objeto de estructura similar en una lista de registros ''' rows = csv.reader(file) ######## opción sin headers: if has_...
f1f7db191c10fbee23a25c3487dddc6275aa2958
anujkumar163/pythonfiles
/savefile.py
894
4.15625
4
print ("Welcome!") print ("Would you like to register") loop = True while (loop == True): username = input ("username: ") password = input ("password: ") print ("register here if you don't have an account") username1 = input ("name: ") print ("this is what you use to login to the system") usern...
9c9afa662142cba4de208b8849cd6a77240a9138
anujkumar163/pythonfiles
/practice33.py
218
3.59375
4
class Add: def result(self, a, b): print('Addition', a+b) class Multi(Add): def result(self, a, b): super().result(10, 20) print("Multiplication:", a*b) m = Multi() m.result(10, 20)
3e23880c47279ec2e740c31b1407a973320483d2
anujkumar163/pythonfiles
/equalcheck.py
296
3.671875
4
num = [1,2,3,4,4,5,6] '''if 1 == 2: print(True) else: print(False) if 4==4: print(True) else: print(False)''' '''for i in range(len(num)-1): if num[i] == num[i+1]: print("yes")''' for i in range(len(num)-1): if num[i] == 3 and num[i+1] == 3: print("yes")
ef7dcc9012947f4e442dc0072b4f39a188668b70
anujkumar163/pythonfiles
/starsPattern.py
2,070
4.125
4
#Interviews numbers and stars pattern question: '''rows = int(input('Enter the number of rows')) for i in range(rows): for j in range(i): print('*', end="") print('') #2 same for number prient rows=int(input('enter a numbers of rows')) for i in range(rows): for j in range(i): ...
3e076e21a2895d400a8541bf6ab4b354dae0c41e
anujkumar163/pythonfiles
/patternapplication2.py
84
3.75
4
n=int(input("Enter number of rows:")) for i in range(n): print((str(n)+" ")*n)
477e2db14445500645dc716fc9b8ca19b77446be
anujkumar163/pythonfiles
/if.py
128
3.859375
4
a = 10 b = 20 c = 30 if a>b and a.c: print("a is max!") elif b>a and b>c: print("b is max") else: print("c is max")
5cd8a2747824935dcc621fc8000892e3c8e16323
anujkumar163/pythonfiles
/04_pr_04_listdir.py
52
3.515625
4
a = input("Enter a number") a = int(a) print(a*a)
40a4a0d2d7b45c3347f0d6a11bf7ce926b54c043
anujkumar163/pythonfiles
/file4.py
50
3.859375
4
num = int(input("enter a number")) print(num*5)
770fb4031c6f6308d5eb7fa740f8ec295f4f9232
0bruhburger0/pizza
/db.py
3,412
3.625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- import sqlite3 from typing import List, Tuple conn = sqlite3.connect("pizza1.db", check_same_thread=False) cursor = conn.cursor() # Создание таблицы cursor.execute("""CREATE TABLE IF NOT EXISTS orders( tg_id INT PRIMARY KEY, pizza_id TEX...
99907c50f02562443e940852329ae6a85b59f017
cusol/taller-python
/Clase_3/istriangle.py
189
4
4
def is_triangle(a,b,c): if a > b+c: print "No." elif b > a+c: print "No." elif c > a+b: print "No." else: print "Yes." is_triangle(2,2,2) is_triangle(6,2,2) is_triangle(2,4,2)
0e12284af7226f1f0a5fcb1d3ae7703c400b97dc
sandrews/tamil-wikipedia-word-list
/find_tamil.py
442
3.546875
4
inputfile = 'tamil.sort.unique' input = open(inputfile,'r') out = open('tamil-words.txt','w') def is_tamil(word): word = word.decode('utf-8') first_char = word[:1] lang_number = ord(first_char) if lang_number >= 2944 and lang_number <= 3071: return True for line in input.readlines(): t...
4154b791030b8fdc886b0b4ca63fd11a8b7a7119
dicksiano/py-circuit-simulator
/src/simulator/simulation.py
9,517
3.6875
4
GATE_TYPE_LIST = [ "in", "out", "not", "and2", "nand2", "nor2", "or2", "xor2", "xnor2" ] class Simulation: """Simulates the circuit logically""" def __init__(self): self.gates = [] # [{ id: int, type: string }] self.gates_map = {} # { id: { type: string, outputs:[], inputs:[] } } ...
e889af24e69929122b64be93524273e37308372e
patrickwol/Python
/iterable.py
1,896
3.78125
4
# -*- coding:utf-8 -*- from collections.abc import Iterable from collections.abc import Iterator # 并行迭代 # name = ['GaoYan','ZYF','Bob','Alice'] # score = [90, 80, 69, 79] # weight = [90, 110, 100, 120] # # # for i in range(len(name)): # # print('name:{},score:{}'.format(name[i],score[i])) # # zip # # zip(name,sco...
a905effe5f7d5bc194d69875a733969a83e19d98
eugene-marchenko/pycharm
/coursera_files.py
120
3.890625
4
# Use words.txt as the file name fname = raw_input("Enter file name: ") fh = open(fname) print fh.read().upper().strip()
e3fd85451a07b963901ec571cfc54270f1ea46da
eugene-marchenko/pycharm
/product.py
131
3.578125
4
def product(elements): count = 1 for i in elements: count = count * i return count print product([4, 5, 5])
fc27e40ed0b65e79ca24b3db39d0e3dc91dcf561
eugene-marchenko/pycharm
/vowel.py
412
4.03125
4
alfab = 'BbCcDdFfGgHhJjKkLlMmNnPpQqRrSsTtVvWwXxYyZz!? []' text = 'Hey look Words!' def anti_vowel(text): new = '' vowel = '' for i in text: #print i for j in alfab: #print j if i == j: #print j vowel = vowel + j #print v...
a37721870fbf79c975ec2b4cd28cdbb0aecf9986
eugene-marchenko/pycharm
/prime.py
281
3.8125
4
def prime(n): if n <= 3: if n == 2 or n == 3: return True else: return False else: for devision in range(2, int(n**0.5)+1): if n % devision == 0: return False return True print prime(52)
6f25eed4e18e1f4605e56ca34d60132b534d7096
Annonymous-error/general-codes-to-be-used-by-beginers
/gui app.py
3,307
3.640625
4
# -*- coding: utf-8 -*- """ Created on Sat May 2 00:18:27 2020 how to create gui @author: Ayush Gupta """ import tkinter as tk from tkinter import ttk from tkinter import messagebox as mbox from csv import DictWriter import os win = tk.Tk() win.title('Gui') #creating lables name_label=ttk.Label(w...
203ccdb8d7fff5a593b23255b0d1314e6eb535f4
Annonymous-error/general-codes-to-be-used-by-beginers
/generator.py
392
4.09375
4
# -*- coding: utf-8 -*- """ Created on Sun Apr 26 11:40:14 2020 @author: Ayush Gupta """ def generator(n): for number in range(2,n+1,2): yield(number) even_number=generator(20) for num in even_number: print(num) # for generator comprehension print(next(square)) square=(i**2 for...
8cb42f164effe22148d3f43f5e25440a6ff5fae8
Annonymous-error/general-codes-to-be-used-by-beginers
/GUI_LABELFRAME.py
1,309
3.796875
4
# -*- coding: utf-8 -*- """ Created on Mon May 4 21:02:14 2020 how to create label_frame @author: Ayush Gupta """ import tkinter as tk from tkinter import ttk win = tk.Tk() win.title('Gui_LABELFRAME') label_frame=ttk.LabelFrame(win,text='enter details') label_frame.grid(row=0,column=0,padx=850,pady=350...
aa8a76109d8fa9d8a3a92ee318be5b73683abae6
krissylegaspi/Data-Structures-and-Algorithm
/Data Structures/Arrays/Python/Interview Question 2/main.py
1,322
4.25
4
# Interview question 2 # Palindrome problem overview # "A palindrome is a string that reads the same forward and background" # For example: radar or madam # Our task is to design an optimal algorithm for checking whether a given string is palindrome or not! def is_palindrome(string): # It has O(s) so basically lin...
0779b46085179d1b27334f8f6c0980771de52923
shubhamsarkar9654/IMDB-Movie-Scrapping
/task6.py
856
3.59375
4
# #task6 # def analyse_movies_language(movies_detail_dictionery): # import pprint # import json # json_language_file=open("imdb_movies.json","r") # language_file= json.load(json_language_file) # list_of_languages = [] # for i in language_file: # for keys,values in i.items(): # if keys == "Language:": # ...
b304dc92e5b5f5b85e720eb2443724ffb43e2075
akshaytiwari22/python_practice
/basic/3_add_numbers_user_input.py
126
4.03125
4
num_1 = input('Enter first number: ') num_2 = input('Enter Second number: ') sum = num_1 + num_2 print('The sum is :', sum)
6bc35168e389731570f24a81b31649453723d0c4
EduardoHuerta/EjemplosConPython
/RedNeuronal.py
2,684
3.96875
4
import numpy as np class NeuralNetwork(): def __init__(self): # siembra para generación de números aleatorios np.random.seed(1) #convertir pesos a una matriz 3 por 1 con valores de -1 a 1 y media de 0 self.synaptic_weights = 2 * np.random.random((3, 1)) - 1 ...
971d9119b77ca00f224da22e297be87754ee7317
LeslieMunMus/Python_GuessingGame
/guessingGame.py
909
4.09375
4
import os import random os.system("clear") # Guess a random number between 0 and 20. # You only have 3 chances and the number changes everytime the game is run def guessFunction(): secret_number = random.randint(0, 20) guess_count = 0 guess_limit = 3 while guess_count < guess_limit: guess = ...
49fe73dde26174b544aa3e4abb75c8e04b0946e6
YeemBoi/1fileWordFinder
/theFinder.py
1,087
3.859375
4
""" Hello! I was very determined to use only one file, so the readme is inside of the code now. This program is basically a super simple Python script for finding all the English words that can be spelled with certain letters. For example, you can type in "hello" and it will output words like hole, hell, he, oh, etc. ...
c191885e64e5bd4334eed3a9199d265a1c7cc385
xico2001pt/feup-mnum
/Práticas/Código/real_roots_algorithms.py
1,666
3.78125
4
import math def bisection_method(a, b, function, precision): prev_diff = 0 # Stores the current and previous difference while abs(abs(b - a) - prev_diff) > precision: prev_diff = abs(b - a) # Store previous difference m = (a + b) / 2 if function(a) * function(m) < 0: b = m...
3a82850ff47406fdbf037329d2576aa167dd87c6
gaoriente/CursoPythonCod3r
/Estrutura_Controle/if_else_1.py
1,083
4.15625
4
# Conceitos Notas # A De 10,0 a 9,1 # A- De 9 a 8,1 # B De 8 a 7,1 # B- De 7 a 6,1 # C De 6 a 5,1 # C- De 5 a 4,1 # D De 4 a 3,1 # D- De 3 a 2,1 # E De 2 a 1,1 # E- De 1 a 0 # # * Para Notas maiores q...
ca904fcc8f588d10c9e62d3b60265166f39331ce
gaoriente/CursoPythonCod3r
/Estrutura_Controle/if_else_2.py
566
3.875
4
def faixa_etaria(idade): if 0 <= idade < 18: return 'Menor idade' elif idade in range(18, 65): return 'Adulto' elif idade in range(65, 100): return 'Melhor idade' elif idade >= 100: 'Centenário' else: return 'Idade Inválida' if __name__ == '__main__': id...
5adea92a6bd7c5edbe5155f71a24cc5cb2e9936d
Anshikaverma24/if-else-meraki-ques
/if else meraki ques/q2.py
182
3.578125
4
# Check whether 1000 is greater than or equal to 4000. If yes, print "barabar ya bada hai". Else print "nahi hai" if 1000>=4000: print("greater or equal") else: print("nope")
6c16ebd3e91a15817aa3f10015f3dba7265cb743
Anshikaverma24/if-else-meraki-ques
/if else meraki ques/q9.py
507
4.4375
4
# If water in the filter is less than 1L then more water needs to be filled. # If the water quantity is between 1L and 10L then there is no need to fill water # If water is more than 10L then the water will overflow. # For water level, take user input in a variable named water and convert it to an integer. water=int...
7427564990de75038b4508550e502d34f2e9966b
Eveneto/Python-Answers-URI
/1008.py
200
3.84375
4
# -*- coding: utf-8 -*- numero = int(input()) horas = int(input()) salariohoras = float(input()) salario = horas * salariohoras print(f'NUMBER = {numero}') print(f'SALARY = U$ {salario:.2f}')
f7a0e717b50a38a9728f2484a9948e02fd91b558
tbaraza/Bootcamp_7
/Andelabs/string_reverse.py
95
3.640625
4
def reverse_string(string): if string == '': return None else: return string[:: -1]
0c19d739376d7bd1b116efd94ab6623d30b84354
MrWhiteRsv/cart_detector
/src/wheel_scanner/revolution_counter.py
4,972
3.65625
4
""" Count forward and backward revolutios based on signal levels. It also retruns feedback regarding the synchronization behavior of both counters. """ from enum import Enum from signal_level import SignalLevel from signal_level import SignalLevel class RevolutionCounter(): def __init__(self): LOW = Sign...
003b0d82cb3b4786b68da62e45e5d77152ede26d
srikanthajithy/Assignment_3
/UnitTest_Arithmetics.py
531
3.5625
4
import Arithmetics import unittest class UnitTest_Arithmetics(unittest.TestCase): def run_test(self): arithmetics = Arithmetics.Arithmetics() # assert arithmetics.sum(2, 2) == 4 self.assertAlmostEqual(arithmetics.sum(2, 2), 4) self.assertNotEqual(arithmetics.sub(6, 2), 2) s...
b5e63a975dd20a0f1fa49c36360398043f9eaea2
GregMcLindon/cp1404_practicals
/prac_04/lecture_activity.py
396
4.0625
4
scores = list() valid_score = False while not valid_score: try: score = int(input("Score: ")) while score >= 0: scores.append(score) score = int(input("Score: ")) valid_score = True except: print("Score must be an integer") if scores == []: print("No v...
58e4fd585739fc34d8ae78eafe7e2f2555daa794
dutchcodes/edxmit6001x
/Final/problem4.py
2,755
3.84375
4
# -*- coding: utf-8 -*- """ Created on Mon Oct 31 18:13:04 2016 @author: DutchCodes """ def longest_run(L): """ Assumes L is a list of integers containing at least 2 elements. Finds the longest run of numbers in L, where the longest run can either be monotonically increasing or monotonically decreasin...
27f6e2fd1a8989355456860b53c0d5f555f227ec
shenbomo/LintCode
/k Sum II.py
851
3.59375
4
__author__ = 'Danyang' class Solution: def kSumII(self, A, k, target): """ brute force :param A: An integer array. :param k: a positive integer (k <= length(A)) :param target: int :return: int """ ret = [] self.dfs(A, k, target, [], 0, 0, len(...
3f4c0cfe353a1cb7a7045e8587499ac5377f2436
pollyanarocha416/desafio-gitHub
/logica-prog-ecencial/Concatenação.py
155
3.796875
4
text1 = input('digite seu nome: ') text2 = input('digite seu sobre nome: ') phrase = text1 + text2 print('seu nome e sobre nome e: ') print(phrase)
59771894526e1cd3c1d874956afff034b587d615
wanga0104/learn
/homework/name.py
127
3.546875
4
first_name = input('请输入你的姓:') name = input('请输入你的名:') print(first_name,name) print(name,first_name)
1facdc066e3cdb23f944996bd0fdd8a44d739184
wanga0104/learn
/homework4/11.py
366
3.890625
4
list = ['Andy','男',18,'篮球','唱歌','跳舞','看书','Python老司机'] list2= ['我','爱','Python'] print(list[3:7]) #1.取出列表中索引3-6的元素 print(list[3:8:2]) #2.取出列表中索引3-7的元素,步长为2 print(list[-3:]) #3.取出列表中最后3个元素 print(list+list2) #4.追加一个列表list2=['我','爱','Python']内容
c919cc065654e1b1be441910839629c6717599aa
wanga0104/learn
/homework3/13.py
374
3.734375
4
cont = 0 while cont < 3: name = input('请输入你的用户名:') passwd = input('请输入你的密码:') if name == 'aaa' and passwd == 'bbb': print('登陆成功!') break else: cont += 1 print(f'登陆失败!\n 您还有{3-cont}次机会') else: print('登陆次数超过3次,账号已经锁定!')
781196434c3f7c0e99b99045c9c72c25aa31f338
prajwalacharya016/CrackingCodingInterviewSolutions
/quest4.4.py
848
3.75
4
from linkedlist import LinkedList, Node from binarytree import Tree llist=[None]*4 def linkedlistimplementation(node,level): if node is None: return if llist[level] is None: llist[level]= LinkedList() llist[level].insert(node) else: llist[level].insert(node) linkedlist...