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
6c058d973500096730ecdc33691ac7eeed84614d
Nithin-Peter-Jesuraj-12/Python
/Rock Paper Scissor.py
480
3.828125
4
from random import * user=input("ROCK, PAPER, SCISSOR? Shoot \n") comp=randint(0,2) if comp == 0: comp = "rock" elif comp == 1: comp = "paper" else : comp = "scissors" if comp == user: print("It is a tie!"+user+"/"+comp) elif user == "rock" and comp == "scissors": print("You win") ...
b8568d778d91a3cf929c319943db6420db1a23f9
Nithin-Peter-Jesuraj-12/Python
/No. Rev.py
142
3.59375
4
no=int(input("Enter your no \n")) remainder = [] while no!=0: remainder.append(no%10) no//=10 print ("".join(map(str,remainder)))
b4b25234f3068a50a14a959dbfda364172945ab9
BarysTsibets/CodeWars-Training
/Fibonachi_nums_task.py
914
4.09375
4
"""Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued ter...
bdfe63418ef1810f15fd777af9d505bd2139a759
eik00d/UTests1
/web1.py
1,284
3.5
4
import sqlite3 import sys class HelloUser: cmd='' params=[] current_role=-1 db=None lastError=None def __init__(self): conn = sqlite3.connect(":memory:") c = conn.cursor() # Create table users -> name:password:role c.execute("CREATE TABLE users (name text, password text, role integer)") c.execute("IN...
7653c8e4c2176b8672a531988ef26c1331540b5d
bsundahl/IACS-Computes-2016
/Instruction/Libraries/bryansSecondLibrary.py
245
4.4375
4
def factorial(n): ''' This function takes an integer input and then prints out the factorial of that number. This function is recursive. ''' if n == 1 or n == 0: return 1 else: return n * factorial(n-1)
7b5e3de71b6bdd958b6debafe5d0882503f87f20
rahul-pande/ds501
/hw1/problem1.py
1,445
4.3125
4
#------------------------------------------------------------------------- ''' Problem 1: getting familiar with python and unit tests. In this problem, please install python verion 3 and the following package: * nose (for unit tests) To install python packages, you can use any python package mana...
7de333d37e0af493325591c525cef536290f13be
GameroM/Lists_Practice
/14_Lists_Even_Extract.py
360
4.21875
4
## Write a Python program to print the numbers of a specified list after removing ## even numbers from it x = [1,2,3,4,5,6,7,8,15,20,25,42] newli = [] def evenish(): for elem in x: if elem % 2 != 0: newli.append(elem) return newli print('The original list is:', x) print('The li...
0632f5713b13eb0b83c1866566125a069d4f997d
GameroM/Lists_Practice
/8_Lists_Empty_Check.py
445
4.375
4
## Write a Python program to check if a list is empty or not x = [] def creation(): while True: userin=input('Enter values,type exit to stop:') if userin == 'exit': break else: x.append(userin) return x print('The list created from user input...
0b89f2504d1fd994033c61d7a07db57f3ab23def
fifol124/Python_course
/bmi.py
241
3.859375
4
print('Podaj swoją masę ciała: ') mass=input() print('Podaj swój wzrost w metrach (1.Xm): ') height=input() mass=float(mass) height=float(height) BMI=(mass/height**2) BMI_round=round(BMI,3) print('Twoje BMI to ' +str(float(BMI_round)))
f39ff9cf7a8419dac0d2ee740aebd7c38a55c035
brianchiang-tw/Python_Crawler_Programming
/regex/regex_match_pipe_symbol.py
474
3.859375
4
import re # -------------------------------------- def match_pattern(patter, string): match = re.match(pattern, string) if match: print( match.group() ) else: print('No match') # -------------------------------------- pattern = 'bike|car|truck' # expected output: # bike match_pattern...
8a8ccbf32880b637bba81516a69e23b3cabd2229
blackseabass/Python-Projects
/Homework/week5_exercise2.py
1,483
4.3125
4
#!/usr/bin/env python """ File Name: week5_exercise2.py Developer: Eduardo Garcia Date Last Modified: 10/4/2014 Description: User plays Rock, Paper, Sciissors with the computer Email Address: garciaeduardo1223@gmail.com """ import random def main(): print("Rock. Paper. Scissors." "\n" "Enter 1 for ...
ab0eda917d1ee8ab10cd94f058aa167fff736f8d
blackseabass/Python-Projects
/Homework/week2_exercise1.py
468
3.984375
4
#!/usr/bin/env python """ File Name: week2_exercise1.py Developer: Eduardo Garcia Date Last Modified: 9/12/2014 Description: Asks user to input amount of total sales, program wll then display profit. Email Address: garciaeduardo1223@gmail.com """ total_sales = float(input("Please enter the projected amou...
e2ad4cd9069fe365fd7a17794f329c9ba5156842
nodokaodayaka/aizu-online-judge
/DSL/ALDS1_6/ALDS1_6_C.py
691
3.78125
4
def quickSort(A, p, r): if p < r: q = partition(A, p, r) quickSort(A, p, q-1) quickSort(A, q+1, r) def partition(A, p, r): x = A[r] i = p -1 for j in range(p, r): if A[j][1] <= x[1]: i += 1 A[i], A[j] = A[j], A[i] A[i+1], A[r] = A[r], A[i+1] return i+1 deck = [] n = int(inpu...
b8107381ec7d2e4a92913974c167a68a7c333839
chloetop/leetcode-1
/312_Burst _Balloons.py
1,744
3.765625
4
_author_ = 'jake' _project_ = 'leetcode' # https://leetcode.com/problems/burst-balloons/ # Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. # You are asked to burst all the balloons. If the you burst balloon i you will get nums[left] * nums[i] * nums[right...
25e198db30e5a5c5c3707f333162c83e94a1e7ea
chloetop/leetcode-1
/005_Longest_Palindromic_Substring.py
1,526
3.8125
4
_author_ = 'jake' _project_ = 'leetcode' # https://leetcode.com/problems/longest-palindromic-substring/ # Given a string S, find the longest palindromic substring in S. # You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. # For each centre point of a charac...
54eb1e3cb5d725c9ed0188484130aff4d805bfda
chloetop/leetcode-1
/110_Balanced_Binary_Tree.py
1,200
4.09375
4
_author_ = 'jake' _project_ = 'leetcode' # https://leetcode.com/problems/balanced-binary-tree/ # Given a binary tree, determine if it is height-balanced. # A height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1. # Calculate the depth ...
f5d54446b59f335c2e9acee4ca200abf88d57f78
SilvestrePerret/scipopt_project
/DM2/Local_Search_Museum.py
14,299
3.703125
4
""" This module implements our local search model for the museum problem. Please read DM_2_Exposition_Au_Musée.md for more details. Use the command below to launch it: python Local_Search_Museum.py <path_to_input> """ import math import random import sys from itertools import combinations from collections import defa...
c8639d6ef1d7044f1a840f7446fc7cfb624a1209
amitravikumar/Guvi-Assignments
/Program14.py
283
4.3125
4
#WAP to find the area of an equilateral triangle import math side = float(input("Enter the side: ")) def find_area_of_triangle(a): return(round(((1/4) * math.sqrt(3) * (a**2)), 2)) result = find_area_of_triangle(side) print("Area of equilateral triangle is ", result)
5e5803c836e3d83613e880061b29d6862774836b
amitravikumar/Guvi-Assignments
/Program4.py
309
4.3125
4
#WAP to enter length and breadth of a rectangle and find its perimeter length, breadth = map(float,input("Enter length and breadth with spaces").split()) def perimeter_of_rectangle(a,b): return 2*(a+b) perimeter = perimeter_of_rectangle(length,breadth) print("Perimeter of rectangle is", perimeter)
5d793981a82cfbeb165ace6457d75817ecc9c97f
Alexeyzhu/SHPA
/Devices/Device.py
604
3.859375
4
from abc import ABCMeta, abstractmethod, abstractproperty class Device(object): """Abstract class for any device in a system""" __metaclass__ = ABCMeta def __init__(self, name, topic): self._name = name self.topic = topic @property @abstractmethod def name(self): retu...
7e60e7442c3ca6ee6c4b15b9b1f9bfafe8cf4cab
Alexeyzhu/SHPA
/Devices/Actor.py
1,507
3.640625
4
from abc import ABCMeta, abstractmethod, abstractproperty class Actor(object): """Abstract class for any actor in a system""" __metaclass__ = ABCMeta def __init__(self): self._possibleActions = {} self._possibleStates = {} @abstractmethod def getName(self): return NotImpl...
db270f710166860ef7135c5915e41d3e7b533a56
celhhayden/CS0008-f2016
/Exercise5.py
525
4
4
# name : Celest Hayden # email : chh147@my.pitt # date : 13 September 2016 # Class : CS0008-f2016 # instructor : Max Noveli # #Description : Chapter 3, Programing Exercise 5 # #Notes: calculating an object's mass # #prompt for the mass mass = float(input("Please input the mass: ")) #calculate the w...
19417ede3a767a4c3621e01f3e0e0308a4081e2e
celhhayden/CS0008-f2016
/f2016_cs8_chh147_a3/f2016_cs8_chh147_a3.py
6,807
3.890625
4
# name : Celest Hayden # email : chh147@my.pitt # date : 21 November 2016 # Class : CS0008-f2016 # instructor : Max Novelli # #Description: Assignement #3 # #Notes: create a program that accesses x amount of data files and pulls lists of # names and their associated running distances. use functions...
7a22a8658ad0c0ab11883b6a16dbe72dab99e4fe
celhhayden/CS0008-f2016
/f2016_cs8_chh147_a2/f2016_cs8_chh147_a2.py
5,371
4.03125
4
# name : Celest Hayden # email : chh147@my.pitt # date : 13 September 2016 # Class : CS0008-f2016 # instructor : Max Noveli # #Description : Assignment 2 # #notes: the user needs to be able to access files and their data # and be able to see the results of people's accumulated distances # #assign...
55d811dbc479938106da7f8d4f9e892929da4152
Flurb/AdventOfCode2017
/day/2/2/program.py
732
3.515625
4
# # Day 2: Corruption Checksum # import sys class Day2: def get_sum_checksum(input_file): # Full sum to return. full_sum = 0 # Open file.. with open(input_file) as f: # For each line in the file.. for line in f: # Get all values in an array of integers. all_numbers = [int(n) for n in line.sp...
f6a6f1afec8a0ca94fbce25d04df6b1f741b0136
cansley/PythonProjects
/PythonExercises/harder.py
11,705
3.890625
4
import re from pprint import pprint as pp import random # A sentence splitter is a program capable of splitting a text into sentences. The standard set of heuristics for # sentence splitting includes (but isn't limited to) the following rules: # # Sentence boundaries occur at one of "." (periods), "?" or "!", except t...
55c336ecbd3d813a27bcc18c3c817ddb9b68be2a
darknli/XSSR
/ESR/test.py
604
3.5625
4
from tensorflow.python.keras.models import Model from tensorflow.python.keras.layers import * import numpy as np def multi_model(): x1 = Input(shape=(3,)) x2 = Input(shape=(3,)) y1 = Dense(10)(x1) y2 = Dense(10)(x2) y1 = Lambda(lambda x:0.1*x)(y1) concat = Add()([y1, y2]) return ...
d93350cc82b58c9b313475005a5ce633a6a6e24a
matheusfsa/AlgebraLinear
/retrosubstituicao.py
529
3.59375
4
import numpy as np def tri_superior(a, b): n = np.shape(a)[0] x = np.zeros(n) for k in range(n-1, -1,-1): delta = 0 for j in range(k+1, n): delta += a[k][j]*x[j] x[k] = (b[k] - delta)/a[k][k] return x def tri_inferior(a, b): n = np.shape(a)[0] y = np.zeros...
5283db977e5def4bfcc93b33bd2290fef5e70a1f
Shadowninja33/WordFreqFromList
/assignment_2_preston_cobb.py
1,549
4.09375
4
def word_freq(names): """Takes in a list of strings and return a dictionary number of occurrences of each key""" namedict = dict() for word in names: if word not in namedict: namedict[word] = 1 else: namedict[word] += 1 return namedict def asc_wor...
4f85beb7470221888c585cd228b87b01646633eb
AniruddhNathani/Natural_Language_Processing
/lemmatization.py
598
3.859375
4
from nltk import WordNetLemmatizer from nltk.corpus import brown import nltk # Difference between stemming and lemmatization tokens = brown.words(categories=['religion']) wnl = WordNetLemmatizer() print([wnl.lemmatize(t) for t in tokens]) # The WordNet lemmatizer only removes affixes if the resulting word is in its ...
c3da1b4f3b4a120d288fb33e8c7017d8f6eff322
tonyvosg/data_analysis
/2.data_visualization/date_time.py
216
3.796875
4
from datetime import datetime #the second argument tell Python to interpret first 4 digit before dash is year, next is month and third is date first_date = datetime.strptime('2014-7-1', '%Y-%m-%d') print(first_date)
7fb5187ecf9969d698401c34ee254385c9679de0
thanosgiap/Numerical-Analysis-Algorithms-Python
/ThirdExercise.py
4,273
3.640625
4
from math import sqrt import numpy as np def luDecomposition(): # Function multiplying two matrices def matrixMultiplication(A, B): res = np.dot(A, B) return res # Function that creates the right pivoting matrix based on the argument def pivotize(m): n = len(m) identit...
ba3a33b1ea3ad2600fe1c99fff6e293b755ee135
Fawaz441/DSA
/binary_tree_1.py
3,349
3.90625
4
# search complexity = log2n # insert complexity = log2n # binary search tree does not have duplicate elements ''' traversal techniques in binary tree - breadth first search - depth first search -in order traversal - pre order traversal - post order traversal ''' class BinarySearchTreeNo...
19e0ae5a87bf65cd85033928822a15e10951da30
Vladionair/Singly_linked_list
/Singly_linked_list.py
6,076
3.90625
4
gAAAAABfUPgRJs9EJpwkAKEKNMFK-QQiAywOV6F21bSOHQgzznFMwWm9SzSHNFms7m8y6zkwugBZbPC5p5IP7qsNPVgmhvBq7aRKfgrzqkFjVjOu8W-uDQBCMPlWS3Cj5hgV7TDj_7egIw8SVf72KsS_rqQZU01acPw8pMyCqux9aEEutpTBzS-w_FAchD7aLokh0KBxAxyZ5Gz2vtduOt8nvW0QZ1tMTxsSg75bPq5qgiFlPUD0wGFuj9ArfwZmv-Xi7yY52n9i0jmR9s3zLy9DpjjTdR-I3_P8Dwf9E3-zxe-UBcBexJ-hvCcaPPn2...
01b03c2b455aea0132051ca2c87eef5ba62bb66a
saif-byte/Python-Bootcamp-DSC-DSU
/week_1/DSC_python_assignment/StudentRecord.py
2,440
3.875
4
# student1_roll_num=input("Enter Roll Number Of First Student") # student1_name=input("Enter Name Of First Student") # student2_roll_num=input("Enter Roll Number Of Second Student") # student2_name=input("Enter Name Of Second Student") # student3_roll_num=input("Enter Roll Number Of Third Student") # student3_name=inpu...
1971a9a13cc857df612840450c1fb3f455d8a034
gitfolder/cct
/Python/calculator.py
1,680
4.21875
4
# take user input and validate, keep asking until number given, or quit on CTRL+C or CTR+D def number_input(text): while True: try: return float(input(text)) except ValueError: print("Not a number") except (KeyboardInterrupt, EOFError): raise SystemExit def print_menu(): print("\n1. A...
45b822d5189e7e8317f7deb26deed12e7562d29e
jebarajganesh1/Ds-assignment-
/Practical 5.py
1,415
4.1875
4
#Write a program to search an element from a list. Give user the option to perform #Linear or Binary search. def LinearSearch(array, element_l):     for i in range (len(array)):         if array[i] == element_l:             return i     return -1 def BinarySearch(array, element_l):     first = 0     array.sort()     ...
401e3fedfb8773d39af37edd72383961a5926f66
Amirreza5/Class
/example_comparison03.py
451
3.90625
4
num = int(input('How many numbers do you want to compare: ')) list_num = list() for i in range(0, num): inp_num = int(input('Please enter a number: ')) list_num.append(inp_num) list_num.sort() print(list_num) for x in range(0, len(list_num)): for y in range(x, len(list_num)): if list_num[x] > l...
cfa2dee09f7d4b7dec7c328f8cef5f085e17dd95
Amirreza5/Class
/example_comparison02.py
218
4.125
4
num = int(input('How many numbers do you want to compare: ')) list_num = list() for i in range(0, num): inp_num = int(input('Please enter a number: ')) list_num.append(inp_num) list_num.sort() print(list_num)
8daae67a2675c63d0a89b47b6e453e01047dddd8
Amirreza5/Class
/example_turtle02.py
371
4.03125
4
from turtle import Turtle, done name = input('Please enter the shape: ') T = Turtle() #Staart of the turtle code if name == 'circle': T.color('Blue') T.circle(150) elif name == 'square' : T.forward(100) T.left(90) T.forward(100) T.left(90) T.forward(100) T.left(90) T.forward(100...
62292bde4893bbe9474e797c1f81cc62f92ccbda
Amirreza5/Class
/example_len02.py
249
3.859375
4
name01 = input('Please enter a name: ') name02 = input('Please enter a name: ') name03 = input('Please enter a name: ') names = [name01, name02, name03] for i in names: for x in i: if x == 'n': names.remove(i) print(names)
a951d701a192dcb392dce7e76e420dd11d9fffae
Amirreza5/Class
/example_string01.py
337
3.890625
4
name = 'matin' print(name.capitalize()) # the method return a string that its first letter is upper class sentence01 = 'I like apples, because apples are delicious' a = sentence01.split() print(a) b = ' '.join(a) print(b) c = 'matin' d = c.upper() # d = MATIN print(d) e = d.lower() print(e) f = sentence01.count(...
aab334399f5367bc5abc955b0687becfbce0ca77
goliksa/Python
/25.my_last_projekt_battleship.py
2,829
4
4
import random board = [] def board_drow(): global board board = [['- ', '1 ', '2 ', '3 ', '4 ', '5 ']] letters = ['- ', 'a ', 'b ', 'c ', 'd ', 'e '] for g in range(5): board.append(['O'] * 6) for m in range(6): board[m][0] = letters[m] print(' '.j...
b8d64be9fcc4903e180d9b05e5be027c4def9eae
goliksa/Python
/7.mutable_VS_immutable.py
478
3.9375
4
spam = '1, 2, 3' def eggs (cheese): chees = '1, 2, 3, Hello' eggs(spam) print(spam) print() spam = [1, 2, 3] def eggs (cheese): cheese.append('Hello') eggs(spam) print(spam) print() import copy spam = ['A', 'B', 'C', 'D'] spam2 = spam cheese = copy.deepcopy(spam)...
ec6d3af845d49d59e54942406461ce86a3ea94c3
goliksa/Python
/6.while-break.py
479
4.09375
4
def attempt (name): print (name + ", how are you? \"good\" or \"bad\"" ) print('Enter you name') input_name = input() while True: attempt(input_name) mood = input() if mood == 'good' or mood == 'bad' or mood == 'Good' or mood == 'Bad': break else: print('It is sh...
fce168869908b9862b4cca81bb5fc57deb736679
CharlotteMoriarty/bank
/part_one/Lists/longest_word.py
181
4.21875
4
def find_longest_word(): words_bank = ["tea", "time", "cat", "computer", "largest_word"] print(list(map(lambda x: (len(x), x), words_bank))[-1][-1]) find_longest_word()
f2af37d7964f90dda90da7efc1dc4689295a5a3f
cmpe-187/gumball-machine
/gumball_machine.py
2,265
3.921875
4
class GumballMachine: def __init__(self): self.valid_currency = {"nickel": 5, "dime": 10, "quarter": 25} # Represents the total value of valid currency the user inserted self.currency_value = 0 self.invalid_currencies = [] def insert(self, currency): # Checks if the inse...
eb2592d3e76d7c969b532974856cb7e8ce87c9ac
takutico/notes
/matches_from_lists.py
571
3.796875
4
# compare two lists in python and return matches l1 = [0, 1, 2, 3, 4, 5, 69, 7, 8, 9] l2 = [11, 22, 3, 44, 55, 6, 77, 8, 99, 0] # in this example result should be # [3, 8, 0] result = [] for i,j in zip(l1, l2): if j in l1: result.append(j) if i in l2: result.append(i) print(list(set(result))) ''' def get_ma...
aaf36ca9d589b805033a581f16bb3701bf4161b4
ktmriki/programok
/0-ig.py
872
3.75
4
n = int(input("Szám: ")) #Bemenet x = [] #Lista y = int(0) #Összeg z = int(0) #Pozitív számok száma zs = int(0) #Negatív számok száma while n != 0: #A sz...
1c00dd9b32e6ed6b6a44ff9912d05d680ceb6c0a
ktmriki/programok
/faktorialis.py
202
3.828125
4
n = int(input("Szám: ")) x = 1 y = 1 if n == 0: print ("A megadott szám faktoriális értéke 0") for y in range(1,n + 1): x = x * y print ("A megadott szám faktoriális értéke ", x)
2368446c2c271c53fc11ed06e5b045e9d740599c
mynameismon/12thPracticals
/question_10/question_10.py
3,204
4
4
# A binary file “Book.dat” has structure [bookno, bookname, author, price]. # Write a user defined function CreateFile() to input data for a record and add to Book.dat. # Write a function CountRec(Author) which accepts Author name as parameter, count and return number ofbooks by the given Author are stored in the bin...
5436a11b86faa2784d2a3aab6b9449bbca9df2fd
mynameismon/12thPracticals
/question_6#alt/question_6.py
1,755
4.125
4
<<<<<<< HEAD # Create random numbers between any two values and add them to a list of fixed size (say 5) import random #generate list of random numbers def random_list(size, min, max): lst = [] for i in range(size): lst.append(random.randint(min, max)) return lst x = random_list(5, 1, 100) # the lis...
2b7b16fe2ba676de0de95fd695afa8ab9af61544
RicaBenhossi/Alura-Learning
/Python/01-DataStructure_Python/route_linked_list.py
2,136
4.15625
4
from data_structure.linked_list import LinkedList class Store: def __init__(self, name, address) -> None: self.name = name self.address = address def __repr__(self) -> str: return '{}\n {}'.format(self.name, self.address) def show_result(lnk_list: LinkedList) -> None: print() ...
cfc87754972046bc68c4b41f72d7182488ca38ff
RicaBenhossi/Alura-Learning
/Python/01-DataStructure_Python/route_doubly_linked_list.py
1,845
4
4
from data_structure.doubly_linked_list import DoublyLinkedList class Store: def __init__(self, name, address) -> None: self.store_name = name self.address = address def __repr__(self) -> str: return f"{self.store_name} - {self.address}" def show_result(dl_list: DoublyLinkedList) ->...
39c074b57d4f7a99dc024bd22c13feb02169226c
Baltiyski/HackBulgaria
/Programming0-1/week03/02-Resolve-with-Functions/divisors.py
262
3.84375
4
def divisor(n): index = 1; result = []; while(index <= (n - 1)): if (n % index == 0): result = result + [index]; index +=1 ; return result; n = input("Enter number : "); n = int(n); print(divisor(n));
d88bc843c4c1e6baa1f40c4bc1cbae0937f80826
Baltiyski/HackBulgaria
/Programming0-1/week01/05-Saturday-Tasks/sum_of_odds.py
195
3.9375
4
n = input("Enter n: "); n = int(n); sumOfOdd = 0; index = 1; while(index <= n): if(index % 2 != 0): sumOfOdd += index; index += 1; print("Sum of all evens = " + str(sumOfOdd))
18ab5a5323df219b155c0681ce69e45a3b8dd2fc
Baltiyski/HackBulgaria
/Programming0-1/week01/02-If-Elif-Else-Simple-Problems/calculator.py
485
4.21875
4
a = input("Enter a: "); a = int(a); b = input("Enter b: "); b = int(b); oper = input("Enter operation : "); result = 0; if(oper == "+"): result = a + b; print("Result is: ") print(result) elif(oper == "-"): result = a - b; print("Result is: ") print(result) elif(oper == "*"): result = a *...
8c6f093b6582d6750d7a8d2f3cfb622c2ac71b6a
Baltiyski/HackBulgaria
/Programming0-1/week02/3-Simple-Algorithms/divisors.py
134
3.609375
4
n = input("Enter number : "); n = int(n); index = 1; while(index < n): if(n % index == 0): print(index) index += 1;
e2646c05711be42373681ce357ad87dee0aef3a3
Baltiyski/HackBulgaria
/Programming0-1/week01/04-While-Loop-Problems/count_to_ten.py
144
3.578125
4
index = 1; while(index <= 10): print(index); index += 1; index2 = 10; print() while(index2 >= 1): print(index2); index2 -= 1;
e8fd3a4260a4873ecac7d15771251c5193bba450
Baltiyski/HackBulgaria
/Programming0-1/week01/05-Saturday-Tasks/sum_digits.py
230
4.0625
4
number = input("Enter number: "); number = int(number); sumOf = 0; while(number != 0): digit = number % 10; sumOf = sumOf + digit number = number // 10; print("The sum of all number's is equal to - " + str(sumOf));
fd81472aad43ca2dc5b105e0169dcb4f82d1eb53
Baltiyski/HackBulgaria
/Programming0-1/week01/03-And-Or-Not-In-Problems/evenover20.py
140
3.953125
4
num = input("Enter number : "); num = str(num); if((num < 20) and (num % 2 != 0)): print("No it isn't"); else: print("Yes it is");
5e211892930f69c82c6744bea1d0e3fca7022727
alonzoDiego/Trabajo01_IA
/8puzzle.py
3,419
3.671875
4
import random as rn import math import copy def veri(tablero, numEsp): for i in range(3): for j in range(3): if numEsp == tablero[i][j]: return False return True def veriL(lista, numEsp): for i in range(3): if numEsp == lista[i]: return False ret...
22a906fe589c49eeed74911755f00786eeaae130
andres-sana/AdventOfCode2020
/02/02.py
746
3.515625
4
inp = open('InputData.txt').read().split('\n') def validatePassword(lowestRate, highestRate, keyword, password): if password[lowestRate] == keyword: if password[lowestRate] == keyword and password[highestRate] == keyword: return False else: return True elif password[high...
c8a4c0ec87733416c553e6cfaff6c2cb1713b76b
mehranagh20/ACM-ICPC
/uva/10814-Simplifying-Fractionss/10814---Simplifying-Fractionss.py
229
3.578125
4
def gcd(a, b): if b == 0: return a return gcd(b, a % b) n = int(input()) for i in range(n): nums = [int(a) for a in input().split('/')] c = gcd(nums[0], nums[1]) print(nums[0] // c, '/', nums[1] // c)
5d3ff67e5ec725b5ec49da10b945c3100ceb672b
mehranagh20/ACM-ICPC
/uva/11291-Smeech/11291-Smeech.py
812
3.5625
4
def eval(str): if '(' not in str: return float(str) p, a, b = "", "", "" i = 1 while str[i] == '.' or str[i].isdigit() or str[i] == '-': p += str[i] i += 1 cur = 0 i += 1 if str[i] == '(': while i < len(str): if str[i] == '(': cur +...
d565a17a7f915d44af18713cbaf248b93c736dfe
mehranagh20/ACM-ICPC
/uva/343-What-Base-Is-This?/main.py
721
3.59375
4
while True: try: a, b, = input().split() except EOFError: break baseA, baseB = [], [] for i in range(2, 37): try: baseA.append((i, int(a, i))) except ValueError: pass for i in range(2, 37): try: baseB.append((i, int(b, i))) ...
2ee9ca274074a2fd668a802e2cd1d554bb5a5219
MrPeer/Accenture-Tekstac
/Python/Classic Curve Members/Memberdet.py
1,671
3.65625
4
class Member: def __init__(self,customerId,customerName,emailId): self.customerId=customerId self.customerName=customerName self.emailId=emailId class GoldMember(Member): def __init__(self,customerId,customerName,emailId): super().__init__(customerId,customerName,emailId...
062ab111d4e37e4f2cb8ec8cd3e2fa4dde001872
MrPeer/Accenture-Tekstac
/Python/Faculties and Students/Accountdet.py
1,212
4.09375
4
class Person: def __init__(self,name,age,dept): self.name=name self.age=age self.dept=dept class Student: def __init__(self,sid): self.sid=sid class Faculty: def __init__(self,fid): self.fid=fid class StudentMember(Person,Student): def _...
d9c90f15d1f15e16857c01328938e2b4667d08f2
MrPeer/Accenture-Tekstac
/Python/Time Table Planning/time_table.py
292
4.0625
4
import Dates y=int(input("Enter year as 4 digits (e.g:2002):")) m=int(input("Enter month number:")) l=Dates.is_leap(y) if(l==1): a="Leap Year" else: a="Not Leap Year" b=Dates.month_name(m) c=Dates.days_in_month(m,y) print("Year: "+a) print("Month Name: "+b) print("Days in month: ",c)
31c9515e1d44e350bec5afc3e73988190ffc740b
MrPeer/Accenture-Tekstac
/Python/Store Student Data/sample.py
316
3.8125
4
reader=open('output_data.txt','a') n=int(input('Enter number of students: ')) for i in range(1,n+1): print('For student'+str(i)) name=input('Enter name: ') score=input('Enter the score: ') reader.write('Name: '+name+' Score: '+score+'\n') reader.close() f=open('output_data.txt','r') print(f.read())
0616ad70e813ad28762b1240d39263405a554226
MrPeer/Accenture-Tekstac
/Python/Alien_s Visit/alien.py
80
3.890625
4
a = input("Enter the name:") print ("Hello "+a+"! Welcome to our planet Earth.")
4a262e656c90efaf5d658c46c5e57b786066e864
HannSoo/algoPrac
/원주율외우기.py
637
3.5
4
""" """ def memo_all(number): def dfc(word): #숫자가 같을때 1 # 숫자가 1씩 단조 증가하거나 단조 감소할때 2 # 두개의 숫자가 번갈아가며 나타날때 4 # 숫자가 등차수열을 이룰 때 d != 1 5 # 이 외의 모든 경우 10 case1 = case2 = case3= case4= cas...
542c400ed5a8bfb88006ce3b2c7f881088720131
YANYANYEAH/jianzhi-offor-python
/16_数值的整数次方.py
1,609
4.40625
4
# -*- coding:utf-8 -*- # // 面试题16:数值的整数次方 # // 题目:实现函数double Power(double base, int exponent),求base的exponent # // 次方。不得使用库函数,同时不需要考虑大数问题。 # tips: 考虑特殊条件,比如 exponent 为负数, 此时结果需要取倒数 # 当结果去倒数的时候,需要考虑分母为0的情况,0^n = 0或者1,n^0 = 1 # 此处需要考虑 简单的方法,比如a^n = a^(n/2) * a^(n/2) 此时需要考虑n为奇数还是偶数 # def get_result(...
079940073578f60fcd55e9161099277500c11c67
YANYANYEAH/jianzhi-offor-python
/18_删除链表节点_1.py
1,365
4
4
# -*- coding:utf-8 -*- # // 面试题18(一):在O(1)时间删除链表结点 # // 题目:给定单向链表的头指针和一个结点指针,定义一个函数在O(1)时间删除该 # // 结点。 class list_node: def __init__(self, x): self.value = x self.next = None def __del__(self): return def connect_node(a,b): a.next = b def deletd_node(x): if x.next == None:...
7e71a30f024e9dbaa68ebcfd0d0944348eb3e633
magdeevd/gb-python
/homework_7/second.py
2,174
4.0625
4
from abc import abstractmethod class Clothes: def __init__(self, title): self.title = title @property def consumption(self): return self.calculate() @abstractmethod def calculate(self): pass class Coat(Clothes): def __init__(self, title, size): super().__i...
03c5034fefdd9e216094fb30bc778172f1ba410c
magdeevd/gb-python
/homework_4/fourth.py
848
3.734375
4
def main(): """ 4. Представлен список чисел. Определить элементы списка, не имеющие повторений. Сформировать итоговый массив чисел, соответствующих требованию. Элементы вывести в порядке их следования в исходном списке. Для выполнения задания обязательно использовать генератор. Пример исходного спи...
d2058e8a4efd58d12b3ee1d45e375caa5e3478a8
magdeevd/gb-python
/homework_1/firtst.py
226
3.765625
4
def main(): hello = "Hello" world = "World" print(f"{hello} {world}") a = input("Enter value of a: ") b = input("Enter value of b: ") print(f"a = {a} b = {b}") if __name__ == '__main__': main()
ccd185a4b82e413c8a528f6e6c821f1d3542c0e3
magdeevd/gb-python
/homework_1/sixth.py
201
3.796875
4
def main(): a = int(input("Enter a: ")) b = int(input("Enter b: ")) i = 1 while a <= b: a = a + 0.1 * a i = i + 1 print(i) if __name__ == '__main__': main()
f58cd8b8c7c7f9f8175fb0816e0ae8073d6101d1
magdeevd/gb-python
/homework_5/third.py
1,052
4.15625
4
def main(): """ 3. Создать текстовый файл (не программно), построчно записать фамилии сотрудников и величину их окладов (не менее 10 строк). Определить, кто из сотрудников имеет оклад менее 20 тыс., вывести фамилии этих сотрудников. Выполнить подсчет средней величины дохода сотрудников. """ sala...
38ac39d0e0b2827c8bc495ffd72b551ac1bda54e
JulhaMouraR/BiotecGirls
/Hackathon.py
878
4.1875
4
import sqlite3 conn = sqlite3.connect('estudantes.db') cursor = conn.cursor() cursor.execute(''' CREATE TABLE IF NOT EXISTS students( UserID VARCHAR(20) NOT NULL, username VARCHAR(60) NOT NULL, firstname VARCHAR(60) NOT NULL, email VARCHAR(60) NOT NULL, password VARCHAR(80) NOT NULL); ''') #gravando no bd conn.commit...
916b53b61a039164b6d47ec13dd56fb9591852ab
vijaymanikantareddy/python_lab
/ex_19.py
159
3.78125
4
def is_sorted(l): r = sorted(l) if r==l: return True else: return False l = [int(i) for i in input().split()] print(is_sorted(l))
28971fea4e7fe747a39eb5d0155512f33b28f32e
vijaymanikantareddy/python_lab
/ex_18_factors.py
187
4.03125
4
def number_of_factors(num): factors = [i for i in range(1,num+1) if num%i==0] print(factors) return len(factors) n = int(input('enter number: ')) print(number_of_factors(n))
258ab8269a335fe6d87e1f988cc4e320d4951c47
Tokuhisa1/foredit
/whiletwo.py
201
3.90625
4
i=0 numbers=[] while i<6: print "at the top is %d"%i numbers.append(i) i=i+1 print "Numbers now:",numbers print "at the buttom i is %d"%i print "The numbers:" for num in numbers: print num
112b4f57103447666d793824aa03717fe86b6694
Avispon99/Tkinter-Gui
/graph_4.py
1,063
3.859375
4
import tkinter def fun_2(): # After repeta los 5 segundos para ejecutar la fun_2, lo que significa que after solo influye en su funcion asiganada var.set('CAMBIO') print('XXXXXXXXX') def fun(): root.withdraw() # oculta ventana root_2 = tkinter.Toplevel() #crea ventana secundaria aviso = tkinter.Label(root_2...
8d114d0f1b954f5b7c104a608623b699b7c5e9a8
mihirsam/CS1465-ALGORITHM-LAB
/25.01.18/Sum_series.py
155
4.03125
4
num = int(input("Enter a number here : ")) summ = 0 while(num >= 0): summ = summ + num num -= 2 print("Sum of the series : {} \n" .format(summ))
588f038e56b16dcb484e558e7e3584aef2297fa7
mihirsam/CS1465-ALGORITHM-LAB
/18.01.18/Factorial_while.py
151
4.09375
4
# Factorial using while loop num = int(input("Enter a number : ")) result = 1 while(num != 0): result = result * num num-= 1 print (result)
54ec08c20f2da60f7e145b5404865b83037c612a
mihirsam/CS1465-ALGORITHM-LAB
/18.01.18/VolSphere.py
159
4.5
4
# find the volume of the sphere radius = int(input("Enter the radius of the sphere : ")) pi = 3.14 result = 4 * pi * (radius**3) result /= 3 print(result)
02e082a3584613008f515f8f1cd324a3c3a1ec85
mihirsam/CS1465-ALGORITHM-LAB
/14.03.18/ActivitySelection.py
354
3.75
4
n = int(input("Number of elements : ")) a = [] f = [] s =[] for i in range(n): print("Activity Selection : ") p = int(input("Start time : ")) s.append(p) l = int(input("End time : ")) f.append(l) i =0 j =0 a.append(i+1) for i in range(1,n): if(s[i] > f[j]): a.append(i+1) j =...
7b40d3cb76b49cb2a77423eb9e1ab973c6a327e0
kapil87/Algorithms
/noOfWaysToArrangeBricks.py
184
3.875
4
def noOfWays(n): """Number of Ways to Arrange bricks of size 1*2 in a board of size 2*n""" if n == 1: return 1 if n == 2: return 2 return noOfWays(n-1) + noOfWays(n-2)
b9431f027a2ba886ff7343f5eb172c8edd80c2d4
marvson/hill-climbing
/src/hillclimbing.py
2,326
3.625
4
from typing import Callable, Generator, List, Tuple, TypeVar # Generic solution type T T = TypeVar("T") def hill_climbing( initial: T, operator: Generator[T, T, None], evaluate: Callable[[T], float], equals: Callable[[T, T], bool], ) -> Tuple[T, List[T]]: """Optimizes a solution for a problem by ...
dfcd8231f970816167266d4ffe866e5806488605
victzhao/homework
/day2/购物车.py
7,815
3.8125
4
#!/usr/bin/env python #商品列表 ShoppingList = { '房子':2000000, '汽车':200000, '电脑':2000, '手机':1998, '水果':19, '冰箱':2975 } #定义检查用户输入的金额是否是数字 def check_input(args): try: int(args) except ValueError: return 1 #定义函数执行列出商品列表 def ShowTable(): ShoppingDic = {} Num = 0...
83c9d6d90aacfda0262d2ab32de1ef9d2585708a
victzhao/homework
/day1/Work1/login.py
1,714
3.671875
4
#!/usr/bin/env python # -*- coding:utf-8 -*- import sys def login(): while True: read_f = open('account.txt','r') name = input('请输入您的用户名:').strip() read_lock_file = open('account-clock.txt','r') UserOfLockList = [] for i in read_lock_file: UserOfLockList.append(i....
7c05f8ad820544ee11e818f74495fa8c7b81f1b7
corytu/exercism
/python/pangram/pangram.py
410
4.03125
4
from string import ascii_lowercase def is_pangram(sentence): sentence = sentence.lower() for letter in ascii_lowercase: if letter not in sentence: return False return True # Starred solution: https://exercism.io/tracks/python/exercises/pangram/solutions/66c0c33fd2774c6d9d032b16fae5...
96456d70e83434b12320a07187f2b2b179f6c161
vinay26-01/python
/reverse in lists.py
317
3.6875
4
def rev(num): rev1=0 while num: r=num%10 num=num//10 rev1=rev1*10+r return rev1 def reverse(n,data): for i in range(n): data[i]=rev(data[i]) return data[i] n=int(input()) data=list(map(int,input().split())) reverse(n,data) print(*data)
2242d783fb0cfbd15912991963b46b1c4e297642
vinay26-01/python
/maxsortlength in lists.py
324
3.546875
4
def maxsortlen(n,arr): c=1 count=1 for i in range(n-1): if arr[i]<arr[i+1]: c+=1 else: if count<c: count=c c=1 return max(c,count) n=int(input()) data=list(map(int,input().split())) print(maxsortlen(n,data...
53b90ed935409d3ecca4042ecfafaf83b4d3ad40
vinay26-01/python
/secondlargest inlists.py
175
3.546875
4
def secondlargest(n,data): data=list(set(data)) data.sort() return data[-2] n=int(input()) data=list(map(int,input().split())) print(secondlargest(n,data))
7ffa674d62eaf1a3d6c14072514242127dff46cc
vinay26-01/python
/max_min_digits.py
119
3.671875
4
num=input("enter number") big=max(num) small=min(num) print("maximum digit =",big) print("minimum digit =",small)
929f4f870dac272403cd0c948ff1f61f3236e587
Wladaaa/python
/zaj3/zad.py
1,568
3.671875
4
import math class zesp(object): def __init__(self, a, b): self.a=a self.b=b def __add__(self, other): if (type(other)==type(self)): res = zesp(self.a+other.a, self.b+other.b) else: res=self res.a=self.a+other return res def __sub__...
540ac6c89b14fc45333291a8a57d6c7cd590f32b
Wladaaa/python
/zaj7/zad1.py
724
3.78125
4
#! /usr/bin/env import sqlite3 connection =sqlite3.connect("books.db") cursor = connection.cursor() cursor.execute('''CREATE TABLE IF NOT EXISTS library (id integer NOT NULL, title text , length integer, PRIMARY KEY (id))''') cursor.execute('''INSERT INTO library(title,length) VALUES ('ks1',300) ''') cursor.execute('''...
17c3129115171a2dd650e3287586998d0053ad8a
dwg1958/Python_Lessons
/dictionaries.py
383
3.84375
4
print("DICTIONARIES") print('') dogs = {"Harley": 5, "Fido": 9, "Tiddles": 2, "Fang": 12} # NB No order print(dogs) print(f" Harley's age is {dogs['Harley']}") # use different quotes! # Change value mydog = "Harley" dogs[mydog] = 6 print(f" Harley's age is {dogs['Harley']}") # use different quotes! # Add and d...