blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
9c83a43e174e983e35825bdee4867d21e9b657e0
daianasousa/Ensinando-com-as-Tartarugas
/Desenhando_estrelas.py
468
4.1875
4
from turtle import * #uma função para desenhar uma estrela #'def' signica 'define' def drawStar(): pendown() begin_fill() for side in range(5): left(144) forward(50) end_fill() penup() #isso vai desenhar uma estrela cinza clara em um fundo azul escuro color("WhiteSmoke") bgcolor("...
false
1b34b710d70edbb88e6c677e35ac5fff7c795232
lkr92/Learning-Projects
/Simple Calculator.py
722
4.34375
4
run = True #Simple Calculator that will run on loop upon user request while run: num1 = float(input("Please type a number: ")) operator = input("Please input an operator character: ") num2 = float(input("Please input a second number: ")) if operator == "+": print(num1 + num2) e...
true
692f27d609c9961bf5feed66b17f29066020467f
yamaton/codeeval
/easy/prime_palindrome.py
1,211
4.125
4
""" prime_palindrome.py Created by Yamato Matsuoka on 2012-07-16. Description ----------- Write a program to determine the biggest prime palindrome under 1000. Input: None Output: Prints the largest palindrome on stdout under 1000. """ import math def integerdigits(n): """Construct list of decimal digits f...
true
886eb287181be88f20433007a08dc93bb7fdd82f
yamaton/codeeval
/hard/grid_walk.py
2,029
4.53125
5
#!/usr/bin/env python # encoding: utf-8 """ grid_walk.py Created by Yamato Matsuoka on 2012-07-19. Description: There is a monkey which can walk around on a planar grid. The monkey can move one space at a time left, right, up or down. That is, from (x, y) the monkey can go to (x+1, y), (x-1, y), (x, y+1), and (x, y-...
true
aa4b8ced0ff163c86e0ddcd53608609a0253c138
yamaton/codeeval
/moderate/jolly_jumpers.py
1,892
4.1875
4
#!/usr/bin/env python # encoding: utf-8 """ jolly_jumpers.py Created by Yamato Matsuoka on 2012-07-17. Description: Credits: Programming Challenges by Steven S. Skiena and Miguel A. Revilla A sequence of n > 0 integers is called a jolly jumper if the absolute values of the differences between successive elements ta...
true
6095a278b6d0625b6c4df3738cdac5805657a1d8
yamaton/codeeval
/moderate/point_in_circle.py2
1,346
4.28125
4
#!/usr/bin/env python # encoding: utf-8 """ point_in_circle.py2 Challenge Description ===================== Having coordinates of the center of a circle, it's radius and coordinates of a point you need to define whether this point is located inside of this circle. ## Input sample Your program should accept as its ...
true
bef391ae6989b5acc9db9e65fa702c8db2e7dd5f
yamaton/codeeval
/easy/capitalize_words.py2
710
4.625
5
#!/usr/bin/env python # encoding: utf-8 """ Challenge Description: Write a program which capitalizes words in a sentence. ## Input sample Your program should accept as its first argument a path to a filename. Input example is the following ``` Hello world javaScript language a letter ``` ## Output sample: Print cap...
true
9fe52d300f8ec8941b028519e78f8ac9a4387da2
yamaton/codeeval
/moderate/cycle_detection.py
2,596
4.125
4
#!/usr/bin/env python # encoding: utf-8 """ cycle_detection.py Created by Yamato Matsuoka on 2012-07-16. Description: Given a sequence, write a program to detect cycles within it. Input sample: A file containing a sequence of numbers (space delimited). The file can have multiple such lines. e.g 2 0 6 3 1 6 3 1 6 ...
true
d4da83831df94855162f5133e602a82621467666
yamaton/codeeval
/moderate/string_rotation.py
835
4.4375
4
#!/usr/bin/env python # encoding: utf-8 """ String Rotation Share on LinkedIn Description: You are given two strings. Determine if the second string is a rotation of the first string. Input sample: Your program should accept as its first argument a path to a filename. Each line in this file contains two comma sepa...
true
8d4ed3c4af0a627a1600f7fea201975bfdbca67e
yamaton/codeeval
/hard/string_list.py
1,689
4.125
4
#!/usr/bin/env python # encoding: utf-8 """ string_list.py Created by Yamato Matsuoka on 2012-07-18. Description: Credits: Challenge contributed by Max Demian. You are given a number N and a string S. Print all of the possible ways to write a string of length N from the characters in string S, comma delimited in al...
true
903201ab083f1fed72d932aa7ae7f1eec9cc8e82
folkol/tutorials
/python3/4.6.functions.py
658
4.3125
4
def fib(n): """Print a Fibonacci series of to n.""" a, b = 0, 1 while a < n: print(a, end=' ') a, b = b, a + b print() fib(100) print(fib.__doc__) def fib_list(n): """Returns a list containing the Fibonacci numbers up to n.""" result = [] a, b = 0, 1 while a < n: ...
true
615fc99fe5103f7a0f9f76ebd0b42272f7804beb
ye-susan/projectEuler
/problem001.py
603
4.28125
4
''' Problem 1: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. ''' sum = 0 for num in range(0, 1000): #if num is divisible by 3 and 5 - add num to sum, else, check that it's d...
true
221cb87c96becce61f3dad6a7fbde4fff4b070eb
BXGrzesiek/Python_Projects
/scripts/fib.py
934
4.3125
4
# script generating a list with fibonacci sequence elements # the user is asked for the number of elements # to reduce the load of computing power, # the list is displayed after all X elements have been generated from time import sleep def fib(n): try: if n == 0: return 0 elif...
true
721e2ff5de164b072bab578c5696097ea5b75453
NielRoman/BSIT302_activity1
/Enployee.py
1,553
4.3125
4
Employee = [] class employ: def __init__(self, name, department, position, rate): self.name = name self.department = department self.position = position self.rate = rate list = True while list: print(""" ************************************ Choose Your Option: [1] Add New Employee's Name [2] Enter Hourly...
true
031f6125cfcc9048ef8ef7826828a3a2fc671d70
spettigrew/cs2-codesignal-mod-quizzes
/problem_solving/postive_sum.py
979
4.25
4
""" Given an array of integers, return the sum of all the positive integers in the array. Examples: csSumOfPositive([1, 2, 3, -4, 5]) -> 1 + 2 + 3 + 5 = 11 csSumOfPositive([-3, -2, -1, 0, 1]) -> 1 csSumOfPositive([-3, -2]) -> 0 Notes: If the input_arr does not contain any positive integers, the default sum should be...
true
f10ab0281a1c0cd70ab11f07d79e37e062f1b0d9
spettigrew/cs2-codesignal-mod-quizzes
/computer_memory_basics/raindrops.py
1,586
4.5625
5
""" Given a number, write a function that converts that number into a string that contains "raindrop sounds" corresponding to certain potential factors. A factor is a number that evenly divides into another number, leaving no remainder. The simplest way to test if one number is a factor of another is to use the modulo ...
true
1bf90ec0db09546d69f3b08820a6f395b60c3716
spettigrew/cs2-codesignal-mod-quizzes
/problem_solving/remove_vowels.py
1,237
4.21875
4
"""Given a string, return a new string with all the vowels removed. Examples: csRemoveTheVowels("Lambda School is awesome!") -> "Lmbd Schl s wsm!" Notes: For this challenge, "y" is not considered a vowel. [execution time limit] 4 seconds (py3) [input] string input_str [output] string """ def csRemoveTheVowels(inpu...
true
ca75c458d27e49fd0f540b9869f75b5831b2d956
cs-fullstack-2019-fall/python-basics2f-cw-LilPrice-Code
/index.py
2,293
4.375
4
import random # Problem 1: # # Write some Python code that has three variables called greeting, my_name, and my_age. # Intialize each of the 3 variables with an appropriate value, # then rint out the example below using the 3 variables and two different approaches for formatting Strings. # # Using concatenation and the...
true
90f8097c9451b5b17d5ee2035206eb7e9dbea17a
SaCut/data_collections
/lists&tuples.py
794
4.1875
4
# creating a list # shopping_list = ["bread", "chocolate", "avocados", "milk"] # # 0 1 2 3 # print(shopping_list) # print(type(shopping_list)) # list indexing # print(shopping_list[0]) # # change a value in the list # shopping_list[0] = "orange" # print(shopping_list) # # add a value to a list # shopp...
true
c99cb40b55ea8c0f8da481e3c76bcc730d882581
lincrampton/pythonHackerRankLeetCode
/swapCase.py
504
4.375
4
'''return a string that has upperCase->lowerCase and lowerCase->upperCase e.g., 'I am Sam I am!" would become "i AM sAM iAM!" def swap_case(s): return_string = "" for i in range(len(s)): if s[i].islower(): return_string += s[i].upper() elif s[i].isupper(): return_s...
true
54482b0ebb8235fb66db096fc1dbe569061751ae
lincrampton/pythonHackerRankLeetCode
/string2npArray.py
284
4.4375
4
'''You are given a space separated list of numbers. Your task is to print a reversed NumPy array with the element type float.''''' linzStr = " 2 3 4 5" linzLst = list(map(int,linzStr.split())) linzLst = linzLst[::-1] import numpy as np linzNp = np.array(linzLst, float) print(linzNp)
true
4616f70fc68c11cfa89707aadd60446df02fd481
luroto/lpthw
/ex6.py
691
4.4375
4
# Setting a first variable types_of_people = 10 # Creating a string using this variable x = f"There are {types_of_people} types of people." #Setting two more variables binary = "binary" do_not = "don't" # Another string using variables and f option y = f"Those who know {binary} and those who {do_not}." # setting vari...
true
607f3a7a2ba239bb519df49d0a40181193290459
Nipun99/COHDCBIS182F-020
/Caeser.py
567
4.5
4
----Code for Encrypting---- plaintext = input('Enter Message :') alphabet="abcdefghijklmnopqrstuvwxyz" key=1 cipher='' for c in plaintext: if c in alphabet: cipher += alphabet [(alphabet.index(c) +key)%(len (alphabet))] print('your encrypted message is :' + cipher) ----Code for Decrypting---- plaint...
false
f27ec99e5fa2e7136bc85e98bc0ff208b21e14b2
MDGSF/PythonPractice
/commonfunction/buildin/any.py
555
4.125
4
#!/usr/bin/env python # -*- coding: UTF-8 -*- # any(iterable) # Return True if any element of the iterable is true. If the iterable is empty, return False. def main(): a_list = [] print(any(a_list)) # False b_list = [True, True] print(any(b_list)) # True c_list = [True, True, False] prin...
true
c98c71fc4004811f052f309a22077b557e24aa85
pranithsrujanroy/cpl-dwm
/test/knn_10p_missing.py
2,648
4.21875
4
# -*- coding: utf-8 -*- """ Created on Tue Sep 11 13:29:39 2018 @author: Student Assignment 5 1. Find a suitable value of k for a given dataset " CAR EVALUATION DATASET". Use the obtained K-value for developing KNN Classifier. Report the classification accuracy. """ import csv #for importing csv data file ...
true
4efe0803924322c8fce38b16d4ece218a8aa8ad3
peefer66/100doc
/day 22_30/Day 30 Error handling & JSON/Start/main.py
625
4.21875
4
# Error catching try: file = open('my_text_file.txt') a_dict = {'key':'value'} print(a_dict['key']) except FileNotFoundError: file = open('my_text_file.txt','w') file.write('Somthing') except KeyError as error_message: print(f'The key {error_message} does not exist') else: content = file.re...
true
0e58e2d7390beb447817ff85d0ac87bb0d942a46
surge55/hello-world
/02-MIT6x/2 Core Elements/for.py
1,165
4.375
4
################################################################################ ## Course: MITx 6.001x - Intro to CS and Programming Using Python ## Student: surge55 ## Date: June 16, 2022 ## Exercise: for ## In this problem you'll be given a chance to practice writing some for loops. #################################...
true
be422176cf425a3cd2d7206f42891b40fb1e35c6
surge55/hello-world
/01-PY4E/01-why_program/wordfind.py
979
4.28125
4
############################################################### ## File Name: wordfind.py ## File Type: Python File ## Author: surge55 ## Course: Python 4 Everybody ## Chapter: Chapter 1 - Why Would you Learn Programming ## Excercise: n/a ## Description: Code walkthrough from book ## Other References: http://...
true
ef39a27ed5643fcec06397894d54eb3965e38863
clairejrlin/stanCode_projects
/stanCode_Projects/boggle_game_solver/anagram.py
2,828
4.1875
4
""" File: anagram.py Name: Claire Lin ---------------------------------- This program recursively finds all the anagram(s) for the word input by user and terminates when the input string matches the EXIT constant defined at line 19 If you correctly implement this program, you should see the number of anagrams for each...
true
0862238765dcbfc1de89586e5e99b8c74db37061
JagadeeshLTTS/Python_assignment_Genesis2021_99004951
/Ass_Qn-14.py
482
4.28125
4
def splitToDigits(number): d=[int(i) for i in number] return d def findLargestNumber(digits_list): digits_list.sort(reverse=True) num=digits_list[0] for i in range(1,len(digits_list)): num=num*10+digits_list[i] return num if __name__ == '__main__': number=input("Enter number: ") ...
false
78dd1d37cdc8033f5f4f1280cd003b5a2fef579a
JagadeeshLTTS/Python_assignment_Genesis2021_99004951
/Ass_Qn-9.py
1,258
4.15625
4
def actualDate(date, month, year): while(month>12 or date>31 or (month==2 and date>29 and year%400==0) or (month==2 and date>28 and year%400!=0)): year=year+(month//12) month=month%12 if(month==1 or month==3 or month==5 or month==7 or month==8 or month==10 or month==12): if(date>...
true
e2e621a2ab8ac4f35abe8535e4f70d51bddf4c99
murtekbey/python-temel
/1-objeler-ve-veri-yapilari/reference.py
605
4.28125
4
# value types => string, integer, float (Numbers) x = 5 y = 25 x = y y = 10 print(x,y) # x değeri hala 25 olarak kalır. # reference types => list a = ["apple", "banana", "lemon"] # a'ya elemanları ekledik. b = ["apple", "peach", "cherry"] # b'ye elemanları ekledik a = b # a'daki listeyi b'deki liste ile eşitleyere...
false
e5737aa69e81287528899376a67fc6e096c9a08f
DmitriiTitkov/python_practice_learning
/ex2/main.py
673
4.28125
4
def divide_numbers(num1, num2): """This function checks if one number can be divided to other without remnant""" if isinstance(num1, int) and isinstance(num2, int): result = num1 % num2 if result == 0: if num2 != 4: print("Number {} can be divided to number {} without...
true
49b3857ebdaac0c5a7c86f4fd92debfcec5f66ff
vibhore-vg/Learning-Python
/advancedExamples/dict_3.py
544
4.25
4
#Python that counts letter frequencies # The first three letters are repeated. letters = "abcabcdefghi" frequencies = {} for c in letters: # If no key exists, get returns the value 0. # ... We then add one to increase the frequency. # ... So we start at 1 and progress to 2 and then 3. freque...
true
827d16eafdd4f252eae58dd02931234d72ec2d52
JarredStanford/Intro-Python-I
/src/14_cal.py
1,249
4.46875
4
""" The Python standard library's 'calendar' module allows you to render a calendar to your terminal. https://docs.python.org/3.6/library/calendar.html Write a program that accepts user input of the form `14_cal.py month [year]` and does the following: - If the user doesn't specify any input, your program should ...
true
567496a8ee5849b1c0d80312f57067b4342d7050
Roberick313/Workshop
/project_4.py
504
4.21875
4
###### Fibonacci number def fibonacci(number): '''This function will calculate the fibonacci of the\n \rEntery parameter''' b = 0 result = '' c = 1 for _ in range(1,number+1): while b < number: result += str(b) + "," b = b+c ...
true
c6ead19db12ad137036599239bcfd0d2c61fdb2e
oryband/code-playground
/sliding-window/medium-truncate-str-by-k.py
2,173
4.15625
4
#/usr/bin/env python """ Given a string constructed from ascii chars and spaces, and a non-negative integer k, truncate the message to size k or less, while also stripping spaces such that the result must end with a word. also, words must not be truncated in the middle. either include whole words or non at all. example...
true
cf77b96341ff986dd35b1c5f3100adbb5752bfe1
iamAdarshh/Data-Structures
/Stack.py
1,317
4.21875
4
#Simple Stack. class EmptyStackError(Exception): pass class Stack: def __init__(self): self.items = [] def is_empty(self): return self.items == [] def size(self): return(len(self.items)) def push(self, item): self.items.append(item) def pop...
false
2c7bb1d9e25306149e166a3d3eb5f35971d35f30
kkundann/Algorithm
/BasicPython.py
677
4.375
4
# developed by van Rossum in 1991 # difference between Python 2 and python 3 # python 2:- print statement is not print_function # python 3: has function and invoked with parantheses # print ("Hello, World.") # # print(type('default string ')) # print(type(b'string with b ')) # # for i in range(0,5): # print(i) #py...
true
a6586ccae2d752536921d497d08d681e72ce182c
H4rliquinn/Intro-Python-I
/src/14_cal.py
1,842
4.53125
5
""" The Python standard library's 'calendar' module allows you to render a calendar to your terminal. https://docs.python.org/3.6/library/calendar.html Write a program that accepts user input of the form `14_cal.py month [year]` and does the following: - If the user doesn't specify any input, your program should ...
true
d3857af92ea1df200f76ed3b09235129a11660b5
alhung/gameoflife
/src/main.py
2,472
4.4375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Game of Life This program is an implementation of Conway's game of life. The purpose of the game is to calculate the next state/generation of a multidimensional grid given an initial state/generation of the grid This implementation resembles a forecasting/prediction...
true
0c957382dea60d860597e4702ecebc35bfab6861
kannan-c1609/Accenture
/38_Upper_and_Lower_case.py
891
4.125
4
""" Single File Programming Question Write a Python program that accepts a string and calculate the number of upper case letters and lower case letters. Input Format: A string in the first line Output Format: Print the original string in the first line. Number of upper case characters in the second line ...
true
22e44b6fbe19de104ad494f2c2bd15532455acf7
kannan-c1609/Accenture
/13_SumOfDivisors.py
579
4.125
4
""" Sum of Divisors Given an integer ‘n’ (1 <= n <= 109), find the sum of its unique divisors. Input Specification: Input 1: the integer ‘n’ Output Specification: Return the sum of divisors of ‘n’. Example 1: Input 1: 6 Output: 12 Explanation: Divisors of 6 are 1, 2, 3 and 6. Sum od number (i.e 1 +...
true
c4e26bd35da92d65d95db31784699242b0cbefee
kannan-c1609/Accenture
/28_Greeting.py
288
4.125
4
""" Create a program that take a name as input and returns a greeting. Examples Input: Gerald Example Output: Hello Gerald! Examples Input: Tiffany Example Output: Hello Tiffany! """ def Greeting(n): return 'Hello ' + n + '!' n = input() print(Greeting(n))
true
8cd48dd8c97dc1a53ada6678bd4cf3d3c1063325
kannan-c1609/Accenture
/33_Maxima_or_minima.py
1,083
4.15625
4
""" Implement the following function: int MaximaOrMinima(int a, int b, int c); Quadratic equation: A quadratic equation is any equation having the form, ax2 + bx + c, where ‘a’ cannot be zero. The function accepts coefficients of a quadratic equation, ‘a’, ‘b’ and ‘c’ as its argument. Implement the function to f...
true
8d8afbe05d6b642fbfcf39aebe148abbb9afc2c7
AmanKishore/CodingChallenges
/Cracking the Coding Interview/Sorting and Searching/GroupAnagrams.py
784
4.34375
4
''' Group Anagrams: Write a method to sort an array of strings so that all of the anagrams are next to each other. ''' def GroupAnagrams(strings): anagrams = {} for i in range(len(strings)): key = "".join(sorted(strings[i].lower())) # get the key by sorting the string if key not in anagrams...
true
32c84bd9254d29fcb27604ae5d501bea536f70ac
AmanKishore/CodingChallenges
/Interview Cake/Recursion and Dynamic Programming/Fibonnaci.py
790
4.375
4
''' Fibonacci: Find the Nth fibonacci number. ''' memo = {0 : 0, 1 : 1} def fib(n): # Compute the nth Fibonacci number if n in memo: return memo[n] else: memo[n] = fib(n-1) + fib(n-2) # Store the newest discovered number return memo[n] def fib_bottom_up(n): if n < 0: ...
false
6a1ae5ee59a0f726995e79ef161e79cf4a5c16de
vardhan-duvvuri/Challange
/ch23.py
230
4.125
4
def reverseLookup(dictionary, value): output = [] for key,val in dictionary.iteritems(): if val == value: output.append(key) return sorted(output) if __name__ == "__main__": print reverseLookup({'a':1, 'b':2, 'c':2}, 2)
true
1d6bc423fc32cec33981e5c4a10b61d59959ddf7
jb4503/PHYS4100_JBermeo
/Problem2.py
1,648
4.40625
4
import math import argparse import sys # A spaceship travels from Earth in a straight line at relativistic speed v to another planet x light years away. # Write a program to ask the user for the value of x and the speed v as a fraction of the speed of light c, # then print out the time in years that the spaceship take...
true
cd260a299fd88a32a46742e90355b1a9db4657d5
jb4503/PHYS4100_JBermeo
/PHYS4100_HW1.py
930
4.3125
4
import math import argparse # A ball is dropped from a tower of height h with initial velocity zero. # Write a program that asks the user to enter the height in meters of the tower # and then calculates and prints the time the ball takes until it hits the ground, # ignoring air resistance. Use your program to calculate...
true
b04dc337d96da4ef5c88ce017fc99f81160721f6
JaySwitzer/InformationTechnology
/calculator.py
414
4.28125
4
num1 = int(input("Enter Number 1: ")) num2 = int(input("Enter Number 2: ")) oper = input ("Enter the operator:") if oper == "*": ans = num1 * num2 print (num1,oper,num2,"=",ans) elif oper == "/": ans = num1 / num2 print (num1,oper,num2,"=",ans) elif oper == "+": ans = num1 + num2 print (num1,...
false
b416ec27c7e16d158e89b82a96d32a7c190c728e
Duk4/Microsoft-Python-for-beginners
/complex_conditions.py
488
4.1875
4
gpa = float(input('What was your Grade Point Average? ')) lowest_grade = float(input('What was your lowest grade? ')) # if gpa >= 0.85: # if lowest_grade >= 0.70: # print('You made the honour role!') # if gpa >= 0.85 and lowest_grade >= 0.70: # print('You made the honour role!') if gpa >= 0.85 and lo...
false
a2e1faf19f6a4f1bafdeddeb05cd070b95900bd2
Duk4/Microsoft-Python-for-beginners
/nums.py
645
4.21875
4
# pi = 3.14159 # print(pi) # first_number = 6 # second_number = 2 # print(first_number + second_number) # print(first_number ** second_number) # first_number = input('Enter first number: ') # second_number = input('Enter second number: ') # print(first_number + second_number) you get a string # print(first_number ** ...
true
5840505b583e8a27ad247cac1e3dc56447c3ed46
jrcolas/Learning-Python
/100DaysBootcamp/Day12/numberGuessing.py
1,450
4.15625
4
from art import logo from random import randint import os EASY_GUESS = 10 HARD_GUESS = 5 randomNumber = randint(1,100) os.system('cls') print(logo) print("Welcome to the Number Guessing Game!") print("I'm thinking of a number between 1 and 100.") difficulty = input("Choose a difficulty. Type 'easy' or 'hard': ").l...
true
3503bbf670e20960ffb54294ae13695cbbdb3de2
Michaelllllll25/Python-Learn
/Lists.py
2,435
4.34375
4
######################################### 5.1. Creating a list empty_list = [] empty_list #[] another_empty_list = list() another_empty_list #[] odd_nums = [1, 3, 5, 7, 9] odd_nums #[1, 3, 5, 7, 9] my_friends = ["Jim", "Joe", "Sally"] my_friends #['Jim', 'Joe', 'Sally'] vowels = ['a', 'e', 'i', 'o', 'u'] vowels #['a', ...
false
2846974b37536874fc1b2fe56ea204171fcd66b1
surajsomani/Basic_Python
/Python Basics/22_Reading_CSV.py
1,244
4.46875
4
import csv #library to handle csv files with open('example.csv') as csvfile: #naming the file as csvfile readCSV = csv.reader(csvfile, delimiter=',') #reading the file for row in readCSV: #reading each row print(row) #print all columns in 1st row print(row[0]) #print 1st column Here also index s...
true
0b798c3c17c0b3302603edc792beb7c7ef9701cb
ferasmis/Repeated-Number-Finder-In-A-List
/RepeatedNumberList.py
241
4.15625
4
## Author: Feras ## Description: A program that finds repeated values in a list def repeated(myList): for i in myList: if myList.count(i) > 1: return i print("The repeated number is: ", repeated([1,2, 45, 67, 45]))
true
ffc6e2fda607020f9c8f320cb42a607e79d7f44b
shawl6201/CTI110
/P3T1_AreasOfRectangles_LeslieShaw.py
748
4.5
4
#CTI-110 #P3T1- Areas of Rectangles #Leslie Shaw #October 6, 2018 #This program is to determine which rectangle has the greater area #Get the length and width of rectangle 1 length1=int(input('Enter the length of rectangle 1:')) width1=int(input('Enter the width of rectangle 1:')) #Get the length and widt...
true
cc909d85ba280a5dc383da83f73abdec347a00aa
77kHlbG/Python
/CeaserCypher.py
1,123
4.21875
4
#!/usr/bin/python -tt import sys # Define a main() function def main(): rotation=1 # Get cyphertext from user cyphertext = input('Enter cyphertext: ') plaintext = cyphertext cyphertext = cyphertext.upper() print('\n') print('Performing Rotation Cypher...') # Repeats for all 25 possible rota...
true
0f05e0f4891bf5964df0b986d46e195c8571825f
BrianHarringtonUTSC/CMS-URG
/VideoStyleDifferences/Lecture_4/functions.py
1,332
4.34375
4
''' You are building a login system for your new app. In order to protect the users, you require their password to have certain propoerties, they are listed below: 1. Must be at least 8 characters long 2. Must have at least 1 uppercase letter 3. Must have at least 1 lowercase letter 4. Must have at lea...
true
a81fc2dd8f67097c6d8b3e4ac6c35e2961665bac
lichader/leetcode-challenge
/problems/median_of_two_sorted_arrays.py
1,832
4.125
4
""" There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may assume nums1 and nums2 cannot be both empty. Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nu...
true
4c0e01485636e314bc7356fda4bf0c77e8f71757
SergioO21/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/2-matrix_divided.py
1,591
4.3125
4
#!/usr/bin/python3 """ matrix_divided function """ def matrix_divided(matrix, div): """ # Divides all elements of a matrix. Args: matrix (list) = The matrix div (int) = Matrix divisor - ``matrix`` must be a list of lists of integers or floats, otherwise raise a ``TypeError`` ex...
true
e8b1f3c9dd3e97b74d37ca22c4b88403954ff202
SergioO21/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/tests/6-max_integer_test.py
2,299
4.1875
4
#!/usr/bin/python3 """ Unittest for ``max_integer`` function """ import unittest max_integer = __import__('6-max_integer').max_integer class test_max_integer(unittest.TestCase): """ # unittests for the function ``max_integer(list=[])`` """ def test_one_argument(self): self.assertEqual(max_in...
false
808811951c539c67504735063f407442135aa7d9
meighanv/05-Python-Programming
/LABS/Threading/multithreading.py
1,309
4.21875
4
""" Running things concurrently is known as multithreading Running things in parallel is known as multiprocessing I/O bound tasks - Waiting for input and output to be completed, reading and writing from file system, network operations These all benefit more f...
true
4a23b8eca75e3ab4d85135818bf5c496292894d4
meighanv/05-Python-Programming
/LABS/Labs-3-4/lab3-4-9-shipCharge.py
1,160
4.21875
4
#Setting up main function def main(): #Calling Charge function passing result of the getWeight function as an argument calcCharge(float(getWeight())) #Defining function to capture and validate the user's input of the number of packages purchased def getWeight(): #Getting initial input packageWeight = i...
true
37c5c209079b920c816c6a06442630b6ee933fe2
meighanv/05-Python-Programming
/LABS/Classes/cellphone.py
2,698
4.5
4
""" Wireless Solutions, Inc. is a business that sells cell phones and wireless service. You are a programmer in the company’s IT department, and your team is designing a program to manage all of the cell phones that are in inventory. You have been asked to design a class that represents a cell phone. The data that sh...
true
3e52bda4af910dccd9710c8d2bfd86388fe4fe07
meighanv/05-Python-Programming
/LABS/recursion/rec-lines.py
442
4.53125
5
""" 3. Recursive Lines Write a recursive function that accepts an integer argument, n. The function should display n lines of asterisks on the screen, with the first line showing 1 asterisk, the second line showing 2 asterisks, up to the nth line which shows n asterisks. """ def main(): recLines(7) d...
true
d00a40884ba51cd5e12a01541e6dd828b884088a
meighanv/05-Python-Programming
/LABS/Classes/animals.py
1,084
4.125
4
class Mammal: # Initializing Mammal object attributes def __init__(self, species): self.__species = species def show_species(self): print('I am a ', self.__species) def make_sound(self): print('Grrr') class Dog(Mammal): # Initializing Dog subclass object attributes de...
false
6963e9b7069b8bcd986331c1fe8a244eca289398
meighanv/05-Python-Programming
/LABS/DICTIONARIES-SETS/dict-set-wordcount.py
1,981
4.4375
4
#This program is to grab all the unique words in a file. def main(): #this is the dictionary to store a word count for each unique word wordcount = {} #Stores the lines of the file specified by the user source = readFile() #This calls the function to extract all the words from a file words ...
true
9274734c6e50e164d86eb699a38088f1c6259aa1
meighanv/05-Python-Programming
/LABS/Labs-3-4/lab3-4-8-Discount.py
1,400
4.21875
4
#Setting up main function def main(): #Calling Discount function passing result of the numPurchase function as an argument calcDiscount(int(numPurchase())) #Defining function to capture and validate the user's input of the number of packages purchased def numPurchase(): #Getting initial input packages ...
true
11fbcfd7fa221cccbb29bb6c115b4a4abee7903d
meighanv/05-Python-Programming
/LABS/Classes/cashregister.py
2,056
4.46875
4
""" 7. Cash Register This exercise assumes that you have created the RetailItem class for Programming Exercise 5. Create a CashRegister class that can be used with the RetailItem class. The CashRegister class should be able to internally keep a list of RetailItem objects. The class should have the foll...
true
041e263bf20440e54deb57f50d18db2dc7586953
yohn-dezmon/python-projs
/mad_lib_git.py
734
4.53125
5
# Prompt user for their name name = input("What is your name? ") # Greeting with users name print(f'''Hey {name}! Welcome to Mad Libs the program! Please provide us with...''') # Prompt user for a noun, adjective, and verb(ING) noun = input("A noun: ") adj = input("An adjective: ") verb = input("A verb ending in ing...
true
f97b49d71868b3e45bfb79f831aecf16dc1f5d6a
aishsharma/Karan-Projects
/Solutions/Numbers/Prime_Factorization.py
1,272
4.3125
4
""" Author: Aishwarya Sharma Question: Prime Factorization - Have the user enter a number and find all Prime Factors (if there are any) and display them. """ from math import sqrt from typing import List # Tests if a number is prime or not. Uses simple formula for test. def is_prime(n: int)->bool: i...
true
bad3f3bc881470c895cf0ea118bd2192a29b381a
jeff87b/Python-module-1
/Day 1-5/007 The area of a square with if and else.py
405
4.28125
4
print ("This program calculates the area of a square.") side1 = float(input("Enter side number one: ")) side2 = float(input("Enter side number two:")) print("The area is:", side1*side2) if side1<0: print("You have entered a negative first number") else: print("The first number is ok") if side2<0: print("Yo...
true
2f218b9f31c503b5ff1ed49b311a44a8e1e9c31b
jeff87b/Python-module-1
/Day 6-10/Day 8/02.py
316
4.125
4
yearEntered = int(input("Enter a year: ")) def isLeapYear(year_entered): leapYearAlg = year_entered % 4 moreLeapYearAlg = year_entered % 100 if leapYearAlg == 0 and moreLeapYearAlg == 0: print("Yes it's a leap year") else: print("No, it's not a leap year") isLeapYear(yearEntered)
false
0bd2d83a82395c518a0860e6d490dfad023e8b3d
katharinameislitzer/smartninjacourse
/Class3_Python3/example_01210_read_analyse_exercise_solution.py
422
4.15625
4
# open the file "height.txt" # it contains the height of each person in the class # separated by a come "," # write a program which reads the file # saves the different heights in a list # and calculates the average height with open("height.txt") as file: a = file.read().split(",") height_avg=0 number_of_people=...
true
7ead56c5eff91f2c77a07160363211d7c124d579
katharinameislitzer/smartninjacourse
/Class1_Python3/example_0500_calculator_excercise_2.py
899
4.375
4
# print welcome to user name = input("Please enter your name: ") print(f"Welcome {name}") # read user input for operation operation = input("Please enter a mathematical sign (+, -, *, /): ") print(f"You entered {operation}") # read user input for first value first_value = int(input("Please enter number one: ")) print(f...
true
a8ad2f52a50cc7be3a9fc3f86c6a206bc1369e11
HaoxuZhang/python-learning
/some-tests/iter.py
245
4.25
4
list=[1,2,3,4] it=iter(list) print(next(it)) print(next(it)) for x in it: print(x,end=" ") #该函数输出为 ''' 1 2 3 4 ''' #iter返回的是一个迭代器,第一次使用next函数会让迭代器指向第一个元素并且保存位置
false
550dd8ab9ba9d4ad3527ed8461efa4623fc6497a
pransil/skLearnMnistViz
/plot_mnist_filters.py
2,337
4.28125
4
""" ===================================== Visualization of MLP weights on MNIST ===================================== Sometimes looking at the learned coefficients of a neural network can provide insight into the learning behavior. For example if weights look unstructured, maybe some were not used at all, or if very l...
true
3bc4c4a6489d517288488c4bc1c33802177a65cc
Mpreyzner/python_algorithms
/n_queens.py
2,564
4.3125
4
# The N Queen is the problem of placing N chess queens on an N×N chessboard # so that no two queens attack each other. # 1) Start in the leftmost column # 2) If all queens are placed # return true # 3) Try all rows in the current column. Do following for every tried row. # a) If the queen can be placed safel...
true
a4061d17e097fc2a7753ce54998eac01619272b1
simransidhu8/C98---Functions
/countWordsFromFile.py
299
4.28125
4
def countWordsFromFile() : fileName = input("Enter file name: ") numberOfWords = 0 f = open(fileName) for line in f : words = line.split() numberOfWords = numberOfWords + len(words) print("Number of words: ") print(numberOfWords) countWordsFromFile()
true
0da0ed62861394a7c4f59eb442dc4a77e1f810fc
Pycone/Python-for-Beginners
/src/ch4/ch4.py
1,350
4.28125
4
''' List example ''' numbers = [1, 2] numbers.append(3) numbers.remove(3) len(numbers) numbers.pop() numbers = [5, 7, 1, 2, 3] numbers.sort() numbers[0] numbers[1] numbers[2] = 'hello python' print (numbers) numbers = [[1,2,3],[4,5,6]] students = [] students.append(['David', 123, True]) students.append(['Hubert', 321...
false
862fbb1580e0dd290a61dae003c552128fe97c64
HunterLaugh/codewars_kata_python
/kata_4_Validate_Sudoku_with_size_N_N.py
2,053
4.125
4
''' 4 kyu Validate Sudoku with size `NxN` Given a Sudoku data structure with size NxN, N > 0 and √N == integer, write a method to validate if it has been filled out correctly. The data structure is a multi-dimensional Array(in Rust: Vec<Vec<u32>>) , ie: [ [7,8,4, 1,5,9, 3,2,6], [5,3,9, 6,7,2, 8,4,1...
true
d720678c5d305947059da4ea89fa966aeecd0b51
HunterLaugh/codewars_kata_python
/kata_6_Format_words_into_a_sentence.py
1,028
4.21875
4
''' Format words into a sentence Complete the method so that it formats the words into a single comma separated value. The last word should be separated by the word 'and' instead of a comma. The method takes in an array of strings and returns a single formatted string. Empty string values should be ignored. Empty arr...
true
e782a8a494d70e5f2d4b0000b1f1d2658513b2ee
HunterLaugh/codewars_kata_python
/kata_5_Regex_for_Gregorian_date_validation.py
1,115
4.15625
4
''' Regex for Gregorian date validation Your task is to write regular expression that validates gregorian date in format "DD.MM.YYYY" Correct date examples: "23.12.2008" "01.08.1994" Incorrect examples: "12.23.2008" "01-Aug-1994" " 01.08.1994" Notes: maximum length of validator is 400 charac...
true
3936d910807507e628b4a0ef156a3a8f9eac24eb
HunterLaugh/codewars_kata_python
/kata_8_Who_ate_the_cookie.py
879
4.5625
5
''' 8 kyu Who ate the cookie For this problem you must create a program that says who ate the last cookie. If the input is a string then "Zach" ate the cookie. If the input is a float or an int then "Monica" ate the cookie. If the input is anything else "the dog" ate the cookie. The way to return the stateme...
true
91ce21140d3ef1fc0a0aa0771979746d4fb330b9
Wallkon/Ejercicios-de-The-Python-Workbook
/Exercise_12_Distance_Between_Two_Points_on_Earth.py
1,929
4.5625
5
""" The surface of the Earth is curved, and the distance between degrees of longitude varies with latitude. As a result, finding the distance between two points on the surface of the Earth is more complicated than simply using the Pythagorean theorem. Let (t1, g1) and (t2, g2) be the latitude and longitude of two point...
true
b98068b9164c4daa471c65ea6ec25082dd26db0f
EDalSanto/ThinkPythonExercises
/cartalk1_triple_double.py
594
4.375
4
fin = open("ThinkPython/words.txt") def triple_double(word): """Tests if a word contains three consecutive double letters""" i = 0 doubles = 0 while i < len(word)-1: if word[i] == word[i+1]: doubles += 1 if doubles == 3: return True i += 2 ...
true
9bd1d9c2a6a087a028eed2119926ea5bc3f94811
Hammad-Ishaque/pydata-practise
/DesignPatterns/FactoryPattern.py
868
4.125
4
from abc import ABCMeta, abstractmethod # What particular instance to create class IPerson(metaclass=ABCMeta): @abstractmethod def person_method(self): """ :return: """ class Student(IPerson): def __init__(self): self.name = "I am Student" def person_method(self):...
true
53fe220d2fcb589571740e9f1998c8977385b350
KazZBodnar/pythoncalc
/main.py
1,793
4.3125
4
import math #help = input("PythonCalc V 1.0; Say 'help' for more info, and 'ready' to start the calculator.") #if help== "help" or "Help": # print("Signs: '+', '-', '*', '/', '^2', 'sqrt', '^3', '!', 'power'.") #else: print("PythonCalc V 1.0 type help for a list of commands") sign = input("What sign should I use?") if...
true
eb39c96d98e1e0813a65215471616a5fe75c71ad
hermineavagyan/OOP
/userClass.py
2,077
4.125
4
class User: #defining a class attriute bank_name = "First Dational Dojo" #creating the class constructor def __init__(self, name, email_address): self.name = name self.email = email_address self.account_balance = 0 # increases the user's balance by the amount specified def make_depo...
true
c069162616ae7c88cd340cf425e63b90e0770f46
cs-fullstack-2019-spring/python-loops-cw-leejr1983
/PythonLoopsCW.py
1,708
4.34375
4
from _ast import If def main(): # problem1() #problem2() #problem3() problem4() # Exercise 1: # Print -20 to and including 50. # Use any loop you want. def problem1(): for numbers in range(-20,51): print (numbers) # Exercise 2: # Create a loop that prints even numbers from 0 to ...
true
50249cbfbfd0eb2e6a64cb97c00743ad91541cdf
Prabithapallat01/pythondjangoluminar
/flow_controls/looping/samlefor.py
343
4.125
4
#for i in range(start,stop): #loop body #for i in range(1,10): #print(i) #for i in range (10,0,-1): # print(i) # to print total of first 50 numbers #total=0 #for i in range(1,51): # total=total+i #print(total) # to print given number is prime or not #to print allprime numbers btwn 5 to 50 #low=5 #upperl...
true
59793bcf0f03f686239659306a7df2e18d72335a
chefmohima/python
/stack_list_implement.py
938
4.125
4
class Stack: #list-based stack implementation def __init__(self): self.items = [] def is_empty(self): return self.items == [] def size(self): return len(self.items) def push(self,item): self.items.append(item) def p...
false
fb167dcdd270d019402443230887932aecdd3ed4
cs-fullstack-2019-fall/codeassessment2-LilPrice-Code
/q3.py
708
4.40625
4
# ### Problem 3 # Given 2 lists of claim numbers, write the code to merge the 2 lists provided to produce a new list by alternating values between the 2 lists. Once the merge has been completed, print the new list of claim numbers (DO NOT just print the array variable!) # ``` # # Start with these lists # list_of_claim_...
true
29e7eb490b503b8ce6f4c6ff9f582ef9e2163913
AmelishkoIra/it-academy-summer-2021
/task1_hw4.py
1,423
4.5
4
"""Функции из Homework4 для тестирования""" def compare_lists(list_one, list_two): """ Функция считает, сколько различных чисел содержится одновременно как в первом списке, так и во втором. """ compare = list_one & list_two return len(compare) def compare_lists_difference(list_...
false
462c756db5826b1b0586f32e6bc0687f85128719
Leg3nd3/Project_97
/guessNumber.py
426
4.25
4
import random number = random.randint(1, 5) guess = int(input("Enter a number from 1 to 5: ")) while number != "guess": print if guess < number: print("Guess is low") guess = int(input("Enter a number from 1 to 5: ")) elif guess > number: print("Guess is high") gues...
true
6184fe53341c9eb095ec008871ae31ecf8f5219e
nadiamarra/learning_python
/triangle.py
776
4.28125
4
def area(base,height): """(number,number)-> number Return the area of a triangle with dimensions base and height. >>>area(10,5) 25.0 >>>area(2.5,3) 3.75 """ return base*height/2 def perimeter(side1,side2,side3): """(number,number,number) -> number Return the perimeter of a t...
true
8a68d28e002f59a91c15da4bf2a283958fbf7857
nadiamarra/learning_python
/rock_paper_scissors_against_computer.py
1,696
4.15625
4
import random player_wins=0 computer_wins=0 while player_wins<2 and computer_wins<2: print("rock...\npaper...\nscissors...") print(f"Player Score:{player_wins} Computer Score:{computer_wins}") player=input("Player, make your move: ") rand_num=random.randint(0,2) if rand...
true
39148beb2114fccdf719e143a4da66607eee1b22
nadiamarra/learning_python
/invert_dict.py
962
4.21875
4
fruit_to_colour={ 'banana':'yellow', 'cherry':'red', 'orange':'orange', 'pear':'green', 'peach':'orange', 'plum':'purple', 'pomegranate':'red', 'strawberry':'red' } #inverting fruit_to_colour colour_to_fruit={} #accumulator set as the new dict name ...
true