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
a75d5895d8c681dee16dbb3e8d22a2e35bfd1359
daniellozuz/Project-Euler
/Problem613/problem613.py
806
3.5
4
''' ProjectEuler Problem 613 : Pythagorean Ant ''' # Lawl, I just input the following into Wolfram: # integrate integrate arctg((y-30)/x)-arctg(y/(x-40)) dy dx from y=0 to 30-(3x/4) from x=0 to 40 # I got the result: # 50 (32 log(2) + 9 log(3) - 25 log(5)) XXX WHYYYY??? # Which turns out to be: # -...
090435b9cf27a02233288045250d90f4181f4b9b
Maciejklos71/PythonLearn
/Practice_python/palidrom.py
635
4.4375
4
#Ask the user for a string and print out whether this string is a palindrome or not. # (A palindrome is a string that reads the same forwards and backwards.) def palidrom(string): string = string.lower().replace(" ","") for i in range(0,len(string)): if string[i]==string[-i-1]: if i ==...
d2d0c864e2e1d2f5269cb33bbda1edf282c7bcd4
GCatSword/flask_ventas
/cargaproductos3.py
1,116
3.5
4
import sqlite3 import csv fVentas = open('./sales.csv', 'r') csvreader = csv.reader(fVentas, delimiter=',') d = {} for linea in csvreader: if linea[2] not in d and linea[2] != 'tipo_producto': d[linea[2]] = {"precio_unitario":float(linea[9]), "coste_unitario":float(linea[10])} conn = sqlite3.connect(...
97def2edc0ebaeb728ea888cea93024d54f249e3
ErenYarar/Python
/Faktoriyel.py
126
3.875
4
sayi = int(input("Sayı: ")) faktoriyel = 1 for i in range(2,sayi+1): faktoriyel *= i print("Faktoriyel: ",faktoriyel)
3ab5abc85decfba2b18227d46f5edd4c43ac9a27
ErenYarar/Python
/Fonksiyonlar_ile_TamBölenbulma.py
339
3.640625
4
def tambolen(sayi): tam_bolen = [] for i in range(2,sayi): if(sayi % i == 0): tam_bolen.append(i) return tam_bolen while True: sayi = input("sayi: ") if(sayi == "q"): print("Kapatılıyor...") break else: sayi = int(sayi) print("tam bölen: ",...
75fd33bc0ecaa0bd91f814ea01224f3141742ada
ErenYarar/Python
/Fonksiyon.py
742
3.8125
4
################ Bilgileri Gösterme ###################### ########################################################## def bilgiler(ad="Bilgi yok",soyad="Bilgi yok",maas = 3000): print("Ad:",ad,"Soyad:",soyad,"maas:",maas) bilgiler("Eren","Yarar") ########################################################## ########...
00ef76b645ba2a01a2b2b97090468e218d7207e8
liuxin979/python
/day01.9.py
202
3.625
4
num = eval(input("Enter a number between 0 and 1000:")) bai = num // 100 % 10 shi = num // 10 % 10 ge = num // 1 % 10 arr = [bai,shi,ge] sum1 = sum(arr) print("The sum of digits is:%d" % (sum1))
0b49b011e6f4a9b69496982902b571915e8c1600
liuxin979/python
/day01.3.py
221
4.0625
4
import math radius,length = eval(input("Enter the radius and length of a cylinder:")) area = radius * radius * math.pi volum = area * length print("The area is:%.2f" % (area)) print("The voume is:%.2f" % (volum))
82186cdbbfb146369d49d88eb8b5c34f7fb4491c
liuxin979/python
/day04.homework7.py
213
3.796875
4
def distance(x1,y1,x2,y2): dis = ((x1-x2)**2+(y1-y2)**2)**0.5 print(dis) if __name__ == '__main__': x1,y1 = eval(input("x1,y1:")) x2,y2 = eval(input("x2,y2:")) distance(x1,y1,x2,y2)
99873b6fbb8387c2f59c117e0d6e30cd0953443a
liuxin979/python
/day02.homework6.py
804
4
4
# import calendar # def num(year,month): # print(calendar.monthrange(year, month)[1]) # def start(): # year = int(input('Enter year: ')) # month = int(input('Enter month number: ')) # num(year,month) # start() def Day(year,month): day = -1 if month >= 1 and month <= 12: ...
0fe0102e08c2e18e56656ac68f420cdc1d1e4666
AdamHamdi/python-first-project
/Loop_control.py
407
3.96875
4
def main(): print("starting program ") word='python' for letter in word: #print (letter) if(letter=='t'): #break leave directly #pass passed this statement #print ('block is passed') continue # continue without printing the letter 't'anything...
a404ad858d43f17542d953aa04209bfa56812a97
Ajmalnavas98/python
/condition.py
750
4
4
x = 3 print( x == 3 ) print(x < 3) print(x > 3) name = "mike" age = 13 #AND """if name == "mike" and age == 13: print("Your name is %s,%d year old", %(name,age)) """ #OR if name == "mike" or name == "rick": print("Your name is mike or rick") final = 5 #vairiable declaration ...
791e204e936dae6616c80e5a2b9b96874a5d3ad5
jenyf/T_07_RodriguezRamon.VegaHuaman
/Rodriguez_Ramon_Jenyfer_Esthefany/Mientras_01.py
309
3.59375
4
#Ejercicio_01 sueldo_quincenal= 1800 sueldo_invalido= (sueldo_quincenal < 1850 or sueldo_quincenal > 2800) while(sueldo_invalido): sueldo_quincenal=float(input("Ingrese sueldo")) sueldo_invalido=(sueldo_quincenal < 1850 or sueldo_quincenal > 2800) #fin_while print("sueldo valido:", sueldo_quincenal)
30a3b98d450d706b6c965910906156e03974898e
jenyf/T_07_RodriguezRamon.VegaHuaman
/Vega_Huaman_Maria_Cristina/iteracion_02.py
268
3.609375
4
#EJERCICIO 2 import os msg=os.sys.argv[1] for letra in msg: if(letra=="M"): print("trabajadora") if(letra=="C"): print("Esta Enferma") if(letra=="K"): print(("es celosa")) if(letra=="T"): print(" esta a dieta") #fin_for
86f21b53c85df4a2ba9be1ab31f0ba624e5282f2
chy1211/PythonLearning
/109_2_before_middle_test_2/0505/car.py
660
3.578125
4
class Car: def __init__(self): self.lb = None self.eg = None self.fl = None self.fr = None self.bl = None self.br = None class Engine: def __init__(self, cc): self.cc = cc class wheels: def __init__(self, size): self.size = size class Car...
171f29e1f5ce84dc46dcbf78ec06c4241b749fee
chy1211/PythonLearning
/109_2_middle_test_1/48.py
86
3.5
4
a = input("輸入一行英文句子:") listm = a.split() listm.reverse() print(listm)
59b22b6b32a37ba93324db2961f221567ceb8fbb
jacotronix/net.jacotronix.python.working
/HackerRank30Days/Algorithms/arrayRotation.py
1,719
3.90625
4
import sys # n - array size # k - num rotations # q - num queries # a - space seprated ints # m - print element m of rotated array n,k,q = raw_input().strip().split(' ') n,k,q = [int(n),int(k),int(q)] a = map(int,raw_input().strip().split(' ')) temp = 0 i = 0 while i < k: temp = a.pop() a.insert(0,temp) ...
b7307e992325e72ee959081fe95dbea512cc69e1
jacotronix/net.jacotronix.python.working
/HackerRank30Days/HackerRank30Days/Day06StringOddEvens.py
1,046
3.625
4
import sys T = int(raw_input().strip()) for i in range (T): s = raw_input().strip() o = "" e = "" for j in range(len(s)): if j%2 == 0: e = e + s[j] else: o = o + s[j] print e, o #Objective #Today we're expanding our knowledge of Strings and combining it w...
ea10bae440da76bdbde5c180e52b0f3cc071298b
robado/automate-the-boring-stuff-with-python
/2. Flow Control/4. Flow Charts and Basic Flow Control Concepts.py
1,038
4.0625
4
# Boolean types spam = True print(spam) # True spam = False print(spam) # False # Comparison Operators # == Equal to # != Not equal to # < Less than # > Greater than # <= Less than or equal to # >= Greater than or equal to print(42 == 42) # True print(42 == 'Hello') # False print(42 != 3) # True print(42 >= 100) ...
692d14e3fea32a798eb19731e5d2b214fa40dcdc
robado/automate-the-boring-stuff-with-python
/2. Flow Control/5. If, Else, and Elif Statements.py
1,216
4.1875
4
# if statement name = 'Alice' if name == 'Alice': print('Hi Alice') print('Done') # Hi Alice # Done # if name is other than Alice than the output will beDone # else statement password = 'swordfish' if password == 'swordfish': print('Access granted.') else: print('Wrong password.') # If password is swordfis...
3f4898cf0bec42b41161a9969771bf68c4af85c7
EyobelB/cstat_weather_data
/Lab9b_Act3.py
3,215
3.703125
4
# By submitting this assignment, I agree to the following: # "Aggies do not lie, cheat, or steal, or tolerate those who do." # "I have not given or received any unauthorized aid on this assignment." # # Name: Eyobel Berhane # Section: 520 # Assignment: Lab 7b # Date: 28 10 2019 impo...
836e8ec03a57755e2e186f9671de6960eab3cacb
sepiggy/dsa_python-brad
/ch02/sumofn.py
743
3.71875
4
import time def sumOfN2(n): start = time.time() theSum = 0 for i in range(1, n+1): theSum += i end = time.time() return theSum, end-start def sumOfN3(n): start = time.time() theSum = (n*(n+1))/2 end = time.time() return theSum, end-start print("sumOfN2 ---> Sum is %d...
56f9aae169bcbdd6daf3ce6248922a1b6b8e75f9
CosmoChan/PRML_Exercise
/Python/05_softmax_regression_classifier/softmax.py
5,998
3.671875
4
#!/usr/bin/env python # encoding: utf-8 from __future__ import division import numpy as np from numpy.linalg import pinv, inv, norm from basis_function import add_dummy_variable import matplotlib.pyplot as plt from scipy.linalg import block_diag def softmax_train(X_train, T_train, lambda_, num_iteration = 10, tolera...
c3bf4fc4c493b93c8ff8c01658efaa70936adbeb
CosmoChan/PRML_Exercise
/Python/02_fisher_discriminant_analysis/load_dataset.py
1,935
4.0625
4
#!/usr/bin/env python # encoding: utf-8 from __future__ import division from mnist import MNIST import pandas as pd import numpy as np def load_mnist(only_binary = True, y_1 = 0, y_2 = 1): """Load mnist data set Load mnist dataset from PRML_Exercise/datasets folder mnist is python module,we can use "pip...
9d5ba904f968e9d9ae53ead154e9d361d954df38
AdrianoAGL/tocadosilisio
/Players.py
1,806
3.625
4
import pygame class Player: def __init__(self, player_position_x, player_position_y, player_width, player_height, player_colour): self.position_x = player_position_x self.position_y = player_position_y self.width = player_width self.height = player_height self.colour = playe...
1d62f92da7f667c74a6cca60e9fa6dcc723cb27b
vasuharish/CodingTheMatrix
/Politics Lab/politics_lab.py
8,045
4.15625
4
voting_data = list(open("voting_record_dump109.txt")) ## Task 1 def create_voting_dict(): """ Input: None (use voting_data above) Output: A dictionary that maps the last name of a senator to a list of numbers representing the senator's voting record. Example: >>> creat...
ec4ebd3912ea2f6770ad93037b48cbf0e9fa9d23
Markofato/projectEuler
/Completed Problems/P009 Special Pythagorean triplet.py
1,768
3.96875
4
#A Pythagorean triplet is a set of three natural numbers, a b c, for which, #a^2 + b^2 = c^2 #For example, 3^2 + 4^2 = 5^2. # 9 + 16 = 25 #There exists exactly one Pythagorean triplet for which a + b + c = 1000. #Find the product abc. #for a : # for b : # for c : # if a+...
a483d3e579816aa318348a3f9349c86c8d22fd52
Markofato/projectEuler
/Completed Problems/P017 Number letter counts.py
3,511
3.78125
4
''' If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not count spaces or hyphens. For example, 342 (t...
9926312e264e05d10a833bba8cfb37a04100713b
iSizar/Neuronl-Networks-
/HOMEWORK III/NN/Activations.py
504
3.640625
4
import numpy as np from numpy import exp def sigmoid(z) -> np.array: ret_vec = map(lambda x: 1./(1 + np.exp(-x)), z) return np.array(list(ret_vec)) def relu(z): return z if z > 0 else 0 def print_f(z): strg = "" for x in z[0]: strg = strg + ' ' + format(x, ".3f") print(strg) # cal...
60a13ff9f3ad2da62594baeb737c944920a9afc6
andrascii/py_file_string_counter
/counter.py
2,266
3.625
4
import sys import argparse from os import listdir from os.path import isfile, join, splitext def file_len(filename): i = 0 with open(filename, errors="ignore") as f: for i, l in enumerate(f, 1): pass return i def get_all_files(path, extensions, excluded_dirs=[]): all_files = []...
dd109d0231382f4680d93159ac106fe0f9d2e0b0
scarletgrant/python-programming1
/p9p1_cumulative_numbers.py
593
4.375
4
''' PROGRAM Write a program that prompts the user for a positive integer and uses a while loop to calculate the sum of the integers up to and including that number. PSEUDO-CODE Set and initialize number to zero Set and initialize total to zero Prompt user for first positive integer While number => 0: total += numb...
340b1481b39b4ed272b3bd09ad648f933570e7de
scarletgrant/python-programming1
/p8p3_multiplication_table_simple.py
415
4.3125
4
''' PROGRAM p8p3 Write a program that uses a while loop to generate a simple multiplication table from 0 to 20. PSEUDO-CODE initialize i to zero prompt user for number j that set the table size while i <= 20: print(i, " ", i*j) increment i+=1 print a new line with print() ''' i = 0 j = int(input("Please...
056554d5ccb26d30af99409cf666c4f39eff29cd
scarletgrant/python-programming1
/p14p3_prime_numbers.py
1,064
4.0625
4
""" PROGRAM REQUEST 14.3 Implement the program that searches for prime numbers in a range of integers and demonstrates the use of the else clause in a for loop in Python from recent lectures (Lecture 13) (Page 16 of the notes). Ensure that you understand how this program works. PSEUDO CODE # Program to illustrate the ...
3bfb8410e8a4e2b498ed3387833a74ed905088e3
scarletgrant/python-programming1
/p10p1_square_root_exhaustive_enumeration.py
1,305
4.25
4
''' PROGRAM Write a program that prompts the user for an integer and performs exhaustive enumeration to find the integer square root of the number. By “exhaustive enumeration”, we mean that we start at 0 and succcessively go through the integers, checking whether the square of the integer is equal to the number entered...
955b815f2ae1f9707cfd51b6185fcd3c37405af5
agilman0803/Main_PDE_Repo
/src/stencil.py
1,587
3.71875
4
import math import numpy as np ## Stencil # A finite difference stencil to calculate an operator. class Stencil(): ## Constructor # Constructs stencil from an initial array. # # @param s list containing index of points contained in stencil. 0 corresponds to point operator is calculating for. Implemented...
4a4fa2a893c1d43911aff906c65d3b93fffd6cc3
ad5jo/multisensor
/PythonSRC/Settings.py
8,106
3.578125
4
#!/usr/bin/python # -*- coding: utf-8 -*- """ Tkinter tutorial This script shows a simple window on the screen. last modified: January 2011 website: www.zetcode.com """ import time import wx import serial from serial.tools import list_ports class InsertFrame(wx.Frame): def __init__(self): #wx.Panel.__in...
21bdc77262b03fc9df8a8e8a5adf92f3b004555d
girOly/pythonEssentials
/programming_mosh/fundamentals/conditions.py
901
4.09375
4
# price = 1000000 # has_good_credit = True # # if has_good_credit: # down_payment = 0.1 * price # else: # down_payment = 0.2 * price # print(f"Down payment: {down_payment}") has_high_income = True has_good_credit = True has_criminal_record = False if has_high_income and has_good_credit: print("Eligible for...
c9a5274eade10531ab42e2f4674ae1e1ae9cfb27
girOly/pythonEssentials
/restful_flask/fundamental_refresher/magic_methods.py
910
3.90625
4
class Person: def __init__(self, name, age): self.name = name self.age = age def __str__(self): return f"Person: {self.name}, {self.age} years old" def __repr__(self): return f"<Person({self.name}, {self.age})>" joe = Person("Joe", 35) print(joe) class Store: def...
35586dc405920feca83fdf991aa734bbeab5183a
girOly/pythonEssentials
/programming_mosh/fundamentals/2dlist.py
407
4.09375
4
# [ # # 123 # 456 # 789 # ] # 3x3 matrix = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] for row in matrix: for item in row: print(item) numbers = [5, 2, 1, 7, 4] numbers.insert(0, 10) print(numbers) print(numbers.index(7)) numbers1 = [2, 2, 4, 6, 3, 4, 6, 1] uniques = [] for number in...
5096f4fb21aa81bc947c5a0499b7546bcef3cc2d
HiddevdBos/AIT
/hangman.py
3,001
4.03125
4
from player import * # start of the game, player chooses a word and def startGame(player_1, player_2): player_1.chooseWord(len(player_2.result())) # choose a random word player_2.getwordLength(player_1.giveAnswer()) # tell player_1 how many letters the word is player_2.wordLength() # process word length print(p...
235a7eb11e48806dc0dfbd7e0c6195abfa2048d8
Madhavpawar600/data-structures
/reverselinkedlist.py
866
3.96875
4
class node: def __init__(self,data): self.data=data self.next=None class linkedlist: def __init__(self): self.head=None def add(self,data): new_node=node(data) new_node.next=self.head self.head=new_node def reverse(self): prev...
e3e36dc1a8ed546d05205248b41b6bbbf1126d68
MMoA16/CoDeLiBrArY
/print_substrings.py
185
3.625
4
str1=input() for i in range(len(str1)): if(i==len(str1)-1): print(str1[len(str1)-1]) break j=i while(j!=len(str1)): print(str1[i:j+1]) j=j+1
707e0ea61e1f821b44b7225c5e287a6645a04815
LucaDev13/hashing_tool
/hashing/hash_text.py
1,252
4.1875
4
from algoritms import sha1_encryption, sha224_encryption, sha256_encryption, sha512_encryption, md5_encryption, \ sha3_224_encryption print("This program works with hashlib library. It support the following algorithms: \n" "sha1, sha224, sha256, sha512, md5, sha3_224\n") print("In order to use this program ...
c99435cdd572d4a69542e5182d46b3cce619e8c1
ericjenny3623/15-112
/oast_HW/side scroller/hw9.py
13,217
3.546875
4
################################################# # hw9.py # # Your name: Eric Jenny # Your andrew id: ejenny ################################################# import math class Bird(): def __init__(self, birdName): self.name = birdName self.eggCount = 0 def fly(self): return "I can ...
fa61c1268678cd3e1fd5f608db08d46d5023ec3b
edwinzhng/hackerrank-solutions
/Artificial Intelligence/Bot Building/bot-saves-princess-2.py
588
3.59375
4
def nextMove(n,r,c,grid): p_row = 0 p_col = 0 for i in range(0, n): for j in range(0, n): if grid[i][j] == 'p': p_row = i p_col = j break; if p_row > r: return("DOWN") elif p_row < r: return("UP") elif p_col > c:...
14329095c3cb016fa414b92d918b37b7f669bba3
MichaelRol/EulerProject
/Problems 1-10/9-PythagTrips.py
188
3.546875
4
import math for b in range(1, 500): for a in range(1, b): c = math.sqrt((a * a) + (b * b)) #print a + b + c if (a + b + c) == 1000: print(a * b * c)
78215b5982346eb03f81b9d7b83c223aa233575b
MichaelRol/EulerProject
/Problems 11-20/20-FactorialDigitSum.py
339
4.0625
4
import math val = input("Calculate factorial: ") def factorial(num): val = 1 for x in range(1, num + 1): val = val * x return val count = 0 num = factorial(val) digits = math.ceil(math.log(num, 10)) for x in range (0, int(digits)): count = count + ((num % (10 ** (x + 1)) - num % 10 ** x)/10 ...
432283c59c855d9292c8d07a74eecd0e96604587
MichaelRol/EulerProject
/Problems 21-30/22-NameScores.py
1,838
3.546875
4
def nameScore(name): score = 0 for x in name: if x == "A": score += 1 elif x == "B": score += 2 elif x == "C": score += 3 elif x == "D": score += 4 elif x == "E": score += 5 elif x == "F": sco...
630d86873dbdadb8c5ba771e2cdae6eaff96d1c8
MichaelRol/EulerProject
/Problems 1-10/5-EvenlyDivisble.py
172
3.59375
4
i = 1 while(True): all = True for x in range(1, 21): if i % x != 0: all = False i = i + 1 if all: print(i) break
7e4a4a9a2197458c5371495838fba8b46f6240ca
MichaelRol/EulerProject
/Problems 41-50/41-PandigitalPrimes.py
552
3.9375
4
def isPrime(x): if x < 2 : return False if x == 2: return True for i in range(3,int(x**0.5)+1, 2): if x % i == 0: return False return True def isPandigital(val): digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] for x in range(0, len(str(val))): ...
7930f98eff263d11ffb289dcbf5986385624c377
MichaelRol/EulerProject
/Problems 31-40/35-CircularPrimes.py
824
3.640625
4
def isPrime(x): if x < 2 : return False if x == 2: return True for i in range(3,int(x**0.5)+1, 2): if x % i == 0: return False return True def hasEvenDigit(num): hasEven = False for dig in str(num): if int(dig) % 2 == 0: hasEven = True ...
f20ce71a2c50985479e704e5264a843d17344fb6
Finallap/AStarShortestPath
/dijkstras/dijkstra1.py
1,861
3.890625
4
from pprint import pprint def find_lowest_cost(costs,to_process): lowest_cost_node = to_process[0] lowest_cost = costs[lowest_cost_node] if len(to_process)>1: for node in to_process[1:]: new_cost = costs[node] if new_cost < lowest_cost: lowest_cost = new_cos...
e4d24657b46a00b21644d9c870d1ad7b2336820c
tripaak/python
/CodeWithHarry/basic_python/ex_1_dictionary.py
442
4.09375
4
# create a dictionary for 4 words and meaning , ask user to input any word and print meaning of this word my_dict = { "Aller":"To Go", "Venir":"To come", "Avoir":"To have", "Etre":"To be " } user_inp = input("Enter any french word to find meaning in english: ") if my_dict.get(user_inp) is not None:...
97d524a37d3d43918209824c6601eb58d1a0d723
tripaak/python
/Practice_Files/closestPowerTo2.py
533
4.25
4
# closest power to 2: find number greter than or equal to n whose submission make closest number to power of 2 # input = 3 # output = 5 because 3 + 5 = 8 = 2 power to 3 # 3 --> 3 + 4 --> 7 check if mod with 2 is 0 --> if yes return 4 else --> 3 + 5 --> check 8 % 2 == 0 def closestPowerToTwo(n): closest_num =...
d8378460fcfeaf950f19fbcd2d6bce47f9a5a704
tripaak/python
/Practice_Files/even_odd_list.py
371
3.875
4
def classify_even_odd(l): final = [] even = [] odd = [] for i in l: if i % 2 == 0: even.append(i) #its even else: odd.append(i) # odd number final.append(even) final.append(odd) return final number = [1,2,3,4,7,5,6...
23c7ee7a6dc041cb7bfa484912918443153bf5d7
tripaak/python
/Practice_Files/sum_user_input.py
249
3.953125
4
user_input = input("Enter any digit number: ") input_length = len(user_input) # print (input_length) i = 0 total = 0 while i < input_length: total = total + int(user_input[i]) i +=1 print (f"Sum total of entered number is :{total}")
47208a23d4ea29f0ad4cf605d0ded3aa4c4ca495
tripaak/python
/Practice_Files/cube_finder.py
638
4.1875
4
# Execercise # Define a Function that takes a number # return a dictionary containing cubes of number from 1 to n # example # cube_finder(3) # {1:1, 2:8, 3:27} ####### First approach # def cube_finder(input_number): # dNumb = {} # for j in range(1,input_number + 1): # vCube = 1 # for i in...
0c41790634413e5d08277fea58a8d91a587142a5
tripaak/python
/Practice_Files/average.py
265
4.09375
4
number_one, number_two, number_three = input("Input your 3 numbers: ").split(",") # average_value = (int(number_one) + int(number_two) + int(number_three))/3 print(f"Average Value of threee numbers are {(int(number_one) + int(number_two) + int(number_three))/3}")
fe8cd1b2aa4a5ca8385b0c7086c183d1e4604f91
tripaak/python
/Practice_Files/for_loop_sum_digits.py
410
3.734375
4
# number_input = input("Enter any digit number: ") # total = 0 # for i in range (len(number_input)): # total = total + int(number_input[i]) # print (total) # Check number of characters name = "akash tripathi" temp = "" for i in range(len(name)): if name[i] not in temp: print (f"{name[i]...
b1a9e2fb8c66b34549a2a8c246af21d9477c7573
tripaak/python
/Practice_Files/watch_coco.py
212
3.671875
4
name, age = input("Input your name and age comma seperated: ").split(",") age = int(age) if name[0].lower() == 'a' and age >= 10: print("You can watch coco") else: print("Sorry you can't watvh coco")
9d95fdb0ad3b8ab19e218f784ab6431ab63ab696
minhduc9699/DSA-Training
/stack.py
635
3.90625
4
class Stack: def __init__(self): self.items = [] def __str__(self): items_string = "" white_space = " " for i in range(len(self.items)): if i == len(self.items) - 1: white_space = "" items_string += str(self.items[i]) + white_space return str(items_string) def is_em...
97f0179825b91cdcf2ff5f2051adf7ebea8b4715
hihiworld/Artificial_Intelligence
/report4/code/maze/maze_solver.py
2,189
3.84375
4
from collections import deque from heapq import heappop, heappush def solve_bfs(maze, graph): start, goal = (1, 1), (len(maze) - 2, len(maze[0]) - 2) queue = deque([("", start)]) visited = set() visited_node_num = 0 while queue: path, current = queue.popleft() visited_node_num +=1 ...
928d0053fe55b35a95f360dc635309bcb2aa0d8b
MrNomercy/MS_Python_Class
/DEV236X/final.py
675
3.875
4
print('Input an interger to add to the total or "Q" to quit') total = list() def adding_report(A): total.append(int(A)) return total while True: inp_value = input('Enter an integer or "Q": ') if inp_value.isdigit(): result = adding_report(inp_value) elif inp_value == "q": ...
23228f5b10913df7565657bb8c40a73872497d6b
Jiawenew/ML-project
/real_PANAS_score.py
2,910
3.859375
4
## This document is used to classify the value of PANAS which be collected by survey. #Positive Affect Score: Add the scores on items 1, 3, 5, 9, 10, 12, 14, 16, 17, and 19. #Scores can range from 10 – 50, with higher scores representing higher levels of positive affect. #Mean Scores: 33.3 (SD±7.2) #Negative Affect Sc...
af33e7124f0053bdfa1502f61d755e06377aeebb
rhoenkelevra/python_simple_applications
/class-notes/fukushu/解答/ex0726_01.py
169
3.59375
4
total = 0 while True: s = input("数値を入力>>>") n = int(s) if n == 0: break total += n print("合計は" + str(total) + "です。")
5c6dae8dbd716c6240682f914ebc9d5eaa3d391b
rhoenkelevra/python_simple_applications
/class-notes/chapter_12/car_factory.py
859
3.859375
4
# -*- coding: utf-8 -*- """ Created on Tue Jul 20 13:23:23 2021 @author: user24 """ ''' Trying to make a factory function like in JS Create instances and append them to a list ''' from car_class1 import Car cars = [] def factory(color, mileage = 0): car = Car(color, mileage) cars.append(c...
89350a7b2c122b6d0d76801ebf0c3be51b88a547
rhoenkelevra/python_simple_applications
/class-notes/chapter_12/c12.py
2,753
3.8125
4
# -*- coding: utf-8 -*- from good_property2 import Goods2 from goods_property import Goods from override import Greet2 from super1 import Player from car_class1 import Car car1 = Car() car2 = Car("red") car3 = Car("black") car1.mileage = 10_000 print(car1) # returns the __str__() instead of memory locati...
ffab176f2d61ca6951c17b0ad6322407c31bbbce
rhoenkelevra/python_simple_applications
/class-notes/renshu_mondai/ex4-r.py
157
3.921875
4
for i in range(6): for j in range(10): if i%2 == 0: print("■ ",end="") else: print("□ ",end="") print("")
39b3b6e6e6b39688eadf2f9b3804283574d24faf
rhoenkelevra/python_simple_applications
/class-notes/fukushu/解答/Hukushu0713.py
675
3.515625
4
dlist = [] count = 0 while count < 10: inp = input("データを入力してください。 > ") if not inp: continue dlist.append(inp) count += 1 while True: inp = input("入力順:1 昇順:2 降順:3 終了:4 > ") if inp == "4": break if inp == "1": for i, data in enumerate(dlist, 1)...
4e5c55234e6ae69f6950a60cde7c9df7b5fd2db7
rhoenkelevra/python_simple_applications
/class-notes/challenges/challenges.py
223
3.734375
4
# -*- coding: utf-8 -*- """ Created on Fri Jul 9 15:07:50 2021 @author: user15 """ a = [1, 2, 2, 2, 3, 4, 10] b = [2, 10] for i in a: for j in b: if j == i: a.remove(i) print(a)
4a2a18560635b9293c84d88b7741b033675ceb58
rhoenkelevra/python_simple_applications
/class-notes/fukushu/hukushu0708_01.py
269
3.6875
4
# アルゴリズムテキスト 練習5 # 点数を入力し、80点以上なら"合格"、80点未満なら"不合格"と表示する x = int(input("点数を入力してください:")) if x >= 80: print("合格") else: print("不合格")
c3362b15875b2178cd7f6226856d6e5da7d1cd92
rhoenkelevra/python_simple_applications
/class-notes/renshu_mondai/ex13-r.py
1,420
3.828125
4
tate = int(input("タテ:")) yoko = int(input("ヨコ:")) print("模様を入力してください(空白を入力して終了)") pList = None #パターンリストの初期化 max = 0 #模様の最大文字数 while True: pattern = input() if len(pattern) > 0: #模様が入力された場合の繰り返し処理 if pList == None: pList = [0] else: nowpList = [0] #模様一時保管用パターンリスト ...
fb3e00c298c159d9369029fa963163ede1f670cb
KimYeong-su/programmers
/python/practice/collectBracket.py
849
3.71875
4
''' # 다른 사람들은 카탈란 수로 풀었습니다. # https://soccer-programming.tistory.com/18 from math import factorial def parenthesisCase(n): return factorial(2*n)//(factorial(n)*factorial(n)*(n+1)) ''' def dfs(n,result,stack,cnt1, cnt2, case): global answer if cnt1 == cnt2 == n and not stack: answer.add(result) ...
3aedfc7ec53a51f4a78613f05d9611cedb33c9ff
KimYeong-su/programmers
/python/DFS_BFS/targetNumber.py
437
3.546875
4
def dfs(idx, result, N, target, numbers): global answer if idx==N: if target == result: answer += 1 return dfs(idx+1, result + numbers[idx], N, target, numbers) dfs(idx+1, result - numbers[idx], N, target, numbers) def solution(numbers, target): global answer ...
5284ca6a6a5c418477d40ebcc6190c455791b223
KimYeong-su/programmers
/python/stack_queue/truck.py
826
3.859375
4
# 다리를 지나는 트럭(https://programmers.co.kr/learn/courses/30/parts/12081) # 입출력 예시 # bridge_length weight truck_weights return # 2 10 [7,4,5,6] 8 # 100 100 [10] 101 # 100 100 [10,10,10,10,10,10,10,10,10,10] 110 def solution(...
78705bd8c5438d5123a3dc319be0b356b54217ce
KimYeong-su/programmers
/python/hash/phonebook.py
848
3.6875
4
# 전화번호 목록(https://programmers.co.kr/learn/challenges?selected_part_id=12077) # phone_book return # [119, 97674223, 1195524421] false # [123,456,789] true # [12,123,1235,567,88] false def solution(phone_book): answer = True phone_book = list(sorted(phone_book)) for i in range...
58171613ea06cc0d047e50d8374b025cf4991cb8
walteraa/py-csv-processing-sample
/csv-utils/csv_utils/csv_processing.py
2,123
3.921875
4
import csv, heapq class CSVParser: ''' Class which represents the CSV parser ''' def __init__(self, file_path): ''' Constructor Arguments: file_path (str): The path of the file to be processed ''' self.file_path = file_path def top_n(...
32cabafde4d5cd6c30b0e364f14ed7f4092753cc
clodo/python-cookbook
/08/interacting-with-a-relational-database/solution.py
640
3.609375
4
import sqlite3 stocks = [ ('GOOG', 100, 490.1), ('AAPL', 50, 545.75), ('FB', 150, 7.45), ('HPQ', 75, 33.2), ] db = sqlite3.connect('database.sqlite') c = db.cursor() # Create table c.execute('create table portfolio (symbol text, shares integer, price real)') db.commit() # Insert data c.executemany('...
6abe2b6bdf319634c06619dfa4711aae4e41622c
void-memories/zelia
/watch.py
156
3.765625
4
import math from datetime import datetime while 1: now = datetime.now() current_time = now.strftime("%f") print("Current Time =", current_time)
aedf64c640c881e66046aef0845e6f8a3284f137
VallieTracy/study-guide-week-2
/oo.py
454
3.515625
4
# Create your classes here class Student: def __init__(self, first_name, last_name, address): self.first_name = first_name self.last_name = last_name self.address = address class Question: def __init__(self, question, correct_answer): self.question = question self.corre...
998898e776650fcced43af21dc404807a1078fd4
sharpk1/Python-Repository
/BankAccount.py
891
3.703125
4
class Account(): def __init__(self, owner, balance): self.owner = owner self.balance = balance print('A new account is created') def deposit(self, depositAmount): self.balance = self.balance + depositAmount print("the new balance is now " + str(self.balance)) ...
b77594a10aedb89fcdc0c9fcfce48698fad877b9
sharathb2423/PYTHON
/Sudoku Solver/sudoku solver.py
1,772
3.875
4
def find_next_empty(puzzle): for r in range(9): for c in range(9): if puzzle[r][c] == 0: return r, c return None, None def is_valid(puzzle, guess, row, col): row_vals = puzzle[row] if guess in row_vals: return False col_vals = [] for i...
6f15398ef97977a914842bb23db0979374a5c95c
Mustafa-Max/Guess-the-number-on-python
/Guess The Number/Guess_The_Number.py
276
4
4
import random hidden = random.randrange(0, 21) guess = int(input("What number will you guess ? ")) if guess == hidden: print("Hit!") elif guess < hidden: print("Your guess is too low") else: print("Your guess is high") print(hidden,"Don't give up")
a4dfec551eac3a855c978d1912dd76267c5d4f8c
vibhor-shri/Python-Basics
/datastructures/PythonList.py
10,533
4.65625
5
separator = "============================" print("List in python") print("List in python is a collection of objects of either same or different data types") print(separator) print() print("There are 2 ways to create a list in python:") print("1. By putting [] brackets in an assignment statement; my_list = []") print("...
e8f93243c5fdb8b236abf3defd638a338884ca14
vibhor-shri/Python-Basics
/controlflow/Loops.py
400
4.34375
4
separator = "============================" print("Loops in python") print("There are 2 types of loops in python, for loops and while loop") print(separator) print() print() print("A for loop, is used to iterate over an iterable. An iterable is an object which returns one of it's elements " "at a time") cities =...
4c366885f854ad3b880c07d220de497b166c72c9
docPhil99/opencvQtdemo
/staticLabel1.py
1,012
3.5
4
from PyQt5.QtWidgets import QWidget, QApplication, QLabel, QVBoxLayout from PyQt5.QtGui import QPixmap, QColor import sys class App(QWidget): def __init__(self): super().__init__() self.setWindowTitle("Qt static label demo") width = 640 height = 480 # create the label that...
d4d0e5a72845e4ffa77234f23370c88a27563a9c
ahmadhaghbin/toturial
/read_file.py
2,320
3.90625
4
import pandas as pd import matplotlib.pyplot as plt import numpy as np def read_excel_data(file_name): data_frame = pd.read_excel(file_name) return data_frame # @@@@ eXTRACT FROM eXCEL in form of dataframe if __name__ == '__main__': #read phython files file_name = "WindSpeed.xlsx" data_fra...
e65ef50a4709eac31977523899379189cfee3b7a
rasuloff/practical-python-worked
/2.2 Containers/2.7 Finding out if you can retire_worked_rasuloff.py
2,013
3.515625
4
# report.py # # Exercise 2.7 Finding out if you can retire ''' Tie all of this work together by adding a few additional statements to your report.py program that computes gain/loss. These statements should take the list of stocks in Exercise 2.5 and the dictionary of prices in Exercise 2.6 and compute the current valu...
b64b0a27cf42f1c6f3f590c83e20e36db6703444
rasuloff/practical-python-worked
/1.4 Strings/1.17_mortgage_worked_rasuloff.py
1,620
4.03125
4
# Exercise 1.10: Making a table # Modify the program to print out a table showing the month, total paid so far, and the remaining principal. The output should look something like this: # 1 2684.11 499399.22 # 2 5368.22 498795.94 # 3 8052.33 498190.15 # 4 10736.44 497581.83 # 5 13420.55 496970.98 # ... # 308 874705.88 ...
942906ed60699cb9119e02157dbade0f11018d39
egoing/python-tutorial
/4_3_list.py
378
3.578125
4
students = ["egoing", "sori", "maru"] grades = [2,1,4] print("students[1]", students[1]) print("len(students)", len(students)) print("min(grades)", min(grades)) print("min(grades)", max(grades)) print("sum(grades)", sum(grades)) import statistics print("statistics.mean(grades)", statistics.mean(grades)) import random...
b2b90f394a999db66d989e0f4df9dd0b0a808dd1
adeayo-py/DBMS-Using-sqlite3
/Orgmail.py
1,473
3.65625
4
import sqlite3 #creating an sqlite file named orgdb and initializing the cursor con=sqlite3.connect('orgdb.sqlite') cur=con.cursor() #Delete predefined table named Counts and create new one cur.execute('DROP TABLE IF EXISTS Counts') cur.execute('CREATE TABLE Counts (org TEXT, count INTEGER)') #file you to work with....
4b27d0669fff56997cece4ba9f22b57c92540b97
JBetser/Portfolio
/core/input_methods.py
1,498
4.09375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import re def input_general(text): if not text.endswith(' '): text += ' ' try: feedback = input(text) except: feedback = None return feedback def input_float(text): while True: feedback = input_general(text) ...
b8011ee51929c87ee298b71858f742de6c9ef88b
grimley517/Euler-python
/euler1/euler1tests.py
1,104
3.75
4
import unittest import euler1 class runtests(unittest.TestCase): def test1(self): mults = euler1.mults(3,10) try: assert mults == [3,6,9] # test 1 multiples of 3 under 10 fails except AssertionError as e: print (mults) print ('should be [3,6,9]') ...
0dc2c4d5ef4b7be76e3be480670d66cd29036d01
maria-kuruvilla/effective_computing
/numpy_argparse_assignment_maria.py
2,036
3.90625
4
""" Make some arrays in numpy and try 5 methods of your choice on them Have the code save some output to your output directory ([my_code]_output/) as a pickle file, and have it read that file back in. Have the code make the output directory if needed. Use argparse to add command-line arguments to your code, allowin...
7e855033e689ad71dfcb4e137374c0351ac3e19f
Uncccle/learning-python1
/3.if函数.py
1,004
3.78125
4
#------if函数------ # 第一种:(if语句语法) a=int(input("请输入号码")) if a < 10: print("哈哈哈") # 第二种: (if...else...) b=int(input("请输入号码")) if b < 7: print("嘎嘎嘎") else: print("啊啊啊") # 第三种: (多重判断) c=int(input("请输入号码")) if c < 10: print("咔咔咔") elif c < 20: print("啦啦啦") else: print("嘻嘻...
87ad826d00f46ec7c95d21c87b3387bb42f60f21
Uncccle/learning-python1
/2.注释&输出.py
546
4.21875
4
#python的注释分为两类 #单行和多行 #单行 # #多行 """ """ #dsmfsd """ sdkf """ #注释解释器是不运行的 #---------------------------------------# # 打印输出 # a="啦啦啦啦" b=22222 c=1.1 #第一种: print(a) print(b) print(c) #第二种: print(f'{a}') print(f'{b}') print(f'{c}') #第三种: print("%s" % a) #当为字符串时,应该用s print("...
7a4b912d065ebedd40cb723432859f006ae1ad35
vids2397/vids2397
/Day 1/exercise27.py
364
3.984375
4
#Program to find the prime umbers between the given range def prime_no(low,upp): res = [] for i in range(low,upp+1): tmp = 2; while tmp < i: r = i % tmp if r == 0: break; tmp += 1 if tmp == i: res.append(i) return res n1 = int(input("Enter the 1st number: ")) n2 = int(input("Enter the 2nd nu...
8d271335108f2e82d4cd1bb0643710deba3caaaf
vids2397/vids2397
/Day 1/exercise4.py
376
4.25
4
n1 = int(input("Enter 1st number: ")) n2 = int(input("Enter 2nd number: ")) n3 = int(input("Enter 3rd number: ")) if n1 > n2 and n1 > n3: print('%d is the biggest number.' % n1) elif n2 > n1 and n2 > n3: print('%d is the biggest number.' % n2) elif n3 > n2 and n3 > n1: print('%d is the biggest number.' % n3) else: ...
2f2eeca3a352a3c799aede0a5f665f2254d562d4
kannchea/Nanodegree
/rename_files.py
426
3.703125
4
import os def rename_files(): #(1) get file names from a folder file_list = os.listdir(r"/Users/Mann/Desktop/Nanodegree/prank") currDir = os.getcwd() os.chdir(r"/Users/Mann/Desktop/Nanodegree/prank") #(2) for each file, rename filename for file_name in file_list: new_name = file_name.tr...
3817df8619e45824b2a425b5e2768bd6d8989b40
curtisjm/python
/personal/basics/functions.py
1,210
4.46875
4
# declare a function def my_function(): print("Hello from a function") # call a function my_function() # arbitrary arguments # if you do not know how many arguments that will be passed into your function, # add a * before the parameter name in the function definition # this way the function will receive a tuple of ...