blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
2e54f9ee0938beb93b9caa2c5417bf60a8870e2d
pasinducmb/Python-Learning-Material
/Genarator Expressions.py
811
4.1875
4
# Generator Expressions from sys import getsizeof # Comprehension for Lists and Tuples value = [(x + 1)**2 for x in range(10)] print("List: ", value) value = ((x + 1)**2 for x in range(10)) print("Tuple: ", value) # (reason for error is due to tuples are not coprehendible objects as Lists, sets and dictionaries, th...
true
f15f1cc97586bb5fc23b23499328542f93204ea5
wobedi/algorithms-and-data-structures
/src/implementations/sorting/quicksort.py
1,074
4.15625
4
from random import shuffle from src.implementations.sorting.basic_sorts import insertion_sort from src.implementations.helpers.partition import three_way_partition def quicksort(arr: list) -> list: """Sorts arr in-place by implementing https://en.wikipedia.org/wiki/Quicksort """ shuffle(arr) # shuff...
true
ac318511b95f4566985bbe95436348c9077d06cb
DanieleOrnelas/4Linux_Python
/aula4/objetos.py
2,858
4.5625
5
#!/usr/bin/python3 # Uma classe associa dados (atributos) e operações (métodos) numa só estrutura. # Um objeto é uma instância de uma classe - uma representação da classe. class Carro(): def __init__(self, marca, modelo, ano): self.marca = marca self.modelo = modelo self.ano = ano self.hodometro = 0 def de...
false
4ba0168721fbd3bc17cac579b53e962d8a0a6ca3
DanieleOrnelas/4Linux_Python
/aula4/exercicios/objeto1.py
2,174
4.21875
4
#!/usr/bin/python3 # PROGRAMA PARA: # Classe User # ATRIBUTOS: Nome / Sobrenome / Username / Senha / Numero de Tentativas # METODOS: Descrever / Saudacao / Login (usando input) / Incrementar tentativas / Reseta Tentativas # PROGRAMA DO TIO class Usuario(): def __init__(self,nome,sobrenome,username,password): se...
false
55e3ac37f644ea67052a1c21aea38dac9b2e7b52
EcoFiendly/CMEECourseWork
/Week2/Code/test_control_flow.py
1,387
4.15625
4
#!/usr/bin/env python3 """ Some functions exemplifying the use of control statements """ __appname__ = '[test_control_flow.py]' __author__ = 'Yewshen Lim (y.lim20@imperial.ac.uk)' __version__ = '0.0.1' __license__ = "License for this code/program" ## Imports ## import sys # module to interface our program with the o...
true
9fd4ea33278bd1c477c4d7451e5367e426633409
hebertmello/pythonWhizlabs
/estudo_tuples.py
810
4.40625
4
# Tuples in Python # ------------------------------------- # - It is a similar to a list in python # - It is ordered an unchangeable # - It allows duplicate elements tuple = () print(tuple) tuple = (1, 2, 3) print(tuple) tuple = (1, "hello", 4, 5) print(tuple) tuple = ("mouse", [8, 4,5], (1, 2, 3)) ...
false
5c96975d02b72a1519f58eb440f497c617f64b9f
hebertmello/pythonWhizlabs
/project1.py
581
4.15625
4
import random print ("Number guessing game") number = random.randint(1, 20) chances = 0 print("Guess a number between 1 and 20") while(chances < 5): guess = int(input()) if (guess == number): print("Congratulations you won!!!") break elif guess < number: print(...
true
9cf18fd8d46e4aa2cf12c1c51ce563ee7f85c43f
AxolotlDev/PruebasPython
/Ej3.py
447
4.15625
4
#Ejercicio 3 #Dados los catetos de un triángulo rectángulo, calcular su hipotenusa. import math CatetoMayor = int(input("Introduzca el valor del cateto mayor: ")) CatetoMenor = int(input("Introduzca el valor del cateto menor: ")) Hipotenusa = (math.sqrt(math.pow(CatetoMenor,2)+math.pow(CatetoMayor,2))) print(f"Si...
false
cc8e5c295453c6ce967e6b302bec73b7858bae04
OmarBahmad/Projetos-Python
/Exercícios Python/DESCOBRINDO TRIANGULO.py
1,182
4.15625
4
print('\033[33m-='*30) print('DESAFIO DOS TRIANGULOS V2.0') print('-='*30) print('\033[37mINTRUÇÕES: Adicione 3 lados de um triangulo e descubra se ele existe e qual formato ele tem.') print('\033[m') a = int(input('LADO A: ')) b = int(input('LADO B: ')) c = int(input('LADO C: ')) print('') if abs(b-c) < a < b+c and a...
false
8383a43b540f04be1f3e20a85017c9f42fe4e13c
ugant2/python-snippate
/pract/string.py
1,664
4.3125
4
# Write a Python function to get a string made of the first 2 # and the last 2 chars from a given a string. If the string # length is less than 2, return instead of the empty string. def string_end(s): if len(s)<2: return ' ' return len(s[0:2]) + len(s[-2:]) print(string_end('laugh out')) # Write ...
true
75a068175dd23bd786319ab2df60e61aee8dbfa1
ugant2/python-snippate
/oop/inheritance Animal.py
651
4.34375
4
# Inheritance provides a way to share functionality between classes. # Imagine several classes, Cat, Dog, Rabbit and so on. Although they may # differ in some ways (only Dog might have the method bark), # they are likely to be similar in others (all having the attributes color and name). class Animal: def __init...
true
7afc1fba01851dd2e64ff935580eba6b76f4efb2
viniromao159/converterBinDec
/main.py
1,629
4.25
4
import os def converter(operation, valor): #<----- Função de conversão if operation == 1: result = int(valor, base=2) return result else: valor = int(valor) return bin(valor)[2:] os.system('cls') or None # limpeza do terminal cont = 0 while cont < 1: # Menu do sistema ...
false
a8af418b9cff8cb6ee6da6dea287fbd6b8e9034c
mikhael-oo/honey-production-codecademy-project
/honey_production.py
1,525
4.1875
4
# analyze the honey production rate of the country # import all necessary libraries import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn import linear_model # import file into a dataframe df = pd.read_csv("https://s3.amazonaws.com/codecademy-content/programs/data-science-path/l...
true
7cabb3d44067c67d5ed50700fa3120ad2277053c
vgates/python_programs
/p010_fibonacci_series.py
940
4.46875
4
# Python program to print first n Fibonacci Numbers. # The Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ... # The sequence is characterized by the fact that every number after the # first two is the sum of the two preceding ones. # get the user input and store it in the variable n # int function...
true
4b2b1f3eb6ebadc10e0737b8affbfc0351d0e87d
vgates/python_programs
/p015_factorial.py
1,015
4.34375
4
# Python program to find factorial of a number # Factorial of a number n is the multiplication of all # integers smaller than or equal to n. # Example: Factorial of 5 is 5x4x3x2x1 which is 120. # Here we define a function for calculating the factorial. # Note: Functions are the re-usable pieces of code which ...
true
fd73120ca7a5ac32608d0aec17003c45fb9198a0
JazzyServices/jazzy
/built_ins/slices.py
1,850
4.25
4
# encoding=ascii """Demonstrate the use of a slice object in __getitem__. If the `start` or `stop` members of a slice are strings, then look for those strings within the phrase and make a substring using the offsets. If `stop` is a string, include it in the returned substring. This code is for demonstration purposes ...
true
12a5c1259f669055442de8ddfb7dfd6245e2bcbf
chagaleti332/HackerRank
/Practice/Python/Collections/namedtuple.py
2,990
4.59375
5
""" Question: Basically, namedtuples are easy to create, lightweight object types. They turn tuples into convenient containers for simple tasks. With namedtuples, you don’t have to use integer indices for accessing members of a tuple. Example: Code 01 >>> from collections import namedtuple >>> Point = na...
true
24a0e80c3f81577f00b5b2096e4b32992914db5e
chagaleti332/HackerRank
/Practice/Python/Math/integers_come_in_all_sizes.py
960
4.4375
4
""" Question: Integers in Python can be as big as the bytes in your machine's memory. There is no limit in size as there is: 2^31 - 1(c++ int) or 2^63 - 1(C++ long long int). As we know, the result of a^b grows really fast with increasing b. Let's do some calculations on very large integers. Task: Read four num...
true
56049a2b6eaef72e1d4381a7f76a1d4cb9800912
chagaleti332/HackerRank
/Practice/Python/Introduction/python_print.py
441
4.4375
4
""" Question: Read an integer N. Without using any string methods, try to print the following: 123....N Note that "" represents the values in between. Input Format: The first line contains an integer N. Output Format: Output the answer as explained in the task. Sample Input: 3 Sample Output: 123 ...
true
08605343a771a0837e3383972c370a03516db4aa
chagaleti332/HackerRank
/Practice/Python/Sets/set_add.py
1,440
4.5625
5
""" Question: If we want to add a single element to an existing set, we can use the .add() operation. It adds the element to the set and returns 'None'. Example >>> s = set('HackerRank') >>> s.add('H') >>> print s set(['a', 'c', 'e', 'H', 'k', 'n', 'r', 'R']) >>> print s.add('HackerRank') Non...
true
59e25fa8a6649f0d23deaa9fe33e4df78f674c03
chagaleti332/HackerRank
/Practice/Python/Introduction/python_loops.py
458
4.1875
4
""" Question: Task Read an integer N. For all non-negative integers i < N, print i^2. See the sample for details. Input Format: The first and only line contains the integer, N. Constraints: * 1 <= N <= 20 Output Format: Print N lines, one corresponding to each . Sample Input: 5 Sample Output: ...
true
2d0beaf86a1f65715dbdacdcf07aec623856b6cb
chagaleti332/HackerRank
/Practice/Python/Sets/the_captains_room.py
1,570
4.15625
4
""" Question: Mr. Anant Asankhya is the manager at the INFINITE hotel. The hotel has an infinite amount of rooms. One fine day, a finite number of tourists come to stay at the hotel. The tourists consist of: → A Captain. → An unknown group of families consisting of K members per group where K ≠ 1. The Captain was gi...
true
4735407294bd47ed69477087a1f628d3426d0cfb
chagaleti332/HackerRank
/Practice/Python/RegexAndParsing/group_groups_groupdict.py
2,019
4.4375
4
""" Question: * group() A group() expression returns one or more subgroups of the match. Code >>> import re >>> m = re.match(r'(\w+)@(\w+)\.(\w+)','username@hackerrank.com') >>> m.group(0) # The entire match 'username@hackerrank.com' >>> m.group(1) # The first parenthesized sub...
true
6ab8e6e334434326b8d52145366e35ac535e8dd9
chagaleti332/HackerRank
/Practice/Python/BasicDataTypes/lists.py
1,968
4.34375
4
""" Question: Consider a list (list = []). You can perform the following commands: * insert i e: Insert integer e at position i. * print: Print the list. * remove e: Delete the first occurrence of integer e. * append e: Insert integer e at the end of the list. * sort: Sort the list. * pop: Pop ...
true
162cd5c5c636f39d116bb3b928b70ce60f1bf25c
khidmike/learning
/Python/caesar.py
849
4.21875
4
# Simple program using a Caesar Cipher to encode / decode text strings import sys def main(): print("Welcome to the Caesar Cipher Encoder / Decoder") print() coding = str(input("What would you like to do? Type 'e' to encode / 'd' to decode: ")) if (coding != "e") and (coding != "d"): print("...
true
69fb03d6f9a26a2b1633c09ec2b9f72133c40627
kmenon89/python-practice
/dictionary.py
1,030
4.125
4
#all about dictiionaries #create dicti={1:'a',2:'b',3:'c'} print(dicti) print(dicti[1]) #append dicti[4]='d' print(dicti) #deletion del dicti[4] print(dicti) #get a value print(dicti.get(2)) #clear whole dicti dicti.clear() print(dicti) #sort dicti dicti={2:'a',3:'b',1:'c'} print(dicti) order=d...
false
bf45447e0c258970584c89c445b40d7d84193812
kmenon89/python-practice
/whileloopchallenge.py
613
4.53125
5
#get the line length ,angle,pen color from user and keep drawing until they give length as 0 #import turtle to draw import turtle # declare variables len=1 angle=0 pcolour="black" #use while loop while len != 0 : #get input from user about length angle and pen colour len=int(input("welcome to sketch...
true
679a164e1ffe6086681b2ec1c990633cadb673ba
kmenon89/python-practice
/fibonacci.py
929
4.1875
4
#fibinacci series a=0 b=1 #n=int(input("please give the number of fibonacci sequence to be generated:")) n=int(input("please give the maximum number for fibonacci sequence to be generated:")) series=[] series.append(a) series.append(b) length=len(series)-1 print(length,series[length]) while len(series)<...
true
e8c815f504f17c7909b98324c18d1a9ef3d06c47
gustavopierre/Introduction_to_Programming_using_Python
/list_demo.py
986
4.125
4
empty_list = list() print("empty_list ->", empty_list) list_str = list("hello") print("list_str ->", list_str) list_tup = list((1, 2, (3, 5, 7))) print("list_tup ->", list_tup) empty_list = [] print("empty_list ->", empty_list) list_syn = [3, 4, "a", "b"] print("list_syn ->", list_syn) print("'a' in list_syn ->", 'a' i...
false
d2015bc58d2c72e4d91ea716ba2cc6cf05f064ec
bartkim0426/deliberate-practice
/exercises4programmers/ch03_operations/python/07_rectangle.py
1,462
4.375
4
''' pseudocode get_length_and_width length: int = int(input("What is the length of the room in feet? ")) width: int = int(input("What is the width of the room in feet? ")) end calculate_feet_to_meter squre_meter: float = round(square_feet * 0.09290304, 3) end calculate_squre_feet squre_feet = length ...
true
db4e3b325d7041142680a0ceff285d6f7a8fdb39
brunacarenzi/thunder-code
/maior e menor num..py
751
4.21875
4
# mostrar qual valor é o maior e qual e o menor print('Olá, por favor teste este esse programa.') n1 = int(input('Informe o 1º número: ')) n2 = int(input('Informe o 2º número:')) n3 = int(input('Informe o 3º número:')) # Verificando o menor número menor = n1 if n2 < n1 and n2 < n3: menor = n2 if n3 < n1 ...
false
91ce1227c7ee2803c148909cf6bf59246429fad2
brunacarenzi/thunder-code
/meses.py
1,046
4.21875
4
'''Escreva o método chamado getMesPorExtenso() que recebe um inteiro, referente ao mês do ano, um código referente ao idioma (1 para português e 2 para inglês) e retorne o mês por extenso. A tabela a seguir ilustra alguns exemplos.''' #meses em Português mesesp = ('zero', 'Janeiro', 'Fevereiro', 'Março', 'Abril...
false
f3ac0037df5a2ecca66736e8a54739d6b178e093
Shweta-yadav12/if-else
/calcualator.py
394
4.34375
4
num1=int(input("enter the number")) num2=int(input("enter the number")) num3=input("enter the number") if num3=="+": print(num1+num2) elif num3=="-": print(num1-num2) elif num3=="*": print(num1*num2) elif num3=="/": print(num1/num2) elif num3=="%": print(num1%num2) elif num3=="**": print(num...
false
fe290593c81f87f7e51b979d896b3b64a38d0c6d
DilaraPOLAT/Algorithm2-python
/5.Hafta(list,tuple)/venv/ornek2.py
1,187
4.375
4
""" ornek2: rasgele uretilen bir listenin elemanlarinin frekans degerlerini bulan ve en yuksek frekans degerine sahip sayiyi gosteren python kodunu yazınız. """ import random randlist=[random.randint(1,100) for i in range(100)] print(randlist) freq=[0]*100 max_freq=0 max_num=0 # for num in range(1,100): # for item...
false
beadb79ce6c4df356833bf50da1c989b1f18bbb0
hanyunxuan/leetcode
/766. Toeplitz Matrix.py
884
4.5
4
""" A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given an M x N matrix, return True if and only if the matrix is Toeplitz. Example 1: Input: matrix = [ [1,2,3,4], [5,1,2,3], [9,5,1,2] ] Output: True Explanation: In the above grid, the diagonals are: "[9]", "[5...
true
e77bbe516fc274f1e9cd3c8614f614ccfd4ab490
Raushan117/Python
/014_Append_Mode.py
827
4.5
4
# Reference: https://automatetheboringstuff.com/chapter8/ # Writing in plaintext mode and appending in plaintext mode # Passing a 'w' or 'a' in the second arugment of open() # If the file does not exist, both argument will create a new file # But remember to close them before reading the file again. # About: # Creati...
true
6beca592164142ea3b6381ec9185b4791ca208ad
sagsh018/Python_project
/18_Tuple_unpacking_with_python_function.py
2,410
4.625
5
# in this lecture we are going to learn more about function, and returning multiple items from function using tuple # unpacking # Suppose we want to write a function, which takes in a list of tuples having name of employee and number of hrs worked # We have to decide who is the employee of the month based number of hou...
true
4b31604397b17724d8a249c691a7828d0c07719c
sagsh018/Python_project
/9_Logical_Operators.py
1,242
4.78125
5
# In This lecture we are going to learn how to chain the comparison operators we have learnt in the previous lecture # We can chain the comparison operator with the help of below listed logical operators # and # or # not # Suppose we want to do two comparisons print(1 < 2) # True print(2 < 3) # True # another way of d...
true
acb345bad9c7a7be1c51586ca0587931d864b99b
sagsh018/Python_project
/14_List_comprehensions_in_python.py
2,803
4.84375
5
# List comprehensions are unique way of quickly creating list in python # if you find yourself creating the list with for loop and append(). list comprehensions are better choice my_list = [] print(my_list) # [], so we have an empty list for item in range(1, 10): my_list.append(item) print(my_list) # [1, 2, 3, 4, 5...
true
2e97e48539eaae2d4a43533487c5d263baa1e587
sagsh018/Python_project
/12_While_loop_in_python.py
1,948
4.4375
4
# While loop will continue to execute a block of code while some condition remains true # Syntax # =============================== # while some_boolean_condition: # do something # =============================== # We can also combine while statement with the else statement # =============================== # ...
true
b67420e180277e8abd7908d95a410427a30373ea
homanate/python-projects
/fibonacci.py
711
4.21875
4
'''Function to return the first 1000 values of the fibonacci sequence using memoization''' fibonacci_cache = {} def fibonacci(n): # check input is a positive int if type(n) != int: raise TypeError("n must be a positive int") if n < 1: raise ValueError("n must be a positive int") # che...
true
a1c4e25c5608a1097f71d22db51a3b51aabcafaa
RadchenkoVlada/tasks_book
/python_for_everybody/task9_2.py
1,098
4.3125
4
""" Exercise 2: Write a program that categorizes each mail message by which day of the week the commit was done. To do this look for lines that start with “From”, then look for the third word and keep a running count of each of the days of the week. At the end of the program print out the contents of your dictionary (o...
true
804ec370c29b1d0cafdae1cf1a2615abf4b3f766
RadchenkoVlada/tasks_book
/python_for_everybody/task10_2.py
1,521
4.3125
4
""" Exercise 2: This program counts the distribution of the hour of the day for each of the messages. You can pull the hour from the “From” line by finding the time string and then splitting that string into parts using the colon character. Once you have accumulated the counts for each hour, print out the counts, one ...
true
86de60fccaa7393daa94e67f1e0e8c25e59f8e30
RadchenkoVlada/tasks_book
/python_for_everybody/task7_2.py
2,907
4.46875
4
""" Exercise 2: Write a program to prompt for a file name, and then read through the file and look for lines of the form: X-DSPAM-Confidence:0.8475 When you encounter a line that starts with “X-DSPAM-Confidence:” pull apart the line to extract the floating-point number on the line. Count these lines and then compute ...
true
e164e4a1b53cdc17bb06540817987c815e4610c0
Jasonzyy9/PythonTraining
/weight converter.py
336
4.15625
4
print("What's your weight? ") weight = int(input("Weight: ")) select = input("(L)bs or (K)g: ") if select.upper() == "L": weight = weight * 0.45 print(f"You are {weight} kilograms") elif select.upper() == "K": weight = weight * 2.2 print(f"You are {weight} pounds") else: print("Please type...
false
10ec91dd7721225830f0ce8d658188b389cc0b03
Arverkos/GeekBrains-Homeprojects
/Lesson06/Lesson06.Task04.py
2,262
4.15625
4
class Car: def __init__(self, speed, colour, name, is_police): self.speed = speed self.colour = colour self.name = name self.is_police = is_police def go(self): print(f'Машина {self.name} {self.colour} поехала') def stop(self): print(f'Машина {sel...
false
342ec86d210a77162b489c42d788703070c8a694
nd955/CodingPractice
/HighestProductOfThree.py
858
4.15625
4
import math def get_highest_product_of_three(input_integers): highest_product_of_3 = 0 highest_product_of_2 = 0 highest_number = 0 lowest_product_of_2 = 0 lowest_number = 0 for i in range(len(input_integers)): highest_product_of_3 = max(highest_product_of_3, highest_product_o...
true
486501ac24a31929fb1f621562a4f610de01c13c
green-fox-academy/fehersanyi
/python/dataStructures/l3.py
533
4.125
4
# Create a function called 'create_new_verbs()' which takes a list of verbs and a string as parameters # The string shouldf be a preverb # The function appends every verb to the preverb and returns the list of the new verbs verbs = ["megy", "ver", "kapcsol", "rak", "nez"] preverb = "be" def create_new_verbs(preverb, ...
true
87fbe9b832ecf321d9514a2f769d52a02ca17765
jessymiyoshi/401-exercicios
/python.py
1,033
4.15625
4
# #PROGRAMA QUE CALCULA A MÉDIA n1 = int(input("Digite a sua N1: ")) n2 = int(input("Digite a sua N2: ")) n3 = int(input("Digite a sua N3: ")) n4 = int(input("Digite a sua N4: ")) media = (n1+n2+n3+n4)/4 print("Sua média é {}" .format(media)) # #PROGRAMA ESTATISTICA DE LETRA frase = input("Digite uma frase: ") letra ...
false
49b5e88a53fd9e1d0965ec3e72931135e06ab8d5
Allien01/PY4E
/02-data-structure/files/01.py
255
4.15625
4
fname = input("Enter the name of the file: ") try: fhandle = open(fname) except: print("This is not a existing file!") exit() for line in fhandle: # imprime cada linha do arquivo em maiúsculo line = line.rstrip() print(line.upper())
false
be90e83b67be93177d2aa6797044fb6504b28473
olegrok/TrackUIAutomatization
/lesson1/6.py
539
4.28125
4
#!/usr/bin/python3 # Написать программу, определяющую является ли фраза палиндромом или нет. # Входные данные содержат строку. # Ответ должен содержать: "полиндром" если это палиндром или "не полиндром" если нет. import re str1 = str(input()) str1 = re.sub(r'\W', '', str1).lower() if str1 == str1[::-1]: print(...
false
5ec90b5061479057ab0be74166f7662897056973
KyeCook/PythonStudyMaterials
/LyndaStudy/LearningPython/Chapter 3/time_delta_objects.py
1,347
4.34375
4
###### # # # Introduction to time delta objects and how to use them # # ###### from datetime import date from datetime import datetime from datetime import time from datetime import timedelta def main(): # Constructs basic time delta and prints print(timedelta(days=365, hours=5, minutes=1)) # print date...
true
48cf608faab61973d1a3660ca5e466728f0db0f9
KyeCook/PythonStudyMaterials
/LyndaStudy/LearningPython/Chapter 2/loops.py
820
4.28125
4
######## # # # Introduction to loops # # ######## def main(): x = 0 # Defining a while loop while (x < 5): print(x) x =+ 1 # Defining a for loop for x in range(5,10): print(x) # Looping over a collection (array, list etc.) days = ["mon", "t...
false
c73bbcb19f8fefe0c8ac9a03af30f84878398d34
rafianathallah/modularizationsforum
/modnumber10.py
395
4.125
4
def pangramchecker(str): alphabet = "abcdefghijklmnopqrstuvwxyz" for characters in alphabet: if characters not in str.lower(): return False return True sentence = str(input("Enter a sentence: ")) if(pangramchecker(sentence) == True): print("This sent...
true
b2681199c636f8d3cf67f2e3211100e512f951d8
CamiloYate09/Python_Django
/FACTORIAL.py
334
4.21875
4
# factorial = int(input("Ingresa Un numero para saber su factorial")) # # acum = 1 # # while factorial>0: # acum *=factorial # factorial = factorial-1 # # # # print('%i' % acum) #FACTORIAL DE FORMA RECURSIVA def factorial(x): if (x==0): return 1 else: return x * factorial(x-1) print...
false
e9c023d8afffb2b4d28954c7bc2ff4311c3e1a94
Ryan149/Bioinformatics-Repository
/bioinformatics/coding/month.py
705
4.15625
4
name={} name[0]="January" name[1]="February" name[2]="March" name[3]="April" name[4]="May" name[5]="June" name[6]="July" name[7]="August" name[8]="September" name[9]="October" name[10]="November" name[11]="December" def daysInMonth(month): days = 30 if (month < 7): if (month % 2 == 0): ...
true
87e82f31d1624d627eed4c122307fc3762165e75
EdBali/Python-Datetime-module
/dates.py
1,626
4.3125
4
import datetime import pytz #-----------------SUMMARRY OF DATETIME module------------ #-------------The datetime module has 4 classes: # datetime.date ---(year,month,date) # datetime.time ---(hour,minute,second,microsecond) # datetime.datetime ---(year,month,date,hour,minute,second,microsecond) # datetime.timedelta ---...
true
a1d69d9a43163882862a5460605a20086fc8f334
marcemq/csdrill
/strings/substrInStr.py
665
4.125
4
# Check if a substring characters are contained in another string # Example # INPUT: T = ABCa, S = BDAECAa # OUTPUT: ABCa IN BDAECAa import sys from utils import _setArgs def checkSubstrInStr(substr, mystr): frec = {key:0 for key in substr} for key in substr: frec[key] += 1 counter = len(frec) ...
true
e1010fcef38081827ce65150ea93eb922d87e2be
kemoelamorim/Fundamentos_Python
/exercicios/Ex018.py
528
4.125
4
""" Faça um programa que leia um ângulo qualquer e mostre na tela o valor do seno, cosseno e tangente desse ângulo. """ from math import sin, cos, tan, radians # lendo ângulo angulo = int(input("Digite o ângulo: ")) # valores de seno e cosseno seno = sin(radians(angulo)) print("O ângulo de %d tem o seno de %.2f" %(ang...
false
4fe669ddce4a2ec9e5df71d9c408a37b4ecc65f4
kemoelamorim/Fundamentos_Python
/Tipos_primitivos/1-Strings/1.0-tipos_primitivos.py
2,007
4.3125
4
# Variaveis e Tipos nome = 'kemoel' # valor com o tipo string ou 'str' idade = 26 # valor com o tipo inteiro ou 'int' salario = 4.728 # valor com o tipo ponto flutuante ou 'float' masculino = True # valor com tipo boleano 'bool' # Função type() mostra o tipo que valor da variável possui print(type(nome)) # tipo s...
false
2a3c4c11d5fbcb16d69d2c18ebc3c0ef30d0b352
PsychoPizzaFromMars/exercises
/intparser/intparser.py
1,951
4.40625
4
'''In this kata we want to convert a string into an integer. The strings simply represent the numbers in words. Examples: - "one" => 1 - "twenty" => 20 - "two hundred forty-six" => 246 - "seven hundred eighty-three thousand nine hundred and nineteen" => 783919 Additional Notes: - The minimum numbe...
true
3b1cc3621fdd084d179c4e7a3c8a5b82bb82fa60
fp-computer-programming/cycle-5-labs-p22rlugo
/lab_5-2.py
412
4.28125
4
# Ryan Lugo: RJL 10/27/21 first_string = input("First Word?: ") second_string = input("Second Word?: ") if first_string > second_string: print(first_string + " is bigger than " + second_string) elif first_string < second_string: print(second_string + " is bigger than " + first_string) elif first_string == sec...
false
80d2008455dc937de197802177241472e75c8f1a
Afnaan-Ahmed/GuessingGame-Python
/guessingGame.py
1,036
4.4375
4
import random #Generate a random number and store it in a variable. secret_number = random.randint(1,10) #Initially, set the guess counter to zero, we can add to it later! guess_count = 0 #set a limit on how many guesses the user can make. guess_limit = 3 print('Guess a number between 1 and 10.') #Do this so the p...
true
14fb59b01f99399e6c623d2f84ae9a2e357fb6ba
sourabh06986/devopsprac
/pythonexp/ec2-user/script3.py
317
4.28125
4
#!/usr/bin/python users = ["user1","user2","user3"] print (users[0]) #Accessing last element print (users[len(users)-1]) print (users[-1]) print (users[-2]) users.append("peter") print users print users[-1] + " " + users[-2] #insert element at specific index users.insert(1,"marry") users.remove("user1") print users
false
5dbb4db96d384b13f027ca6adba424dae8f8b7a0
vishnupsingh523/python-learning-programs
/gratestofThree.py
543
4.375
4
# this program is to find the greatest of three numbers: def maxofThree(): # taking the input of three numbers x = int(input("A : ")); y = int(input("B : ")); z = int(input("C : ")); #performing the conditions here for finding the greatest if x>y: if x>z: print(x," is the g...
true
4db1862dd0c6508368c515de5ebedc672ae1f5e5
klaus2015/py_base
/剑指offer算法/练习.py
1,340
4.1875
4
'''给定一个只包括 '(',')','{','}','[',']' ,'<','>' 的字符串,判断字符串是否有效。 有效字符串需满足:  左括号必须用相同类型的右括号闭合。  左括号必须以正确的顺序闭合。  注意空字符串可被认为是有效字符串。  示例 1: 输入: "()" 输出: true  示例 2: 输入: "()[]{}<>" 输出: true  示例 3:输入: "(<{)]}" 输出: false  示例 4: 输入: "([{ }]" 输出: false  示例 5:输入: "(<{[()]}>)" 输出: true  ''' class QueueError(Exception): pass class...
false
cdd383d3959b8ea02086267fe51163a1f79e7aa6
klaus2015/py_base
/code/day04/r6.py
252
4.15625
4
""" 在控制台中获取一个整数作为边长. """ length = int(input("请输入边长: ")) string = "*" space = ' ' print(string * length-2) for item in range(length): print(string + space * (length - 2) + string) print(string * length)
false
3349311b8347f6eac17c3dfb9b87da5816f57e0c
eestey/PRG105-16.4-Using-a-function-instead-of-a-modifier
/16.4 Using a function instead of a modifier.py
945
4.1875
4
import copy class Time(object): """ represents the time of day. attributes: hour, minute, second""" time = Time() time.hour = 8 time.minute = 25 time.second = 30 def increment(time, seconds): print ("Original time was: %.2d:%.2d:%.2d" % (time.hour, time.minute, time.second)) ...
true
302bee99dec0d511bda305ec8ba4bdc6fa028138
Rossnkama/AdaLesson
/linear-regression.py
1,181
4.25
4
# Importing our libraries import numpy as np import matplotlib.pyplot as plt # Our datasets x_data = [1.0, 2.0, 3.0] y_data = [2.0, 4.0, 6.0] # Forward propagation in our computational graph def feed_forward(x): return x * w # Loss function def calculate_loss(x, y): return (feed_forward(x) - y)**2 # To plot...
true
26003c0363ef59d0a28dbc9e3ba40b835c803f09
D4r7h-V4d3R/Ornekler
/class1,__init__,self.py
1,115
4.125
4
#normal OOP Programmlama tarzı (basit programlama) #uninit un self class work: pass emplo1 = work() emplo1.ad = "Hasan" emplo1.soyad = "Kılıc" emplo1.maas = "3100" emplo2 = work() emplo2.ad = "Kemal" emplo2.soyad = "Ok" emplo2.maas = "2300" print(emplo1) print(emplo1.ad,emplo1.soyad) #With init,...
false
9621fb0236eaf16068f246c7bc199679c51c24d2
Snakanter/FunStuff
/rps.py
1,832
4.1875
4
#!/usr/bin/env python3 """ File: rps.py Name: A rock-paper-scissors game against the CPU Concepts covered: Random, IO, if/else, printing """ import random import sys import os def main(): # Code here print("READY FOR A GAME OF ROCK, PAPER, SCISSORS!?") PlayerChoice = input("Choose between optio...
true
52a19ec7a20ac94d87dd8d26a9492df110792804
hsqStephenZhang/Fluent-python
/对象引用-可变性-垃圾回收/8.4函数的参数作为引用时2.py
2,010
4.375
4
""" 不要使用可变类型作为函数的参数的默认值 """ class HauntedBus(object): def __init__(self, passengers=[]): # python会提醒,不要使用mutable value self.passengers = passengers def pick(self, name): self.passengers.append(name) def drop(self, name): try: self.passengers.remove(name) exce...
true
baa67284aac469155cfd13d9a5b9a5a2d465fbb5
hsqStephenZhang/Fluent-python
/接口-从协议到抽象基类/11.2Python喜欢序列.py
592
4.1875
4
""" Python尽量支持基本协议 对于一个序列来说,协议要求其实现__getitem__,__contains__,__iter__,__reversed__ index,count的方法 但是,鉴于序列的重要性,在类没有实现__contains__和__iter__方法的时候,只需要定义了 __getitem__方法,也可以实现in,和迭代运算符 """ class Func(object): def __init__(self): self.data = range(0,20,2) def __getitem__(self, item): return self.dat...
false
7cc3efabd755c0aba8f2e650dfcf5a043b89b5c1
baki6983/Python-Basics-to-Advanced
/Collections/Tuple.py
328
4.46875
4
#tuples are ordered and unchangable fruitsTuples=("apple","banana","cherry") print(fruitsTuples) print(fruitsTuples[1]) # if you try to assign value to fruitsTuples[1] , it will change because its Unchangeable # With DEL method you can completely List , but you cant item in the list for i in fruitsTuples: pr...
true
6705d4095c282200d0c3f2ca1c7edfb15cdc7009
akshayreddy/yahtzee
/yahtzee.py
2,427
4.25
4
''' .) Programs creats a list of dices .) ProbailityInfo is used to keep track of the positions of dices which will be used to re rolled in future .) probability contais the list of probanilities ''' from decimal import Decimal from random import randint import sys j,k=0,0 dices,ProbabilityInfo,probaility=[],[],[...
true
50a19615d64c0c8e015d625211e2404dd322b0f6
defytheflow/cs50
/week6/caesar.py
1,223
4.375
4
# This program encrypts the given message by a given key using Caesar Cipher import sys def main(): check_args() key = int(sys.argv[1]) % 26 message = input("plaintext: ") encrypt_caesar(message, key) def check_args() -> bool: """ Checks provided command lines arguments. """ if len(sys.argv)...
false
cc35a2f8ef7f5c1c81d6d491abdfb6263c632769
denze11/BasicsPython_video
/theme_4/13_why_range.py
604
4.21875
4
# Когда нам может помочь range winners = ['Max', 'Leo', 'Kate'] # Простой перебор for winner in winners: print(winner) # Что делать если нам нужно вывести место победителя? # использовать while? # или есть способ лучше? # вывести нечетные цифры от 1 до 5 numbers = [1, 3, 5] for number in numbers: print(num...
false
10be9e035cd80484fcb8a5eef1531a9545f9f30b
denze11/BasicsPython_video
/theme_14/14_copy_list.py
547
4.3125
4
a = [1, 2, 3] # копия с помощью среза b = a[:] b[1] = 200 # список а не изменился print(a) # копия с помощью метода copy b = a.copy() b[1] = 200 # список а не изменился print(a) # Эти способ бы не будут работать если есть вложенные списки a = [1, 2, [1, 2]] b = a[:] b[2][1] = 200 # список а сного меняется print(a)...
false
d5d129c657c35a21983e77972370f67e146bdfe7
NatheZIm/nguyensontung-homework-c4e14
/Day4/ex3.py
287
4.25
4
isPrime=0 n=int(input("Enter Number to Check: ")) if n == 1 or n == 0: print(n,"Is Not Prime Number ") else: for i in range(1,n+1): if n%i==0: isPrime+=1 if (isPrime==2): print(n,"Is Prime Number") else: print(n,"Is Not Prime Number")
false
1d62f6a708016a46f4ec143529a47ba0fd7fd0a9
MFRoy/pythonchallenges
/python/grade_calculator.py
520
4.1875
4
print("Welcome to average grade calculater ") maths = int(input(" Please imput your Maths mark : ")) physics = int(input(" Please imput your Physics mark : ")) chemistry = int(input(" Please imput your Chemistry mark : ")) average =((maths+physics+chemistry)/3) print ("your percentage is", " ",average,"%") grade= "Fai...
false
09fd2d4e77c3bb2ce2401f583a567c6351aaf2d7
veryobinna/assessment
/D2_assessment/SOLID/good example/liskov_substitution.py
1,345
4.125
4
''' Objects in a program should be replaceable with instances of their base types without altering the correctness of that program. I.e, subclass should be replaceable with its parent class As we can see in the bad example, where a violation of LSP may lead to an unexpected behaviour of sub-types. In our example, "i...
true
eeb4417e9f419a311fb639aeada768728c113f28
tekichan/teach_kids_python
/lesson5/circle_pattern.py
897
4.34375
4
from turtle import * bgcolor("green") # Define Background Color pencolor("red") # Define the color of Pen, i.e our pattern's color pensize(10) # Define the size of Pen, i.e. the width of our pattern's line radius = 100 # Define the radius of each circle turning_angle = 36 # Define how much the ...
true
15e49688c27e8237138889efa46963ffa4775c91
kenifranz/pylab
/popped.py
309
4.28125
4
# Imagine that the motorcycles in the list are stored in chronological order according to when we owned them. # Write a pythonic program to simulate such a situation. motorcycles = ['honda', 'yamaha','suzuki'] last_owned = motorcycles.pop() print("The last motorcycle I last owned was "+ last_owned.title())
true
17f39a18c96ac3f6a3bb1646da4d01875b1889e6
JaredColon-Rivera/The-Self-Taught-Programmer
/.Chapter-3/Challenge_4.py
233
4.375
4
x = 10 if x <= 10: print("The number is less than or equal to 10!") elif x > 10 and x <= 25: print("The number is greater than equal to 10 but it is less than or equal to 25!") elif x > 25: print("The number is greater than 25!")
true
d6bd643d0da7cfb11fd22a0d0b346171fba82b24
sureshbvn/leetcode
/recursion/subset_sum.py
952
4.25
4
# Count number of subsets the will sum up to given target sum. def subsets(subset, targetSum): # The helper recursive function. Instead of passing a slate(subset), we are # passing the remaining sum that we are interested in. This will reduce the # overall complexity of problem from (2^n)*n to (2^n). ...
true
5d0d3522cee1193cb0765c366e7d5d73a583aab2
pravinv1998/python_codeWithH
/newpac/read write file.py
339
4.15625
4
def read_file(filename): ''' 'This function use only for read content from file and display on command line' ''' file_content = open(filename) read_data = file_content.read() file_content.close() return read_data n=read_file("name.txt") print(n) print(read_file.__doc__) # read the ...
true
bc4906e63fbb7278109151edfd73f7d06cc38630
abalulu9/Sorting-Algorithms
/SelectionSort.py
701
4.125
4
# Implementation of the selection sorting algorithm # Selection sort takes the smallest element of the vector, removes it and adds it to the end of the sorted vector # Takes in a list of numbers and return a sorted list def selectionSort(vector, ascending = True): sortedVector = [] # While there are still elements...
true
2f28f3c4f6c93913345c688e688662eb228879ed
stanislav-shulha/Python-Automate-the-Boring-Stuff
/Chapter 6/printTable.py
997
4.46875
4
#! python3 # printTable.py - Displays the contents of a list of lists of strings in a table format right justified #List containing list of strings #rows are downward #columns are upward tableData = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goo...
true
96a3ec7334436703a69c3d4bd396eb3f99ca5bf2
stanislav-shulha/Python-Automate-the-Boring-Stuff
/Chapter 4/CommaList.py
733
4.59375
5
#Sample program to display a list of values in comma separated format #Function to print a given list in a comma separated format #Takes a list to be printed in a comma separated format def comma_List(passedList): #Message to be printed to the console message = '' if len(passedList) == 0: print('Empty List') ...
true
2b7df14561403960fe975298193f7863d79d2987
charlesumesi/ComplexNumbers
/ComplexNumbers_Multiply.py
1,049
4.3125
4
# -*- coding: utf-8 -*- """ Created on 16 Feb 2020 Name: ComplexNumbers_Multiply.py Purpose: Can multiply an infinite number of complex numbers @author: Charles Umesi (charlesumesi) """ import cmath def multiply_complex(): # Compile one list of all numbers and complex numbers to be multiplied ...
true
3d354cd1c4e773dee69e1b41201c83e943a11ed7
PurpleMyst/aoc2017
/03/first.py
878
4.1875
4
#!/usr/bin/env python3 UP = (0, -1) DOWN = (0, 1) LEFT = (-1, 0) RIGHT = (1, 0) NEXT_DIRECTION = { RIGHT: UP, UP: LEFT, LEFT: DOWN, DOWN: RIGHT } def spiral_position(target): assert target >= 1 x, y = 0, 0 value = 1 magnitude = 1 direction = RIGHT while True: for _...
false
007f176e9d38b1d07543cda8113ae468d31daa28
andresjjn/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/4-print_square.py
779
4.375
4
#!/usr/bin/python3 """ Module Print square This document have one module that prints a square with the character #. Example: >>> print_square(4) #### #### #### #### """ def print_square(size): """Add module. Args: size (int): The size length of the square. Reises: TypeE...
true
e23a809a3a920c566aa857d70f684fc787381bbb
GbemiAyejuni/BubbleSort
/bubble sort.py
828
4.28125
4
sort_list = [] # empty list to store numbers to be sorted list_size = int(input("Enter the size of list: ")) # variable to store size of list indicated by the user for i in range(0, list_size): number = int(input("Enter digit: ")) sort_list.append(number) # adds each number the user gives to sort_list ...
true
bba7a6b1f479e572f02d49c019ad5e3acffe17ad
mbollon01/caesar
/caesar.py
1,968
4.15625
4
def main(): print ("Welcome to Caesar shift\n") print ("=======================\n") print ("1.Encrypt\n2.Decrypt") option = int(input("please input an option: ")) message = input('Enter Message: ') shift = int(input("input the shift: ")) if option ==1: encrypt(message, shift) elif option ==2: decrypt(m...
false
d9a69fbda9ed1346f9475dd255278948ae5038de
arifams/py_coursera_basic_
/for_test2.py
352
4.40625
4
print("before, this is the total number") numbers = 3,41,15,73,9,12,7,81,2,16 for number in numbers: print(number) print("now python try to find the largest number") largest_so_far = 0 for number in numbers: if number > largest_so_far: largest_so_far = number print(largest_so_far, number) print("Now the curre...
true
7b9e12083faf0278926f41cc4c60562e24332697
lasupernova/book_inventory
/kg_to_PoundsOrOunces.py
1,806
4.125
4
from tkinter import * #create window-object window = Tk() #create and add 1st-row widgets #create label Label(window, text="Kg").grid(row=0, column=0, columnspan=2) #create function to pass to button as command def kg_calculator(): # get kg value from e1 kg = e1_value.get() # convert kg into desired un...
true
6e8d17c385229344a5ba7cfddfdc9679de7e09eb
jelaiadriell16/PythonProjects
/pset2-1.py
736
4.1875
4
print("Paying the Minimum\n") balance = int(raw_input("Balance: ")) annualInterestRate = float(raw_input("Annual Interest Rate: ")) monthlyPaymentRate = float(raw_input("Monthly Payment Rate: ")) monIntRate = annualInterestRate/12.0 month = 1 totalPaid = 0 while month <= 12: minPayment = monthlyPaymentRate ...
true
ba3b85ec95dc22ecb4c91ada9c2f61512e5359ea
Gabe-flomo/Filtr
/GUI/test/tutorial_1.py
1,950
4.34375
4
from PyQt5 import QtWidgets from PyQt5.QtWidgets import QApplication, QMainWindow import sys ''' tutorial 1: Basic gui setup''' # when working with PyQt, the first thing we need to do when creating an app # or a GUI is to define an application. # we'll define a function named window that does this for us def window...
true
75f4e3cd2ccfe294c9940f3cc7332c3626dcb139
Muhammad-Yousef/Data-Structures-and-Algorithms
/Stack/LinkedList-Based/Stack.py
1,303
4.21875
4
#Establishing Node class Node: def __init__(self): self.data = None self.Next = None #Establishing The Stack class Stack: #Initialization def __init__(self): self.head = None self.size = 0 #Check whether the Stack is Empty or not def isEmpty(self): retur...
true
43f674a715ad3f044bc2a5b406dc3b5edabe1323
DoozyX/AI2016-2017
/labs/lab1/p3/TableThirdRoot.py
838
4.4375
4
# -*- coding: utf-8 -*- """ Table of third root Problem 3 Create a table with third root so that the solution is a dictionary where the key is the integer and the value is the third root of the integer. The keys should be numbers whose third root is also an integer between two values m and n. or a given input, print ou...
true