blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
d2de097ee33f0060830681df81f87f600f5da69c
Scott-Dixon-Dev-Team-Organization/cs-guided-project-linked-lists
/src/demonstration_3.py
804
4.1875
4
""" Given a non-empty, singly linked list with a reference to the head node, return a middle node of linked list. If there are two middle nodes, return the second middle node. Example 1: Input: [1,2,3,4,5] Output: Node 3 from this list The returned node has value 3. Note that we returned a `ListNode` object `ans`, su...
true
00ead084fe729599aeedba61cc88fc277e7726ad
menezesluiz/MITx_-_edX
/week1/exercise/exercise-for.py
442
4.34375
4
""" Exercise: for Finger Exercises due Aug 5, 2020 20:30 -03 Completed Bookmark this page Exercise: for exercise 1 5.0/5.0 points (graded) ESTIMATED TIME TO COMPLETE: 5 minutes In this problem you'll be given a chance to practice writing some for loops. 1. Convert the following code into code that uses a for loop. ...
true
36e8464800601f9fc4553aacc2f48369940393df
menezesluiz/MITx_-_edX
/week1/exercise/exercise04.py
2,056
4.40625
4
""" Exercise 4 Finger Exercises due Aug 5, 2020 20:30 -03 Completed Bookmark this page Exercise 4 5/5 points (graded) ESTIMATED TIME TO COMPLETE: 8 minutes Below are some short Python programs. For each program, answer the associated question. Try to answer the questions without running the code. Check your answers,...
true
c142beb40fb5f0bf1527f2a5fc3172165d0d4d09
yonggyulee/gitpython
/02/07.operater_logical.py
744
4.3125
4
#일반적으로 피연산자(operand)는 True 또는 False 값을 가지는 연산 a = 20 print(not a < 20) print(a < 30 and a !=30) b = a > 1 # 다른 타입의 객체도 bool 타입으로 형변환이 가능하다 print(bool(10), bool(0)) print(bool(3.14), bool(0.)) print(bool('hello'), bool('')) print(bool([0,1]), bool([])) print(bool((0,1)), bool(())) print(bool({'k1':'v1', 'k2':'v2', 'k3...
false
8d6d347432112c3884102402bf0c269bcbd2ab89
Preet2fun/Cisco_Devnet
/Python_OOP/encapsulation_privateMethod.py
1,073
4.4375
4
""" Encapsulation = Abstraction + data hiding encapsulation means we are only going to show required part and rest will keep as private """ class Data: __speed = 0 #private variable __name = '' def __init__(self): self.a = 123 self._b = 456 # protected self.__c ...
true
cd9c959a5bc604f523799d07470931d281d79698
paulc1600/Python-Problem-Solving
/H11_staircase.py
1,391
4.53125
5
#!/bin/python3 # ---------------------------------------------------------------------# # Source: HackerRank # Purpose: Consider a staircase of size n: # # # ## # ### # #### # # Observe that its base and height are both equal to n, and # ...
true
2cc6154799ccae67f873423a981c6688dc9fb2b5
paulc1600/Python-Problem-Solving
/H22_migratoryBirds_final.py
1,740
4.375
4
#!/bin/python3 # ---------------------------------------------------------------------# # Source: HackerRank # Purpose: You have been asked to help study the population of birds # migrating across the continent. Each type of bird you are # interested in will be identified by an integer value. Each...
true
e955679387cd90ad3e5dfbbff7f941478063823d
Hajaraabibi/s2t1
/main.py
1,395
4.1875
4
myName = input("What is your name? ") print("Hi " + myName + ", you have chosen to book a horse riding lesson, press enter to continue") input("") print("please answer the following 2 questions to ensure that you will be prepared on the day of your lesson.") input("") QuestionOne = None while QuestionOne not in...
true
a3b8127727aab91acb49a0c57c81aa5bf8b7ea4a
atishay640/python_core
/comparison_oprators.py
363
4.28125
4
# Comparison operators in python # == , != , > , < >= ,<= a= 21 b= 30 c= a print(a==b) print(c==a) print(a>=b) print(a<=b) print(a<b) print('------------------------------------') # Chaining comparison operators in python # 'and' , 'or' , and 'not' print(a == b and b == c) print(a == b or a == c) print(not a == 2...
false
fd7715910c9fee1405c6599869252b112b098520
atishay640/python_core
/dictionary.py
891
4.4375
4
# Dictionary in python # It is an unordered collection # Used 'key'-'value' pairs to store values. # it is identified with {} print("**********dictionary in python") students_dic = {1 : 'Atishay' ,2 : 'Vikas' ,3 : 'Aakash' } print(students_dic) print("**********fetch value in python") print(students_dic[2]) print...
false
2599892f0d1edf3a23907bad202b1d1b0f10328f
atishay640/python_core
/polymorphism.py
922
4.15625
4
# Inheritance in python class Person: def __init__(self,name,mob_no,address): self.name = name self.mob_no = mob_no self.address = address def eat(self): print('I eat food') class Employee(Person): def __init__(self,name,mob_no,address,company_name): Person.__init...
false
0d0892bf443e39c3c5ef078f2cb846370b7852e9
JakobLybarger/Graph-Pathfinding-Algorithms
/dijkstras.py
1,297
4.15625
4
import math import heapq def dijkstras(graph, start): distances = {} # Dictionary to keep track of the shortest distance to each vertex in the graph # The distance to each vertex is not known so we will just assume each vertex is infinitely far away for vertex in graph: distances[vertex] = math....
true
b9bb7deb73be996ec847225a3c10f9f8c063b7c8
jglantonio/learning_python
/curso001/03_strings.py
562
4.375
4
#!/usr/bin/env python3 # Strings y funciones para trabajar con ellos variable = "Tengo un conejo "; print(variable); variable2 = "llamado POL"; print(variable2); print(variable + variable2); print(variable*2); # function len length_variable = len(variable); print("La variable "+variable+", tiene ",length_variable); ...
false
026526ddd9c38e990d966a0e3259edcb2c438807
arlionn/readit
/readit/utilities/filelist.py
1,003
4.21875
4
import glob from itertools import chain def filelist(root: str, recursive: bool = True) -> [str]: """ Defines a function used to retrieve all of the file paths matching a directory string expression. :param root: The root directory/file to begin looking for files that will be read. :param recursive...
true
0d012a23dfd3e68024f560287226171040c2ca67
EthanReeceBarrett/CP1404Practicals
/prac_03/password_check.py
941
4.4375
4
"""Password check Program checks user input length and and print * password if valid, BUT with functions""" minimum_length = 3 def main(): password = get_password(minimum_length) convert_password(password) def convert_password(password): """converts password input to an equal length "*" output""" fo...
true
262d7b72a9b8c8715c1169b9385dd1017cb2632b
EthanReeceBarrett/CP1404Practicals
/prac_06/programming_language.py
800
4.25
4
"""Intermediate Exercise 1, making a simple class.""" class ProgrammingLanguage: """class to store the information of a programing language.""" def __init__(self, field="", typing="", reflection="", year=""): """initialise a programming language instance.""" self.field = field self.ty...
true
8aa1cf81834abd2a7cb368ffdb9510ae7f0039e4
nobleoxford/Simulation1
/testbubblesort.py
1,315
4.46875
4
# Python program for implementation of Bubble Sort def bubbleSort(arr): n = len(arr) # Traverse through all array elements for i in range(n): # Last i elements are already in place for j in range(0, n-i-1): # traverse the array from 0 to n-i-1 # Swap if the el...
true
b29b3de7434393fca62ea01898df1015e7a8871f
iamkarantalwar/tkinter
/GUI Sixth/canvas.py
1,080
4.21875
4
#tkinter program to make screen a the center of window from tkinter import * class Main: def __init__(self): self.tk = Tk() #these are the window height and width height = self.tk.winfo_screenheight() width = self.tk.winfo_screenwidth() #we find out the center co or...
true
5765384a784ac51407757564c0cbafa06cedb83b
divyaprabha123/programming
/arrays/set matrix zeroes.py
1,059
4.125
4
'''Set Matrix Zeroes 1. Time complexity O(m * n) 2. Inplace ''' def setZeroes(matrix): """ Do not return anything, modify matrix in-place instead. """ #go through all the rows alone then is_col = False nrows = len(matrix) ncols = len(matrix[0]) ...
true
47040df315ac09b44047e645f8f988b5a1142342
falcoco/pythonstudy
/ex7.py
299
4.25
4
age = 7 if age >= 18: print 'your age is ',age print 'adult' #else: # print 'your age is ',age # print 'teenager' elif age >= 6: print 'your age is ',age print 'teenager' else: print 'kid' #age = 20 #if age >= 6: # print 'teenager' #elif age >= 18: # print 'adult' #else: # print 'kid'
false
9a3b9864abada3b264eeed335f6977e61b934cd2
willzhang100/learn-python-the-hard-way
/ex32.py
572
4.25
4
the_count = [1, 2, 3, 4, 5] fruits = ['apples', 'oranges', 'pears', 'apricots'] change = [1, 'pennies', 2, 'dimes', 3, 'quarters'] #first for loop goes through a list for number in the_count: print "This is count %d" % number #same for fruit in fruits: print "A fruit of type: %s" % fruit #mixed list use %r for i ...
true
d6c2b9f271797e580226702c6ec843e00eea3508
SMinTexas/work_or_sleep
/work_or_sleep_in.py
428
4.34375
4
#The user will enter a number between 0 and 6 inclusive and given #this number, will make a decision as to whether to sleep in or #go to work depending on the day of the week. Day = 0 - 4 go to work #Day = 5-6 sleep in day = int(input('Day (0-6)? ')) if day >= 5 and day < 7: print('Sleep in') elif day >= 0 and d...
true
d0db003c65b5b4bb5d08db8d23f49b29d15a2d9b
mariaKozlovtseva/Algorithms
/monotonic_check.py
798
4.3125
4
def monotonic(arr, if_true_false=False): """ Check whether array is monotonic or not :param arr: array of different numbers :return: string "Monotonic" / "Not monotonic" or if True / False """ decreasing = False increasing = False idx = 0 while not increasing and idx < len(arr)-1: ...
true
b300d785046b93cc5829c98ede2cdb5bfd12e105
grgoswami/Python_202011
/source/Tista3.py
818
4.21875
4
colors = { 'Tista': 'Purple', 'Gia' : 'Turquoise', 'Anya':'Minty Green' } print(colors) for name , color in colors.items(): print(name + "'s favorite color is " + color) print(name + ' has ' + str(len(name)) + ' letters in her or his name') print('\n') #Survey na...
false
41c3f5039e71c2ea562a61ddb37987b3e80ad0fc
grgoswami/Python_202011
/source/reg17.py
465
4.28125
4
def Fibonacci0(num): """ The following is called the docstring of the function. Parameters ---------- num : int The number of elements from the Fibonacci sequence. Returns ------- None. It prints the numbers. """ a = 1 print(a) b = 1 print(b) for i in r...
true
c0dfe2aa84bf9cc8e5e33ecdd36a8712e3601f13
grgoswami/Python_202011
/source/reg6.py
442
4.21875
4
# String indexing str0 = 'Tista loves chocolate' print(len(str0)) print(str0[3]) # String slicing print(str0[5:7]) print(str0[4:7]) # String mutation # Strings are not 'mutable'; they are called immutable str0[3] = 'z' print(str0) s2 = 'New York' zip_code = 10001 # The following is called string concatenation pr...
false
8a0fcd96d2e7a22e2ef1d45af7dd914f4492d856
vamsikrishnar161137/DSP-Laboratory-Programs
/arrayoperations.py
1,774
4.28125
4
#SOME OF THE ARRAY OPERATIONS import numpy as np a=np.array([(1,4,2,6,5),(2,5,6,7,9)])#defining the array. print '1.The predifined first array is::',a b=np.size(a)#finding size of a array. print '2.Size of the array is::',b c=np.shape(a)#finding shape of an array print '3.Shape of the array is::',c d=np.ndim(a) print '...
true
bc16a054e3eee1730211763fe3d0b71be4d41019
shevdan/programming-group-209
/D_bug_generate_grid.py
2,259
4.375
4
""" This module contains functions that implements generation of the game grid. Function level_of_dif determines the range (which is the representation of the level of difficulty which that will be increased thorough the test) from which the numbers will be taken. Function generate_grid generates grid, with a one spe...
true
3da0639a03ae3f87446ad57a859b97af60384bc4
blafuente/SelfTaughtProgram_PartFour
/list_comprehension.py
2,397
4.65625
5
# List Comprehensions # Allows you to create lists based on criteria applied to existing lists. # You can create a list comprehension with one line of code that examins every character in the original string # Selects digigts from a string and puts them in a list. # Or selects the right-most digit from the list....
true
d2f172a112ec5a30ab4daff10f08c5c4c5bc95a1
AAKASH707/PYTHON
/binary search tree from given postorder traversal.py
2,332
4.21875
4
# Python program to construct binary search tree from given postorder traversal # importing sys module import sys # class for creating tree nodes class Node: def __init__(self, data): self.data = data self.left = None self.right = None # initializing MIN and MAX MIN = -sys.maxsize - 1 M...
true
a079327ad1c4c1fcc01c22dc9e1e8f335f119958
AAKASH707/PYTHON
/Print Square Number Pattern.py
234
4.25
4
# Python Program to Print Square Number Pattern side = int(input("Please Enter any Side of a Square : ")) print("Square Number Pattern") for i in range(side): for i in range(side): print('1', end = ' ') print()
true
5b90a261a667a86387e49463f49a8855b477174c
AAKASH707/PYTHON
/Count Words in a String using Dictionary Example.py
639
4.34375
4
# Python Program to Count words in a String using Dictionary string = input("Please enter any String : ") words = [] words = string.split() frequency = [words.count(i) for i in words] myDict = dict(zip(words, frequency)) print("Dictionary Items : ", myDict) *******************************************************...
true
35d76db2c786b8d4bec786699466b294d98b9855
dnsdigitaltech/aulas-de-python3
/funcoes.py
755
4.46875
4
#Funções permitem as chamadas modularizações do meu códigos #São blocos de códigos que spá serão chamados executados quando forem chamados #Em python as funções são definidas pela palavra reservada def """ Definição def NOME(parâmetros): COMANDOS Chamada NOME(argumentos) """ #Função que faz a soma de ...
false
ab975ef466da96fb72d1996b1df0c8ee155934c5
dnsdigitaltech/aulas-de-python3
/lista-parte-2-ordenar-lista.py
509
4.15625
4
#ordenar as listas lista = [124,345,72,46,6,7,3,1,7,0] #para ordenar a lista usa-se o método sort lista.sort() # altera ardenadamente a lista que já existe print(lista) lista = sorted(lista) # retorno uma lista ordenada print(lista) #Ordenar decrescente lista.sort(reverse=True) print(lista) #Inverter a lista lista....
false
5d464a64a9d8ef963da82b64fba52c598bc2b56c
josh-folsom/exercises-in-python
/file_io_ex2.py
402
4.4375
4
# Exercise 2 Write a program that prompts the user to enter a file name, then # prompts the user to enter the contents of the file, and then saves the # content to the file. file_name = input("Enter name of file you would like to write: ") def writer(file_name): file_handle = open(file_name, 'w') file_handle....
true
f36220a4caae8212e34ff5070b9a203f4b5814f8
josh-folsom/exercises-in-python
/python_object_ex_1.py
2,486
4.375
4
# Write code to: # 1 Instantiate an instance object of Person with name of 'Sonny', email of # 'sonny@hotmail.com', and phone of '483-485-4948', store it in the variable sonny. # 2 Instantiate another person with the name of 'Jordan', email of 'jordan@aol.com', # and phone of '495-586-3456', store it in the variable '...
true
953751722d3d968d169e147a78ea2716fcb573ce
Chadlo13/pythonTutorials
/Test13-Compare.py
279
4.21875
4
def maxFunc (num1,num2,num3): return max(num1,num2,num3) input1 = input("Enter a number: ") input2 = input("Enter a number: ") input3 = input("Enter a number: ") maxNum = maxFunc(int(input1),int(input2),int(input3)) print("the largest value is: " + str(maxNum))
false
26f2d3651294e73420ff40ed603baf1ac2abb269
Rohitjoshiii/bank1
/read example.py
439
4.21875
4
# STEP1-OPEN THE FILE file=open("abc.txt","r") #STEP2-READ THE FILE #result=file.read(2) # read(2) means ir reads teo characters only #result=file.readline() #readline() it print one line only #result=file.readlines() #readlines() print all lines into list line=file.readlines() # for loop ...
true
cefd70520471331df28cce805b8041f465f8d24a
Pasha-Ignatyuk/python_tasks
/task_5_7.py
912
4.15625
4
"""Дана целочисленная квадратная матрица. Найти в каждой строке наибольший элемент и поменять его местами с элементом главной диагонали.[02-4.2-ML22]""" import random n = 4 m = 4 matrix = [[random.randrange(0, 10) for y in range(m)] for x in range(n)] print(matrix) def print_matrix(matrix): for i in range(len(mat...
false
db3c248cd270dad58a6386c4c9b6dc67e6ae4fab
AK-1121/code_extraction
/python/python_20317.py
208
4.1875
4
# Why mutable not working when expression is changed in python ? y += [1,3] # Means append to y list [1,3], object stays same y = y+[1,3] # Means create new list equals y + [1,3] and write link to it in y
true
b3a16e0f14a5221be418de9d5162ad97cff9fba0
JoelDarnes88/primer_programa
/2.0.-Come_helado.py
532
4.1875
4
apetece_helado = input("¿Te apetece helado? (Si/No): ") tiene_dinero = input("Tienes dinero (Si/No): ") esta_el_señor_de_los_helados = input("esta el señor de los helados (Si/No) ") esta_tu_tia = input("¿Estás con tu tía? (Si/No)") Te_apetece_helado = apetece_helado == "Si" puedes_permitirtelo = tiene_dinero == "Si" o...
false
6f2581f4fafe6f3511327d5365f045ba579a46b1
CdavisL-coder/automateTheBoringStuff
/plusOne.py
372
4.21875
4
#adds one to a number #if number % 3 or 4 = 0, double number #this function takes in a parameter def plus_one(num): num = num + 1 #if parameter is divided by 2 and equal zero, the number is doubled if num % 2 == 0: num2 = (num + 1) * 2 print(num2) #else print the number else: ...
true
73c96ebcfebcf11ad7fde701f001d8bdbd921b00
poljkee2010/python_basics
/week_2/2.3 max_of_three.py
215
4.1875
4
a, b, c = (int(input()) for _ in range(3)) if a < b > c: print(b) elif a < c > b: print(c) elif b < a > c: print(a) elif a > b or a > c: print(a) elif b > a or b > c: print(b) else: print(c)
false
17e5dcdb6b83c5023ea428db1e93cc494d6fe405
Parashar7/Introduction_to_Python
/Celsius_to_farenheight.py
217
4.25
4
print("This isa program to convert temprature in celcius to farenheight") temp_cel=float(input("Enter the temprature in Celsius:")) temp_faren= (temp_cel*1.8) +32 print("Temprature in Farenheight is:", temp_faren)
true
ebefd9d3d3d7139e0e40489bb4f3a022ee790c19
vatasescu-predi-andrei/lab2-Python
/Lab 2 Task 2.3.py
215
4.28125
4
#task2.3 from math import sqrt a=float(input("Enter the length of side a:")) b=float(input("Enter the length of side b:")) h= sqrt(a**2 + b**2) newh=round(h, 2) print("The length of the hypotenuse is", newh)
true
8eea3adf0682985a99b7276a0cc720cbeec98d0b
scalpelHD/Study_python
/课堂/car.py
1,239
4.125
4
class Car(): """一次模拟汽车的尝试""" def __init__(self,make,model,year): """初始化描述汽车的属性""" self.make=make self.model=model self.year=year self.odometer_reading=0 def get_descriptive_name(self): """返回整洁的描述性信息""" long_name=str(self.year)+' '+self.make+' '+self....
false
1179a03075ab98c1e6727b067074bb3f67d4ba38
scalpelHD/Study_python
/课堂/5 if 语句.py
1,153
4.21875
4
cars=['AUDI','Toyota','bmw','honda','beijing','jeep','beiJING']#if语句 for car in cars: if car=='bmw': print(car.upper()) else: print(car.title()) if car.lower()=='audi' or car.upper()=='TOYOTA':#或 print(car.title()) if car.lower()=='beijing' and car!='beiJING':#与 print(car...
false
f235e7b36ac48915e7e0750af1fb6621a971f227
yadavpratik/python-programs
/for_loops_programs.py
1,901
4.28125
4
# normal number print with for and range function '''n=int(input("enter the number : ")) print("normal number print with for and range function") for i in range(n): print(i) # ============================================================================================================================= # pr...
true
a1ee1c5cfa1a83dfa4c2ca2dc2ec204b201ed1f2
NatalieBeee/PythonWithMaggie
/algorithms/printing_patterns.py
1,218
4.28125
4
''' #rows for i in range(0,5): #columns for j in range(0,i+1): print ('*', end ='') print ('\r') ''' # half_pyramid() is a function that takes in the number of rows def half_pyramid(num_r): #for each row -vertical for i in range(0,num_r): #for each column -horizontal for j ...
true
3cacfde1db19a4f7b8ccf3fca55c579fc8fc7313
smith-sanchez/validadores_en_python
/Boleta 17.py
682
4.125
4
#INPUT cliente=(input("ingrese el nommbre del cliente: ")) precio_mochila=float(input("ingrese el precio de la mochila:")) numero=int(input("numero de mochilas:")) #procesing total=(precio_mochila*numero) #vereficador cliente_necesario=(total>120) #OUTPUT print("############################") print("# B...
false
754cd0a9c3159b2eb91350df0f5d2907c543a6ad
sbishop7/DojoAssignments
/Python/pythonAssignments/funWithFunctions.py
639
4.21875
4
#Odd/Even def odd_even(): for count in range(1,2001): if count % 2 == 1: print "Number is ", count, ". This is an odd number." else: print "Number is ", count, ". This is an even number." #Multiply def multiply(arr, x): newList = [] for i in arr: newList....
true
9535c83847a12174fc9d6002e19f70c163876af5
LdeWaardt/Codecademy
/Python/1_Python_Syntax/09_Two_Types_of_Division.py
1,640
4.59375
5
# In Python 2, when we divide two integers, we get an integer as a result. When the quotient is a whole number, this works fine # However, if the numbers do not divide evenly, the result of the division is truncated into an integer. In other words, the quotient is rounded down to a whole number. This can be surprisin...
true
86ea818619a81d0034994f0c9c70d326b5972d56
Sanakhan29/PythonPrograms
/if_elif_else.py
260
4.125
4
ali_age = int(input('Input Ali Age:')) sara_age = int(input('Input Sara Age:')) if ali_age == sara_age: print('They both have same age') elif ali_age < sara_age: print('Ali is younger than Sara') else: print('Ali is elder than Sara')
false
1e34f96001b049c57de96ba8aef944d7aa5268da
ShrutiBhawsar/practice-work
/MapFilterLambda_part4.py
1,502
4.25
4
numbers = [1,2,3,4,5,6,7,8,9,10] def EvenFunction1(): evenList = [] for number in numbers: if number % 2 == 0: evenList.append(number) print(numbers) print("Even Number List is {}".format(evenList)) # EvenFunction1() def OddFunction1(): oddList = [] for number in numbers: ...
false
ea14d5de2d43b1f19eb612dea929a612ebfed717
Ottermad/PythonNextSteps
/myMagic8BallHello.py
819
4.15625
4
# My Magic 8 Ball import random # put answers in a tuple answers = ( "Go for it" "No way, Jose!" "I'm not sure. Ask me again." "Fear of the unkown is what imprisons us." "It would be madness to do that." "Only you can save mankind!" "Makes no difference to me, do or don't - whatever" ...
true
9f4a1f9c1e212efe17186287746b7b4004ac037a
Col-R/python_fundamentals
/fundamentals/Cole_Robinson_hello_world.py
762
4.21875
4
# 1. TASK: print "Hello World" print('Hello World!') # 2. print "Hello Noelle!" with the name in a variable name = "Col-R" print('Hello', name) # with a comma print('Hello ' + name) # with a + # # 3. print "Hello 42!" with the number in a variable number = 24 print('Hello', number) # with a comma print('Hello '+ str(nu...
true
768d5acc06bf952cb396c18ceea1c6f558634f6f
Col-R/python_fundamentals
/fundamentals/strings.py
1,874
4.4375
4
#string literals print('this is a sample string') #concatenation - The print() function inserts a space between elements separated by a comma. name = "Zen" print("My name is", name) #The second is by concatenating the contents into a new string, with the help of +. name = "Zen" print("My name is " + name) number = 5 ...
true
66d04eb4ab92c922cd8f9ae2d60699b1eb6947c3
Bikryptorchosis/PajtonProj
/TestSets.py
2,338
4.15625
4
# farm_animals = {"sheep", "cow", "hen"} # print(farm_animals) # # for animal in farm_animals: # print(animal) # # print('-' * 40) # # wild_animals = set(['lion', 'panther', 'tiger', 'elephant', 'hare']) # print(wild_animals) # # for animal in wild_animals: # print(animal) # # farm_animals.add('horse') # wild_a...
false
7ddac6a6f3770cacd02645e29e1058d885e871f2
dburr698/week1-assignments
/todo_list.py
1,924
4.46875
4
# Create a todo list app. tasks = [] # Add Task: # Ask the user for the 'title' and 'priority' of the task. Priority can be high, medium and low. def add_task(tasks): name = input("\nEnter the name of your task: ") priority = input("\nEnter priority of task: ") task = {"Task": name, "Priority": priority}...
true
7d6aef42709ca67f79beed472b3b1049efd73513
chriklev/INF3331
/assignment6/_build/html/_sources/temperature_CO2_plotter.py.txt
2,237
4.1875
4
import pandas as pd import numpy as np import matplotlib.pyplot as plt def plot_temperature(months, time_bounds=None, y_bounds=None): """Plots the temperatures of given months vs years Args: months (string): The month for witch temperature values to plot. Can also be list of strings with ...
true
3b343e3551776f7ea952f039008577bdfc36ae9c
ewertonews/learning_python
/inputs.py
222
4.15625
4
name = input("What is your name?\n") age = input("How old are you?\n") live_in = input("Where do you live?\n") string = "Hello {}! Good to know you are {} years old and live in {}" print(string.format(name, age, live_in))
true
9c3254d781dda926a1050b733044a62dd1325ec7
kevinsu628/study-note
/leetcode-notes/easy/array/27_remove_element.py
2,103
4.1875
4
''' Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. The order of elements can be changed. It doesn't matter what you leave beyond th...
true
880f3286c2b5052bd5972a9803db32fd1581c68d
devilsaint99/Daily-coding-problem
/product_of_array_exceptSelf.py
680
4.3125
4
"""Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i. For example, if our input was [1, 2, 3, 4, 5], the expected output would be [120, 60, 40, 30, 24]. If our input was [3, 2, 1], ...
true
d997ee82822d758eddcedd6d47059bae5b7c7cac
akassharjun/basic-rsa-algorithm
/app.py
1,320
4.15625
4
# To create keys for RSA, one does the following steps: # 1. Picks (randomly) two large prime numbers and calls them p and q. # 2. Calculates their product and calls it n. # 3. Calculates the totient of n ; it is simply ( p −1)(q −1). # 4. Picks a random integer that is coprime to ) φ(n and calls this e. A simple way i...
true
5d6d8d557279b809dba055dc702c186c0a5abebd
carlson9/KocPython2020
/in-classMaterial/day4/exception.py
375
4.1875
4
raise Exception print("I raised an exception!") raise Exception('I raised an exception!') try: print(a) except NameError: print("oops name error") except: print("oops") finally: print("Yes! I did it!") for i in range(1,10): if i==5: print("I found five!") continue print("Here is five!") else: pr...
true
901e7a3327f2da3817d48f0cd748031a7361c1ae
workready/pythonbasic
/sources/t06/t06ejer06.py
824
4.1875
4
class Item: pass # Tu codigo aqui. Estos son los elementos a guardar en las cajas class Box: pass # Tu codigo aqui. Esta clase va a actuar como abstracta class ListBox(Box): pass # Tu codigo aqui class DictBox(Box): pass # Tu codigo aqui # Esto prueba las clases i1 = Item("Item 1", 1...
false
aa3ce5e3f0253d2065b99dd809b0fe29992dd954
workready/pythonbasic
/sources/t04/t04ej04.py
297
4.28125
4
# Una lista es un iterable a_list = [1, 2, 3] for a in a_list: # Tip: para que print no meta un salto de línea al final de cada llamada, pasarle un segundo argumento end=' ' print (a, end=' ') # Un string también es un iterable a_string = "hola" for a in a_string: print(a, end=' ')
false
5dfd71362ded3403b553bc743fab89bab02e2d38
BluFox2003/RockPaperScissorsGame
/RockPaperScissors.py
1,684
4.28125
4
#This is a Rock Paper Scissors game :) import random def aiChoice(): #This function generates the computers choice of Rock, Paper or Scissors x = random.randint(0,2) if x == 0: choice = "rock" if x == 1: choice = "paper" if x == 2: choice = "scissors" return choice def gam...
true
690c1fc35fdd3444d8e27876d9acb99e471b296b
gridl/cracking-the-coding-interview-4th-ed
/chapter-1/1-8-rotated-substring.py
686
4.34375
4
# Assume you have a method isSubstring which checks if one # word is a substring of another. Given two strings, s1 and # s2, write code to check if s2 is a rotation of s1 using only # one call to isSubstring (i.e., "waterbottle" is a rotation of # "erbottlewat"). # # What is the minimum size of both strings? # ...
true
f4890c20a78d87556d0136d38d1a1a40ac18c087
AlbertGithubHome/Bella
/python/list_test.py
898
4.15625
4
#list test print() print('list test...') classmates = ['Michael','Bob', 'Tracy'] print('classmates =', classmates) print('len(classmates) =', len(classmates)) print('classmates[1] =', classmates[1]) print('classmates[-1] =', classmates[-1]) print(classmates.append('Alert'), classmates) print(classmates.insert(2,'...
true
4740f88aedeb28db6bfb615af36dfed7d76fda0f
vincent-kangzhou/LeetCode-Python
/380. Insert Delete GetRandom O(1).py
1,434
4.1875
4
import random class RandomizedSet(object): def __init__(self): """ Initialize your data structure here. """ self.valToIndex = dict() self.valList = list() def insert(self, val): """ Inserts a value to the set. Returns true if the set did not already cont...
true
b3b008d706062e0b068dd8287cfb101a7e268dd9
vincent-kangzhou/LeetCode-Python
/341. Flatten Nested List Iterator.py
2,132
4.21875
4
# """ # This is the interface that allows for creating nested lists. # You should not implement it, or speculate about its implementation # """ # class NestedInteger(object): # def isInteger(self): # """ # @return True if this NestedInteger holds a single integer, rather than a nested list. # :r...
true
eb36a1f18bb74176c9e5d3739f2a7b7353af4afe
bhavin-rb/Mathematics-1
/Multiplication_table_generator.py
655
4.6875
5
''' Multiplication generator table is cool. User can specify both the number and up to which multiple. For example user should to input that he/she wants to seea table listing of the first 15 multiples of 3. Because we want to print the multiplication table from 1 to m, we have a foor loop at (1) that iterates over ...
true
ac5acc74b5275738bd8a5eb40161f5098ea681ff
andytanghr/python-exercises
/PyPart1/madlib.py
285
4.25
4
print('Please fill in the blanks below:') print('Hello, my name is ____(name)____, and today, I\'m going to ____(verb)____.') name = input('What is your name? ') verb = input('What action do you take? ' ) print('Hello, my name is {}, and today, I\'m going to {}.'.format(name, verb))
false
4bde10e50b2b57139aed6f6f74b915a0771062dd
Ayesha116/cisco-assignments
/assigment 5/fac1.py
869
4.6875
5
# Write a Python function to calculate the factorial of a number (a non-negative # integer). The function accepts the number as an argument. def fact(number): factorial = 1 for i in range(1,number+1): factorial = factorial*i print(factorial) fact(4) # ...
true
4801ff9cb5d83bd385b3f650a3ba808d7f3cf229
Ayesha116/cisco-assignments
/assigment 5/market6.py
670
4.34375
4
# Question: 6 # Suppose a customer is shopping in a market and you need to print all the items # which user bought from market. # Write a function which accepts the multiple arguments of user shopping list and # print all the items which user bought from market. # (Hint: Arbitrary Argument concept can make this ta...
true
737c8d15876ea1c6cf897d21b9e96dd7be2fe5d8
Ayesha116/cisco-assignments
/assigment 3/calculator.py
504
4.1875
4
# 1. Make a calculator using Python with addition , subtraction , multiplication , # division and power. a =int(input("enter first value:")) b =int(input("enter second value:")) operator =input("enter operator:") if operator=="+": print("answer=",a+b) elif operator=="-": print("answer=",a-b) elif opera...
false
d7f20fbdee7d28a99591ab6bc4d3baf14f4a1920
aarizag/Challenges
/LeetCode/Algorithms/longest_substring.py
747
4.1875
4
""" Given a string, find the length of the longest substring without repeating characters. """ """ Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. """ def lengthOfLongestSubstring(s: str) -> int: letter_locs = {} cur, best, from_ind = 0, 0, 0 ...
true
052bcd3e8b2293371303450d3281f56c98498521
harish-515/Python-Projects
/Tkinter/script1.py
1,203
4.375
4
from tkinter import * #GUI are generated using window & widgets window = Tk() """ def km_to_miles(): print(e1_value.get()) miles = float(e1_value.get())*1.6 t1.insert(END,miles) b1=Button(window,text="Execute",command=km_to_miles) # pack & grid are used to make these button to visible b1.grid(row=0,c...
true
c932c15d1ecdfe595d96f532b83a11d02a9ef341
oclaumc/Python
/ex001ex002.py
431
4.3125
4
#Desafio 1 e 2 #Hello World / Exibir / inserção de variaves / formatação de objetos nome = input ("Qual seu nome?") print ("olá {}, prazer te conhecer!".format(nome)) print ("Qual sua data de nascimento?") dia = input ("Dia:") mes = input ("Mês:") ano = input ("Ano") #print ("Você nasceu no dia",dia,"do mês",mes,"do a...
false
51f27da75c6d55eeddacaa9cef05a3d1d97bb0db
r-fle/ccse2019
/level3.py
1,500
4.21875
4
#!/usr/bin/env python3 from pathlib import Path import string ANSWER = "dunno_yet" ########### # level 3 # ########### print("Welcome to Level 3.") print("Caeser cipher from a mysterious text file") print("---\n") """ There is text living in: files/mysterious.txt You've got to try and figure out what the secret mes...
true
8b8bd85ec48ddd120a6438354affb7372e689c99
Sparkoor/learning
/start/collectionsTest.py
1,708
4.125
4
""" collections测试 """ from collections import namedtuple p = (1, 2, 3, 4, 5) print(type(p)) print(p) # 可以定义坐标之类的,并且保证不可变,Point tuple的一个子类 Point = namedtuple('name', ['x', 'y']) print(Point) # <class '__main__.name'> name的一个实例 print(type(Point)) p = Point(1, 2) print(p) q = Point(2, 3) print(q) # 使用list存储数据时,按索引访问元素很...
false
59b53e13a6f8bb9d2d606de898fc92738e5bd10b
imyoungmin/cs8-s20
/W3/p6.py
692
4.125
4
''' Write a program which takes 5 strings as inputs and appends them to a list l. Swap each element in l with its mirror - that is, for some element at index i, swap l[i] with l[4-i] if i < 3. For instance, if l = ['Alex', 'Bob', 'Charlie', 'David', 'Ethan'], then after swapping, l should read ['Ethan', 'David', 'Char...
true
952628cbcb0b3bcffc567eebd19a4b4b2477fa1f
Grace-TA/project-euler
/solutions/problem_004.py
611
4.125
4
from utils import is_palindromic def problem_004(n_digits: int = 3): """ In a loop from sqrt(n) to 1 check if i is factor of n and i is a prime number. - O(n^2) time-complexity - O(1) space-complexity """ result = 0 for i in range(10**n_digits - 1, 10**(n_digits - 1) - 1, -1): for...
false
73f585596248ef1b48fab824d5d8204911acf857
ssong86/UdacityFullStackLecture
/Python/Drawing_Turtles/draw_shapes_no_param.py
701
4.125
4
import turtle def draw_square(): window = turtle.Screen() window.bgcolor("pink") # creates a drawing GUI with red background color brad = turtle.Turtle() # drawing module brad.shape("turtle") brad.color("blue") brad.speed(2) for x in range (0,4): # runs from 0 to 3 (4-1) brad.f...
false
c46fc22351db7e3fdafadde09aea6ae45b7c6789
rajatthosar/Algorithms
/Sorting/qs.py
1,682
4.125
4
def swap(lIdx, rIdx): """ :param lIdx: Left Index :param rIdx: Right Index :return: nothing """ temp = array[lIdx] array[lIdx] = array[rIdx] array[rIdx] = temp def partition(array, firstIdx, lastIdx): """ :param array: array being partitioned :param firstIdx: head of the...
true
68fc5fd6c86607595d5eb547218c7a55781f3389
manjulive89/JanuaryDailyCode2021
/DailyCode01092021.py
1,381
4.5625
5
# ------------------------------------------- # Daily Code 01/09/2021 # "Functions" Lesson from learnpython.org # Coded by: Banehowl # ------------------------------------------- # Functions are a convenient way to divide your code into useful blocks, allowing order in the code, make it # more readable, reu...
true
9d1b835fd8b5e6aeadb4ff23d54c2bc0b5435b2f
manjulive89/JanuaryDailyCode2021
/DailyCode01202021.py
1,831
4.3125
4
# ----------------------------------------------- # Daily Code 01/20/2021 # "Serialization" Lesson from learnpython.org # Coded by: Banehowl # ----------------------------------------------- # Python provides built-in JSON libraries to encode and decode JSON # Python 2.5, the simplejson module is used, wher...
true
5cac576e1c3b2e1ecd67bfd71ab20bc765b4eee3
jtm192087/Assignment_8
/ps1.py
960
4.46875
4
#!/usr/bin/python3 #program for adding parity bit and parity check def check(string): #function to check for a valid string p=set(string) s={'0','1'} if s==p or p=={'0'} or p=={'1'}: print("It is a valid string") else: print("please enter again a valid binary string") if __name__ == "_main...
true
a0c94fff02953dd66974b2476f299a4417e7605c
Gabrielgjs/python
/AnoAlistamento.py
600
4.1875
4
from datetime import date ano = int(input('Ano de nascimento: ')) atual = date.today().year alistamento = 18 idade: int = atual - ano print(f'Quem nasceu em {ano} tem {idade} anos em {atual}.') if idade == 18: print('voê tem que se alistar IMEDIATAMENTE!') elif idade > alistamento: saldo = idade - alistamento ...
false
be982a03905d0ca95fe7e1b8c6bcdf7300b3a0e0
vit050587/Python-homework-GB-2
/lesson4.4.py
847
4.25
4
# 2. Вычисляет урон по отношению к броне. # Примечание. Функция номер 2 используется внутри функции номер 1 для вычисления урона и вычитания его из здоровья персонажа. player_name = input('Введите имя игрока') player = { 'name': player_name, 'health': 100, 'damage': 50, 'armor' : 1.2 } enemy_name ...
false
578f3caf2d4247460b9331ae8f8b2a9cc56a4a74
EgorVyhodcev/Laboratornaya4
/PyCharm/individual.py
291
4.375
4
print("This program computes the volume and the area of the side surface of the Rectangular parallelepiped") a, b, c = input("Enter the length of 3 sides").split() a = int(a) b = int(b) c = int(c) print("The volume is ", a * b * c) print("The area of the side surface is ", 2 * c * (a + b))
true
2531327f966f606597577132fa9e54f7ed0be407
Rotondwatshipota1/workproject
/mypackage/recursion.py
930
4.1875
4
def sum_array(array): for i in array: return sum(array) def fibonacci(n): '''' this funtion returns the nth fibonacci number Args: int n the nth position of the sequence returns the number in the nth index of the fibonacci sequence '''' if n <= 1: return n else: ...
true
338f94f012e3c673777b265662403e5ef05a5366
alyssaevans/Intro-to-Programming
/Problem2-HW3.py
757
4.3125
4
#Author: Alyssa Evans #File: AlyssaEvans-p2HW3.py #Hwk #: 3 - Magic Dates month = int(input("Enter a month (MM): ")) if (month > 12) or (month < 0): print ("Months can only be from 01 to 12.") day = int(input("Enter a day (DD): ")) if (month % 2 == 0) and (day > 30) or (day < 0): print("Incorrect amount of d...
true
ef8b3da9c09b5ca1ceb6acc12bd70209fa6dac39
alexandrelff/mundo1
/ex035.py
420
4.15625
4
#Desenvolva um programa que leia o comprimento de trÊs retas e diga ao usuário se elas podem ou não formar um triângulo r1 = int(input('Digite o valor da reta 1: ')) r2 = int(input('Digite o valor da reta 2: ')) r3 = int(input('Digite o valor da reta 3: ')) if (r1 < r2 + r3) and (r2 < r1 + r3) and (r3 < r1 + r2): ...
false
3b0f3bd8d100765ae7cb593a791c9f2908b1ce76
rossvalera/inf1340_2015_asst2
/exercise1.py
2,159
4.1875
4
#!/usr/bin/env python """ Assignment 2, Exercise 1, INF1340, Fall, 2015. Pig Latin This module converts English words to Pig Latin words """ __author__ = 'Sinisa Savic', 'Marcos Armstrong', 'Susan Sim' __email__ = "ses@drsusansim.org" __copyright__ = "2015 Susan Sim" __license__ = "MIT License" def pig_latinify(w...
true
2591ae068b28c4d9e92470dd0348fabd32ee814a
CooperMetts/comp110-21f-workspace
/exercises/ex01/numeric_operators.py
852
4.25
4
"""Numeric operators practice.""" __author__ = "730336784" number_one: int = int(input("Pick a number ")) number_two: int = int(input("Pick another number ")) number_one_to_the_power_of_number_two: int = number_one ** number_two number_one_divided_by_number_two: float = number_one / number_two number_one_int_divide...
false
a00293978a88a612e4b7a3ea532d334f43a279d5
CooperMetts/comp110-21f-workspace
/sandbox/dictionaries.py
1,329
4.53125
5
"""Demonstrations of dictonary capabilities.""" # Declaring the type of a dictionary schools: dict[str, int] # Intialize to an empty dictonary schools = dict() # set a key value pairing in the dictionary schools["UNC"] = 19400 schools["Duke"] = 6717 schools["NCSU"] = 26150 # Print a dictonary literal representati...
true
590cab46ee48d2e7380fd4025683f4321d9a1a34
dipak-pawar131199/pythonlabAssignment
/Introduction/SetA/Simple calculator.py
642
4.1875
4
# Program to make simple calculator num1=int(input("Enter first number: ")) num2=int(input("Enter second number: ")) ch=input(" Enter for opration symbol addition (+),substraction (-),substraction (*),substraction (/), % (get remainder) and for exit enter '$' ") if ch=='+': print("Sum is : ",num1+num2) ...
true
86c83cf3af2c57cc3250540ec848a3d5924b6d4b
dipak-pawar131199/pythonlabAssignment
/Functions/Sumdigit.py
691
4.15625
4
(""" 1) Write a function that performs the sum of every element in the given number unless it comes to be a single digit. Example 12345 = 6 """) def Calsum(num): c=0;sum=0 while num>0: # loop for calcuating sum of digits of a number lastdigit=num%10 sum+=lastdigit ...
true