blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
02467d255c9184e51c2fd62edd052e5a9dd1a5dd
danieltshibangu/Mini-projects
/rand_file_writer.py
793
4.3125
4
# this program will print a user specified amount # of random numbers to the random_numbers.txt file # import the random module import random # state the variables used num_of_rand = 0 random_num = 0 # state the constants RAND_MAX = 500 def main(): # create variable for user input num_of_rand = int( input( ...
true
9c4aea9dd5ed5b7f1ebc7f69cc058032e0582d4d
subash-sunar-0/python3
/Assignment1.py
815
4.25
4
#WAP that ask user to enter their name and their age.print out a message address to them that tells them the year they will turn 100 years old try: name = str(input("please enter your name:" )) age = int(input("Please enter your age: ")) num = 100-age if age >=100: print(name, "...
true
ca327674cf6069bd0628d2ffb013bc021e5b2b5b
Tulip2MF/100_Days_Challenge
/day_010/number_of_days.py
716
4.125
4
def divisionFunction(year): if (year % 4) == 0: if (year % 400) == 0: return True elif (year % 100) == 0: return False else: return True else: return False def days_in_month(year, month): leap_year = divisionFunction(year) month_days ...
true
b0d6a2da26dbb9753984c4e809ecd416bda12714
defaults/algorithms
/Python/Geometry/orientation_of_3_ordered_points.py
1,858
4.15625
4
# coding=utf-8 from __future__ import print_function """ Orientation of an ordered triplet of points in the plane can be 1. counterclockwise 2. clockwise 3. collinear If orientation of (p1, p2, p3) is collinear, then orientation of (p3, p2, p1) is also collinear. If orientation of (p1, p2, p3) is clockwise, then orie...
true
1b6a6723c48abfd90938356ffd29f520c346c55f
thevolts/PythonSnippets
/Day_of_the_week.py
319
4.25
4
# Python program to Find day of # the week for a given date import datetime import calendar def findDay(date): born = datetime.datetime.strptime(date, '%d %m %Y').weekday() return (calendar.day_name[born]) # Driver program date = '03 02 2019' date = str(input("Enter Date :")) print(type(date)) print(findDay(date))
true
f43ab77e2049e5525b260811534d8e925a66b45b
ViRaL95/HackerRank
/strings/find_maximum_consecutive_repeating.py
1,211
4.3125
4
def find_max_consecutive(string): """ This method finds the largest consecutive characters in a string. It does this by having a previous and a current 'pointer' which checks if they are equal. If they are equal we can increase a count and check if its value is greater than max_. If it is we update...
true
4f9d9ba09b4835ccef2fd4aac4a76296be2250bc
dmitchell28/Other-People-s-Code
/quessing a number.py
815
4.28125
4
from random import randint print ("In this program you will enter a number between 1 - 100." "\nAfter the computer will try to guess your number!") number = 0 while number < 1 or number >100: number = int(input("\n\nEnter a number for the computer to guess: ")) if number > 100: print...
true
131534c10785852aad6b7b75f442f7b2d3708e37
amnaamirr/python-beginners
/volume-of-sphere.py
246
4.3125
4
"""Write a python program to get the volume of a sphere, take the radius as input from user. V = 4/3 πr3""" import math radius = float(input("ENTER RADIUS: ")) pi = math.pi volume = 4/3*(pi)*(radius**3) print("THE VOLUME OF SPHERE IS",volume)
true
79e4531c7cddbe0819ed8f25f947271b43a0a7fe
amnaamirr/python-beginners
/checking-palindrome.py
461
4.1875
4
"""Write a program to check whether given input is palindrome or not """ # palindrome is a number which reads the same forward or backward num = (input("ENTER A NUMBER: ")) reverse_num = num[::-1] while int(num) > 9: if num == reverse_num: print(f"THE NUMBER {num} IS A PALINDROME!") break ...
true
83d52ed13f38fe1a7a8a56676fbdd2df539ebb42
16030IT028/Daily_coding_challenge
/SmartInterviews/SmartInterviews - Basic/044_Half_Diamond_pattern.py
654
4.21875
4
# https://www.hackerrank.com/contests/smart-interviews-basic/challenges/si-basic-print-half-diamond-pattern/problem """ Print half diamond pattern using '*'. See example for more details. Input Format Input contains a single integer N. Constraints 1 <= N <= 50 Output Format For the given integer, print the half ...
true
857582fbc152c5f27e6203ff838284f458161dba
16030IT028/Daily_coding_challenge
/SmartInterviews/047_Swap_Bits.py
1,551
4.15625
4
# https://www.hackerrank.com/contests/smart-interviews/challenges/si-swap-bits/problem """ Given a number, swap the adjacent bits in the binary representation of the number, and print the new number formed after swapping. Input Format First line of input contains T - number of test cases. Each of the next T lines c...
true
5f3742149ccb7d2f09cf2233de28e7339cd30777
16030IT028/Daily_coding_challenge
/InterviewBit/005_powerOfTwoIntegers.py
662
4.15625
4
# https://www.interviewbit.com/problems/power-of-two-integers/ """Given a positive integer which fits in a 32 bit signed integer, find if it can be expressed as A^P where P > 1 and A > 0. A and P both should be integers. Example Input : 4 Output : True as 2^2 = 4. """ import math def isPower(n): if n == 1: ...
true
a3f07f91380d0e530fb44c94b28f84855efba2f0
16030IT028/Daily_coding_challenge
/Algoexpert-Solutions in Python/Group by Category/Recursion/001_powerset.py
1,210
4.4375
4
# https://www.algoexpert.io/questions/Powerset """ ​ Powerset ​ Write a function that takes in an array of unique integers and returns its powerset. The powerset P(X) of a set X is the set of all subsets of X. For example, the powerset of [1,2] is [[], [1], [2], [1,2]]. Note that the sets in the powerset do not need ...
true
302f512a87c8f0dbd29c36cd9326e1ba73ab95e4
JacobJustice/Sneer
/sneer
2,956
4.21875
4
#! /usr/bin/python3 import sys import getopt # # sneer_default # # parameters: # word -word in the input string that the character you are considering to # upper or lower is from # index-index of the character you are considering to upper or lower # # return: # boolean (capitalize this character or not) # # paramet...
true
d9180832982a0a6edae7e16eacedb63e2a31f643
s-ankur/cipher-gui
/vigenere.py
1,111
4.21875
4
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ The Vigenère cipher is a method of encrypting alphabetic text by using a series of interwoven Caesar ciphers, based on the letters of a keyword. It is a form of polyalphabetic substitution. """ import random from itertools import cycle from collections import Counter impor...
true
66ce3651849839bafd55e0d1fe26eac975fb6ab5
s-ankur/cipher-gui
/caesar.py
2,164
4.21875
4
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D woul...
true
a50d97b6cea7967ac59ac5654f7cc23c4c5ff17d
mehedi-hasan-shuvon/python-ML-learing
/6.py
226
4.125
4
#........if else statements......... number =int (input ("enter your marked: ")) print(number) if number>=90 and number<=100: grade='A' elif number>=80: grade='B' else: grade='fail' print("the grade is" ,grade)
true
9c610e215d10acf6066a03c14a1d7afbc09a3903
beardedsamwise/AutomateTheBoringStuff
/Chapter 7 - Regexes/practiceQuestions.py
1,227
4.34375
4
import re # Question 21 # Write a regex that matches the full name of someone whose last name is Watanabe. # You can assume that the first name that comes before it will always be one word that begins with a capital letter. watanabeRegex = re.compile(r'([A-Z])(\w)+(\s)Watanabe$') print(watanabeRegex.search('haruto ...
true
26436225c9a4d34240e231b93ddf065ec78cdd0c
beardedsamwise/AutomateTheBoringStuff
/Chapter 7 - Regexes/passwordComplexity.py
1,387
4.4375
4
# Write a function that uses regular expressions to make sure the password string it is passed is strong. # A strong password is defined as one that is at least eight characters long, contains both uppercase and lowercase characters, and has at least one digit. import re def passStrength(password): capsRegex = re...
true
896f9f9eb299255024397cf01780615bfbb5e232
iamstmvasan/python_programs
/BinaryGap.py
953
4.1875
4
#BinaryGap #Find longest sequence of zeros in binary representation of an integer. ''' given a positive integer N, returns the length of its longest binary gap. The function should return 0 if N doesn't contain a binary gap. For example, given N = 1041 the function should return 5, because N has binary representation ...
true
8ca9ccbcc5fd6f66be9a640eb69332ced45ee797
Dfmaaa/transferfile
/Python31/factorial_finder.py
277
4.4375
4
print("This app will find the factorial of the number given by you.") def factorial(n): if n == 0: return 1 else: return n * factorial(n-1) n=int(input("Input a number to compute the factiorial : ")) print(factorial(n)) import factorial_finder
true
42c189f912652267b1bcfb2638774364f9ecfb11
foldsters/learn-git
/example.py
1,537
4.25
4
# # Decription: This program will analize the upper and lower case content of # a given string. # sampleString = ("We the People of the United States, in Order+ to form a more perfect Union," " establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare," " and secure ...
true
3ed20ff3deb2c1950cdbbf5e474f2d7b8003db5d
HoussemCharf/FunUtils
/Searching Algorithms/binary_search.py
775
4.125
4
# # Binary search works for a sorted array. # Note: The code logic is written for an array sorted in # increasing order. # T(n): O(log n) # def binary_search(array, query): lo, hi = 0, len(array) - 1 while lo <= hi: mid = (hi + lo) // 2 val = array[mid] if val == query: ...
true
5cd6988aca1ca186b582e812a4c19bc40021d1d3
CruzJeff/CS3612017
/Python/Exercise3.py
1,448
4.4375
4
# -*- coding: utf-8 -*- """ Created on Mon Nov 27 13:44:36 2017 @author: User """ '''Very often, one wants to "Cast" variables of a certain type into another type. Suppose we have variable x = '123', but really we would like x to be an integer. This is easy to do in python, just use desiredtype(x) e.g. int(...
true
17223ef9ccbbfb48804dcbdcc8e544293f5c8c20
wsegard/python-bootcamp-udemy
/python-bootcamp/01-Nbers.py
612
4.28125
4
# Addition print(2+1) # Subtraction 2-1 # Multiplication 2*2 # Division 3/2 # Floor Division 7//4 # Modulo 7%4 # Powers 2**3 # Can also do roots this way 4**0.5 # Order of Operations followed in Python 2 + 10 * 10 + 3 # Can use parentheses to specify orders (2+10) * (10+3) # Let's create an object called "a" and assign...
true
205f7076b1b29a348c317117854b9b87751f6bb8
zaid-kamil/DP-21-PYTHON-DS-1230
/functions_in_python/param_fun1.py
777
4.25
4
# parameterized functions take input when you call them # there are 5 ways to call a parameterized function # 1. with required parameters ✔ # 2. with keyword/named parameters ✔ # 3. with default parameters ✔ # 4. with variable arguments ✔ # 5. with keyword arguments ✔ ###################################################...
true
9d7f39be8a14a8010e7cc3652024793e8ba65a9c
zumerani/Python
/Classes and Objects/inheritance.py
1,815
4.125
4
class Student: def __init__(self , name , school): self.name = name self.school = school self.marks = [] def average(self): return sum(self.marks) / len(self.marks) @classmethod def friend(cls , origin , friendName , salary): #return a new Student called 'friend...
true
8e467824df7bbab58d2f56478b1311cfe79a5bc7
HalynaMaslak/Python_for_Linguists_module_Solutions
/Frequency_Brown_corpus.py
1,121
4.375
4
# -*- coding: utf-8 -*- """ Create a program that: Asks for a word; Checks whether it is more frequent as a Noun or a Verb in the Brown corpus. Display a message if it does not appear as a noun or a verb in the Brown corpus. """ from nltk.corpus import brown print('The program checks whether the entered word is more fr...
true
3e1a7e19c27eda447d07c27f8ee641f5c384f4bf
mnaiwrit52/git-practice
/fibonacci.py
693
4.28125
4
#This code helps in generating fibonacci numbers upto a certain range given as user input # f1 = 0 # f2 = 1 # n = int(input("Enter the range: ")) # print(f1,f2,end=' ') # for count in range(2,n): # f3 = f1 + f2 # print(f3,end=' ') # f1 = f2 # f2 = f3 def fibo_series(num): f1 = 0 f2 = 1 co...
true
d429b8cdd4993081ced30d6e7d663a737d4adc54
claeusdev/Python-basics
/chapter 4/ques3.4.py
562
4.15625
4
temp = float(input('enter a temperature in Celsius:')) if temp < -273.15: print ('The temperature is invalid because it is below absolute zero') if temp == -273.15: print('the temperature is absolute 0') if -273.15 < temp < 0: print('the temperature below is freezing') if temp == 0: print('the t...
true
39510b515c5c1bc0feb29b00bb5196a26809f907
MrWillian/BinarySearch
/binarySearch.py
615
4.125
4
# Returns index of x in array if present def binarySearch(array, l, r, x): # check base case if r >= l: middle = l + (r - l)//2 #Get the middle index # If element is present at the middle returns itself if array[middle] == x: return middle # If element is smaller than middle, then it can o...
true
cd23ce139de38af256c594434e90b9e65a6ec98d
eloyekunle/python_snippets
/others/last_even_number.py
587
4.25
4
# An algorithm that takes as input a list of n integers and finds the location of the last even integer in the # list or returns 0 if there are no even integers in the list. def last_even_number(numbers): index = None for i in range(len(numbers)): if numbers[i] % 2 == 0: index = (numbers[i...
true
ad17e4a130882a927f4c2fe2f02aa4a29bf03682
eloyekunle/python_snippets
/search/ternary_search.py
1,130
4.375
4
# The ternary search algorithm locates an element in a list # of increasing integers by successively splitting the list into # three sublists of equal (or as close to equal as possible) # size, and restricting the search to the appropriate piece. def ternary_search(key, numbers): i = 0 j = len(numbers) - 1 ...
true
5c8922df6c04bdc6d16903a96e8efee04537443a
Mona6046/python
/practicepython/Fibonacci.py
418
4.125
4
#Fibonacci #length of Fibonacci series length=input("Enter the length of Fibonacci series") series=[] def nextFibonacci(lastNumber,secondLastNumber): return lastNumber+secondLastNumber lastNumber=1 secondLastNumber=0 count=0 while(count<int(length)): series.append(lastNumber) temp=nextFibonacci(lastNumber...
true
51c7cdf895daf7909396c98145de469e35e384a4
Mona6046/python
/practicepython/Palindrome.py
425
4.53125
5
#Ask the user for a string and print out whether this string is a palindrome or not def isPalandrome(string): #reverse String reverseString=string[::-1] if(string==reverseString): return True return False #ask for input string inputString=input("Enter the string :") flag=isPalandrome(inputSt...
true
bab6b20b217df90aa53245a9188ac8744ba69082
learndevops19/pythonTraining-CalsoftInc
/training_assignments/Day_05/ExceptionHandling/Day05_Excp_Assignment3.py
955
4.21875
4
''' 3. Complete the below program to run successfully: a. Write user defined exception class for User_defined_exception1, User_defined_exception2 b. Handle the user defined exception writing #appropriate message to user # we need to guess this alphabet till we get it right ''' alphabet = 'k' class SmallerAlphabetE...
true
16a1aeb6af9b419aee184b8d7ea1d38db887d964
learndevops19/pythonTraining-CalsoftInc
/training_assignments/Day_01/Bhairavi_Alurkar/data_types_8.py
342
4.15625
4
#!/usr/bin/python """ Python program to add the 10 to all the values of a dictionary. """ def add_10_to_each_value(): sample_input = {1: 10, 2: 20, 3: 30, 4: 40, 5: 50} for each in sample_input: sample_input[each] += 10 return sample_input if __name__ == "__main__": res = add_10_to_each_val...
true
f9c58f1338d19540bcff6478b4e52eb5b1d56734
learndevops19/pythonTraining-CalsoftInc
/Day_04/Sample_Codes/sample_generator_expression.py
205
4.3125
4
# Initialize the list my_list = [1, 3] # List comprehension lst = [x ** 2 for x in my_list] print(lst) # Generator Expression gen = (x ** 2 for x in my_list) print(gen) print(next(gen)) print(next(gen))
true
2e2491a162c69e4682738bc5a915b5f8adf7d3be
learndevops19/pythonTraining-CalsoftInc
/training_assignments/Day_03/circle.py
402
4.25
4
import math from math import pi class Circle: def __init__(self, radius): self.radius = radius def area(self): return (pi * math.pow(self.radius,2)) if __name__ == "__main__": print("Enter the radius of circle: ",end = " ") radius = int(input("Enter radius of circle: ")) ci...
true
4c4b7384a09a591938f114853701218ce801fa44
learndevops19/pythonTraining-CalsoftInc
/Day_03/sample_class_and_object.py
1,679
4.8125
5
#!/usr/bin/env python """ Program shows how Class and Object are work in Python """ class Employee: """ Class Employee with employee name and pay details """ # Constructor def __init__(self, first, last, pay): """ Initialize method :param first: Employee first name ...
true
33cb5b2cf89af347803c101abededa4c8e1bfc9d
learndevops19/pythonTraining-CalsoftInc
/training_assignments/Day_01/Bhairavi_Alurkar/data_types_10.py
375
4.3125
4
#!/usr/bin/python """ Python program to print second largest number """ def find_second_largest_number(): sample_input = [-8] new_list = list(set(sample_input)) if len(new_list) >= 2: new_list.sort() return new_list[-2] else: return new_list[0] if __name__ == "__main__": ...
true
7f3d40b3e6db391218e051b870cd2213612912fb
learndevops19/pythonTraining-CalsoftInc
/Day_01/sample_flow_control.py
1,287
4.125
4
# Flow Control example # if, elif else example x = "one" if x == "one": print("one is selected") elif x == "two": print("two is selected") else: print("Something else is selected") # if -- else: if x == "one": print("one is selected") else: print("Something else is selected") for i in in ran...
true
2886a20c5d07a53e536f94750c7aee68f24ea8f2
learndevops19/pythonTraining-CalsoftInc
/Day_07/sample_asyncio_doesnot_reduce_cpu_time.py
801
4.28125
4
""" Module to understand time performance impact using asyncio for CPU extensive operations """ import asyncio import time COUNT = 50000000 # 50 M async def countdown(counter): """ function decrements counter by one each time, until counter becomes zero Args: counter (int): counter value ...
true
bd8e6a35ac8394229a5cfc596d2bda9be673ca1a
learndevops19/pythonTraining-CalsoftInc
/training_assignments/Day_01/Nitesh_Mahajan/assignment_1.py
1,149
4.59375
5
#!usr/bin/env python """ This program generates factorial or fibonacci series based on user inputs """ def find_factorial(): """ This function takes a number from user and generates it factorial Args: Returns: """ num = int(input("Enter number to find factorial:")) factorial = num ...
true
7a93506cd68520d63eb4106ea3a107965772aed5
learndevops19/pythonTraining-CalsoftInc
/training_assignments/Day_03/solution_01.py
260
4.21875
4
import math class Circle: def area_of_circle(radius): return (math.pi*(math.pow(radius,2))) if __name__ == '__main__': radius = int(input('Enter the radius of circle')) print('area of circle is {}'.format(Circle.area_of_circle(radius)))
true
9a859b29234323955e4c023cd9384819ccee01eb
learndevops19/pythonTraining-CalsoftInc
/Day_01/sample_list_operations.py
1,132
4.40625
4
"""List operations""" fruits = ["orange", "apple", "pear", "banana", "apple"] print("value of list: ", fruits) fruits.append("grape") # append element at end fruits.insert(0, "kiwi") # insert element at 0th index print("fruits after fruits.append('grape') & fruits.insert(0, 'kiwi'): ", fruits) fruits.extend(["orange"...
true
b97b17a502db05b99a82e2ddd612083cac4a06cb
learndevops19/pythonTraining-CalsoftInc
/training_assignments/Day_02/Nitesh_Mahajan/assignment_1.py
547
4.34375
4
def func(*args, a=[]): a.append(args) print(id(a)) print(a) func(1, 2, 3) """A new list 'a' is created with default value [] and all the arguments packed in a tuple because of *args will get append in the list""" func(7, 8, 9, a=[]) """As we are passing a list again, it will create a new list 'a' again ...
true
ad17413c509743100ac3695ae4999576ecc30f76
learndevops19/pythonTraining-CalsoftInc
/training_assignments/Day_01/kshipra_namjoshi/select_operation.py
1,243
4.40625
4
""" Module to choose function and perform operation for the specified user input. """ import math def generate_factorial(num): """ Calculates factorial of a number. Args: num: Number whose factorial is to be calculated. """ print(f"Factorial of {num} is {math.factorial(num)}.") def fib...
true
36a86e3737d5a7d868c2a77b3e512a6599e7c317
rachelli12/Module8
/more_fun_with_collections/dictionary_update.py
1,648
4.4375
4
""" Program: name: dictionary_update.py Author: Rachel Li Last date modified: 06/27/2020 The purpose of this program is to calculate average scores using dictionary """ def get_test_scores(): ''' use reST style :param scores_dict: this represents the dictionary :param num_score: this represents the nu...
true
0498fe45d30127d7e290df70e7a582d675855ea3
shreeyamaharjan/Assignment
/Functions/QN17.py
257
4.15625
4
result = (lambda c: print("The string starts with given character") if c.startswith(ch) else print( "The string doesnot start with given character")) ch = input("Enter any character : ") string = str(input("Enter any string : ")) print(result(string))
true
6f55859a819e8f17a5a61ee9f93373b7857d6044
benben123/algorithm
/myAlgorithm/py/TwoPointer/isPalindrome.py
1,080
4.25
4
""" Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, we define empty string as valid palindrome. Example 1: Input: "A man, a plan, a canal: Panama" Output: true Example 2: Input: "race a car" Output: false """ class...
true
f517ae85c0fd7014784ddda976194f084d8b4166
runmeat6/ETF-Comparator
/_0_read_data.py
1,052
4.1875
4
""" This file has the function to read in the data Key to naming conventions: camelCase global (and imported) variables and function parameters CamelCase class names snake_case variables not intended to be used globally and function names """ import csv def load_data_with_csv(fileName, delimiterChara...
true
49efdb4c3b918568218cee3ded8c594e4ff13e20
rush1007/Python-Assignment
/task3.py
2,638
4.1875
4
# 1. Create a list of 10 elements of four different data types like int, string, complex and float. lst = [1, "Hello", 3.2, 2+3j, "Consultadd", 4, 5.5, 4+9j, "Training", 20] print(lst) # 2. Create a list of size 5 and execute the slicing structure lst = [1, 2, 3, 4, 5] sli = lst[2:4] print(sli) # 3. Write a progra...
true
37455f6ae7a52bbc82600ca4f920c315d51050f6
AbhishekJunnarkar/AWS_Configuration_Eval_using_Lambda_boto3
/pythonbasics/07_Control-statements_ifelse-elif_while_continue_break.py
879
4.15625
4
x = 10 y = 20 if x > y: print('x is greater then y') else: print('y is greater then x') # ------IF elif example -------# ''' If marks are >=60, first class if marks are <60 and >=50, second class if marks are <50 and >=35, third class if marks <35, failed ''' marks = 34 if marks >= 60: print("first class"...
true
a4524689f10677f3be217bcb9af0fc07816b28d7
Gabospa/30DaysOfCode
/day25.py
891
4.25
4
""" A prime is a natural number greater than 1 that has no positive divisors other than 1 and itself. Given a number, n , determine and print whether it's Prime or Not prime. Note: If possible, try to come up with a O(n**0.5) primality algorithm, or see what sort of optimizations you come up with for an O(n) algori...
true
9b0b9d5e3bc8b81fe0f7f21c87c4d730833d2038
Gabospa/30DaysOfCode
/day14.py
977
4.125
4
""" Complete the Difference class by writing the following: - A class constructor that takes an array of integers as a parameter and saves it to the elements instance variable. - A computeDifference method that finds the maximum absolute difference between any numbers in and stores it in the instance variable. """...
true
4692f2b7be7783a84b8e0d360ef670095b56909d
venkor/Python3Learning
/ex14.py
980
4.28125
4
#Imports the sys module (library) from sys import argv #requires 2 arguments to run script, user_name, nickname = argv #Our new prompt looks like this now, it's a string variable with two ">" and a space prompt = '>> ' #Some little chit-chat with the user - using formatting to input the variables given when running scr...
true
2b336be9bcf0c54898aa3c08669770fd875ef347
rahdirs11/CodeForces
/python/capitalize.py
223
4.125
4
# this is basically to perform capitalize operation where # you have to make just the first letter upper-case word = input().lstrip() try: print(word if word[0].isupper() else word[0].upper() + word[1: ]) except: pass
true
b408bdfea6160eb710eaf8cf126ecd7bea3848ad
lastduxson/Early-Python-Code
/test.py
244
4.15625
4
# Code for Assignment01 # print("Please enter your name as instructed below") first = input("What is your first name? ") last = input("What is your last name? ") print("Thank you ",first,last) input("Press ENTER to end this interview")
true
2665ed95928f883516190c7668d9dd21e3cefc3f
aman003malhotra/FlaskTwitterClone
/shopping_cart.py
254
4.125
4
num_of_items = int(input("Enter How many items did you buy?")) sum = 0 for i in range(1, num_of_items): amount = int(input("What is the amount of the {} item".format(str(i)))) sum += amount print("The total price of all the items is {}$".format(sum))
true
1befe27d199a33e015e531e222d190cf48f43495
VolkRiot/LP3THW-Lessons
/lists.py
564
4.125
4
the_count = [1, 2, 3, 4, 5] fruits = ['apples', 'oranges', 'pears', 'apricots'] change = [1, 'pennies', 2, 'dimes', 3, 'quarters'] # simple for loop for number in the_count: print(f'This is count {number}') for fruit in fruits: print(f'The fruit is {fruit}') for i in change: print(f'The change value is ...
true
30ea9900d10c5e7228ef84b2f79604e5397b6086
jordanstarrk/DataStructures
/src/nodes.py
1,371
4.53125
5
# ----------------------------------------------------------- # Python3 implementation of a Node class with 3 methods. # This Node Class is used to implement more complex data # structures in the same directory, such as LinkedLists, # Stacks, Queues. # # ----------------------------------------------------------- cl...
true
704fe4dd3c0f54de4d68eaa077244bd3b07768b2
raijelisaumailagir0383/03_RPS
/01_get_userchoice_v2.py
635
4.375
4
# checks user enters rock / paper / scissors def rps_checker(): valid = False while not valid: # asks user to choose and puts their answer into lowercase response = input("Choose: ").lower() # checks user response and either returns it or asks question again if response == "r" ...
true
b47f8b7cef93dca5331f9b7fd19a857e8b389a12
mactheknight/Lab9
/Lab9-Finished.py
2,623
4.4375
4
############################################ # # # 70pt # # # ############################################ # Create a celcius to fahrenheit calculator. # Multiply by 9, then divide by 5, then add 32 t...
true
6934de03a1eda1c24790fde1071c2d90a5c8031e
roxana-hgh/change_number-base
/change_number-base.py
2,807
4.375
4
# convert postive decimal numbers to other base 2-10 # Author: Roxana Haghgoo # get base from user run = True while run: base = input(">>> Please enter the 'base' you want to convert to: ") try: base = int(base) if base >= 0 and base < 11: run = False else: ...
true
5968f45a98d8284a6b98302579923deb3ab1425a
IngMosri/221-3_40129_DeSoOrOb
/proyecto final/search_book_menu.py
1,853
4.125
4
#!/usr/bin/python3 class Search_book: def search_book_menu(): correcto=False num=0 while(not correcto): try: num = int(input("choose the following option : ")) correcto=True except ValueError: print('Error, choose a vali...
true
f2a1f7f59785a573b6c891b8f75fd0f26bbaaa6c
alankrit03/Problem_Solving
/Jump_Search.py
1,018
4.125
4
# Python3 code to implement Jump Search import math def jumpSearch(arr, x, n): # Finding block size to be jumped step = int(math.sqrt(n)) # Finding the block where element is # present (if it is present) prev = 0 while arr[int(min(step, n) - 1)] < x: prev = step step += int(ma...
true
3a03ca36e458c2ec30ef34dcffab9c5da947feaa
rpural/DailyCodingProblem
/Daily Coding Problem/spiral.py
1,174
4.4375
4
#! /usr/bin/env python3 ''' Daily Coding Problem This problem was asked by Amazon. Given a N by M matrix of numbers, print out the matrix in a clockwise spiral. For example, given the following matrix: [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]] ...
true
eca6cc3641b8600347a1ae99eafba92851ec3348
rpural/DailyCodingProblem
/Daily Coding Problem/romanDecode.py
1,098
4.125
4
#! /usr/bin/env python3 ''' Daily Coding Problem This problem was asked by Facebook. Given a number in Roman numeral format, convert it to decimal. The values of Roman numerals are as follows: { 'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1 } In addition, note that the...
true
1c0baa9eb202fa02110201b4c4783ab139dcdba7
rpural/DailyCodingProblem
/armstrong.py
621
4.375
4
#! /usr/bin/env python3 ''' An Armstrong number is one where the sum of the cubes of the digits add up to the number itself. Example 371 = 3**3 + 7**3 + 1**3. ''' def isArmstrong(value): svalue = str(value) digits = len(svalue) sum = 0 for i in svalue: sum += int(i) ** digits if sum ==...
true
d6924fa0196457a90bb8d5d63ac6c7d0b54d53e8
rpural/DailyCodingProblem
/Daily Coding Problem/palindromeInt.py
687
4.3125
4
#! /usr/bin/env python3 ''' Daily Coding Problem This problem was asked by Palantir. Write a program that checks whether an integer is a palindrome. For example, 121 is a palindrome, as well as 888. 678 is not a palindrome. Do not convert the integer into a string. ''' def reverseNum(num): result = 0 whil...
true
cea9ced7ae3899e22d61ade2f72a5c4b41cc339e
rpural/DailyCodingProblem
/multLab0.py
480
4.3125
4
#! /usr/bin/env python3 # Create a multiplication table for a given value, with a specified number # of elements. # Input the two variables base = 5 count = 10 # The input will be text (strings), so convert the values to integers base = int(base) count = int(count) # print a title for the table print("\n\nMultiplic...
true
8444ccbe55092a6fde4645df4b237eebd4211d98
rpural/DailyCodingProblem
/Daily Coding Problem/maxpath.py
1,142
4.15625
4
#! /usr/bin/env python3 ''' Daily Coding Problem This problem was asked by Google. You are given an array of arrays of integers, where each array corresponds to a row in a triangle of numbers. For example, [[1], [2, 3], [1, 5, 1]] represents the triangle: 1 2 3 1 5 1 We define a path in...
true
523a2bc773dbf194591fb318503722ba465dd626
rakeshrana80/PyProject
/guessnumber.py
1,027
4.3125
4
#!/usr/bin/env python #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. import random,sys def main(): rand_number = random.randint(1,9) count = 0 choice = "yes" while choice.low...
true
8690b3af2aae3f4c2e237eee03ef94b6f46d5461
stanCode-Turing-demo/projects
/stanCode_Projects/weather_master/weather_master.py
2,088
4.40625
4
""" File: weather_master.py ----------------------- This program should implement a console program that asks weather data from user to compute the average, highest, lowest, cold days among the inputs. Output format should match what is shown in the sample run in the Assignment 2 Handout. """ EXIT = -100 def main():...
true
99091fe6b2729b61ecd90908e6549999302dd722
stanCode-Turing-demo/projects
/stanCode_Projects/boggle_game_solver/largest_digit.py
1,496
4.5625
5
""" File: largest_digit.py Name: Josephine ---------------------------------- This file recursively prints the biggest digit in 5 different integers, 12345, 281, 6, -111, -9453 If your implementation is correct, you should see 5, 8, 6, 1, 9 on Console. """ largest_dig = 0 def main(): """ This program recursively f...
true
ba696d1df208c62aa461fde8dfff3c50a7a6bbe3
nkuang123/MIT6001x
/Lesson 3/guess my number.py
907
4.21875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Dec 17 21:20:11 2017 @author: normankuang @title: Lesson 3 / Exercise: guess my number """ highBound = 100 lowBound = 0 guess = int((highBound + lowBound) / 2) print("Please think of a number between 0 and 100!") while True: guess = int((highBoun...
true
4c98342d2c2274393d56ed7ace2157588e8a32a8
debojyoti-majumder/CompCoding
/2019/2019Q1/mlsnippets/linkedList.py
2,444
4.1875
4
# Simple Linked list implmentation to understand python class Node: def __init__(self, data = None): self.data = data self.next = None def setNext(self, nextNode): self.next = nextNode def getData(self): return self.data def getNext(self): return self.next ...
true
b3e6b79b57203ba1d3c78a632a2360f1f2ca3e48
zeeshan-emumba/GoogleCodingInterviewQuestions
/contiguousProduct.py
681
4.125
4
""" Contract: Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. input = [2, 3, -2, 4] output = [6] input = [-2, 0, -1] output = 0 """ input = [2, 3, -2, 4] input1 = [-2, 0, -1] def contiguousProduct(input): largestProduct = 0...
true
1c30dbbf12cd68578b6a7536acad2c130dd95f2a
jaimienakayama/wolfpack_pod_repo
/eva_benton/snippets_challenge.py
2,086
4.5
4
print("Challenge 3.1: Debug code snippets") #Debug each snippet in order print() print("Code Snippet 1:") u = 5 v = 2 if u * v == 10: print(f"The product of u ({u}) and v ({v}) is 10") else: print(f"The product of u ({u}) and v ({v}) is not 10") # This equation requires the "==" comparison operator, "=" is ...
true
5fa92196a4b441bdd1a3e67c269ae94e06ce26b5
Libardo1/Monty-Hall-Problem
/monty_hall.py
1,442
4.1875
4
# Setup the Monty Hall problem to run simulations. """ NEEDS: 3 random values, 2 = goat, 1 = car place values into array """ import random import numpy as np def monty_hall(): GOAT = 0 CAR = 1 solution1 = 0 solution2 = 0 for x in range(10): doors = np.array([0,0,0]) car_locat...
true
ac490579f4cdd5b12bd6e6736b18e8af3bc6c9a7
mpsb/practice
/codewars/python/cw-iq-test.py
1,275
4.5
4
''' Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob — to check his answers, he needs a program that among the given numbers finds one that is di...
true
c3d1d8bbb3de9ade1c28f0e4758df3097656bf6b
devmfe/Fundamental-Python-Tutorial
/SidHW/gradientcalc.py
766
4.3125
4
m = 0 print("WELCOME TO SID'S GRADIENT CALCULATOR!") print("--------------------------------------------------") c = float(input("What is the constant term of the line? (c)\n")) print("--------------------------------------------------") x = float(input("Ok, now what is the x-value? (x)\n")) print("----------...
true
1947fecfb584b3fcc6e8b795ee833d9f16fa1918
niranjanh/RegExp
/regexp_16.py
697
4.46875
4
/* Comprehension: Escape Sequence Description Write a regular expression that returns True when passed a multiplication equation. For any other equation, it should return False. In other words, it should return True if there an asterisk - ‘*’ - present in the equation. Sample positive cases (should match all of the...
true
61f70e447fdee0f317ef90ec7fc649fafc5b8f7d
kmvinoth/Hackerrank
/Easy/lst_comprehension.py
900
4.375
4
""" Let's learn about list comprehensions! You are given three integers X,Y and Z representing the dimensions of a cuboid along with an integer N. You have to print a list of all possible coordinates given by i,j,k on a 3D grid where the sum of i+j+k is not equal to N. Here 0<=i<=X; 0<=j<=Y; 0<=k<=Z; Input Format Fou...
true
7c194fe3d8c6a81286e733ac83e70504271b88df
xyz010/Leetcode
/101 Symmetric Tree.py
741
4.125
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def check(self,leftSub, rightSub): if leftSub == None and rightSub == None: return True elif ...
true
4e82f8cd9bb1ea8ef60061ac84b47222963a086b
erik-vojtas/Practice-field
/passwordChecker.py
1,676
4.21875
4
#Write a program to check the validity of password input by users. #Conditions: # At least 1 letter between [a-z] # At least 1 number between [0-9] # At least 1 letter between [A-Z] # At least 1 character from [$#@] # Minimum length of transaction password: 6 # Maximum length of transaction password: 12 def password...
true
02117a734be84fa3c948446902ab867fbe88f014
Temitayooyelowo/Udacity_Nanodegrees
/Data_Structures_and_Algorithms /Project_0/Task4.py
1,529
4.21875
4
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) """ TASK 4: The telephone company want to i...
true
c98a4ff408969037fb8e038cc7cc94691faf1a61
suruchee/python-basics
/Python-Practice/challenge2.py
418
4.65625
5
#Create a list of your favorite food items, the list should have minimum 5 elements. #List out the 3rd element in the list. #Add additional item to the current list and display the list. #Insert an element named tacos at the 3rd index position of the list and print out the list elements. food = ["rice","bread","milk","...
true
e9ef572e9c29db7165008c41587441ec14afebb6
suruchee/python-basics
/Python-Practice/object-oriented-practice.py
1,612
4.25
4
class Students: def __init__(self, name, contact): self.name = name self.contact = contact def getdata(self): print("Accepting data") self.name = input("Enter name") self.contact = input("Enter contact") def putdata(self): print("The name is" + self.name, "T...
true
6604ec8bf1b16e8a1eba7fafae7b44e2e2b7ce43
DanielleRenee/python_practices
/danielle-functions.py
1,587
4.5625
5
# Define your function below. nums = [5, 12, 6, 7, 4, 9, 10] not_all_nums = [4, 5, 6, 8, 'w', 'o', 'w'] def even_or_odd(lst, string='even'): """ Take two arguments, a list and a string indicating whether the user wants a new list containing only the odd or even numbers. Return the user its new list. ...
true
cddb25d783549db4eaf2e2daf6e7236b14489a4b
zachknig/Pirple-work
/main.py
1,837
4.34375
4
""" -- HOMEWORK 1 -- Zach Koenig, 07.22.19 This assignment involves solidifying knowledge gained with assigning and printing variables within a python framework by creating and pushing metadata variables concerning my favorite song, Moscow by Autoheart. All data was collected using Spotify. """ # variable defi...
true
bbd16e7366ce210165e99e89a3fef964be3cf74b
CNM07/Python_Basics
/task1.py
436
4.34375
4
#Write a program which accepts a string as input to print "Yes" if the string is "yes", "YES" or "Yes", otherwise print "No". #Hint: Use input () to get the persons input word = input('Type a word:' ) if word == 'yes': print('Yes') elif word == 'Yes': print('Yes') elif word == 'YES': print('Yes') else: ...
true
4f2b5b0f5cf8b0c98ab3ec8e8a0b593d10c1ba91
JeanB762/python_cookbook
/find_commonalities_in_2_dict.py
553
4.3125
4
# You have two dictionaries and want to find out what they # might have in common (same keys, same values, etc.). # consider two dictionaries: a = { 'x' : 1, 'y' : 2, 'z' : 3 } b = { 'w' : 10, 'x' : 11, 'y' : 2 } # To find out what the two dictionaries have in common, simply # perform co...
true
964ac2ff4c3a83af8d0f61f5d42b51ccc844896a
eimearfoley/Carcassonne
/public_html/cgi-bin/Meeple.py
1,231
4.15625
4
class Meeple(object): """Creates a meeple Object 01/02/18 - Stephen and Euan Initiates a Meeple Object. player points to the player object which "owns" the Meeple placed is a boolean which represents if the Meeple is placed on the board or not colour is a string which represent...
true
d3d704d800c6d5d9a99d6022f2ae3f97e61f3ed4
chriskaringeg/Crimmz-pass-locker
/user_test.py
1,887
4.15625
4
import unittest from user import User class TestUser(unittest .TestCase): ''' Tets case that defines test cases for the user class behaviours Args: unittest.TestUser: TestUser class that helps in creating test cases ''' def setUp(self): ''' set up method to run bef...
true
28f26d0f4c1f28a207901f5f19932badf4c2cc33
Ritvik09/My-Python-Codes
/Python Codes/Calculator.py
1,501
4.125
4
# Print options (add,sub,mult,div) # 1=add 2=sub 3=mult 4=div # two inputs while True: print("Welcome User!") print("Press 1 for Addition") print("Press 2 for Subtraction") print("Press 3 for Multiplication") print("Press 4 for Division") Operation = int(input()) if Operation =...
true
1a6fcbe4f898b684fe086f26cdb05ea94dea8ffb
SACHSTech/ics2o-livehack1-practice-TheFaded-Greg-L
/minutes_days.py
652
4.4375
4
''' ------------------------------------------------------------------------------- Name: minutes_days.py Purpose: Converts Minutes to days, hours and minutes Author: Lui.G Created: 03/12/2020 ------------------------------------------------------------------------------ ''' # Variables for the converter minutes = i...
true
21f8aa6c4f01ad917bec22dbac6d4f65611c6073
alexssantos/Python-codes
/Samples/Exercice/TP3-DR2/dr2-tp3-1.py
331
4.15625
4
myList = [] for element in range(5): myList.append(element) print(myList) if 3 in myList: myList.remove(3) else: print('myList do not have item 3') if 6 in myList: myList.remove(6) else: print('myList do not have item 6') print(myList) print('Length of myList: ', len(myList)) myList[-1] = 6 pr...
true
7f41fdc174d611267eff4bcec042c39d2e1a426a
alexssantos/Python-codes
/Samples/DateTime/time-datetime-modules.py
562
4.25
4
import time import datetime # --------- TIME Module --------- format = "%H:%M:%S" # Format print(time.strftime(format)) # 24 hour format # format = "%I:%M:%S" # Format print(time.strftime(format)) # 12 hour format # # Date with time-module format = "%d/%m...
true