blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
c3bb54518500f812fc7a04184ac3789384338027
yuri77/Sorting
/src/iterative_sorting/iterative_sorting.py
1,256
4.21875
4
# TO-DO: Complete the selection_sort() function below def selection_sort(arr): for i in range(len(arr)): print("arr", arr) last_index = len(arr) current = arr[i] # TODO: can I find index of the smallest element and the value at the same time, i.e in one loop? smallest = min(...
true
5ad96eda63d0304403695bad58753f9847ea77e4
DavidIyoriobhe/Week-2
/Area of a Trapezoid.py
481
4.3125
4
#This is a program is written to calculate the area of a Trapezoid """You are given any values to work with, as the program is only to assist you in solving this problem. Hence, you will be required to enter values as appropriate.""" a = float(input("Enter a value for the shorter base, a: ")) b = float(input("Ente...
true
8f2cf30c2b3bd9deb637539ad59a7a832d61fb9a
cfrome77/ProgrammingMeritBadge
/python/tempConverter.py
947
4.25
4
#!/usr/bin/env python3 ''' Temperature Convertor Converts from fahrenheit to celsius ''' done = False # Variable to determine if we are done processing or not while not done: # Repeat until the done flag gets set temp = int(input("Enter the temperature in degrees Farenheight (F): ")) # reads...
true
17c77c097c5964261d819a828c225c80f4ce20a3
MaheshBhandaree/python
/MinMax.py
299
4.15625
4
a= int(input("Enter First no")) b= int(input("Enter Second no")) min=a if(a<b) else b print("MINIMUM VALUE IS :",min) # for MAX VAlue a= int(input("Enter First no")) b= int(input("Enter Second no")) c= int(input("Enter Third no")) max= a if a>b and a>c else b if(b>c) else c print("Max value:",max)
false
4ccdec52e51795aa67503fabc1c2b08816440432
santhoshdevaraj/Algos
/419.py
1,539
4.125
4
# Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, # empty slots are represented with '.'s. You may assume the following rules: # You receive a valid board, made of only battleships or empty slots. # Battleships can only be placed horizontally or vertically. In other ...
true
3fa3618c5d43b2c07b26a46b32d8d7eecfc48f2f
Ezlan97/python3-fullcourse
/fullcourse.py
2,659
4.28125
4
#import libary from math import * #simple print print("Hello World!") print(" /|") print(" / |") print(" / |") print(" /___|") #variable name = "John" age = 25 print("There once was a man name " + name + ", ") print("he was " + str(age) + " years old.") print("he really liked the name " + name +...
true
249d5c418b62ac935e377286bd77c00bfe0fcc50
ppaul456/Python
/Assignments/homework_assignment_3/working_with_lists.py
856
4.15625
4
#Pohsun Chang #830911 #MSITM6341 #09/17/2019 grocery_items = ['Apple','Orange', 'Steak', 'Chicken', 'water'] # create 5 items in a list price_of_grocery_items = [40,30,60,50,10] # ceate each item's price in another list print(grocery_items) print(price_of_grocery_items) print(grocery_items[2]+' costs $'+str(price_of_g...
true
97c162ba4d94d9563b62768d5ed2c3faec5ecd59
mcharanrm/python
/stack/maximum_element.py
651
4.3125
4
'''Find the maximum element in the stack after performing few queries 1 x -Push the element x into the stack. 2 -Delete the element present at the top of the stack. 3 -Print the maximum element in the stack. ''' #ProblemStatement: #https://www.hackerrank.com/challenges/maximum-element/problem def maximum_el...
true
7f68390c001467a4904cbecb34d490161f24ca19
SoftwareIntrospectre/Problem-Solving-Practice
/Convert_lambda_to_def.py
795
4.34375
4
# Convert a Lambda Expression into a def statement (function) ##Example 1: Check if a number is even # Step 1: Take original lambda expression even = lambda num: num % 2 == 0 print even(4) # returns True print even(5) # returns False # Step 2: Convert syntax to def statement def even(num): return num % 2 == 0...
true
e3abca0fbb77725fc086141f6e88f063447ddcc3
SoftwareIntrospectre/Problem-Solving-Practice
/InheritanceWithMeals.py
841
4.46875
4
# Use inheritance to create Derived Classes: Breakfast, Lunch, and Dinner from the Base Class: Meal class Meal(object): def __init__(self): print 'This is a meal' def timeOfDay(self): print 'Any time of day' class Breakfast(Meal): def __init__(self): Meal.__init__(s...
true
bdaaec8409cf7802b77a636ddd742aecd3ac2655
Shaaman331/Aula-Python-Pro
/Aulas/Aula10.For.py
697
4.71875
5
''' For * Um loop for é usado para iterar sobre uma sequência (que é uma lista, uma tupla, um dicionário, um conjunto ou uma string). * Isso é menos parecido com a palavra-chave for em outras linguagens de programação e funciona mais como um método iterador encontrado em outras linguagens de programação orientadas ...
false
029335d2052a04d8536a1fddf930c502e7f1f0b5
Shaaman331/Aula-Python-Pro
/Aulas/Aula12.Interando.Dicionario.py
1,157
4.5625
5
''' O dicionário possue métodos destinados a interação sobre seus elementos, você consegue interar diretamente sobre o dicionário usando o laço For * O métodos keys() retonará uma lista de todas as chaves do dicionário, * O método values() retornará uma lista de todos os valores no dicionário. * É possivel fazer o ...
false
fded2bf256ad45b75f0e9f4dc0ff364f942a5181
mirondanielle/hello-world
/Week1project6 - Miron.py
759
4.34375
4
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> radius = float(input("Enter the radius: ")) Enter the radius: 7 >>> area = 3.14 * radius ** 2 >>> print ("The area is", area, "square units.") ...
true
1077fb7bcd3c578e896ae9bbdf7b82e5a5c85b63
mirondanielle/hello-world
/Week4pi.py
280
4.15625
4
iterations = int(input("Enter the number of iterations: ")) piFour = 0 numerator = 1 denominator = 1 for count in range(iterations): piFour += numerator / denominator numerator = -numerator denominator += 2 print("The aprroximation of pi is", piFour * 4)
false
ebb0a30391415bf601c50a11d56c365703cebc16
siyengar88/Python4selenium
/DemoTest1/InterchangeFLinList.py
425
4.46875
4
#Python program to interchange first and last elements in list li=[1,2,3,4,5,6,7,8] print("{} {}".format("Original List: ",li)) temp=li[-1] #storing the last element in a temporary variable li[-1]=li[0] #Bringing first element to last position li[0]=temp #storing last element in first position p...
true
3c127048a5aaff0b8a4d6f41fdfccd821c25ceb8
techsparksguru/python_ci_automation
/Class2/python_functions.py
1,167
4.78125
5
""" https://www.tutorialspoint.com/python3/python_functions.htm https://docs.python.org/3/library/functions.html https://realpython.com/documenting-python-code/ """ # Creating a function def my_function(): print("Hello from a function") # Calling a Function my_function() ## Functions with arguments/Parameters def...
true
91158d5f59f950c22ac811b0f9125c10c6da71f6
DtjiPsimfans/Python-Set
/python_set.py
1,544
4.28125
4
# Python Set class PythonSet: """ This class contains attributes of a python set. """ def __init__(self, elements=[]): # type: (list or str) -> None self.elements: list = [] # initial value for element in elements: if element not in self.elements: self.elements.append(element) self.elements...
true
c8fae950c0238d63e5a2e3e2dc3eecec4e87383e
ErhardMenker/MOOC_Stuff
/fundamentalsOfComputing/interactiveProgramming/notes_acceleration&friction.py
808
4.21875
4
## The spaceship class has two fields: # self.angle is the ship orientation (the angle, in radians, of the ship's forward velocity from the x-axis) # self.angle_vel is the speed in which the ship moves in the current direction ## Acceleration # Acceleration can be modeled by increasing the velocity with time, just as ...
true
a7d76c6044048cf5775dc5b92e90536fa3acfbac
ErhardMenker/MOOC_Stuff
/fundamentalsOfComputing/interactiveProgramming/notes_variables.py
1,056
4.375
4
# variables - placeholders for important values # used to avoid recomputing values and to # give values names that help reader understand code # valid variable names - consists of letters, numbers, underscore (_) # starts with letter or underscore # case sensitive (capitalization matters) # legal names - ninja, Ninj...
true
220e2b2bfd11ceff670fae721a0b0211830bf0c3
xzpjerry/learning
/python/est_tax.py
1,885
4.21875
4
#! /usr/bin/env python3 ''' Estimating federal income tax. Assignment 1, CIS 210 Authors: Zhipeng Xie Credits: 'python.org' document Inputer income and num_of_exemption, output tax. ''' def brain (temp_income, temp_num_of_exempt): ''' (float or int, int) -> float return estimated tax r...
true
6a7d1eb11c8fe77bba32e59e760a9889746cf131
zhangzhongyang0521/python-basic
/python-sequence/sequence-feature.py
2,282
4.28125
4
# 序列是一块用于存放多个值的连续内存空间,并按照一定顺序排列,每个元素都有一个索引 # python中常见的序列:列表、元组、集合、字典和字符串 # 索引,python中的序列索引从0开始(从左到右),从-1开始(从右到左) words = ["AA", "BB", "CC", "DD", "EE"] print(words[2]) print(words[-1]) # 切片,访问序列中一定范围的元素,可以通过切片生成新的序列 # 语法格式:sname[start:end:step],其中start如果不指定默认为0,end若不指定默认为序列的长度,step若不指定默认为1 print(words[1:3]) print(wo...
false
15c5cdcc306952ab21b7afed16435aad8cd3e8eb
zhangzhongyang0521/python-basic
/python-quickstart/comment.py
1,140
4.1875
4
# -*- coding:utf-8 -*- # coding=utf-8 ''' @ description: according to height and weight to calc BMI @ author: tony.zhang @ date: 2020.06.20 ''' """ another format multiline comment """ print('''according to height and weight to calc BMI''') # ================application begin================ # input you...
true
4a849488c7669e1a41a05fa101f675d3940385c4
dahlvani/PythonTextProjects
/String Information.py
798
4.28125
4
def reverse(s): str = "" for i in s: str = i + str return str print("Your reversed string is", str) def countvowels(s): num_vowels=0 for char in s: if char in "aeiouAEIOU": num_vowels = num_vowels+1 print ("Your string has", num_vowels, "vowels") #I call a functi...
true
108bda1e87d44a3b1839c6665e833c9247e0a669
nicklutuxun/Calculator-of-pi
/Calculator of pi.py
782
4.28125
4
# coding: utf-8 # In[ ]: import matplotlib.pyplot as plt import time #n is the term of Maclaurin series print('Hi! This is a program to calculate the approximate value of pi') n=int(input('Please enter n:')) #Time starts time_start=time.time() sum_i=0 for i in range(1,n+1): sum_i=(sum_i+(-1)**(i-1)/(2*i-1)) ...
true
c30b0d745e69c5fe6f9333188a7fd61fe2ae66d7
Rishi-saw/Python-3
/objectOrientedProgrammingUsingPython/operatorOverloadingDunderMethods.py
1,481
4.375
4
class Salary: '''__funcname__ are known as duncder methods particularly used for operator overloading and object value management''' def __init__(self, amount, type): self.amount = amount self.type = type def __add__(self, other): # this is a dunder method ...
true
7b99aa93a301e94aded9d77c093ad4db771326b3
fe-sts/CampinasTech
/Trilha_Python_001/Exercício_009.py
484
4.15625
4
''' 9. Elabore um algoritmo em Python que calcule a área e o perímetro de um círculo, sabendo que A = πr² e P=2πr. ''' import math raio = float(input('Digite o raio do circulo em metros: ').strip()) area = math.pi * (raio ** 2) print('A area do círculo é {:.2f}'.format(area)) #mostra 2 casas decimais após . perimetro...
false
c12b18f8584ae8610cf68d07b7f38b2e7b5aa79a
fe-sts/CampinasTech
/Trilha_Python_001/Exercício_012.py
427
4.3125
4
''' 12. Elabore um algoritmo em Python que: a) Primeiro exiba uma mensagem de boas vindas; b) Pergunte o nome do usuário; c) Exiba uma mensagem dizendo uma mensagem de olá seguida pelo nome do usuário seguida por outra mensagem fazendo um elogio. ''' print('Bem vindo!') nome = str(input('Qual o seu nome? ').strip()) pr...
false
9623052ed6b863c5001d9331c0536eeefe22dad9
DesLandysh/My100daysPath
/003_of_100/3_1.py
201
4.28125
4
# Odd or even number = int("33") # int(input("which number do you want to check? ")) if number % 2 == 0: print(f"this number {number} is even.") else: print(f"this number {number} is odd.")
true
5504a7da4128f03acc7902f0d0a7f6ecbf558f0f
DesLandysh/My100daysPath
/009_of_100/9_1.py
837
4.3125
4
# Grading program # database of student_scores in dict names: scores # write a program that converts their scores to grades. -> new dict # DO NOT modify student_score dict # DO NOT write any print statements. # scores 91 - 100 = "Outstanding" # scores 81 - 90 = "Excedds Expectations" # Scores 71 - 80 = "Acceptable" # s...
true
56071b2d97462c397320f8e07decb48e6ee2993e
Aungmyintmyat97/testing
/string.py
1,359
4.1875
4
'hello' + "world" '\"yes,\" I am.' '\"yes\", we are.' print('\"yes\", we are') print('\"NO,\" we aren\'t') >>> '\"yes,\" I am.' '"yes," I am.' >>> '\"yes\", we are.' '"yes", we are.' >>> print('\"yes\", we are') "yes", we are >>> print('\"NO,\" we aren\'t') "NO," we aren't >>> print('\'no,\' we aren\'t') 'no,' we aren...
false
590f0f9c8f8aaac4fd1c9d6f8ca4bbae283ac85b
thomaskellough/PracticePython
/Exercise 11 - Check Primality Functions.py
537
4.21875
4
""" Ask the user for a number and determine whether the number is prime or not. (For those who have forgotten, a prime number is a number that has no divisors). You can (and should!) use your answer to Exercise 4 to help you. """ your_number = int(input('Give me a number.\n')) def prime(number): count = 0 f...
true
30ba4e7f235af64f1634a722113eeea48cafcf55
williancae/pythonGuanabara
/mundo01/Aulas de Conteudo/a02_tipoPrimitivos#06.py
1,227
4.21875
4
# '''Metodos de entrada e Saida''' # # n1 = int(input('digite um numero: ')) #é nescessario dizer que tipo de valor voce recebe int(),float(),bool(),str() # # n2 = int(input('Digite segundo numero: ')) # # s = n1 + n2 # # print('A some é ',s) # # print('A soma vale {}'.format(s)) # # ================== # Exemplo # n1 =...
false
c19bbd21a3956fdc109a8e205ff179f7d2055c8d
w3cp/coding
/python/python-3.5.1/4-control-flow/17-func-lambda-expressions.py
782
4.3125
4
# Small anonymous functions can be created with the lambda keyword. # This function returns the sum of its two arguments: lambda a, b: a + b . # Lambda functions can be used wherever function objects are required. # They are syntactically restricted to a single expression. # Semantically, they are just syntactic sugar ...
true
f45117116f0c463dfe6cbe9657e78cbf838692b1
SuguruChhaya/python-tutorials
/Data Structures and Algorithms/mergeS.py
2,776
4.21875
4
#Practicing mergeosrt iterative def merge(arr, arrEmpty, l, m, r): #Define 3 pointers #Beginning of first subarray a = l #Beginning of second subarray b = m+1 #Beginning of big subarray we are copying into c = l #I think I can check for special case. I can do it after the solution works...
true
28311956d8c5c460f7b516211d30594e0f3036c8
austinjalexander/sandbox
/c/learntoprogram/week1/code_compare/user_input.py
849
4.28125
4
# notice how we don't have to explictly declare the types # of each variable (e.g., int, double, etc.); # moreover, we can actually put an integer in a variable on # one line and then put a string in the same variable on the next; # oh boy can this dupe us! integer_number = 0 decimal_number = 0.0 my_string = "Your...
true
1c0dc260738867d30e283219ff70d1cc5361c98d
iniffit/learning-projects
/Dice Roll.py
1,701
4.21875
4
# This is a dice roll simulator. You can run the program to roll two dice after answering questions. The dice roll is represented by 2 seperate integers. # This is my first ever solo program in Python # Some key learning points I got from writing this program # - Importing modules (Random) # - Nesti...
true
63e29b7a6e7ace44cf07457f347d2ab77a164018
dani888/cs110
/alarm2.py
2,533
4.25
4
# alarm2.py -- an alarm clock with a clock as a component field from clock import * import time class AlarmClock(): '''A (fake) alarm clock. We say it's fake because it "tocks" a minute every real second. Like Clock, this is a 24 hour clock. ''' def __init__(self): t = time.localt...
true
a81806a7e25e2898341c6ed62d02ea3e218af725
McEnos/sorting_algorithms
/merge_sort.py
763
4.25
4
def merge_sort(sequence): """ Sequence of numbers is taken as input, and is split into two halves, following which they are recursively sorted. """ if len(sequence) < 2: return sequence mid = len(sequence) // 2 left_seqeunce = merge_sort(sequence[:mid]) right_sequence = merge_sort(sequen...
true
ee227446623008c77762cf5b5abc4971e4e1bc9a
bentevo/ddd
/exercises/wordchecker.py
1,494
4.125
4
# the words that are not correct are listed in the 'wrong' list, and the words are an empty list for the user to add wrong = ["apples", "cheese", "fries", "banana", "kangaroo", "quick", "triangle", "manatee"] words = [] # input sentence. sentence = input("Hello! Please enter your sentence here. ") # splitting the se...
true
4d6e4835ff49407f93cd78b7ca2a4163bf4177fe
Patibandha/new-python-education
/riddhi_work/reverse_str.py
847
4.53125
5
# wap to take string from the user and print it back in reverse order. def reverse(s): try: # if entry.isalpha(): if type(s) == str: entry = "" for i in s: entry = i + entry # return entry return entry elif type(s) == in...
true
8488dde2c2713f28327d1ac9b23a46593c3a5be9
shankardengi/DataStructure
/doubly_linked_list.py
2,719
4.3125
4
class Node: def __init__(self,data): self.data = data self.next = None self.prev = None @staticmethod def insert_node_front(first): data = int(input("Enter Data into node:")) node = Node(data) if first == None: first = node else: ...
true
3adedd21d929bef168600b2d6ef34ce11e72eb55
shankardengi/DataStructure
/linkedlist_first_second_higst.py
1,878
4.1875
4
class linked_list: def __init__(self,data): self.data = data self.next = None @staticmethod def create_list(): size = int(input("size of list:")) first = None for i in range(size): data = linked_list(int(input("Enter Data:"))) data.next = firs...
true
9e340eb2668797ea9bd78064d92cffc730aaef04
Parkyes90/algo
/local/binary_search.py
1,089
4.125
4
from typing import List, Union """arr: List[int] -> 오름 차순으로 정렬되있다고 가정한다.""" def binary_search(arr: List[int], target: int) -> Union[int, None]: left = 0 right = len(arr) - 1 while left <= right: mid = (left + right) // 2 if arr[mid] < target: left = mid + 1 elif arr[mi...
false
6318079f6cd50256e12991337f167f52c5e46287
Parkyes90/algo
/local/hanoi.py
267
4.125
4
def hanoi(count, fr, by, to): if count < 2: return [[fr, to]] ret = [] ret += hanoi(count - 1, fr, to, by) ret.append([fr, to]) ret += hanoi(count - 1, by, fr, to) return ret if __name__ == "__main__": print(hanoi(1, 1, 2, 3))
false
fd700aad91ad3000d5ecad3ca437973dcabc15e4
wolfgang-azevedo/python-tips
/tip21_split/tip21_split.py
877
4.46875
4
#!/usr/bin/env python3.8 # ######################################## # # Python Tips, by Wolfgang Azevedo # https://github.com/wolfgang-azevedo/python-tips # # Built-in method Split # 2020-03-20 # ######################################## # # string_comma = '1,2,3' string_space = '1 2 3' ### Built-in method split, wit...
false
1fcc6be6104b92ed66e40247e901ca155aace569
ebenp/python2
/median_index.py
1,138
4.375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "Eben Pendleton" __credits__ = "Derived from https://stackoverflow.com/questions/24101524/finding-median-of-list-in-python" __status__ = "Production" def median_index(vals): ''' Return the best approximate median index from a given list. The median...
true
0a530e962a1f1aefd3545e47d8cb3752b196c9b1
chuxinh/cs50-2019
/pset6/caesar.py
1,179
4.53125
5
"""Implement a program that encrypts messages using Caesar’s cipher, per the below. $ python caesar.py 13 plaintext: HELLO ciphertext: URYYB Details of Caesar’s cipher can be found here: https://lab.cs50.io/cs50/labs/2019/x/caesar/ """ from cs50 import get_string import sys def main(): # validate command line ar...
true
fd3d7bbd01cfae6eece77c24859d31f63df2ddbd
cynful/project-euler
/p014.py
1,072
4.125
4
#!/usr/bin/env python """ Longest Collatz sequence Problem 14 The following iterative sequence is defined for the set of positive integers: n -> n/2 (n is even) n -> 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 ...
true
b311b1b8860571cc22cac9a1bd0bfe434e65e9f8
cynful/project-euler
/p025.py
708
4.15625
4
#!/usr/bin/env python """ 1000-digit Fibonacci number Problem 25 The Fibonacci sequence is defined by the recurrence relation: F_n = F_n-1 + F_n-2, where F_1 = 1 and F_2 = 1. Hence the first 12 terms will be: F_1 = 1 F_2 = 1 F_3 = 2 F_4 = 3 F_5 = 5 F_6 = 8 F_7 = 13 F_8 = 21 F_...
true
3294213b6ed2bcb5e4448fc1de49cb86944aa1d9
ivankitanov/repos
/loops.py
712
4.21875
4
# numbers= ["43", "42", "41", "44", "47", "1", "8"] # def odd_or_even(): # even=[] # odd=[] # for number in numbers: # if number%2==0: # even.append(number) # else: # odd.append(number) # print("The even numbers are: ") # for num1 in even: # print num1 # ...
true
fe61c77e817977b8902c53dfd5679c9b3f4f63fc
WebSovereign/school_database
/database.py
520
4.1875
4
import sqlite3 def create_database(): # Create a connection to sqlite3 # Try to connect to a database called 'school.db' # If 'school.db' does not exist, create it conn = sqlite3.connect("school.db") # Create a cursor to make queries with c = conn.cursor() c.execute(""" CREATE TA...
true
303922169d991f88cc03caef981a5fd5e02d6d24
loganpassi/Python
/Algorithms and Data Structures/HW/HW1/vowelCount.py
936
4.40625
4
#Logan Passi #CPSC-34000 #08/27/19 #vowelCount.py #Write a short Python function that counts the number of vowels in a given #character string. def countVowels(inpStr, length): vowelList = ['a', 'e', 'i', 'o', 'u'] #list of vowels vowelListLength = len(vowelList) numVowels = 0 for i in range...
true
2627b9607e29b29182c6d0facad6997a7364d804
loganpassi/Python
/coin_flip.py
796
4.3125
4
##Logan Passi ##09/28/2016 ##Prog6_5.py ##In class exercise to demonstrate the use of ##the random function when simulating a coin toss. import random #make random functions accessible def main(): NUM_FLIPS = 10 #Python named constant counter = int() #counter variable numHeads = int(); numTails ...
true
322252f7121d81d02b81cfbeaab782bfdafc9584
acakocic/Python-project
/sort.py
1,167
4.15625
4
from main import children_list, printChildrenOut from person import * # Sorting the list by lastName, firstName in ascending order. print("\n\nSorting the list by lastName, firstName in ascending order.\n") for i in range(len(children_list)): for j in range(i + 1, len(children_list)): name_i = child...
true
7a2de52d3c767785d6e0f202d551e2340fc0cfa7
puneethnr/Code
/Programs/Microsoft/DayOfTheWeekThatIsKDaysLater.py
588
4.21875
4
''' Given current day as day of the week and an integer K, the task is to find the day of the week after K days. ''' def day_of_week(day: str, k: int) -> str: # WRITE YOUR BRILLIANT CODE HERE days = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Satur...
true
269456d426c16b56c8681ebca684f8ae772b4961
puneethnr/Code
/Programs/Amazon/PalindromeNumber.py
1,271
4.375
4
# Check if a number is Palindrome # In this post a different solution is discussed. # 1) We can compare the first digit and the last digit, then we repeat the process. # 2) For the first digit, we need the order of the number. Say, 12321. # Dividing this by 10000 would get us the leading 1. # The trailing 1 can be ...
true
4d7983328450feabfd0cd69ecac92bfe98fe6637
MeganPu/Tech-Savvy-Megan
/HW String.py
2,223
4.21875
4
#Exercise 5 def any_lowercase1(s): for c in s: if c.islower(): return True else: return False team = 'New England Patriots' print(any_lowercase1(team)) #This function only check the first character of the string and #will return True only if the first character in ...
true
78cbb43cfcb3f70a1cd99fec79c57cbc1c3c3141
Aman-dev271/Pythonprograming
/42th_Single_inheritence.py
1,277
4.125
4
class Employee: no_of_employee = 23 def __init__(self,name , work , sallary): self.name = name self.work = work self.sallary = sallary def Detail_function(self): print(f"The name of Employee{self.name} and work is {self.work} and sallary is {self.sallary}") # Single i...
false
7ebee19c4c6a6d652656cdf1b21bb2c228695ad1
Aman-dev271/Pythonprograming
/54th_list_comprihentions.py
299
4.28125
4
# List comprehension in python # write a program to print the number that are divisible by 3 ls = [] for i in range(100): if i%3==0: ls.append(i) print(ls) # To do this in one line we use the List comprehensions # let see ls = [ i for i in range(100) if i%10 == 0 ] print(ls)
true
c405a8a20f33f32962b6ea6b99a726cde0cdbc66
Aman-dev271/Pythonprograming
/53th_generators_in_python.py
967
4.21875
4
# in python have # Itrateable = .__iter__() or .__getitem__ # Itrate = .__next__() # Itration = to itrate again and again # generator work as like range fucntion for i in range(100): print(i) # in these loop it does not store the value it genrate in fly and display #in the generter we will store th...
false
2d39437a2a5b5b632d6a5c208cb8d886883689e1
Yaswant-Kumar-Singhi/python-tkinter-BMI-GUI
/bmi.py
314
4.34375
4
print('This program is used to calculate BMI of an individual \n') name = input("Enter your name") weight = float(input("Enter your weight")) height = float(input("Enter your height")) ht_in_m = (height * 0.3048) ht_cal = ht_in_m **2 bmi = weight / ht_cal print(f"{name} your BMI is {bmi}")
true
64bbe9080ca572bd9ef6146146232f7828991341
halfwaysleet97/pythop_assignment_dec1
/eqn_proof.py
444
4.25
4
def lhs(a , b): sides = (a - b ) ** 2 return sides def rhs(a , b): sides = (a ** 2 ) - ( 2 * a * b ) + (b ** 2) return sides print(" to prove (a-b)^2 = a^2 - 2ab + b^2, enter\n") num1 = int(input('the value of a\n' )) num2 = int(input('the value of b\n' )) ls = lhs(num1 , num2) rs = rhs(num1 , num2)...
false
b3d9854387f203d67891339aacbe8cf9cb16a337
shubhangi2803/Practice_Python
/Exercise 9.py
909
4.40625
4
# Generate a random number between 1 and 9 (including 1 and 9). # Ask the user to guess the number, then tell them whether they # guessed too low, too high, or exactly right. # (Hint: remember to use the user input lessons from the very first exercise) # Extras: # 1. Keep the game going until the user types “exit” # ...
true
e30b22c71d13abe9f09f03b04071ab04193878ba
HarshCic/data_structures_and_algorithms_with_python
/04_bubble_sort.py
584
4.28125
4
""" ################################################################# ####################### Bubble sort ############################ ################################################################# """ def bubble_sort(array_): for j in range(len(array_)): for i in range(len(array_)-1): if a...
false
ae40f7eea66a9ad3393f4cb7151c58a8b53aece9
ryanriccio1/prog-fund-i-repo
/main/labs/lab6/(ec)ryan_riccio_6_17_lab6.py
2,038
4.34375
4
# this is from program 6-17 (in the spotlight) # according to the powerpoint, i can get extra credit from this # search_coffee_record.py # this program searches inventory records from coffee.txt # main function def main(): try: found = False # get user input for the coffee they want to find ...
true
d0432ba360aa0bec509ee9b26f9d0f4a7438f8e6
bangerterdallas/portfolio
/Chessboard_Generator_Password_Checker/chessboard.py
2,340
4.125
4
import turtle tr = turtle.Turtle() tr.speed(0) class Chessboard: def __init__(self, tr, startX, startY, width=100, height=100): self.height = height self.width = width self.x_pos = startX self.y_pos = startY # create a method to draw a circle def __draw_rectan...
true
a3966789b472f5a2bd4a6e75255911504babb545
yashdobariya/-Guess-Number-Game
/Guess Number.py
621
4.15625
4
# Guess The Number n=25 num_of_guess=1 print(" Guess Number Game:") print("num of guesses is limited to only 5 times") while(num_of_guess<=5): guess_number = int(input("Guess the Number:\n")) if guess_number<25: print("your number is smaller than Guess") elif guess_number>25: p...
true
8b8c9b4f2b7b8271bac29ca78639e3f861f4ca5f
cshintov/Courses
/principles_of_computing/part1/week1/homework/appendsums.py
270
4.25
4
def appendsums(lst): """ Repeatedly append the sum of the current last three elements of lst to lst. """ for i in range(25): sum_three = sum(lst[-3:]) lst.append(sumthree) sum_three = [0, 1, 2] appendsums(sum_three) print sum_three[10]
true
e513d7a10d95ed865101d06784e67a37a276cef9
oneraghavan/AlgorithmsNYC
/ALGO101/UNIT_01/TopDownMergeSort_mselender.py
1,070
4.1875
4
#TopDownMergeSortInPython: #A Python implementation of the pseudocode at #http://en.wikipedia.org/wiki/Merge_sort def merge_sort(m): if len(m) <=1: return m left = [] right = [] middle = int(len(m) / 2) for x in range(0, middle): left.append(m[x]) for x in range(middle, len(m...
true
408269f6941e5474047b7daed12d7315d16d1d0c
oneraghavan/AlgorithmsNYC
/Algorithms/Strings/levenshtein/levenshtein.py
1,025
4.15625
4
#!/usr/env/python def lev(w1, w2): """ Implementation of Levenshtein Distance between two strings. """ word_one_row = [0 for x in xrange(len(w1) + 1)] matrix = [list(word_one_row) for x in xrange(len(w2)+ 1)] for i in xrange(len(w1) + 1): matrix[0][i] = i for j in xrange(len(w2...
false
fc2d1524844bda179bac2ff82d50411eee4ae829
shahaddhafer/Murtada_Almutawah
/Challenges/weekSix/dayThree.py
2,825
4.25
4
# Binary String Expansion # --------------------------------------------------------------------------------- # You will be given a string containing characters ‘0’, ‘1’, and ‘?’. For every ‘?’, either ‘0’ or ‘1’ characters can be substituted. Write a recursive function that returns an array of all valid strings that h...
true
5effbb6beab2b4ce0027863909cde56512ebc7a0
shahaddhafer/Murtada_Almutawah
/Challenges/weekThree/dayFour.py
2,217
4.28125
4
# Is Palindrome # -------------------------------------------------------------------------------- # Strings like "Able was I, ere I saw Elba" or "Madam, I'm Adam" could be considered palindromes, because (if we ignore spaces, punctuation and capitalization) the letters are the same from front and back. Create a funct...
true
ce3fa6c3c2e0337712a0ad658c974e49ac46d516
KodaHand/LP3THW
/ex6.py
1,010
4.5625
5
# declares types of people types_of_people = 10 # x is now equal to a string while putting types_of_people in it x = f"There are {types_of_people} types of people." # declares binary binary = "binary" # declares do_not do_not = "don't" # makes y a string and puts binary and do_not into it y = f"Those who know {binary}...
true
e5a553b35d9d178cfc0add1957e6d34a0760eb0d
McMunchly/python
/pypractice/e13.py
397
4.25
4
# create a fibonacci sequence up to a user-inputted length limit = int(input("Enter number of fibonacci digits to display: ")) numbers = [] num1 = 1; num2 = 1; while(limit > 0): if(len(numbers) < 2): numbers.append(num1) else: num1 = numbers[len(numbers) - 1] num2 = numbers[len(numbe...
true
b64356a7f937b2cbdf67639fe77c0d95bf2264f9
McMunchly/python
/games/game.py
1,231
4.15625
4
# move around a little play area import random blank = "." def DisplayMap(area, size): for x in range(0, size): row = "" for y in range(0, size): row = row + area[y + (size * x)] + " " print(row) def Move(move, coord, board): board[coord] = blank if command ...
true
5b9f964265daa61a5629c2c2c5c57708d1a4a127
taoxm310/CodeNote
/A_Byte_of_Python/str_format.py
802
4.21875
4
age = 20 name = 'time' # 不省略index print('{0} was {1} years old when he wrote this book'.format(name,age)) # 省略index print('{} was {} years old when he wrote this book'.format(name,age)) # 用变量名 print('{name} was {age} years old when he wrote this book'.format(name=name,age=name)) # f-string print(f'why is {name} play...
true
ffc749569b1b8703910f19b5f269a52ff579b5c3
guptaNswati/holbertonschool-higher_level_programming
/0x07-python-classes/102-square.py
1,170
4.4375
4
#!/usr/bin/python3 """ This is a Square class. The Square class creates a square and calculates its area. """ class Square: """ Initialize Square object """ def __init__(self, size=0): self.size = size @property def size(self): return self.__size @size.setter def siz...
true
f3cd5efb8312d4b906aeca951e07a4488458cb15
dotthompson/rpg-game
/Python3/triangle.py
358
4.1875
4
# How to print triangle # ask for range num = int(input("Enter the range: \t ")) # i loop for range(height) of the triangle # first j loop for printing space ' ' # second j loop for printing stars '*' for i in range(num): for j in range((num - i) - 1): print(end = ' ') for j in range(i + 1): ...
false
c6ae5cda3aafe6195841d5e7e42e366a29916c23
dotthompson/rpg-game
/Python3/py101.py
1,283
4.125
4
# comments after this wont be read # "hello world" # 'hello world' # \ escape character # 'I\'m' # "I'm " # several lines of test for string # """ # asdsadasd # sadasdasa # sadasdasa # """ # print # print("hello world") # print('abc') # print('cde') # print('Dorothy' + ' Thompson') # print('\tThis is a great ...
false
9b32a23d496fa5162c68963daf4c73efbfb4fd70
yonicarver/cs265
/Lab/4/lab04/s1.py
1,182
4.28125
4
# python 3.5 # ----------------------------------------------------------------------------- # Yonatan Carver # CS 265 - Advanced Programming # Lab 04 # ----------------------------------------------------------------------------- # Q2.1 Look at the students input file in the directory. Write a Python program # that, f...
true
abb08002375faf85d8eaae6025f8c3aaf19bc0da
Gritide/Py
/ps37.py
1,429
4.21875
4
#Dogukan Celik #Dogukan.Celik89@myhunter.cuny.edu def computeFare(zone, ticketType): """ Takes as two parameters: the zone and the ticket type. Returns the Copenhagen Transit fare, as follows: 3 If the zone is 2 or smaller and the ticket type is "adult", the fare is 23. 3If the zone is ...
true
9d09f5c1cb775fcb7b29ca648f2566f55bb59048
SaintClever/Pythonic
/quiz/questions.py
2,938
4.375
4
""" Quiz questions and answers """ import random # Return / enter not included: 3 spaces questions = { '1. What is the result of f"{2 + 2} + {10 % 3}": ': '4 + 1', '2. Assuming name = "Jane Doe", what does name[1] return: ': 'a', '3. What will name.find("Doe") return from "Jane Doe": ': '5', '4. Wha...
true
e12e46e63d88d56de944588fa11ffc6003c8a24d
natalietanishere/Coding-Practice
/Referencing-Files/recur.py
417
4.25
4
def recursive_method(num): def factorial(num): if num == 1: return 1 else: return (num * factorial(num-1)) if num<0: print("No factorials") #def recur_factorial(num): #if num==1: #return num # else: ## return num * recur_factorial(num-1) #if num>0: #print("Sorry, factorial...
false
37edfab5a975869ef4e5e024a41edee570a586ef
mdjibran/Algorithms
/Matrix/FlipMatrixInPlace.py
921
4.1875
4
def printMat(matrix): for row in matrix: print(row) print("---------") def Flip(matrix): source = 0 destination = len(matrix)-1 temp = matrix[0][2] # 1 matrix[0][2] = matrix[0][0] # 1 -> 3 printMat(matrix) temp, matrix[2][2] = matrix[2][2], temp # 3 -> 9 printMat(m...
false
deb1dee5fbd43c861c574176ae1f9acd5ca2d317
cwg1003/team-6-456
/Confighandler.py
1,577
4.53125
5
# Author: Chad Green & Diyorbek Juraev # Date: 03/31/2021 ''' This program: 1. validates an input file and contents in it. 2. Handle file opening in a mode 2.1. Handle file exceptions, etc. 3. Search file contents ''' import magic def parse_file(filename): #open the file to read, and implement the logic as require...
true
726ec712ff946acea5ede884c030d2ed61cb9422
TirumaliSaiTeja/Python
/app.py
1,801
4.15625
4
# weight = int(input("weight: ")) # unit = input("(L)bs or (K)gs: ") # if unit.upper() == "L": # converted = weight * 0.45 # print(f"You are {converted} kilos") # else: # converted = weight / 0.45 # print(f"You are {converted} pounds") # course = 'learning python course' # print('learning' in course) ...
true
55d1327b7920652db09011cca88e7597fd527588
edelira/rock-paper-scissors
/rock-paper-scissors.py
1,545
4.15625
4
import random print "Welcome to Rock, Paper, Scissors! \nBest out of five wins! \nSelect your tool" user_score = 0 computer_score = 0 def score(): print "Current score \nUser: %d \nComputer: %d" %(user_score, computer_score) while True: user_pick = raw_input("Rock, paper or scissors? ").lower() options ...
true
b4e4f0b90bba0259511a0c1654729d71d1fec7fb
YashDjsonDookun/home-projects
/Projects/HOME/PYTHON/Codecademy/Vacation/Vacation.py
933
4.125
4
print ("Please choose a city from Los Angeles, Tampa, Pittsburgh or Charlotte.") def hotel_cost(nights): #Assuming that the hotel costs $140/nights return 140 * nights def plane_ride_cost(city): if city == "Charlotte": return 183 elif city == "Tampa": return 220 elif city == "Pitt...
true
fc403310c072617a16037a0a1c1600e883d4e556
radetar/hort503
/Assignment03/ex30.py
463
4.15625
4
people = 30 cars = 40 trucks = 15 if cars > people: print("We should take the cars") elif cars < people: print("We should not take the cars") else: print("We can't decide") if trucks > cars: print("Too many trucks") elif trucks < cars: print("maybe we could take the trucks") else:...
true
973f067b608ac5da1cdd7efbffcde8c3973235d9
Bicky23/Data_structures_and_algorithms
/merge_sort/myversion_inversions.py
1,205
4.1875
4
def merge_sort_inversions(array): # base case if len(array) <= 1: return array, 0 # split into two and recurse mid = len(array) // 2 left, left_inversions = merge_sort_inversions(array[:mid]) right, right_inversions = merge_sort_inversions(array[mid:]) # merge and return sorted_array, ...
true
a9ef5ee835e77018609406891d020a72be16d91e
halilibrahimdursun/class2-functions-week04
/4.9_alphabetical_order.py
386
4.53125
5
def alphabetical_order(words=''): """takes an input form user in which the words seperated with hyphen icon(-), sorts the words in alphabetical order, adds hyphen icon (-) between them and gives the output of it.""" words = words.split('-') words.sort() return '-'.join(words) print(alphabetical_or...
true
87a14dfd5e90062e5596119d3b735519d61b795a
PierreVieira/Python_Curso_Em_Video
/ex014.py
276
4.21875
4
""" Exercício Python 014: Escreva um programa que converta uma temperatura digitando em graus Celsius e converta para graus Fahrenheit. """ celcius = float(input('Informe a temperatura em °C: ')) print(f'A temperatura de {celcius} °C corresponde a {celcius*9/5 + 32} °F')
false
6168dfbcc982d78e54c9e5e8423004cd84001732
PierreVieira/Python_Curso_Em_Video
/ex093.py
1,208
4.34375
4
""" Exercício Python 093: Crie um programa que gerencie o aproveitamento de um jogador de futebol. O programa vai ler o nome do jogador e quantas partidas ele jogou. Depois vai ler a quantidade de gols feitos em cada partida. No final, tudo isso será guardado em um dicionário, incluindo o total de gols feitos durante o...
false
d45c77453c57d60a233db4fe2b3f4fc30e2f8816
PierreVieira/Python_Curso_Em_Video
/ex067.py
500
4.125
4
""" Exercício Python 067: Faça um programa que mostre a tabuada de vários números, um de cada vez, para cada valor digitado pelo usuário. O programa será interrompido quando o número solicitado for negativo. """ while True: numero = int(input('Digite um número par ver sua tabuada: ')) if numero < 0: bre...
false
721f12d9b18c38fc661d20c3bac9f0d1d52a5e90
PierreVieira/Python_Curso_Em_Video
/ex059.py
932
4.28125
4
""" Exercício Python 059: Crie um programa que leia dois valores e mostre um menu na tela: [ 1 ] somar [ 2 ] multiplicar [ 3 ] maior [ 4 ] novos números [ 5 ] sair do programa Seu programa deverá realizar a operação solicitada em cada caso. """ def exibe_menu(): print('[1] SOMAR') print('[2] MULTIPLICAR') ...
false
7a3415d734459585ed4f3b97d550e1c0284134df
PierreVieira/Python_Curso_Em_Video
/ex011.py
639
4.15625
4
""" Exercício Python 011: Faça um programa que leia a largura e a altura de uma parede em metros, calcule a sua área e a quantidade de tinta necessária para pintá-la, sabendo que cada litro de tinta pinta uma área de 2 metros quadrados. """ largura_parede = float(input('Largura da parede em metros: ')) altura_parede = ...
false
6d513e20684d8ae107909a6641536a3154b00e32
PierreVieira/Python_Curso_Em_Video
/ex005.py
271
4.125
4
""" Exercício Python 005: Faça um programa que leia um número Inteiro e mostre na tela o seu sucessor e seu antecessor. """ numero = int(input('Digite um número: ')) print(f'Analisando o número {numero}, seu antecessor é {numero-1} e o seu sucessor é {numero+1}')
false
fbb95bf72ee99f80cedd361e76ce280ef22556fb
PierreVieira/Python_Curso_Em_Video
/ex065.py
648
4.1875
4
""" Exercício Python 065: Crie um programa que leia vários números inteiros pelo teclado. No final da execução, mostre a média entre todos os valores e qual foi o maior e o menor valores lidos. O programa deve perguntar ao usuário se ele quer ou não continuar a digitar valores. """ lista_numeros = [] while True: li...
false
d8deb644b0bf3f70b789d19a087a6eb6129237bc
PierreVieira/Python_Curso_Em_Video
/ex109/main.py
547
4.15625
4
""" Exercício Python 109: Modifique as funções que form criadas no desafio 107 para que elas aceitem um parâmetro a mais, informando se o valor retornado por elas vai ser ou não formatado pela função moeda(), desenvolvida no desafio 108. """ from ex109 import moedas valor = float(input('Digite o preço: R$ ')) print(f'A...
false
ba5ae12de79a18282aabc202ea58d5e864c72019
PierreVieira/Python_Curso_Em_Video
/ex089.py
2,059
4.28125
4
""" Exercício Python 089: Crie um programa que leia nome e duas notas de vários alunos e guarde tudo em uma lista composta. No final, mostre um boletim contendo a média de cada um e permita que o usuário possa mostrar as notas de cada aluno individualmente. """ from statistics import mean def pegar_nome(): while T...
false