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
9c198707d630b0b99ccc73294ae2249f8e52582b
Tavial/cursophyton
/ALFdatosSimples/ejercicio09.py
576
4.15625
4
''' Escribir un programa que pida al usuario su peso (en kg) y estatura (en metros), calcule el índice de masa corporal y lo almacene en una variable, y muestre por pantalla la frase Tu índice de masa corporal es <imc> donde <imc> es el índice de masa corporal calculado redondeado con dos decimales. IMC = peso...
7ea4ad1d64edd040b9572c615f550c3488dde131
Tavial/cursophyton
/ALFcondicionales/ejercicio06.py
1,291
4.375
4
''' Los alumnos de un curso se han dividido en dos grupos A y B de acuerdo al sexo y el nombre. El grupo A esta formado por las mujeres con un nombre anterior a la M y los hombres con un nombre posterior a la N y el grupo B por el resto. Escribir un programa que pregunte al usuario su nombre y sexo, y muestre po...
2418436b66812d56c024f62600b64f4fda325e60
Tavial/cursophyton
/ALFdatosSimples/ejercicio10.py
608
4.53125
5
''' Escribir un programa que pida al usuario dos números enteros y muestre por pantalla la <n> entre <m> da un cociente <c> y un resto <r> donde <n> y <m> son los números introducidos por el usuario, y <c> y <r> son el cociente y el resto de la división entera respectivamente. ''' print ("Vamos a obtener el ...
b728aafc4536358c55c802932a6352874f2cb782
baddener/PYTHON
/urok1.py
834
4.1875
4
import math op = input("operation") x = float(input("Number one")) y = float(input("Number two(при sqr и sqrtx - не учитывается, введите любую цифру)")) z = float(input("Stepen'")) result = None if op == "+": result = x+y print(result) elif op == "-": result = x-y print(result) elif op =...
f51ef0de3acebe21518f400f8ff2a2b31446adbc
btepok/IrisDbot
/db_manage.py
10,856
3.71875
4
import sqlite3 import random import os def create_db(): try: sqlite_connection = sqlite3.connect('users.db') sqlite_create_table_query = '''CREATE TABLE Users ( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name TEXT NOT NULL...
f3bbb44b478a266de878784844125710a46d0941
genezaleski/nba_predictive_model
/naiveBayes.py
5,032
3.71875
4
from csv import reader from math import sqrt from math import exp from math import pi import time # Load a CSV file def load_csv(filename): dataset = list() with open(filename, 'r') as file: csv_reader = reader(file) for row in csv_reader: if not row: continue dataset.append(row) return dataset # C...
6ae6bbe4d3165091bdfd815642ab9f251c31b74b
13bca031/Learning-Python-with-101Loop
/dict.py
116
4.03125
4
my_dict = {'name':'Jack', 'age': 26} # Output: Jack print(my_dict['name']) # Output: 26 print(my_dict.get('age'))
c3540f54b31fcfa3a340ccf1cc2045057e4a7d28
greenshad/PIESpaceRider
/Python_EKF_final/Camera.py
7,052
3.625
4
###################################################################################################################### # Localization of a space cobot by visual odometry # PIE # ISAE SUPAERO # Toulouse, 14.03.2021 # # Authors: BECKE Philipp # SECHERESSE Vincent # ################## # Camera class #############...
777c3e02fba423495a3d87f29401dcc16c7af99c
AmoghM/HackerRankML
/Temperature-Predction/temperature_prediction_GB.py
2,438
4
4
''' Accuracy:- 62.82% Question Link:- https://www.hackerrank.com/challenges/temperature-predictions/problem Original data shape: Input (X): [1,2,3] Temperature (Y): [5.,7.3,6.2] Prediction (X'): [4] Example for reshaped data format for fit(): Input (X) is [[1], [2], [3] ] Temp...
6de2ac2bbde9274df1540b29f9c983a39253bd57
the-matrixio/ml_competition_didi
/preprocess_data/get_weekday.py
630
4.1875
4
''' Given absolute time, return weekday as an integer between 0 and 6 Arguments: Absolute time (integer) Returns: Integer between 0 and 6 inclusive. Monday is 0, Sunday is 6. ''' from __future__ import absolute_import from __future__ import division from __future__ import print_function import calendar def get_wee...
1faf5d828e45a329cff95c5d0e16b61c19d1a2b2
Jaslew/LeetCode
/Python/026. 删除排序数组中的重复项.py
1,796
3.859375
4
""" 简单 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 你不需要考虑数组中超出新长度后面的元素。 示例 2: 给定 nums = [0,0,1,1,1,2,2,3,3,4], 函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4。 你不需要考虑数组中超出新长度后面的元素。 说明: 为什么返回数值是整数...
5aeb016d19e379ee950b1cef96e986c0646f14e4
mohiuddin13631/simple_project
/GUI_project/gui_project.py
3,616
3.90625
4
#tutorial --- 232 import tkinter as tk #tkinter is a libery. ja pythone dewa ase from tkinter import ttk # its a sub module of tkinter from csv import DictWriter import os win = tk.Tk() win.title('GUI') #! create label # for creating level we can use two module 1) pack 2)grid -- grid is batter name_label = ttk.Label(w...
2279c21a983ac35521d4b80087140f2aa7d1b121
kengozavr/new
/lab6/lab6_4.py
1,959
3.609375
4
import tkinter as tk from random import choice, randint class Ball: def __init__(self): self.r = randint(30, 50) self.x = randint(self.r, 800 - self.r) self.y = randint(self.r, 600 - self.r) self.x_vector = randint(-3, 3) self.y_vector = randint(-3, 3) self.flag_bal...
ec4687df38e8cc00d0291b118a23cb4a48f0dcc1
Israel87/PythonPirple-HW1
/lists.py
1,558
4.09375
4
#Details: #Create a global variable called myUniqueList. It should be an empty list to start. #Next, create a function that allows you to add things to that list. Anything that's passed to this function #should get added to myUniqueList, unless its value already exists in myUniqueList. If the value doesn't exist a...
b5878d9ff3f147f2ab014c8d2e5d6302cddd8243
clade/airSU
/lib/data_path.py
1,160
3.625
4
""" Function to create DATA file with incrementing number Usage : filename = get_filename(directory='/sd') This function returns a new file name """ import os import re import time expr = re.compile('DAT_([0-9][0-9][0-9][0-9]).txt') filetemplate = "DAT_{i:04d}.txt" def get_max_number(directory="/sd"): i ...
fcb36dc1d019f8c72119fcccc52e271ee0d7b880
19059019/HonoursProject
/assesmentmanagementsystem/Willems_sources/wb272-stuff/assignments/a02/files/duration.py
317
3.78125
4
#!/usr/bin/env python3 def end_time(): time_start = int(input('Start time: ')) duration = int(input('Duration: ')) time_end = (time_start // 100) * 60 + (time_start % 100) + duration return '{0:02}{1:02}'.format((time_end // 60) % 24, time_end % 60) if __name__ == '__main__': print(end_time())
d943aabe8b553683a4c38acc2c834e1fbe61aa3b
SurabhiPradhan/code-grow
/MY_PYTHON_PROJECTS/mapping/map.py
1,679
3.53125
4
import folium import pandas data = pandas.read_csv("in.csv") # extracting the data in separate lists latitude = list(data["lat"]) longitude = list(data["lng"]) City = list(data["city"]) Population = list(data["population_proper"]) #function to change cirlce marker color depending upon population of the City in popu...
a04127594453a5490c471827a965f745ad283064
SCBera/HardWay2Py
/ex5.py
609
4
4
# Storing variables in a string my_name = 'Subhas Chandra Bera' my_age = 31 # not a lie my_height = 176 # cm my_weight = 64 # kg my_eyes = 'Black' my_teeth = 'White' my_hair = 'Black' print(f"Let's talk abut {my_name}.") print(f"He's {my_height} cms tall.") print(f"He's {my_weight} kgs heavy.") print("Actually that's ...
4b2538b6531686da1ed060e85e362a5c7a7a37f0
Eirenne/CodeforcesSolutions
/101498C.py
171
3.5
4
T = int(input()) words = ["First", "Second", "Third"] for i in range(T): l = [int(a) for a in input().split()] print(words[min(range(len(l)), key=l.__getitem__)])
c2c4c604aa6b8e9dc8f48d4002e48af68788b048
parthcode/TKinterApp
/variables.py
784
3.765625
4
from tkinter import * start = Tk() start.title("Variables") start.geometry("400x600") some = Label(start, text="Enter the first number") some.pack() first_number = Entry(start, width=10) first_number.pack() some = Label(start, text="Enter the second number") some.pack() second_number = Entry(start, width=10) second...
10e5d2d5be1fe20d0bcb95120aa0c78a667e0cab
tejashinde/.py
/Practice/NOWusingfor.py
216
3.78125
4
inputString = input("Please enter a string : ") wordList = inputString.lower().split(" "); wordCount = {} for i in wordList: wordCount[i] = 0 for i in wordList: wordCount[i] += 1 print (wordCount)
dd232362e74158dc8818166b003b09bdb7067069
tejashinde/.py
/Practice/stringtobase.py
462
3.78125
4
# def baseN(num,b,numerals): # return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b]) # # n = 20 # b = 16 # # baseN(20,16,"0123456789abcdefghijklmnopqrstuvwxyz") def typeConversionFunction(n,base): convertString = "0123456789ABCDEF" if n < base: ret...
b1c5168ba8626de5597e03b2a35e530179d5bd61
tejashinde/.py
/Practice/LargestNumberFormed.py
309
3.625
4
list = [50,2,1,9] l2 = [] for iterable in list: for char in str(iterable)[0]: for index in range(0,len(list)): if(index == len(list)): continue if(int(char) > int(str(iterable)[index])): l2.append(char) # if(int(str)) print(l2)
cca2c65a67742200006c6998d45dca616ab0f9db
tejashinde/.py
/Practice/maxFunctionPyMa.py
1,378
3.796875
4
# Tejas Shinde # Symbiosis Institute of Computer Studies and Research # 2nd Sept 2018 def maxnum(*largs): try: maximum = 0 for element in largs: # STRING if(type(element) == str): numint = float(element) if(numint > maximum): ...
ca5d9be37f360f13a8638546bfaba77e871479f6
tejashinde/.py
/Practice/uniqueNumbers.py
95
3.65625
4
list = [1,1,2,2,3,3] dic = {} for index in list: dic[index] = index print(dic.keys())
bf13f88bc78bb15280365ba69c1e3072c923936c
weihuacern/UdacityHadoopMapReduce
/L7MapReduceDesignPatterns/Q2_TopN.py
1,632
3.59375
4
#!/usr/bin/env python """ Your mapper function should print out 10 lines containing longest posts, sorted in ascending order from shortest to longest. Please do not use global variables and do not change the "main" function. """ import sys import csv import io def mapper(): reader = csv.reader(sys.stdin, delimiter='...
77db9841cf16c96919bf770b7f01e9a2e9abd864
tegamax/ProjectCode
/Common_Questions/TextBookQuestions/PythonCrashCourse/Chapter_8/8_11.py
1,260
4.21875
4
''' 8-11. Archived Messages: Start with your work from Exercise 8-10. Call the function send_messages() with a copy of the list of messages. After calling the function, print both of your lists to show that the original list has retained its messages. ''' ''' def send_messages(short_list): sent_messages = [] ...
4a6aa2ffcf88c2e4a38ce56fab7d316f6d4e0114
tegamax/ProjectCode
/Common_Questions/TextBookQuestions/PythonCrashCourse/Chapter_9/Ex_9_4.py
1,639
4.28125
4
''' 9-4. Number Served: Start with your program from Exercise 9-1 (page 162). Add an attribute called number_served with a default value of 0. Create an instance called restaurant from this class. Print the number of customers the restaurant has served, and then change this value and print it again. Add a method call...
15adf600d22bd201224113041307e14208a970c0
tegamax/ProjectCode
/Common_Questions/TextBookQuestions/PythonCrashCourse/Chapter_8/8_4.py
586
4.09375
4
''' 8-4. Large Shirts: Modify the make_shirt() function so that shirts are large by default with a message that reads I love Python. Make a large shirt and a medium shirt with the default message, and a shirt of any size with a different message. ''' ''' def make_shirt(shirt_size='large'): if shirt_size == 'lar...
b2def23578d639e50d6eea882e5b9a8246edb01b
Pajke123/ORS-PA-18-Homework07
/task2.py
469
4.1875
4
""" =================== TASK 2 ==================== * Name: Recursive Sum * * Write a recursive function that will sum given * list of integer numbers. * * Note: Please describe in details possible cases * in which your solution might not work. * * Use main() function to test your solution. ========================...
36d96afca41d0850346fec1d648638e58208c3ed
ebtrader/shipper
/Split_DF.py
416
3.78125
4
import pandas as pd df = pd.DataFrame({'Tracking Number':['10X4R3W','30X5R3W','20X6R3W','70X4R3W','80X7R3W'], 'A':[3,4,7,6,1], 'Shipper':['Fedex', 'Fedex', 'UPS', 'UPS', 'Conway']}) print (df) s = 30 #df1 = df[df['Sales'] >= s] df1 = df[df['Shipper'] == 'Fedex'] df2 = df[df['Shipper'] == 'UPS'] df3 = df[df...
be84fefead1b575714dff0af23a77cdb55dc3239
Amrutha26/100DaysOfCode
/Week5/GFG(Day1-7)/Day2/Day2 - Solution.py
578
3.71875
4
#User function Template for python3 class Solution: def findNth(self,N): #code here res = 0 i = 1 # convert N to base 9 while(N > 0): res += i * ( N % 9 ) # i * remainder N = int(N / 9) i = i * 10 # Alternate soln is store ...
8a8e08160ca15108ab0719457e4d37180356a9f1
Amrutha26/100DaysOfCode
/Week7/GFG(Day15-21)/Day17/Day17 - Solution.py
1,495
3.5
4
// { Driver Code Starts //Initial Template for C #include<stdio.h> #include<stdlib.h> struct Node { int data; struct Node *next; }*start; void insert(); // } Driver Code Ends //User function Template for C //Function to find the data of nth node from the end of a linked list. int getNthFromLast(struct No...
4784097591055b420d9da1df8a650782095d4d57
Amrutha26/100DaysOfCode
/Week2/Day13/Duplicate Character.py
1,382
3.6875
4
''' Duplicate Character Tina is given a string S which contains the first letter of all the student names in her class. She got a curiosity to check how many people have their names starting from the same alphabet. So given a string S, she decided to write a code that finds out the count of characters that occur more...
2c8584e4d58ef291ee872d5b5f95a6034d121a5f
AlexAdvent/night-code-sprint
/pinp-pong.py
4,115
3.53125
4
import turtle from numpy import random wn = turtle.Screen() wn.title("Ping Pong") wn.bgcolor('black') width = 800 height = 600 wn.setup(width=width, height=height) wn.tracer(0) class AI: def where_to_move(self): ball_cor = [ball_1.ball.xcor(), ball_1.ball.ycor()] ball_speed = [ball_1.ball.dx, ball...
50223c75eec39c839362f251baaa94f728c4d6d6
qs8607a/Algorithm-39
/Euler/part2/p68.py
1,655
3.5
4
##Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and ##each line adding to nine. ## ##Working clockwise, and starting from the group of three with the numerically ##lowest external node (4,3,2 in this example), each solution can be described ##uniquely. For example, the above solution c...
26410cf5ae0f194059e16deda7f1a82a3058329a
qs8607a/Algorithm-39
/Euler/part3/p104.py
1,057
3.734375
4
##The Fibonacci sequence is defined by the recurrence relation: ##Fn = Fn1 + Fn2, where F1 = 1 and F2 = 1. ##It turns out that F541, which contains 113 digits, is the first Fibonacci number ##for which the last nine digits are 1-9 pandigital (contain all the digits 1 to 9 ##, but not necessarily in order). And F274...
c0263a27dc0d5f52ae3207227f08690e9f1a2545
qs8607a/Algorithm-39
/Euler/part1/p4.py
1,729
4.09375
4
##A palindromic number reads the same both ways. The largest palindrome made from ##the product of two 2-digit numbers is 9009 = 91 99. ##Find the largest palindrome made from the product of two 3-digit numbers. def isPalindromic(n): return str(n)==''.join(reversed(str(n))) def f1(): result=0 fo...
74a604962afc9390ed69ebe60e739e42c2e72c9c
qs8607a/Algorithm-39
/Euler/part3/p117.py
229
3.578125
4
Cached={} def f(n): if n<2:return 1 if n not in Cached: Cached[n]=f(n-1)+f(n-2) if n>=3: Cached[n]+=f(n-3) if n>=4: Cached[n]+=f(n-4) return Cached[n]
15a0adbef0f9a0f76b3c705deed5622a0eb24792
qs8607a/Algorithm-39
/Euler/eulertools.py
5,235
3.5
4
#-*- coding:utf-8 -*- import time from itertools import cycle from collections import Counter from random import randint # 数学部分 def GCD(*args): """ 最大公约数 """ y = args[0] index = 1 while index < len(args): x = args[index] if x > y: x, y = y, x ...
51130ee6b208ec4ba7c8b5f3d9337669d6ad97b4
qs8607a/Algorithm-39
/Euler/part2/p89.py
2,264
3.875
4
##The rules for writing Roman numerals allow for many ways of writing each number ##(see FAQ: Roman Numerals). However, there is always a "best" way of writing a ##particular number. ## ##For example, the following represent all of the legitimate ways of writing the ##number sixteen: ## ##IIIIIIIIIIIIIIII ##VII...
a65bc7560664ccc746193d57e1dccdc807f5d6c8
qs8607a/Algorithm-39
/Euler/part1/p50.py
1,041
3.65625
4
##The prime 41, can be written as the sum of six consecutive primes: ##41 = 2 + 3 + 5 + 7 + 11 + 13 ##This is the longest sum of consecutive primes that adds to a prime below ##one-hundred. ##The longest sum of consecutive primes below one-thousand that adds to a prime, ##contains 21 terms, and is equal to 953. #...
64f7d9316c008a8e78456f07e6c6b2228e297bcd
zhenyakeg/Final_preparation
/2nd term/_23_find_abcd.py
326
3.734375
4
s = input() state = 0 i = 0 for letter in s: if letter == 'a': state = 1 elif letter == 'b' and state == 1: state = 2 elif letter == 'c' and state == 2: state = 3 elif letter == 'd' and state == 3: state = 4 print("found:", i - 3) else: state = 0 i...
af381abd855ce933755b2b2ac742812f6a5d1dea
zhenyakeg/Final_preparation
/1st term/23.Hanoi.py
328
3.9375
4
def hanoi(n, i = 1 , k = 3): if n == 1: print(n, i, k) else: tmp = 6 - i -k hanoi(n-1,i, tmp) print(n, i, k) hanoi(n-1, tmp, k) hanoi(3) '''Асимптотика O(2^N - 1)''' '''23. Ханойские башни. Алгоритм и его реализация на Python.'''
e76dc868cbfe89d0e829dd8cfde95cd6661c3112
dwalczak84/pythonprogramming
/Practice_Makes_Perfect.py
10,094
3.953125
4
############################################################################### # Practice Makes Perfect ############################################################################### # Practice! Practice Practice! # The best way to get good at anything is a lot of practice. This lesson is # full of practice problems...
077e070ecddeedee387a0a9b9b658262af4eccaf
AMfalme/OOP-python-Furniture-sales
/OOP_file.py
1,182
4.1875
4
from abc import ABCMeta, abstractmethod class Electronics(object): """docstring for Electronics This is an abstract Base class for a vendor selling Electronics of various types. """ __metaclass__ = ABCMeta def __init__(self, make, year_of_manufacture, sale_date, purchase_price, selling_price, purchase_date): ...
58f2f8f0c819d448d6234c6eceb5878e1dca2501
dionysus/coding_challenge
/leetcode/029_DivideTwoIntegers.py
770
4.09375
4
def divide(dividend, divisor): """ :type dividend: int :type divisor: int :rtype: int """ if (dividend < 0 and divisor < 0) or (dividend >= 0 and divisor >= 0) : divMod = myMod(abs(dividend), abs(divisor), True) else: divMod = myMod(abs(dividend), abs(divisor), False) ...
84f44e91f5a2344aed98d43d3630dfd9acd5a8a3
dionysus/coding_challenge
/hackerrank/common-child.py
2,141
3.703125
4
''' Common Child Difficulty: Medium www.hackerrank.com/challenges/common-child/problem ''' #!/bin/python3 import math import os import random import re import sys # Complete the commonChild function below. # alpha = ord('A') def letterCount(s): dic = {} # keep track of indiceds with a dict for i in range(l...
61123681d1a35d9a00b4cfba76103fc78ca105e5
dionysus/coding_challenge
/leetcode/088_MergeSortedArray.py
1,297
4.1875
4
''' 88. Merge Sorted Array URL: https://leetcode.com/problems/merge-sorted-array/ Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and nums2 are m and n respectively. You may assume that nums1 has enough space (size that is...
883852cb21100cdb98debf7b5601314183810744
dionysus/coding_challenge
/leetcode/007_ReverseInteger.py
907
4.09375
4
''' 7. Reverse Integer Difficulty: Easy URL: https://leetcode.com/problems/reverse-integer/ Given a 32-bit signed integer, reverse digits of an integer. Note: Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For the purpose of this pr...
088c22e6bb379460cbeeb2d89d0f8a06a4d6b2c6
SurajGavali/Python-Programming
/Games/pingpong game/pin pong.py
3,689
4.53125
5
# simple ping pong game using python3 for beginners # By @SurajGavali import turtle #for graphical window window = turtle.Screen() window.title('Ping Pong by @SurajGavali') # for setting title of the window window.bgcolor('black') window.setup(width=1000,height=700) window.tracer(0) #stops updating window score_A...
05d0485e40117cf2b4e8063942e6cb4154569ac6
MankaranSingh/Algorithms-for-Automated-Driving
/code/exercises/control/get_target_point.py
981
4.125
4
import numpy as np def get_target_point(lookahead, polyline): """ Determines the target point for the pure pursuit controller Parameters ---------- lookahead : float The target point is on a circle of radius `lookahead` The circle's center is (0,0) poyline: array_li...
9482cfb5d361dcdb2381ca79cafcdba410b19624
mebinjohnson/Library-Management-System
/1 Book Issue.py
1,577
3.75
4
import csv import time from Functions import * #___________________________________________________________________________________________________________________________________________________ design('*',25) design('Book Issue',1) design('*',25) #______________________________________________________________________...
a44e31f32621b697d7f6b9c5d4cf369dbd2993fb
CYehLu/test
/difference.py
1,498
3.84375
4
import numpy as np def d_dx(var, dx): ''' calculate the partial x difference for given dx (dx varies to y). Parameters ----- var: a two dimensional numpy array dx: one dimensional numpy array with len = var.shape[0] Returns ----- dvar_dx: var differential to x. the shape is as...
84fd29ef2d853ea303e83aad3e4d2ef24cec7011
HoraN1/alien_invasion
/bullet.py
1,117
3.953125
4
import pygame from pygame.sprite import Sprite class Bullet(Sprite): """ A class to manage the bullet """ def __init__(self, game_settings, screen, ship): """ Create a bullet at the location of ship """ super().__init__() self.screen = screen # Create a ...
597c4e4c39eaf811a3858df14bebc7b4079a8acc
acc-cosc-1336/cosc-1336-spring-2018-ZachariahClymerAcc
/tests/assignments/test_assign6.py
990
3.515625
4
import unittest from src.assignments.assignment6 import get_count_A_C_G_and_T_in_string #write the import for function get_count_A_C_G_and_T_in_string class Test_Assign6(unittest.TestCase): def test_countACGT_w_string_ATGCTTCAGAAAGGTCTTACG(self): ''' Create a test case to test the count of As, Cs...
3dcb4ab815eefd4305dec3cf682e822dcc5002a7
myonov/Project-Euler
/pr301.py
227
3.546875
4
from __future__ import print_function def main(): limit = 2 ** 30 + 1 a = 0 for x in range(1, limit): if x ^ (2 * x) ^ (3 * x) == 0: a += 1 print(a) if __name__ == '__main__': main()
160ca7821395dbe9c972d117513ff9416405a527
myonov/Project-Euler
/pr59.py
672
3.734375
4
from __future__ import print_function from itertools import product from string import letters def main(): common_words = [ 'the', 'a', 'and', 'to', 'of', 'that', 'on', 'at', 'this', ] bound = 7 text = map(int, open('cipher1.txt', 'r').read().strip().split(',')) let = [ord(x) for x in le...
d197741e706ae37359b48446bd508accf9bed261
myonov/Project-Euler
/pr3.py
452
3.78125
4
from __future__ import print_function def isprime(x): if x == 2: return True if x == 3: return True if x % 2 == 0: return False i = 3 while i*i <= x: if x % i == 0: return False i += 2 return True def main(): num = 600851475143 b = int(num ** 0.5 + 0.5) for s in ran...
7c2421ed87ad846699df2a2de5180dc63e1fd464
erlosshex/DIP
/Two/2.py
265
3.546875
4
def fib(n): print 'n = ',n if n>1: return n*fib(n-1) else: print 'end of the line' return 1 # testing modular if __name__=='__main__': for i in xrange(10): print '*'*40 fib(i) print '*'*40
0322ab224463fa6f7174b200c1b24b0566e627aa
dnpfefferle/New_Repo
/dictionary.py
503
4.09375
4
#dictionaries use curly brackets #unlike lists, dictionaries store info in pairs or multiple pairs good_boi = {"name": "Rex", "animal": "dog", "no_hobbies": 4, "wakeup_weekend": 10} print(f'Hello I am {good_boi["name"]} and I am a {good_boi["animal"]}.') print(f'I hav...
25a8f29ef127b5e6c66022e6194a6ff94514c6eb
NivethaMuthusamy/sdet
/python/Activity10.txt
172
3.78125
4
#Tuple Number Checker tuplenum= (10, 4, 20, 6, 85, 16) print(tuplenum) for x in tuplenum: if (x % 5 == 0): print(x)
241ff0f2e3f25eca6534f6ff88567f42c8feca1f
flpn/advanced_python
/general_topics/files/directories.py
616
3.5
4
import os import shutil # Current work directory os.getcwd() # as a string os.getcwdb() # as bytes # Changing current directory os.chdir('/home/flpn') # List directories and files os.listdir(os.getcwd()) # returns a list with the names of all directories and files from the path passed as argument # Making a ...
97a58ddd0ebc3b781060b5890773e39cd94d7060
moun-1911/python
/positive numbers.py
225
3.796875
4
list1 = [ 12 , -7 , 5 , 64 , -14 ] for number in list1: if number > 0 : print ( number, end = " " ) list2 = [12,14,-95,3] for number in list2: if number > 0 : print (number, end = " ")
9a4d4eebd391912b6d05ded7e962957629c0f441
mcalzett/Sales-Conversion-Optimization
/fb_ads.py
3,490
3.65625
4
"""The data used in this project is from an anonymous organisation’s social media ad campaign. The file conversion_data.csv contains 1143 observations in 11 variables. Below are the descriptions of the variables. 1.) ad_id: an unique ID for each ad. 2.) xyz_campaign_id: an ID associated with each ad campaign of XYZ ...
13f852d91a8d8d8c06c336724ab2f2a6f6650f46
mpstesney/zertz_3d
/zertz3d.py
10,655
3.515625
4
''' 15-112 Term Project Spring '20 Michael Stesney mstesney Zertz 3D Game design based entirely on Zertz board game by Kris Burm http://www.gipf.com/zertz/index.html Tutorials used to learn basics of Panda3D: https://docs.panda3d.org/1.10/python/introduction/tutorial/index https://arsthaumaturgis.github...
de87750f2393e38315185d90237d758d881867a9
krajniczkova/Codebrainers26052020
/OOP/Homework_after_day1/exercise9.py
552
3.96875
4
# Write a Python class which has two methods get_String and print_String. # get_String accept a string from the user and print_String print the string in upper case. # Tworzymy klasę class TwoMethods(): def __init__(self): # i mówimy, że self będzie stringiem 1, który jest inicjalnie pusty self.st...
07e1767515771f7b099c6edf0bc7f11c4499ed49
myselfHimanshu/DeepLearning_coursework
/Udemy/CNN/cnn1.py
1,860
3.53125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 25 16:20:09 2017 @author: Himanshu @title: CNN """ #Convolutional Neural Network #Install Theano #Install Thensorflow #Install Keras #Part 1: Building the CNN #Import the Keras libraries and packages from keras.models import Sequential from keras...
4d41770232d291cda94c0367189760ae5865b9ef
DataYI/PrimerPython
/easy_tkinter/TypingPractice/typing_level_01.py
2,436
3.625
4
""" 1. Letter 类用于从文件夹中读取素材图片,并通过 ImageTk 转换为 tkinter 支持的格式,最终将所以素材图片存储为dict; 2. MainCanvas 类用于绘制图片和文本; 3. 通过 Letter 生成的随机字符,MainCanvas 可以从 Letter 存储 图片的字典中取出字符图片,并在画布上创建图片对象(以字符作为 tags),要切换切图片时,通过 tags 删除字符图片,同时重复之前 的操作生成新的字符图片 """ from tkinter import Tk, Canvas from PIL import ImageTk from pathlib import...
6d2e6f096d102a4389ad65866e6d32ec76773a7b
mvujas/HyperAggregate
/protocol_prototype/src/hyperaggregate/aggregation_profiles/impl/utils/secret_sharing.py
2,660
3.96875
4
import numpy as np def create_int_additive_shares(number_to_split, num_shares): """Splits given number in specified number of additive shares :param number_to_split: Number to split (in range of np.int64) :type number_to_split: int :param num_shares: Number of shares that number_to_split should be sp...
3f0e940434fc3296db1d93cd606a08088dc280f8
alxvnt/P7
/P7/GPapp/wiki.py
782
3.921875
4
#! /usr/bin/env python3 # coding: utf-8 import wikipedia class Wiki: # Get the question as an attribute def __init__(self, place): wikipedia.set_lang("fr") self.place = " " + place # Return the first 2 sentence of wiki def wiki_quote(self): search = wikipedia....
7f735319ca0fe10f850350b6653b6cd93bc4507c
maheravi/Assigment-13
/BRKOUT.py
5,288
3.515625
4
import pygame import sys pygame.init() class Color: black = (0, 0, 0) white = (255, 255, 255) red = (255, 0, 0) blue = (0, 0, 255) yellow = (255, 255, 0) red1 = (255, 51, 51) purple = (255, 0, 255) fiz = (0, 255, 255) lgreen = (0, 255, 0) yellow1 = (255, 255, 51)...
8a67f4193958f7c1dbd77f34c11250462eff1fad
MikaBob/trumpf-spiel
/Monster.py
6,411
3.65625
4
import turtle from turtle import * import math from random import choice monsters = {} monsterName = [] aiMonster = [] humanMonster = [] humanKarteText = [] aiKarteText = [] humanPunkte = 0 aiPunkte = 0 result = False zahlHumanTurtle = [] zahlAiTurtle = [] screen = Screen() screen.addshape('VK.gif') # Datenbank...
d0b732ebacafb7a946783028e7288ceaff486bbc
osydorchuk/ITEA2
/homework_todo/homework6/task02.py
1,451
3.5625
4
# Создать свою структуру данных Словарь, которая поддерживает методы, get, items, keys, values. # Так же перегрузить операцию сложения для словарей, которая возвращает новый расширенный объект. # Указанные методы описываем самостоятельно, без использования стандартных. import shelve class ShelveDictionary: def...
a1f93b265f36331e16184c049705e47c0121f9ab
osydorchuk/ITEA2
/lesson1/main6.py
130
3.625
4
a = (1, 2, 3) a = 10 b = 20 print(a, b) a, b = b, a print(a, b) print('-'*5) a, b = ([1, 2, 3], [3, 2, 1]) print(a, b)
8d22e143cfbe1a77b0bef19beb24cd440467ae3e
osydorchuk/ITEA2
/lesson2/list_example.py
187
3.875
4
list_var = [1, 2, 3] for i,j in enumerate(list_var): print(i,j) print('-'*5) for i in enumerate(list_var): print(i) print('-'*5) for i in enumerate("string"): print(i, j)
5a129e2a8a4dd86d3d295899ff3cf8e015afd5fb
calvinstudebaker/ssc-scheduling
/src/core/constants.py
2,840
4.28125
4
"""Hold values for all of the constants for the project.""" class Constants(): """This is a class for managing constants in the project.""" STRINGS = {} @classmethod def get_string(cls, val, dictionary=None): """Get the string representation of the given constant val. Looks in the subclass's dictionary cal...
47f18684fbc9356e3dea3ec9dc13dbad30c662b6
SantiagoValdez/PokerBot
/src/Bot.py
6,107
3.5625
4
# -*- coding: utf-8 -*- ''' Creado el 23/09/2011 @author: Nahuel Hernández @author: Javier Pérez @author: Carlos Bellino @author: Vanessa Jannete Cañete @author: Gabriela Gaona ''' import Jugador from copy import deepcopy class Bot(Jugador): ''' El bot extiende de un jugador, redefine los méto...
73d430f0f86ce3a1feefd2140c10cb36d360cd7a
tuckdruck/hashmap
/linked_list.py
2,822
4.03125
4
from link import Link class LinkedList(object): # Initialize a new LinkedList object. Use of sentinel nodes for head # and tail to prevent having to check for null when unshifting or # pushing links def __init__(self): self.head = Link() self.tail = Link() self.head.next = se...
5f4e32612824db81428b663b2a98108af296434d
r-moraru/steinitz-exchange-lemma
/exchange_lemma.py
1,554
3.6875
4
import helpers def find_replaceable_subset(gs, lis): """Given a generating set (gs) and a linearly independent set of vectors (lis) returns subset of generating set (exchangeable subset) such that lis U (gs - exchangeable_subset) generates the same vector space and has the same cardinality as gs""" ...
bfbdf191e5e3dd9de05fca510943d708ae97f6d4
sdpy5/functions
/album_name.py
510
3.953125
4
def make_album(artist_name,album_name,tracks = ''): album = {'artist name':artist_name,'album name':album_name,'tracks':tracks} return album while True: art_name = input('enter artist name : ') if art_name == 'quit': break alb_name = input('enter album name : ') if alb_na...
65e61f4fb4365cea4d629c9d67fdad77ed706e93
Monso0n/Data-Structures-
/Lab 4/Lab4-500950561.py
5,680
3.953125
4
# You may not use dicts. def getName(): return "Kainth, Mayank" class MyHashTable(): def __init__(self, size, hash1): #44 # Create an empty hashtable with the size given, and stores the function hash1 self.size = size self.hash = hash1 self.itemCount = 0 self.k...
00e2d97bca1d99f9c7fa95b5a38eeb901c4b1cee
jaydrennan/sudoku_solver
/sudoku_solver/sudoku_grid.py
667
3.546875
4
from sudoku_solver.find_possible_values import solve_grid from sudoku_solver.validate_puzzle import is_valid_sudoku_grid class Sudoku: def __init__(self, grid): self.grid = grid def is_valid(self): return is_valid_sudoku_grid(self.grid) def solve(self): return solve_grid(self.gri...
94f4d5e0d095afe3077243be4706ff9135672ccd
dwillis/django-rmp-data
/rmp/utils.py
394
4.1875
4
""" General-purpose utility functions. """ import re def camelcase_to_underscore(camelcase_str): """ Replace CamelCase with underscores in camelcase_str (and lower case). """ underscore = re.sub(r'(.)([A-Z][a-z]+)', r'\1_\2', camelcase_str) lower_underscore = re.sub(r'([a-z0-9])([A-Z])', r'\1_\2'...
1fb82de9258ee0de4da88c427a31d1189702b3e9
etschgi1/Codewars
/5kyu/timeconvert.py
213
3.65625
4
def make_readable(seconds): s = seconds % 60 h = seconds//60//60 m = seconds//60 - h*60 return ("{:02}:{:02}:{:02}".format(h, m, s)) for i in range(0, 1000000, 5000): print(make_readable(i))
a6da2062585d75edf9643bdac2f9df4619211327
vijaypatha/python_sandbox
/numpie_mani.py
2,173
4.375
4
''' pretty simple: 1) Create a array 2) Manipylate the arary: Accessing, deleting, inserting, slicing etc ''' #!/usr/bin/env python # coding: utf-8 # In[10]: import numpy as np #Step 1: Create a array x = np.arange(5,55,5).reshape(2,5) print("Array X is:") print(x) print("Attrubute of Array X is:") print("# of ...
a5c1183d848fbcd98444dbd5140648be809c8d46
vijaypatha/python_sandbox
/Stats_for_stock.py
7,580
4.125
4
#!/usr/bin/env python # coding: utf-8 # # Statistics from Stock Data # # In this lab we will load stock data into a Pandas Dataframe and calculate some statistics on it. We will be working with stock data from Google, Apple, and Amazon. All the stock data was downloaded from yahoo finance in CSV format. In your works...
4676cd42a6ad323ffbb58407bf3c196b377b1960
kittttttan/test
/py/server.py
1,004
3.8125
4
'''Tiny CGI Server for python3 example: python server.py localhost 8000 and access http://localhost:8000/ ''' from http.server import HTTPServer, CGIHTTPRequestHandler from sys import argv class CustomCGIHandler(CGIHTTPRequestHandler): # override if you need cgi_directories = ['/cgi-bin', '/ht...
86f2268590847d4f99e6899e8049b7a2abe72ac4
anjalak/Code-Archive
/Python_Code/python code/bitOperator.py
892
4.21875
4
# Create a function in Python called bitOperator that takes two bit strings of length 5 from the user. # The function should return a tuple of the bitwise OR string, and the bitwise AND string # (they need not be formatted to a certain length, see examples). def bitOperator(int1, int2): num1 = int(int1,2); nu...
0e51a677b19e0842650c4c924573599b2628590a
anuragdandge/Python-Basic-Programs
/Swap by logical operator.py
128
3.984375
4
a = int(input("Enter A = ")) b = int(input("Enter B = ")) a = a^b b = a^b a = b^a print("\n A = ",a ,"\n B = ",b)
d10c161384e0e4b7fda5d679072b1285410ef76c
gelisa/algorithms
/add_two_bins.py
769
3.84375
4
def sort_by_len_asc(s1, s2): if len(s1) >= len(s2): return s1, s2 else: return s2, s1 def sum_digits(digit1, digit2): raw_sum = int(digit1) + int(digit2) carry = str(raw_sum // 2) position_sum = str(raw_sum % 2) return position_sum, carry def table_binary_addition(s1, s2): ...
4aaa6a543c058ffda68ac350fa8595bf1e7fcda0
gelisa/algorithms
/stanford/p1w2.py
2,457
3.9375
4
def quickSort(a, pivot): """ :param a: :return: """ def get_pivot(pivot, a, l, r): """ :param pivot: can be: 'first' 'last' 'median' :return: """ if pivot == 'first': return l if pivot == 'last': ret...
db3f4556f8bf72d2cdeacc0ea7bb84201f9316cf
Quadrob/Photo-editing
/PhotoEditor.py
2,310
4.0625
4
#Simple Application that applies a desired filter to the recived image using the python pillow module # # Robert Zeelie Created 09 Sep 2019 # #Scroll to the bottom of this file and replace the input with disired image and run from PIL import Image #Black and white filter functions def black_and_white(input_i...
3e62ff8d0a86acb6a027615d99964e4aa7f02b19
MarinaMarch/wwcode_mit_spring2017
/PS2_hangman/ps2_problem1.py
1,964
3.984375
4
# -*- coding: utf-8 -*- """ Created on Fri Jun 16 17:11:42 2017 @author: marina """ import random import string WORDLIST_FILENAME = "words.txt" def load_words(): """ Returns a list of valid words. Words are strings of lowercase letters. Depending on the size of the word list, this...
1221f5d7e29e4ba8b96a4abb250542fcb21e20b8
YAPP-18th/Study_Algorithm_Team_3
/Sort/TheLargestNumber/soyeon.py
421
3.515625
4
# Timeout from itertools import permutations def solution(numbers): permute = list(permutations(numbers,len(numbers))) list_permute = [''.join(map(str,i)) for i in permute] answer = max(list_permute) return answer # Best // lambda 이용 # def solution(numbers): # numbers = list(map(str, numbe...
353fd47ddfd604cadfd282b07c290b034bb51f27
YAPP-18th/Study_Algorithm_Team_3
/Sort/KthNumber/soyeon.py
568
3.734375
4
# 배열 array의 i번째 숫자부터 j번째 숫자까지 자르고 정렬했을 때, k번째에 있는 수 def solution(array, commands): answer=[] for sub_command in commands: sub_array= array[sub_command[0]-1:sub_command[1]] sub_array.sort() answer.append(sub_array[sub_command[2]-1]) return answer #Better # def solution(array, comman...
45a34f585ac9c9cb1a05f1f41984e00d18ba8057
ahmetikt/PythonHub
/Assignment - 7 (FizzBuzz).py
258
3.875
4
list1 = list(range(1, 101)) # print(list1) for i in list1: if i % 3 == 0 and not i % 15 == 0: print('Fizz') elif i % 5 == 0 and not i % 15 == 0: print('Buzz') elif i % 15 == 0: print('FizzBuzz') else: print(i)
0273ca1647ab02f01a1d8d5995a57ecf433e80fd
nkuhta/Python-For-Everybody
/5. Functions/Functions.py
2,913
3.921875
4
############################################################## ################## Function Basics ##################### ############################################################## # def = define function command def hello(): print('hello') print('fun') # call hello function hello() print('zip') # cal...
a1fc48c0fbeefc1018e852b58a151757e67d3dd2
Sporkyy/codewars
/6-kyu-array-diff.py
1,396
3.875
4
# 6 kyu | Array.diff # https://www.codewars.com/kata/523f5d21c841566fde000009 # Your goal in this kata is to implement a difference function, which subtracts # one list from another and returns the result. # It should remove all values from list a, which are present in list b. # array_diff([1,2],[1]) == [2] # If a ...
1923937dffff707cc33850f283bf90145306f413
tarun8718/AI-Lab
/Py Programs/3e.py
200
3.890625
4
N = int(input("Enter the number: ")) temp = N sum = 0 while temp>0 : digit=temp%10 sum += digit**3 temp //= 10 if sum == N : print("It is an Amrstrong number") else: print("Nope")