blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
870430a89fb57bdadf8863b9ee8a43ccd3bff287
NhatNam-Kyoto/Python-learning
/100 Ex practice/ex8.py
375
4.125
4
'''Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically. Suppose the following input is supplied to the program: without,hello,bag,world Then, the output should be: bag,hello,without,world ''' inp = input('Nhap c...
true
a93dd6d0d3929fb5e0004fc9f86ae9703c0a7a60
Lifefang/python-labs
/CFU07.py
1,880
4.25
4
# By submitting this assignment, I agree to the following: # “Aggies do not lie, cheat, or steal, or tolerate those who do” # “I have not given or received any unauthorized aid on this assignment” # # Name: Matthew Rodriguez # Section: 537 # Assignment: CFU-#9 # Date: 10/23/2019 # this...
true
0311d830fd6398fc5056583cfe1ac83e2b1ea5bf
Lifefang/python-labs
/Lab3_Act1_e.py
1,031
4.25
4
# By submitting this assignment, all team members agree to the following: # “Aggies do not lie, cheat, or steal, or tolerate those who do” # “I have not given or received any unauthorized aid on this assignment” # # Names: Isaac Chang # Matthew Rodriguez # James Phillips # ...
true
0e1b7ba647bf813dc211973b5a06720dc2c77eb2
Lifefang/python-labs
/Lab3_Act1_a.py
894
4.125
4
# By submitting this assignment, all team members agree to the following: # “Aggies do not lie, cheat, or steal, or tolerate those who do” # “I have not given or received any unauthorized aid on this assignment” # # Names: Isaac Chang # Matthew Rodriguez # James Phillips # ...
true
b408bb03477e3949e571946a04c75bb58a32e149
eloybarbosa/Fundamentos-de-programacao-com-Python
/TP1/Atividade 08.py
1,061
4.125
4
#8. Escreva um programa em Python que receba três valores reais X, Y e Z, guarde esses valores numa tupla e verifique se esses valores podem ser os comprimentos dos lados de um triângulo e, neste caso, retorne qual o tipo de triângulo formado. print('Nessa atividade vamos receber três valores reais (X, Y e Z) guardalo...
false
fa05d06ca10271b82850f978d5a737e47e1d6adb
eloybarbosa/Fundamentos-de-programacao-com-Python
/TP1/Atividade 18.py
1,371
4.15625
4
#18. ) Em jogos antigos era possível ver que os desenhos eram compostos por vários triângulos. Como uma maneira de treinar isso, a partir do N dado pelo usuário desenhe um polígono de lado N composto somente por triângulos como na figura: import math import turtle #referencia: https://github.com/AllenDowney/ThinkPyth...
false
3fa6134a2488116dbe43bca9e3cb24676b1bfbae
eloybarbosa/Fundamentos-de-programacao-com-Python
/TP1/Atividade 05.2.py
1,024
4.25
4
#5.2. Dada uma tupla, retorne 2 tuplas onde cada uma representa uma metade da tupla original. print('Nessa atividade vamos criar uma tupla inserindo quanto elemento desejarmos, a tupla e encerrada quando for digitada a palava "sair". ') print('Depois o programa vai nos retornar 2 tuplas onde cada uma representa uma me...
false
41c89e83236a971c90349a0cef1c89753a191993
lcgarcia05/370-Group5Project
/name/backend_classes/temporary_storage.py
1,293
4.15625
4
from name.backend_classes.playlist import Playlist class TemporaryStorage: """ A class which will handle the temporary storage of a created playlist and store the list of songs in a text file. """ def __init__(self, temp_playlist): """ Initializes the temp_playlist class and converts playl...
true
6a350be7b75cc55510365c0992478dea32fabef0
apatten001/strings_vars_ints_floats
/strings.py
786
4.3125
4
print('Exercise is a good thing that everyone can benefit from.') var1 = "This is turning a string into a variable" print(var1) # now i'm going to add two strings together print("I know im going to enjoy coding " + ","+ " especially once I've put the time in to learn.") # now lets print to add 2 blank lines in be...
true
d2ad7cfbd2bb9c727dc6e60d38da40a323b3105d
CaseyNord-inc/treehouse
/Write Better Python/docstrings.py
457
4.3125
4
# From Docstrings video in Writing Better Python course. def does_something(arg): """Takes one argument and does something based on type. If arg is a string, returns arg * 3; If arg is an int or float, returns arg + 10 """ if isinstance(arg, (int, float)): return arg + 10 elif ...
true
c9b4ec541b0b9ab0f390b6792fe553789c2c3302
Rrawla2/cs-guided-project-python-i
/src/demonstration_1.py
1,696
4.375
4
""" Define a function that transforms a given string into a new string where the original string was split into strings of a specified size. For example: If the input string was this: "supercalifragilisticexpialidocious" and the specified size was 3, then the return string would be: "sup erc ali fra gil ist ice xpi...
true
fd2958044308c991ea843b73987860bb7fc75a3b
Anushree-J-S/Launchpad-Assignments
/problem1.py
412
4.15625
4
#Create a program that asks the user to enter their name and age. #Print out a message addressed to them that tells them the year that they will turn 100 years old print("Code for problem 1") from datetime import datetime name=input("Enter your name:") age=int(input("Enter your age:")) year=int((100-age)...
true
3941b7f787b9a23e4f64732bfa8215baa7abd7ff
klkael/Ujian_Bank
/PYTHON/0.py
1,416
4.28125
4
print(1+1) nama = "asd" umur = 12 print(nama) print("halo, aku " + nama) print("umurku" + str(umur)) print("umurku", umur) print('saya ' + nama + 'usia ' + str(umur)) print('saya', nama, 'usia', umur) print('saya %s umur %d' %(nama, umur)) print('saya {} usia {}'.format(nama, umur)) print(f'saya {nama} usia {umur}') pr...
false
5eeb25bf53ae5078589644cf03a7830a03803979
EduardoPNK/Atividades_funcoes
/3.py
419
4.1875
4
#Faça um programa, com uma função que necessite de três argumentos, e que forneça a soma desses três argumentos. def soma(n1, n2, n3): resultado = n1 + n2 + n3 return resultado numero1 = int(input('Informe um numero para soma: ')) numero2 = int(input('Informe um numero para soma: ')) numero3 = int(inp...
false
2c07ea5764d7173d72c7b85a1d0622a6a7c8e145
vinodh1988/python-code-essentials
/conditional.py
436
4.15625
4
name=input('enter you name >> ') print(len(name)) if(len(name)>=5): print('Valid name it has more than 4 characters') print('We shall store it in the database') elif(len(name)==3 or len(name)==4): print('type confirm to store it into the database >>') if 'confirm'==input(): print('stored in ...
true
9fbbc0f624b4d73e88b72a51ed23d50c52d8331d
jaekeon02/Studying-Progress
/python/gui/Calculatortest.py
1,986
4.1875
4
# 계산기를 만들어 보겠습니다. # Entry 2개 -> 숫자 2개를 각각 입력받습니다. # 버튼 5개 #| +, -, *, /, %| # Entry 두개에 값을 채워 넣고 #| +, -, *, /, %|버튼을 누르면 두 엔트리에 들어있던 값을 토대로 # 결과값을 출력해줍니다 # Label 1개 => 결과값을 콘솔창이 아닌 Label에 출력해보세요 from tkinter import * calculator = Tk() calculator.configure(width="75m",height="100m") ##########함수배치부분########### def ADD(...
false
0b1ba18925bc89c7564a8cfb61c18749eeb5f168
sh-am-si/numerical_python
/asteriks.py
499
4.125
4
''' :author: Volodya :created: 16/12/2019 Introduction to Python Lecture 3, Functions and comprehensions Asteriks ''' lst = [1, 2, 3] print('calling without asteriks', lst) print('calling with asteriks', *lst) def my_sum(a, b, c): return a + b + c lst = [1, 2, 3] print(my_sum(*lst)) dic = ...
false
e3c217f79478ea89de35f9f7b761d19fbfdde837
x223/cs11-student-work-Karen-Gil
/Countdown2.py
438
4.28125
4
countdown = input('pick a number') number= countdown while number>0: #number has to be grater than zero in order for it to countdown duh!!! print number number= number-1 #In order for there to be a countdown it has to be number-1 print('BOOM!!!') # I origanaly wrote print boom as showen below but it pri...
true
d50968987468a7fd1ac886ace6ca45dd8cb0a167
sanket-khandare/Python-for-DS
/Stage 1.py
710
4.25
4
# Task 1 - Hello World print('Hello World!') # Task 2 - basic operations name = 'sanket' print('Hello '+ name) # Task 3 - using lists name_list = ['Sanket','Abhay','Pravin',['Friends', 3]] print(name_list[3][1]) # Task 4 - copy & update list new_name_list = name_list[:] new_name_list[3][0] = 'Total Friends' print(ne...
false
0da6b491db0b5599895b81f1fd57a72df49b1393
Farheen2302/ds_algo
/algorithms/sorting/quicksort.py
1,223
4.25
4
def quicksort(arr, start, end): if start < end: pivot = _quicksort(arr, start, end) left = quicksort(arr, 0, pivot - 1) right = quicksort(arr, pivot + 1, end) return arr def _quicksort(arr, start, end): pivot = start left = start + 1 right = end done = False while n...
true
26ba767c26370a46d7c5998cd0bff03a9e4ea7af
soli1101/python_workspace
/d20200720/test7.py
685
4.1875
4
print('------- 문제3 -------') # 태어난 년도를 입력하면 띠 출력 # 년도를 12로 나눈 나머지를 구한다 # 자축인묘진사오미신유술해 # 4,5,6,7,8,9,10,0,1,2,3 year = input("출생년도는?") year = int(year) mod = year%12 if mod == 4: print('쥐띠') if mod == 5: print('소띠') if mod == 6: print('호랑이띠') if mod == 7: print('토끼띠') if mod == 8: print('용띠') ...
false
e749028dba668306be4afba488e05fae22ef49e3
Tania-Aranega/Python
/Módulo 8/Ejercicio2_Generadores&Potencias.py
431
4.1875
4
# def potencia(base): # """Documentación""" # exponente=1 # while True: # yield base**exponente # exponente+=1 # i = 0 # it = potencia(2) # while i < 100: # print(it.__next__()) # i += 1 def potencia(base, exponente): i = 0 result = 1 while i < exponente: resu...
false
0bb37602e0531c8d9340ce0f9335d817c0730b97
donato/notes
/interviews/2017/practice/linked-list-palindrome.py
1,265
4.15625
4
def find_middle(head): """FInd meddle of linked list using 2 runner strategy and return if it's an odd length list return middle_node, is_odd(Bool) """ r1 = head r2 = head while r2.next: if not r2.next.next: return r1, False r1 = r1.next r2 = r2.next.next ...
true
8c0cf4f81e474e9ddbc409bcd235e6013dde6cf0
SadeghShabestani/8_time
/8_time.py
301
4.21875
4
hour = float(input("Enter Hour: ")) minute = float(input("Enter Minute: ")) second = float(input("Enter Second: ")) print(f"{hour} : {minute} : {second}") result_hour = hour * 3600 result_minute = minute * 60 result = result_hour + result_minute + second print(f"Seconds: {result}")
false
6df318d7ca006994d1cd820a2188de161880468d
valentynbez/practicepython-solutions
/06_string_lists.py
369
4.125
4
# https://www.practicepython.org/exercise/2014/03/12/06-string-lists.html def pal_check(): pal = input('Please add sentence: ') new_pal = [n.lower() for n in pal if n.isalpha()] rev_pal = ''.join(new_pal[::-1]) new_pal = ''.join(new_pal) if new_pal == rev_pal: print("It's palindrome!") e...
false
72d4699df84a1d7776185f448f3d6aa2f8d05107
Sitarko/learn-homework-2
/1_date_and_time.py
900
4.28125
4
""" Домашнее задание №2 Дата и время 1. Напечатайте в консоль даты: вчера, сегодня, 30 дней назад 2. Превратите строку "01/01/20 12:10:03.234567" в объект datetime """ from datetime import datetime, timedelta def print_days(date_now): try: dt1 = timedelta(days = 1) yesterday = date_now - dt1 ...
false
4701dc2609fcbc88935c0a52dca736fd40fa5099
Ricardo-Sillas/Project-1
/Main.py
964
4.21875
4
import hashlib def hash_with_sha256(str): hash_object = hashlib.sha256(str.encode('utf-8')) hex_dig = hash_object.hexdigest() return hex_dig # starts numbers off with length 3, increments the number by one, then increments length by one at the end of that length def getNum(s, n): if len(s) == n: check(...
true
795979147914ef731e1a331174035def44ec225b
simple2source/macugEx
/macugEx/datastruct/Link_list.py
1,677
4.15625
4
# -*- coding:utf-8 -*- """ python 实现数据结构-链表 """ class Node(object): """定义节点和指针,指针指向下一个节点的值 """ def __init__(self, data): self.data = data self.next = None class LinkList(object): def __init__(self): self.head = None self.tail = None def append(self, data): node = Node(data) if self.head is None: ...
false
c12295ae7f494a67fa97ae8e15a1a8629df2caaa
khushalk77/khushal-kumar
/khushal 2k18csun01066 PT3 .py
1,290
4.4375
4
#!/usr/bin/env python # coding: utf-8 # # 1. What is the syntax to call a constructor of a base class from child class # # ans: class parentclassname: # def _init_(self,var): # self.var=var # print(self.var) # class childclassname(parentclassname): # pass # ...
false
09f75de95ac1f64a6ffd3b73e803b32ed8a209a8
rakeshsukla53/interview-preparation
/Rakesh/python-basics/call_by_reference_in_python.py
1,081
4.28125
4
def foo(x): x = 'another value' # here x is another name bind which points to string variable 'another value' print x bar = 'some value' foo(bar) print bar # bar is named variable and is pointing to a string object # string objects are immutable, the value cannot be modified # you can not pass a simple p...
true
de4fc062a33d209172ed71d02074dda15ebbe5d4
rakeshsukla53/interview-preparation
/Rakesh/trees/Symmetric_Tree_optimized.py
888
4.28125
4
# for this method I am going to use the reverse binary tree method to check for symmetric tree # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def __init__(self): self....
true
dc53ce7c76f9b149441aeda751214149d8933c17
rakeshsukla53/interview-preparation
/Rakesh/python-iterators/remove_while_iteration.py
636
4.125
4
__author__ = 'rakesh' somelist = range(10) for x in somelist: somelist.remove(x) #so here you are modifying the main list which you should not be doing print somelist somelist = range(10) for x in somelist[:]: #Because the second one iterates over a copy of the list. So when you modify the original list, you do...
true
d9d3972659395307fb5353071b3615a0ad82c1bc
rakeshsukla53/interview-preparation
/Rakesh/Google-interview/breeding_like_rabbits_optimized_method.py
2,970
4.5
4
__author__ = 'rakesh' #here we have to know about memoization #Idea 1 - To sabe the result in some variables ---but it is not feasible. Fibonacci can be done since only two variables #are required. Also in the memoization part there is only recursion process not all. #Idea 2 - Use some kind of hash table here, but i...
true
1b1e945ef82db250c50dd635c5da0a86a8ec32fc
rakeshsukla53/interview-preparation
/Rakesh/Common-interview-problems/product of array except self.py
912
4.15625
4
class Solution(object): def productExceptSelf(self, nums): """ :type nums: List[int] :rtype: List[int] Logic : You will use two loops one going from left to right, and other from right to left for example if a = [1, 2, 3, 4] Going from left -> a = [1, 1, 2, ...
true
23ca1215a474d6a40ac0c93df2446b5475adce9a
rakeshsukla53/interview-preparation
/Rakesh/Common-interview-problems/Ordered_Dict.py
1,795
4.21875
4
__author__ = 'rakesh' #What is orderedDict #An OrderedDict is a dict that remembers the order that keys were first inserted. If a new entry overwrites an existing entry, the original insertion position is left unchanged. Deleting an entry and reinserting it will move it to the end. from collections import OrderedDict...
true
dcb5dc0d8b77109893f6c8f0446daf75e4cf57f8
rakeshsukla53/interview-preparation
/Rakesh/Natural Language Processing/word_tokenize.py
750
4.1875
4
__author__ = 'rakesh' #http://pythonprogramming.net/tokenizing-words-sentences-nltk-tutorial/ from nltk.tokenize import sent_tokenize, word_tokenize EXAMPLE_TEXT = "Hello Mr. Smith, how are you doing today? The weather is great, and Python is awesome. The sky is pinkish-blue. You shouldn't eat cardboard." print(sent...
true
dfdc48c3cc68c316dd4f21725016f669f365d0b2
WillDavid/Python-Exercises
/BuscaPython/algoritmoBusca02.py
267
4.1875
4
numeros = [] x = int(input("Informe a quantidade de numeros: ")) for i in range(x): numero = float(input("Informe um número real: ")) numeros.append(numero) lista = [] for i in numeros: if i not in lista: lista.append(i) print("Lista Ordenada: ", lista)
false
6d3aba17b75e3eff3b706bc6ec4bdf1b583dc0a8
katiemharding/ProgrammingForBiologyCourse2019
/problemsets/PythonProblemSets/positiveOrNegative.py
996
4.59375
5
#!/usr/bin/env python3 import sys # for testing assign a number to a value unknown_number = int(sys.argv[1]) # first test if it is positive if unknown_number>0: print(unknown_number, "is positive") if unknown_number > 50: # modulo (%) returns the remainder. allows testing if divisible by if unknown_number%3 == 0: ...
true
c97df9692c0d772e8cef6a60bdb23a59ba803ccd
sxd7/p_ython
/python.py
413
4.21875
4
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> import math >>> radius=float(input("enter the radius of the circle:")) enter the radius of the circle:5 >>> area=math.pi*radius*radius; >>> pr...
true
222f287965120511ecb52663994e286d2752d363
PradeepNingaiah/python-assginments
/hemanth kumar python assginment/14.exception.py
1,734
4.5625
5
#1. Write a program to generate Arithmetic Exception without exception handling try: a = 10/0 print (a) except ArithmeticError: print ("This statement is raising an arithmetic exception.") else: print ("Success.") #--------------------------------------------------------------------------...
true
5c805c9c2964f9a1ee57fc8549e2dae20c2aa693
christianns/Curso-Python
/05_Entradas_y_salidas/06_Ejercicio_3.py
909
4.3125
4
''' Ejercicio 3 Crea un script llamado descomposicion.py que realice las siguientes tareas: Debe tomar 1 argumento que será un número entero positivo. En caso de no recibir un argumento, debe mostrar información acerca de cómo utilizar el script. El objetivo del script es descomponer el número en unidades, decenas, ce...
false
1a544cb42c9ad4753c9759abcf5df19547c09897
christianns/Curso-Python
/03_Control_de_flujo/20_Ejercicio_15.py
2,301
4.28125
4
# Problema 15: Realiza un sistema para controlar el ingreso a un cine, donde ofrezca # películas de terror, acción y aventuras. En cada opción tenga restricción por edad. # Categorías $ Edad (%) # Terror 18 - 55 # Acción 10 a mas # Aventura 4 a mas # Análisis: Para la solución de es...
false
d114c4ca0205f54dd4f3c90e48cd1d7440fb1184
christianns/Curso-Python
/07_Errores_y_excepciones/08_Ejercicio_4.py
958
4.25
4
''' Ejercicio 4 Realiza una función llamada agregar_una_vez(lista, el) que reciba una lista y un elemento. La función debe añadir el elemento al final de la lista con la condición de no repetir ningún elemento. Además si este elemento ya se encuentra en la lista se debe invocar un error de tipo ValueError que debes cap...
false
dd44d58ab9c771cfbeb0a0c0099d12170ab62839
christianns/Curso-Python
/04_Coleccion_de_datos/05_Diccionarios.py
2,425
4.375
4
# Diccionarios. # Son junto a las listas las colecciones más utilizadas y se basan en una # estructura mapeada donde cada elemento de la colección se encuentra # identificado con una clave única, por lo que no puede haber dos claves iguales. # En otros lenguajes se conocen como arreglos asociativos. # Los diccionarios...
false
c9a753fc4a85c8874a49112449b6c924397339ab
christianns/Curso-Python
/06_Programacion_de_funciones/09_Ejercicio_1.py
541
4.21875
4
''' Ejercicio 1 Realiza una función llamada area_rectangulo(base, altura) que devuelva el área del rectangulo a partir de una base y una altura. Calcula el área de un rectángulo: su base y altura ingrese por teclado. Nota: El área de un rectángulo se obtiene al multiplicar la base por la altura. ''' base = int(input(...
false
5c8ce54a695bc87fa2e214eed81bea061134739e
christianns/Curso-Python
/04_Coleccion_de_datos/06_Pilas.py
1,090
4.53125
5
''' Pilas Son colecciones de elementos ordenados que únicamente permiten dos acciones: - Añadir un elemento a la pila. - Sacar un elemento de la pila. La peculiaridad es que el último elemento en entrar es el primero en salir. En inglés se conocen como estructuras LIFO (Last In First Out). Las podemos crear c...
false
dac0c4fbd04f7c8d193cc2dd8bb3a0cb42948202
christianns/Curso-Python
/06_Programacion_de_funciones/07_Funciones_recurcivas.py
1,154
4.65625
5
''' Funciones recursivas Se trata de funciones que se llaman a sí mismas durante su propia ejecución. Funcionan de forma similar a las iteraciones, pero debemos encargarnos de planificar el momento en que dejan de llamarse a sí mismas o tendremos una función rescursiva infinita. Suele utilizarse para dividir una tare...
false
9bcaa72b193d3b5ce12db67faffd751c3f1cc7c5
girisagar46/KodoMathOps
/kodomath/mathops/quiz_service.py
1,377
4.15625
4
from decimal import Decimal from asteval import Interpreter class SubmissionEvaluator: """A helper class to evaluate if submission if correct or not. """ def __init__(self, expression, submitted_result): self.expression = expression self.submitted_result = submitted_result # https:...
true
493cc5ee3132d01c05cca6495738e3e4f6ab1436
rbodduluru/PythonCodes
/Duplicatenumsinlist.py
448
4.25
4
# #!/usr/bin/python # Python program to find the duplicate numbers in the list of numbers def finddup(myList): for i in set(myList): if myList.count(i) > 1: print "Duplicate number(s) in the list : %i"%i if __name__ == '__main__': myList = [] maxNumbers = 10 while len(myList)...
true
285f282b32ba4233a000dcab3f7131bff31e638e
JancisWang/leetcode_python
/572.另一个树的子树.py
1,705
4.15625
4
''' 给定两个非空二叉树 s 和 t,检验 s 中是否包含和 t 具有相同结构和节点值的子树。s 的一个子树包括 s 的一个节点和这个节点的所有子孙。s 也可以看做它自身的一棵子树。 示例 1: 给定的树 s: 3 / \ 4 5 / \ 1 2 给定的树 t: 4 / \ 1 2 返回 true,因为 t 与 s 的一个子树拥有相同的结构和节点值。 示例 2: 给定的树 s: 3 / \ 4 5 / \ 1 2 / 0 给定的树 t: 4 / \ 1 2 返回 false。 在真实的面试中遇到...
false
20c489dd909c4846446ecf15b8169f6a5fe9da13
dwambia/100daysofhacking
/Tiplator.py
565
4.28125
4
#Simple python code to calculate amount a user is to tip total_bill = input("What is your total bill? ") #ignore the $ sign if user inputs total_bill= total_bill.replace("$","") #convert users bill to float total_bill=float(total_bill) print(total_bill) #list of possible tips calculation tip_1= 0.15*total_bill tip_2...
true
c48ae9d514b516831db37fb3efbe033cdd007c90
AlexDuo/DuoPython
/OOP/inherit.py
1,369
4.46875
4
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: Duo # 使用人类做继承的例子 class relation(object): def make_friends(self,obj): print("%s is making friends with %s"%(self.name,obj.name)) self.friendlist.append(obj) class humanbeings: def __init__(self,name,age): self.name = name ...
false
b7a4c138b9106c64d6db33f53e6cd0b5b35e5648
olotintemitope/Algo-Practice
/quick_sort.py
1,732
4.125
4
def quick_sort(lists): lists_length = len(lists) if lists_length > 2: current_position = 0 """ Partition the lists """ for index in range(1, lists_length): pivot = lists[0] if lists[index] <= pivot: current_position += 1 swap = lis...
true
326aa90db503a36ee76c999842089ea710c8dd97
Mcps4/ifpi-ads-algoritmos2020
/LISTA_2_FABIO_PARTE_2/F2_P2_Q5_PRODUTOS.PY
1,041
4.125
4
def main(): produto_1 = float(input('Digite o preço primeiro produto:')) produto_2 = float(input('Digite o preço segundo produto:')) produto_3 = float(input('Digite o preço terceiro produto:')) precos(produto_1, produto_2, produto_3) def precos(produto_1, produto_2, produto_3): if ...
false
36b47b83057b9df45ac0df30a99c54dc7ba604e6
Dex4n/exercicios-python
/exercicio_03.py
875
4.46875
4
#3 - Crie uma classe calculadora com as quatro operações básicas (soma, subtração, multiplicação e divisão). # usuário deve informar dois números e o programa deve fazer as quatro operações. class Calculadora: def soma (self, numero1, numero2): return numero1 + numero2 def subtracao(self, numero1, num...
false
93173a6bfe98ad20e0492289b53e0fe63ec4bd37
Alm3ida/resolucaoPythonCursoEmVideo
/desafio35.py
646
4.125
4
"""Analise os comprimentos e verifique se é possível formar um triângulo""" from math import fabs a = float(input('Digite o valor do primeiro lado: ')) b = float(input('Digite o valor do segundo lado: ')) c = float(input('Digite o valor do terceiro lado: ')) """ A condição de existência de um triângulo de lados a, b,...
false
fc022efeb99cf1ca3f7c4e9b9e8b3754061d8439
Alm3ida/resolucaoPythonCursoEmVideo
/desafio58.py
684
4.15625
4
""" Melhore o jogo do DESAFIO 028 onde o computador vai "pensar" em um número entre 0 e 10. Só que agora o jogador vai tentar adivinhar até acertar, mostrando no final quantos palpites foram necessários para vencer """ from random import randint contagem = 0 numC = randint(0, 10) numP = int(input(''' Estou pensando em ...
false
92146b3c6056ca9ba4fcdcd849a340716999b743
Alm3ida/resolucaoPythonCursoEmVideo
/desafio42.py
925
4.125
4
""" Refaça o desafio 35 dos triângulos, acrescentando o recurso de mostrar que tipo de triângulo será formado: - Equilátero: todos os lados iguais - Isósceles: dois lados iguais - Escaleno: todos os lados diferentes """ import math a = int(input('Digite o valor do primeiro lado: ')) b = int(input('Digite o valor do seg...
false
3f749cb2850ed64d6f566e23b75c1df30023bab7
Divyalok123/CN_Data_Structures_And_Algorithms
/more_problems/Test2_P2_Problems/Minimum_Length_Word.py
298
4.28125
4
#Given a string S (that can contain multiple words), you need to find the word which has minimum length. string = input() newArr = string.split(" ") result = newArr[0] for i in range(1, len(newArr)): if(len(newArr[i]) < len(result)): result = newArr[i] print(result)
true
f312341382425fcd01f4a489b0fc7e615ac3ba22
diek/backtobasics
/trade_apple_stocks.py
1,541
4.1875
4
'''Suppose we could access yesterday's stock prices as a list, where: The indices are the time in minutes past trade opening time, which was 9:30am local time. The values are the price in dollars of Apple stock at that time. So if the stock cost $500 at 10:30am, stock_prices_yesterday[60] = 500. Write an efficient f...
true
a0e534755de438b61477b6e823fca6069a07aeb4
beggerss/algorithms
/Sort/quick.py
1,410
4.1875
4
#!/usr/bin/python2 # Author: Ben Eggers (ben@beneggers.com) import time import numpy as np import matplotlib.pyplot as plt import itertools # Implementation of a quicksort in Python. def main(): base = 10000 x_points = [] y_points = [] for x in range(1, 20): arr = [np.random.randint(0, base*x) for k in range(b...
true
fc7388718bca1ed338e149cca0db47afca7f135c
Shasheen8/just_tests
/palindrome.py
541
4.1875
4
def Palindrome(mystr): try: mystr= "malayalam" rev_mystr= reversed(mystr) if (mystr == rev_mystr): return ("The string is a palindrome") else : return ("The string is not a palindrome") except ValueError: return "valid only for a string" ...
false
3c50a395000e9474c8be1cd4233e55137df20293
jscs9/assignments
/moves.py
1,681
4.1875
4
import random as rand def request_moves(how_many): ''' Generates a string representing moves for a monster in a video game. how_many: number of move segments to be generated. Each segment occurs in a specific direction with a distance of between 1 and 5 steps. Segment directions ...
true
d743d3a14ada3869d20047f59194f3d92cee2d62
okomeshino/python-practice
/basic/range.py
398
4.125
4
# encoding:utf-8 # 10を引数で渡す → 10回ループ for i in range(10): print(i) if i == 9: print("------------------------------") # 2と10を引数で渡す → 2から始まって9までループ for i in range(2, 10): print(i) if i == 9: print("------------------------------") # 負の数を渡すことも可能 for i in range(-2, 10): print(i)
false
a77fa382d0086b208654915fd2e6dde4d31ce021
krzysztof-laba/Python_Projects_Home
/Polymorphism/polymorphism_3.py
1,194
4.21875
4
class Document(): def __init__(self, name): self.name = name def show(self): raise NotImplementedError("Subclass must implement abstract method.") class Pdf(Document): def show(self): return "Show pdf documents!" class Word(Document): def show(self): return "Show word ...
false
1e9d15bcc381cea35ba1496e94a25c4ed981878f
krzysztof-laba/Python_Projects_Home
/CodeCademy/SchoppingCart.py
970
4.15625
4
class ShoppingCart(object): """Creates shopping cart objects for users of our fine website""" items_in_cart = {} def __init__(self, customer_name): self.customer_name = customer_name print("Customer name:", self.customer_name) def add_item(self, product, price): """Add product to the cart""" if not product...
true
05aa5bd36eba8a10f25800c4d61829f1e5710a67
RadioFreeZ/Python_October_2018
/python_fundamentals/function_basic2.py
1,655
4.34375
4
#Countdown - Create a function that accepts a number as an input. Return a new array that counts down by one, from the number # (as arrays 'zero'th element) down to 0 (as the last element). For example countDown(5) should return [5,4,3,2,1,0]. def countdown(num): return [x for x in range(num, -1,-1)] print(cou...
true
9257ae7106cf111e01eae338b262a65947204458
DishaCoder/Solved-coding-challenges-
/lngest_pall_str.py
221
4.125
4
inputString = input("Enter string : ") reverse = "".join(reversed(inputString)) size = len(inputString) if (inputString == reverse): print("Longest pallindromic string is ", inputString) else: for
true
eb31fc6b5c6b5957bf62c9a7c48864dee92aeba5
lyvd/learnpython
/doublelinkedlist.py
1,521
4.5
4
#!/usr/bin/python ''' Doubly Linked List is a variation of Linked list in which navigation is possible in both ways either forward and backward easily as compared to Single Linked List. ''' # A node class class Node(object): # Constructor def __init__(self, data, prev, nextnode): # object data self.data = dat...
true
df9f7a91df1bbb03d9f9661ece0c905936aba7b8
lyvd/learnpython
/node.py
552
4.1875
4
#!/usr/bin/python # Create a class which presents a node class BinaryTree: def __init__(self, rootObj): # root node self.key = rootObj # left node self.leftChild = None self.rightChild = None # Insert a left node to a tree def insertLeft(self, newNode): # if there is no left node if self.leftChild ...
true
f0d0c2f1b869c22f0d16a4b26ddd8ff489623903
aRToLoMiay/Special-Course
/Основные инструкции/errors.py
852
4.34375
4
# -*- coding: utf-8 -*- # Программа для вычисления положения мяча при вертикальном движении # с использованием функции # Упражнение 1. Ошибки с двоеточиями, отступами и т.п. def y(t): v0 = 5 # Начальная скорость g = 9.81 # Ускорение свободного падения return v0*t - 0.5*g*t**2 t = 0.6 # Время...
false
030139068d2f3eafd4e60f3e3bfabf374a174e30
akjalbani/Test_Python
/Misc/Tuple/xycoordinates.py
499
4.15625
4
""" what are the Mouse Coordinates? """ ## practical example to show tuples ## x,y cordinates stored as tuple, once created can not be changed. ## use python IDLE to test this code. ## 08/06/2020 import tkinter def mouse_click(event): # retrieve XY coords as a tuple coords = root.winfo_pointerxy() print(...
true
e6d26f45c62d5a0b943c6c43e712fe04dc9307d1
akjalbani/Test_Python
/Misc/Network/dictionary_examples.py
2,039
4.5
4
# let us have list like this devices = ['router1', 'juniper', '12.2'] print(devices) ############### Another way to print values ######################### for device in devices: print(device) #If we build on this example and convert the list device to a dictionary, it would look like this: devices = {'hostname': 'rou...
true
29900772d1df82995e52988be2eba8303b1457fd
akjalbani/Test_Python
/Misc/Turtle_examples/shape2.py
288
4.15625
4
# Turtle graphics- turtle will draw angle from 0-360 (15 deg) # tested in repl.it # Type- collection and modified import turtle turtle = turtle.Turtle() for angle in range(0, 360, 15): turtle.setheading(angle) turtle.forward(100) turtle.write(angle) turtle.backward(100)
true
255724b8bd84e1a0dbd793d35eec9d935fb480f5
susankorgen/cygnet-software
/Python100DaysClass2021/py/CoffeeMachineOOP/coffee_maker.py
2,064
4.15625
4
# Instructor code. # Except: Student refactored the self.resources structure and added get_resources. class CoffeeMaker: """Models the machine that makes the coffee""" def __init__(self): self.resources = { "water": { "amount": 500, "units": "ml", ...
true
84541b7ceb0b56ad10f0fede67d7c32823d09814
ianmanalo1026/Projects
/Biginners/Guess the number (Project1).py
2,015
4.15625
4
import random class Game: """Player will guess the random Number""" def __init__(self): self.name = None self.number = None self.random_number = None self.indicator = None def generateNumber(self): self.random_number = random.randint(1,5) return se...
true
488421439b7188696f4e4d7f33dcc682e1bb3ef9
120Davies/Intro-Python-I
/src/13_file_io.py
1,074
4.375
4
""" Python makes performing file I/O simple. Take a look at how to read and write to files here: https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files """ # Open up the "foo.txt" file (which already exists) for reading # Print all the contents of the file, then close the file # Note: pay close...
true
845883db9a28eb311b552650748ce4037f0ccb21
RocioPuente/KalAcademyPython
/HW3/Palindrome.py
353
4.1875
4
def reverse(number): rev=0 while number > 0: rev = (10*rev)+number%10 number//=10 return rev #print(reverse (number)) def isPalindrome(number): if number == reverse(number): return ("The number is a Palindrome") else: return ("The number is not a Palindrome") ...
true
427d378903744e1d5e6b11fffcd1833e4a4e1465
fannifulmer/exam-basics
/oddavg/odd_avg.py
520
4.15625
4
# Create a function called `odd_average` that takes a list of numbers as parameter # and returns the average value of the odd numbers in the list # Create basic unit tests for it with at least 3 different test cases def odd_average(numbers): new_list = [] try: for number in range(len(numbers)): ...
true
c9314fef90c6104045e9fc0ddb376f8b70304c5d
nipunramk/Introduction-to-Computer-Science-Course
/Video19Code/video19.py
1,490
4.1875
4
def create_board(n, m): """Creates a two dimensional n (rows) x m (columns) board filled with zeros 4 x 5 board 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 x 2 board 0 0 0 0 0 0 >>> create_board(4, 5) [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] >>> create_board(3, 2) [[0, 0],...
true
4d1423ccc90971c23c833e73bbdc3374da797e0d
hannahpaxton/calculator-2
/arithmetic.py
2,463
4.1875
4
"""Functions for common math operations.""" def add(num1, num2): """Return the sum of the two inputs.""" # define a variable "sum" # set this variable as the sum of num1, num2. sum = num1+num2 # return sum sum_nums = num1 + num2 return sum_nums def subtract(num1, num2): """Return the sec...
true
b072e29a8a8f7ef5256c727290fe2a5c9fb949f5
ArpitaDas2607/MyFirst
/exp25.py
2,222
4.3125
4
def break_words(stuff): '''This function will, break up words for us.''' words = stuff.split(' ') return words #Trial 1: #print words stuff = "Now this looks weird, it\'s blue and green and all in between" statements = break_words(stuff) print statements #---------------------------------------------------...
true
771482ef77c84b1daf7d50d8fce7d4d0aabf94ce
Anthima/Hack-CP-DSA
/Leetcode/BinarySearch/solution.py
877
4.125
4
# RECURSIVE BINARY SEARCH. class Solution: def binarySearch(self,arr,start,end,target): if(start <= end): # FINDING THE MIDDLE ELEMENT. mid = start+((end-start)//2) # CHECKING WHETHER THE MIDDLE ELEMENT IS EQUAL TO THE TARGET. if(arr[mid] == targ...
true
9687ded4776870f4a119959b99ef6bb5dda412ba
Anthima/Hack-CP-DSA
/Leetcode/Valid Mountain Array/solution.py
596
4.3125
4
def validMountainArray(arr): i = 0 # to check whether values of array are in increasing order while i < len(arr) and i+1 < len(arr) and arr[i] < arr[i+1]: i += 1 # i == 0 means there's no increasing sequence # i+1 >= len(arr) means the whole array is in increasing order if i == 0 or i ...
true
1eb14c2eb2e8174f6e5e759daaa32afba5bc9612
rowand7906/cti110
/M3HW1_AgeClassifier_DanteRowan.py
421
4.34375
4
#Age Classifier #June 14, 2017 #CTI 110 M3HW1 - Age Classifier #Dante' Rowan # Get the age of the person age = int(input('Enter the age of the person: ')) # Calculate the age of the person. # Determine what age the person is if 1: print('Person is an infant.') elif 1 > 13: print('Person is a ch...
true
2da8a1ca5b0ee01c712e682cdeef21c8b5f836bf
diesears/E01a-Control-Structues
/main10.py
2,414
4.3125
4
#!/usr/bin/env python3 import sys, utils, random # import the modules we will need utils.check_version((3,7)) # make sure we are running at least Python 3.7 utils.clear() # clear the screen print('Greetings!') #making the greetings text appear colors = ['red','orange','yello...
true
3d34e2eada50e5d5f166e5c6bfdd30cc576c5c1e
abhishekpn/Know-your-future-age-
/age in 2090.py
1,087
4.15625
4
print('AGE CALCULATOR MACHINE') print("1.You can calculate what is your age will be in any paricular year \n" "2.You can calculate when you will be 100 years old ") curr_year = 2020 value = str(input("Enter your Age OR Year of birth: ")) if len(value)<=2: print(f"This is your present age {value}") ...
false
a4933426e475c8d8d34bc7ea7ca00f9706836202
stanwar-bhupendra/LetsLearnGit
/snum.py
411
4.1875
4
#python program to find smallest number among three numbers #taking input from user num1 = int(input("Enter 1st number: ")) num2 = int(input("Enter 2nd number: ")) num3 = int(input("Enter 3rd number: ")) if(num1 <= num2) and (num1 <= num3): snum = num1 elif(num2 <=num1) and (num2 <=num3): snum = num2 else: ...
true
773b41d9f6a9ad8133fda4c9954c35ca45dece2d
patrickbeeson/python-classes
/python_3/homework/Data_as_structured_objects/src/coconuts.py
1,034
4.15625
4
""" API for coconut tracking """ class Coconut(object): """ A coconut object """ def __init__(self, coconut_type, coconut_weight): """ Coconuts have type and weight attributes """ self.coconut_type = coconut_type self.coconut_weight = coconut...
true
30cfd0f856263b7889e535e9bea19fd645616ef9
patrickbeeson/python-classes
/python_1/homework/secret_code.py
870
4.59375
5
#!/usr/local/bin/python3 """ This program takes user input, and encodes it using the following cipher: Each character of the string becomes the character whose ordinal value is 1 higher. Then, the output of the program will be the reverse of the contructed string. """ # Get the user input as a string user_input = str(...
true
81de86c9e5ae59d686bb8155ea4a75fd8c26e84e
dinodre1342/CP1404_Practicals
/Prac5/week5_demo3.py
802
4.28125
4
def subject(subject_code, subject_name): """ This is a function for printing subject code and name. :param subject_code: This is the JCU unique code for each subject :param subject_name: This is the associated name matching the code :return: A string message displaying both code and name """ ...
true
267424da731e2162e11a87f8e1ba38c671e04dbd
ronaldobrisa/projetos-python
/TUPLAS.py
1,584
4.28125
4
#lanche = tupla() lista[] dicionário{} #TUPLAS EM PYTHON SÃO IMUTÁVEIS #lanche = ('hamburguer', 'pizza', 'suco', 'pudim') #Fatiamento de tuplas #print(f'Eu gosto de, ', lanche[:2]) #print(f'Eu gosto de, ', lanche[-2]) #print(f'Eu gosto de, ', lanche[-2:]) #for comida in lanche: #print(f'Eu gosto de {comida}') #p...
false
91b5a6c3d5e2e6e9efea43f259386b8633ced137
tomasztuleja/exercises
/practisepythonorg/ex2_1.py
324
4.1875
4
#!/usr/bin/env python # http://www.practicepython.org/exercise/2014/02/05/02-odd-or-even.html inp = int(input("Type an Integer: ")) test = inp % 2 testfour = inp % 4 if test == 0: print("It's an even number!") if testfour == 0: print("It's also a multiple of 4!") else: print("It's an odd number...
true
f303128e8b5a7d3071d49a026d95fbb8b3c3595b
ryokugyu/Algorithms
/bubble_sort/bubbleSort-Python/bubbleSort.py
419
4.21875
4
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Oct 7 15:33:03 2018 @author: ryokugyu """ def bubbleSort(alist): for passnum in range(len(alist)-1,0,-1): for i in range(passnum): if alist[i]>alist[i+1]: temp = alist[i] alist[i] = alist[i+1] ...
false
3ce1a459cb6ffcbc9630c5944134b68c71c2d4ba
Manjunath823/Assessment_challenge
/Challenge_3/nested_dictionary.py
844
4.34375
4
def nested_key(object_dict, field): """ Input can be nested dict and a key, the function will return value for that key """ keys_found = [] for key, value in object_dict.items(): if key == field: keys_found.append(value) elif isinstance(value, dict): #t...
true
41c79387bae3ed9d3a045bfc672eda6b899d7bde
PeterM358/python_OOP
/SOLID LAB/02_OCP/animal.py
1,532
4.25
4
# class Animal: # def __init__(self, species): # self.species = species # # def get_species(self): # return self.species # # # def animal_sound(animals: list): # for animal in animals: # if animal.species == 'cat': # print('meow') # elif animal.species...
false
1480e4f71cc8b0bc2b27f113937ba4b1cafe8cfb
saif93/simulatedAnnealingPython
/LocalSearch.py
2,948
4.125
4
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" implementation of Simulated Annealing in Python Date: Oct 22, 2016 7:31:55 PM Programmed By: Muhammad Saif ul islam """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" import math import random from copy import deepcopy ...
true
43b0f70793519b645bb599955d56b52a2c801c5b
BrenoSDev/PythonStart
/Introdução a Programação com Python/EX07,6.py
724
4.125
4
#Programa que lê três strings e imprime o resultado da substituição da primeira, dos caracteres da segunda pelos da terceira print('Digite três strings e nós substituiremos os caracteres da segunda pelos da terceira na primeira!') string1 = list(input('String 1: ')) string2 = ' ' string3 = '' while len(string2) != le...
false
25a8ce3074fb682a23763f3e350e20484753a9bd
BrenoSDev/PythonStart
/Treinos Py/T6.py
1,009
4.15625
4
#Validação de informações nome = input('Nome: ') while len(nome) <= 3: print('\033[31mERRO! O nome deve possuir mais de 3 caracteres!\033[m') nome = input('Nome: ') idade = input('Idade: ') while int(idade) < 0 or int(idade) > 150: print('\033[31mERRO! Digite uma idade entre 0 e 150 anos:\033[m') idade = inpu...
false
31d9dc0b6c3e23b9c7dbee6a63139df021b69b27
SarwarSaif/Python-Problems
/Hackerank-Problems/Calendar Module.py
842
4.28125
4
# -*- coding: utf-8 -*- """ Created on Tue Oct 2 14:20:23 2018 @author: majaa """ import calendar if __name__ == '__main__': user_input = input().split() m = int(user_input[0]) d = int(user_input[1]) y = int(user_input[2]) print(list(calendar.day_name)[calendar.weekday(y, m, d)].upper()) ...
true