blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
23f9d9fc5134daddae2aa9bc7c15853370b464ae
EddyScript/Git-With-Eddy
/Calculator.py
1,092
4.28125
4
# Assignment 1--------------------------------------------- def calculator(): first_number = int(input("Enter a number: ")) operator = input("Enter an operator: ") ops = ["+","-","*","/"] if operator in ops: second_number = int(input("Enter another number: ")) else: print("Sorry," + ...
false
dc66d84ad39fb2fe87895ca376652e9d95781326
amshapriyaramadass/learnings
/Hackerrank/Interviewkit/counting_valley.py
789
4.25
4
#!/bin/python3 import math import os import random import re import sys # # Complete the 'countingValleys' function below. # # The function is expected to return an INTEGER. # The function accepts following parameters: # 1. INTEGER steps # 2. STRING path #Sample Input # #8 #UDDDUDUU #Sample Output #1 # def cou...
true
35775689bab1469a42bae842e38963842bf54016
scottherold/python_refresher_8
/ExceptionHandling/examples.py
731
4.21875
4
# practice with exceptions # user input for testing num = int(input("Please enter a number ")) # example of recursion error def factorial(n): # n! can also be defined as n * (n-1)! """ Calculates n! recursively """ if n <= 1: return 1 else: return n * factorial(n-1) # try/except (if ...
true
52c84ab4101801d394c4c8ee1dc3621e54b8285c
Reyes2777/100_days_code
/python_class/exercise_1.py
515
4.15625
4
#Write a Python program to convert an integer to a roman numeral. class Numbers: def int_to_roman(self, number_i): value = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] roman_numbers = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"] roman_num = [] f...
false
9aeb414b897c3948dfe4313d40b30bd7471a3d49
priyal-jain-84/Projects
/sudoku project.py
2,429
4.25
4
# Sudoku project using backtracking method # board=[ [7,3,0,9,5,0,0,0,0], [2,0,0,6,7,0,5,8,0], [0,0,5,0,1,0,4,0,0], [1,9,0,0,6,3,2,0,5], [0,4,0,0,0,0,6,0,0], [5,6,8,2,0,7,0,0,0], [0,2,0,0,8,1,3,0,0], [0,0,1,0,0,9,7,6,0], [0,7,0,5,2,0,8,0,9] ...
false
8923477b47a2c2d283c5c4aba9ac797c589fbf7e
nobin50/Corey-Schafer
/video_6.py
1,548
4.15625
4
if True: print('Condition is true') if False: print('Condition is False') language = 'Python' if language == 'Python': print('It is true') language = 'Java' if language == 'Python': print('It is true') else: print('No Match') language = 'Java' if language == 'Python': print('It is Python') ...
true
6a22f2e3cd18309c2b74becebafa184467ce9b87
Piper-Rains/cp1404practicals
/prac_05/hex_colours.py
591
4.375
4
COLOUR_CODES = {"royalblue": "#4169e1", "skyblue": "#87ceeb", "slateblue": "#6a5acd", "slategray1": "#c6e2ff", "springgreen1": "#00ff7f", "thistle": "#d8bfd8", "tomato1": "#ff6347", "turquoise3": "#00c5cd", "violet": "#ee82ee", "black": "#000000"} print(COLOUR_CODES) colour_name = inpu...
false
e8893f7e629dede4302b21efee92ff9030fe7db2
Piper-Rains/cp1404practicals
/prac_05/word_occurrences.py
468
4.25
4
word_to_frequency = {} text = input("Text: ") words = text.split() for word in words: frequency = word_to_frequency.get(word, 0) word_to_frequency[word] = frequency + 1 # for word, count in frequency_of_word.items(): # print("{0} : {1}".format(word, count)) words = list(word_to_frequency.keys()) words.s...
true
6abf00b079ceab321244dbe606f05bac9a347be0
siva237/python_classes
/Decorators/func_without_args.py
1,331
4.28125
4
# Decorators: # ---------- # * Functions are first class objects in python. # * Decorators are Higher order Functions in python # * The function which accepts 'function' as an arguments and return a function itslef is called Decorator. # * Functions and classes are callables as the can be called explicitly. # def hel...
true
39a9ed0ca6f8ce9095194deb21f2c685cfcb079c
mantrarush/InterviewPrep
/InterviewQuestions/SortingSearching/IntersectionArray.py
1,037
4.21875
4
""" Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each element in the result should appear as many times as it shows in both arrays. The result can be in any order. Follow up: What if the given array is already sorted? How w...
true
4a81b3f14a778f7db90f588f71e7e1f49c471f50
jskim0406/Study
/1.Study/2. with computer/4.Programming/2.Python/8. Python_intermediate/p_chapter03_02.py
1,524
4.125
4
# 클래스 예제 2 # 벡터 계산 클래스 생성 # ex) (5,2) + (3,4) = (8,6) 이 되도록 # (10,3)*5 = (50,15) # max((5,10)) = 10 class Vector(): def __init__(self, *args): '''Create vector. ex) v = Vector(1,2,3,4,5) ==>> v = (1,2,3,4,5)''' self.v = args print("vector created : {}, {}".format(self.v, type(self.v))) ...
false
6a39d9c02444a887957b2e07fb3b9144abbb6283
meniscus/AtCoder
/ARC/ARC012/A.py
269
4.25
4
day = input() if (day == "Sunday" or day == "Saturday") : print(0) elif (day == "Monday") : print(5) elif (day == "Tuesday") : print(4) elif (day == "Wednesday") : print(3) elif (day == "Thursday") : print(2) elif (day == "Friday") : print(1)
false
66da83e7687f9d598add37baee9aecf6ff44c10a
shfhm/Practice-Python
/Check Power of 2.py
226
4.40625
4
#function that can determine if an input number is a power of 2 import math def sqrtt(x): i=math.sqrt(x) if i**2==x: print('the input is power 2 of %s' %(i) ) else: print('it\'s not the power 2')
true
2e70910939fedcde1d3c98da05618a8ff871abd0
diego-ponce/code_snippets
/code_challenges/sort_stack.py
1,380
4.15625
4
def pop_until(fromstack, tostack, val): ''' pops from fromstack onto tostack until val is greater than the last value popped. Returns the count of items popped. ''' count = 0 while fromstack: if fromstack[-1] < val: return count pop_val = fromstack.pop() tosta...
true
ae56bc91c4fe03e9d6e2066aa43858cf2b3c63b1
houxianxu/learnToProgramCoursera
/week4/a2.py
2,929
4.34375
4
#!/usr/bin/python3.2 def get_length(dna): """ (str) -> int Return the length of the DNA sequence dna. >>> get_length('ATCGAT') 6 >>> get_length('ATCG') 4 """ return len(dna) def is_longer(dna1, dna2): """ (str, str) -> bool Return True if and only if DNA sequence dna1 is lo...
false
a54f2d23123a452a9a4b4ed7be2e1ea6cebf4b5b
emmadeeks/CMEECourseWork
/Week2/Code/lc1.py
2,225
4.65625
5
#!/usr/bin/env python3 #Author: Emma Deeks ead19@imperial.ac.uk #Script: lc1.py #Desc: List comprehensions compared to for loops #Arguments: No input #Outputs: Three lists containing latin names, common names and mean body masses for each species of birds in a given list of birds #Date: Oct 2019 # Creates a list o...
true
3e953d2ae7128c97dcdad05b1f4dd97cbd58f77d
emmadeeks/CMEECourseWork
/Week2/Sandbox/comprehension_test.py
1,903
4.46875
4
## Finds list those taxa that are oak trees from a list of species #There is a range of 10 and i will run throough the range and print the numbers- remember it starts from 0 x = [i for i in range(10)] print(x) #Makes an empty vector (not vector LIST) called x and fils it by running through the range 10 and appendin...
true
0cca2868af0d5c598552626a20bdd749e57e2364
emmadeeks/CMEECourseWork
/Week2/Code/oaks.py
1,565
4.59375
5
#!/usr/bin/env python3 #Author: Emma Deeks ead19@imperial.ac.uk #Script: oaks.py #Desc: Uses for loops and list comprehensions to find taxa that are oak trees from a list of species. #Arguments: No input #Outputs: Oak species from list #Date: Oct 2019 """ Uses for loops and list comprehensions to find taxa that are ...
true
d3ec3a217a17c9ab7963663f0db285dfd80945e7
carinasauter/D04
/D04_ex00.py
2,018
4.25
4
#!/usr/bin/env python # D04_ex00 # Create a program that does the following: # - creates a random integer from 1 - 25 # - asks the user to guess what the number is # - validates input is a number # - tells the user if they guess correctly # - if not: tells them too high/low # - only lets th...
true
098556b0003a35c50a5631496c5d24c38a7c3e12
CODEvelopPSU/Lesson-4
/pythonTurtleGame.py
1,176
4.5
4
from turtle import * import random def main(): numSides = int(input("Enter the number of sides you want your shape to have, type a number less than 3 to exit: ")) while numSides >= 3: polygon(numSides) numSides = int(input("Enter the number of sides you want your shape to have, type a ...
true
d62805b6544a217f531eaf387853a7120c479d3f
ArturAssisComp/ITA
/ces22(POO)/Lista1/Question_7.py
1,115
4.125
4
''' Author: Artur Assis Alves Date : 07/04/2020 Title : Question 7 ''' import sys #Functions: def sum_of_squares (xs): ''' Returns the sum of the squares of the numbers in the list 'xs'. Input : xs -> list (list of integers) Output: result -> integer ''' ...
true
590591e904740eb57a29c07ba3cf812ac9d5e921
ArturAssisComp/ITA
/ces22(POO)/Lista1/Question_4.py
1,580
4.15625
4
''' Author: Artur Assis Alves Date : 07/04/2020 Title : Question 4 ''' import sys #Functions: def sum_up2even (List): ''' Sum all the elements in the list 'List' up to but not including the first even number (Is does not support float numbers). Input : List -> list (list of...
true
58c1e655e91256c0e0aed84e0c61f4a7818434d9
zelenyid/amis_python
/km73/Zeleniy_Dmytro/9/task1.py
303
4.15625
4
from math import sqrt # Розрахунок відстані між точками def distance(x1, y1, x2, y2): dist = sqrt((x2-x1)**2 + (y2-y1)**2) return dist x1 = int(input("x1: ")) y1 = int(input("y1: ")) x2 = int(input("x2: ")) y2 = int(input("y2: ")) print(distance(x1, y1, x2, y2))
false
b74253bc3566b35a29767cc23ceb5254cb303441
MailyRa/calculator_2
/calculator.py
1,093
4.125
4
"""CLI application for a prefix-notation calculator.""" from arithmetic import (add, subtract, multiply, divide, square, cube, power, mod, ) print("Welcome to Calculator") #ask the user about the equation def calculator_2(): user_input = (input(" Type your equation ")) num = use...
true
6a9febac0dcf6886c3337991eb7c5dde84ee281b
pdhawal22443/GeeksForGeeks
/GreaterNumberWithSameSetsOFDigit.py
2,055
4.15625
4
'''Find next greater number with same set of digits Given a number n, find the smallest number that has same set of digits as n and is greater than n. If n is the greatest possible number with its set of digits, then print “not possible”. Examples: For simplicity of implementation, we have considered input number as a ...
true
52fc107624d46f57e2b99394196053e444eb7136
PawelKapusta/Python-University_Classes
/Lab8/task4.py
387
4.15625
4
import math def area(a, b, c): if not a + b >= c and a + c >= b and b + c >= a: raise ValueError('Not valid triangle check lengths of the sides') d = (a + b + c) / 2 return math.sqrt(d * (d - a) * (d - b) * (d - c)) print("Area of triangle with a = 3, b = 4, c = 5 equals = ", area(3, 4, 5)) print("Area o...
true
849402be8f503d46883dc5e8238821566b33598b
Rajatku301999mar/Rock_Paper_Scissor_Game-Python
/Rock_paper_scissor.py
2,350
4.21875
4
import random comp_wins=0 player_wins=0 def Choose_Option(): playerinput = input("What will you choose Rock, Paper or Scissor: ") if playerinput in ["Rock","rock", "r","R","ROCK"]: playerinput="r" elif playerinput in ["Paper","paper", "p","P","PAPER"]: playerinput="p" elif playerinput i...
true
f9ac9c75d756a1548225c139265206ffb70e3bfc
manzeelaferdows/week3_homework
/data_types.py
1,481
4.1875
4
str = 'Norwegian Blue', "Mr Khan's Bike" list = ['cheddar', ['Camembert', 'Brie'], 'Stilton', 'Brie', 'Brie'] tuples = (47, 'spam', 'Major', 638, 'Ovine Aviation') tuples2 = (36, 29, 63) set = {'cheeseburger', 'icecream', 'chicken nuggets'} dict = {'Totness': 'Barber', 'BritishColumbia': 'Lumberjack'} print(len(list))...
false
866df365ca6ec790f67224b2208e90eca5eeb811
vaamarnath/amarnath.github.io
/content/2011/10/multiple.py
665
4.125
4
#!/usr/bin/python import sys def checkMultiple(number) : digits = {"0":0, "1":0, "2":0, "3":0, "4":0, "5":0, "6":0, "7":0, "8":0, "9":0} while number != 0 : digit = number % 10 number = number / 10 digits[str(digit)] += 1 distinct = 0 for i in range(0, 10) : if digi...
true
e1289e9769ad313bc415a66d5e5600e5007fec90
dhansolo/R-P-S
/main.py
684
4.21875
4
from random import randint player = raw_input('rock (r), paper (p), or scissors (s)? ') while player != 'r' and player != 'p' and player != 's': player = raw_input('Must choose rock (r), paper (p), or scissors (s) ') # end='' tells print to print an extra space instead of a line in python 3 and above computer =...
false
7cee4713aa67c45851d8ac66e6900c25c95ccef1
UCMHSProgramming16-17/final-project-shefalidahiya
/day05/ifstatement2.py
366
4.375
4
# Create a program that prints whether a name # is long name = "Shefali" # See if the length of the name counts as long if len(name) > 8: # If the name is long, say so print("That's a long name") # If the name is moderate elif len(name) < 8: print("That's a moderate name") # If the name is short else l...
true
1a9dea57415668bf56fd5e0b0193952a1af49e27
freaking2012/coding_recipes
/Python/LearnBasics/HashPattern2.py
365
4.3125
4
''' This program takes input a even number n. Then it prints n line in the following pattern For n = 8 ## #### ###### ######## ######## ###### #### ## ''' n=input("Enter number of lines in patter (should be even): ") for i in range(1,n/2+1): print (' ' * (n/2-i)) + ('##' * i) for i in range(1,n/2+1): ...
true
4ca634a62c46930073c67fbb01bea13796de8edb
leoP0/OS1
/Small Python/mypython.py
1,376
4.1875
4
#Python Exploration #CS344 #Edgar Perez #TO RUN IT JUST DO: 'python mypython.py' (whitout the ' ') #Modules import random import string import os import io #function that generates random lowercase leters given a range def random_char(y): return ''.join(random.choice(string.ascii_lowercase) for x in range(y)) #cre...
true
5548df9c3f3e31ffce2cdb3e0f6fda197bf7ab72
tazdaboss/python_basic
/datatype_learn/number_operation.py
226
4.1875
4
num1=int(input("enter num1:\t")) num2=int(input("enter num2:\t")) print("add",num1+num2) print("subtract",num1*num2) print("divide",num1/num2) print("remainder",num1%num2) print("quotient",num1//num2) print("power",num1**num2)
false
b6f5c5dc5b1c4703650b0e12ba82517d237c92ea
SanjayMarreddi/Open-CV
/Object_Detection/1.Simple_Thresholding.py
2,452
4.375
4
# Now we are focused on extracting features and objects from images. An object is the focus of our processing. It's the thing that we actually want to get, to do further work. In order to get the object out of an image, we need to go through a process called segmentation. # Segmentation can be done through a variety ...
true
dddf7daa3fd9569dbeb61fdba7f39f070aa4be39
Ironkey/ex-python-automatic
/Chapter 01-02/Hello World.py
597
4.21875
4
# This program says hello and asks for my name. print('Hello wolrd!') print ('What is your name?') # ask for their name myName = input() print('It is good to meet you, ' + myName) print('The Length of your name is:') print(len(myName)) print('What is your age?') # ask for their age myAge = input() print('You will be...
true
4c69bf913b87c5c3373368d83464ecd9e49e9184
mennonite/Python-Automation
/Chapter 8 -- Reading and Writing Files/Practice Projects/madlibs_Regex.py
920
4.25
4
#! python3 # madlibs_Regex.py - opens and reads a text file and lets the user input their own words (solved using REGEX) import re # open text file madlibFile = open('.\\Chapter 8 -- Reading and Writing Files\\Practice Projects\\test.txt') # save the content of the file into a variable content = madlibFile.read() m...
true
cb5a0fa4c5e15ece58b25f8a0fedb9fb56f26c5f
rohitprofessional/test
/f_string.py
386
4.4375
4
letter = "Hey my name is {1} and I am from {0}" country = "India" name = "Rohit" print(letter.format(country, name)) print(f"Hey my name is {name} and I am from {country}") print(f"We use f-strings like this: Hey my name is {{name}} and I am from {{country}}") price = 49.09999 txt = f"For only {price:.2f} doll...
true
f9d5c0e1ab4ec959bb7988e185c83b2ba49a23a5
rohitprofessional/test
/PRACTICE/stop_watch.py
534
4.125
4
#---------------STOP WATCH-------- import time time_limit = int(input("Enter the stopwatch time.: ")) # hours = int(time_limit/3600) # minutes = int(time_limit/60) % 60 # seconds = (time_limit) % 60 # print(hours,minutes,seconds) for x in range(time_limit,0,-1): seconds = (x) % 60 minutes = i...
true
608257fd5528026be5797f7ca712d9328ca7382b
rohitprofessional/test
/CHAPTER 01/localVSglobal_variable.py
1,353
4.5
4
# It is not advisable to update or change the global variable value within in a local block of code. As it can lead to complexity # in the program. But python provides a global keyword to do so if you want to. # Although it is also not advisable to use global variable into a local function. It is a maintainable progr...
true
e49eb95627c1f9262aad83447236cc085a6f5afd
rohitprofessional/test
/CHAPTER 07/intro to for loops.py
1,151
4.375
4
# -------------------- FOR LOOP UNDERSTANDING ------------------------------- '''So here we range is a function w/c helps compiler to run the for loop. Return an object that produces a sequence of integers from start (inclusive) to stop (exclusive) by step. range(i, j) produces i, i+1, i+2, ..., j-1. start defa...
true
37940d1160cc5a78595a58676589eca91d3d7fdc
AlanaMina/CodeInPlace2020
/Assignment1/TripleKarel.py
1,268
4.28125
4
from karel.stanfordkarel import * """ File: TripleKarel.py -------------------- When you finish writing this file, TripleKarel should be able to paint the exterior of three buildings in a given world, as described in the Assignment 1 handout. You should make sure that your program works for all of the Triple sample w...
true
3da0242e36ee059b8471559ae4491a435b90e234
AlanaMina/CodeInPlace2020
/Assignment5/word_guess.py
2,881
4.1875
4
""" File: word_guess.py ------------------- Fill in this comment. """ import random LEXICON_FILE = "Lexicon.txt" # File to read word list from INITIAL_GUESSES = 8 # Initial number of guesses player starts with def play_game(secret_word): """ Add your code (remember to delete the "pass" below) """ ...
true
6033405dc1913c086c43a57b8ed06e70a481a8c1
mrahmed0116/Practise1
/sortbasedonvalues.py
429
4.28125
4
''' Sort dictionary based on keys ''' dict1= {'x':4,'y':3,'z':2,'a':1,'b':1, 'c':0} s1 = sorted(dict1.keys()) print(s1) output={} for s in s1: for i in dict1: if i == s: output[i] = dict1[i] print(output) ''' Sort dictionary based on values ''' s2 = sorted(dict1.values()) print(s2) output1={}...
false
6ed8de9512fcf7f26e356d1e8def736dfe7e5051
keerthz/luminardjango
/Luminarpython/languagefundamentals/secondlargest.py
353
4.1875
4
num1=int(input("enter num1")) num2=int(input("enter num2")) num3=int(input("enter num3")) if((num2>num1) & (num1>num3)): print("num1 is largest",num1) elif((num3>num2) & (num2>num1)): print("num2 is largest",num2) elif((num1>num3) & (num3>num2)): print("num3 is largest",num3) elif((num1==num2) & (num2==num3...
false
4f06365db3bb2fdfa5e6c62e722e03f1ca916a7b
twillis209/algorithmsAndDataStructures
/arraySearchAndSort/insertionSort/insertionSort.py
422
4.125
4
def insertionSort(lst): """ Executes insertion sort on input. Parameters ---------- lst : list List to sort. Returns ------- List. """ if not lst: return lst sortedLst = lst[:] i = 1 while i < len(sortedLst): j = i - 1 while j >= 0 and sortedLst[j] > sortedLst[j+1]: temp = sortedLst[...
true
18290f2b984ca71bdbc4c147ec052ba17e246ad0
twillis209/algorithmsAndDataStructures
/arraySearchAndSort/timsort/timsort.py
1,029
4.25
4
import pythonCode.algorithmsAndDataStructures.arraySearchAndSort.insertionSort as insertionSort def timsort(): pass def reverseDescendingRuns(lst): """ Reverses order of descending runs in list. Modifies list in place. Parameters --------- lst : list List to sort. Returns ------- List. """ runStack...
true
227ffd15cf6fd13ac446c356d96c0761e1932f4d
ruteshr/python
/string_palindraome.py
243
4.15625
4
#String is Palindrome string=list(str(input("enter a String :"))) a="" for i in string: a=i+a if("".join(string)==a): print('{} is palindrome'.format("".join(string)) ) else: print('{} is not palindrome'.format("".join(string)) )
false
df296049dd2cd2d136f15afdf3d8f1ebec49871d
wulianer/LeetCode_Solution
/062_Unique_Paths.py
902
4.25
4
""" A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? Ab...
true
fb10a2f3e98da33e6f5cbbe1f1d08f41dc452855
vincenttchang90/think-python
/chapter_1/chapter_1_exercises.py
1,190
4.375
4
#chapter 1 exercises #1-1 # In a print statement, what happens if you leave out one of the parentheses, or both? ## print 'hello') or print('hello' return errors # If you are trying to print a string, what happens if you leave out one of the quotation marks, or both? ## print('hello) or print(hello') return errors wh...
true
526886cff12e987b705d2443cd0bc1741a552f36
bharatanand/B.Tech-CSE-Y2
/applied-statistics/lab/experiment-3/version1.py
955
4.28125
4
# Code by Desh Iyer # TODO # [X] - Generate a random sample with mean = 5, std. dev. = 2. # [X] - Plot the distribution. # [X] - Give the summary statistics import numpy as np import matplotlib.pyplot as plt import random # Input number of samples numberSamples = int(input("Enter number of samples in the sample lis...
true
c5d76587c717609f3a2f3da3a9136f92b3fee367
bmgarness/school_projects
/lab2_bmg74.py
755
4.125
4
seconds = int(input('Enter number of seconds to convert: ')) output = '{} day(s), {} hour(s), {} minute(s), and {} second(s).' secs_in_min = 60 secs_in_hour = secs_in_min * 60 # 60 minutes per hour secs_in_day = secs_in_hour * 24 # 24 hours per day days = 0 hours = 0 minutes = 0 if seconds >= secs_in_day: days ...
true
ec32d18f39290dc135c190a49764ae585be27ccd
ayeshaghoshal/learn-python-the-hard-way
/ex14.py
1,252
4.5
4
# -*- coding: utf-8 -*- print "EXERCISE 14 - Prompting and Passing" # Using the 'argv' and 'raw_input' commands together to ask the user something specific # 'sys' module to import the argument from from sys import argv # define the number of arguments that need to be defined on the command line script, ...
true
8c787b221b005f2f997f7d927a008d3ff9fa1514
ayeshaghoshal/learn-python-the-hard-way
/ex19.py
2,520
4.40625
4
# -*- coding: utf-8 -*- print "EXERCISE 19 - Functions and Variables" # defining the function that commands the following strings to be printed out # there are 2 parameters that have to be defined in brackets def cheese_and_crackers(cheese_count, boxes_of_crackers): # use of the parameters is the same method ...
true
cce19d5079460040e6174142d487e9fac7a22adf
jamesfeng1994/ORIE5270
/HW2/tree/tree_print.py
2,454
4.15625
4
class Tree(object): def __init__(self, root): self.root = root def get_depth(self, current, n): """ This function is to get the depth of the tree using recursion parameters: current: current tree node n: current level of the tree return: the dept...
true
180595fd0f78376e8b9d3da6af980876a743fcda
Vandeilsonln/Python_Automate_Boring_Stuff_Exercises
/Chapter-9_Organizing-Files/selective_copy.py
1,268
4.125
4
#! python3 # selective_copy.py - Once given a folder path, the program will walk through the folder tree # and will copy a specific type of file (e.g. .txt or .pdf). They will be copied to a new folder. import os, shutil def copy_files(folderPath, destinyPath, extension): """ Copy files from 'folderPath' to ...
true
26d42973cb952c3c2af0cddba3d4772c34b2d788
Liam-Hearty/ICS3U-Unit2-03-Python
/circumference_finder.py
493
4.625
5
#!/usr/bin/env python3 # Created by: Liam Hearty # Created on: September 2019 # This program will calculate the circumference of a determined circle radius. import constants def main(): # this function will calculate the circumference # input radius = int(input("Enter the radius of circle (mm): ")) ...
true
94a97edaa66c9527fc133ec3c33386a5410968ba
biradarshiv/Python
/CorePython/24_String_Formatting.py
1,464
4.46875
4
""" The format() method allows you to format selected parts of a string. Sometimes there are parts of a text that you do not control, maybe they come from a database, or user input? To control such values, add placeholders (curly brackets {}) in the text, and run the values through the format() method: """ print("# Fi...
true
a36c60c380517b1e6b6d146669e9b93cf797fbcd
biradarshiv/Python
/CorePython/13_ClassObject.py
2,393
4.25
4
""" Python is an object oriented programming language. Almost everything in Python is an object, with its properties and methods. A Class is like an object constructor, or a "blueprint" for creating objects. """ print("# Create a class and access a property in it") class MyClass: x = 5 print(MyClass) p1 = MyClass() p...
true
2358ce9bd1a93f9692cff142908bde4f985fd4c5
sukiskumar/sukiskumar
/ex3.py
202
4.125
4
ch=input("enter a char:") if(ch=='A'or ch=='a'or ch=='E'or ch=='e'or ch=='I'or ch=='i'or ch=='O'or ch=='o'or ch=='U'or ch=='u'): print(ch,"its a vowel letter") else: print(ch,"its a consonent")
false
47846eb1a2b8b5db15f5f7262ae51e15973eb75b
oxfordni/python-for-everyone
/examples/lesson2/4_exercise_1.py
372
4.21875
4
# Determine the smallest number in an unordered list unordered_list = [1000, 393, 304, 40594, 235, 239, 2, 4, 5, 23095, 9235, 31] # We start by ordering the list ordered_list = sorted(unordered_list) # Then we retrieve the first element of the ordered list smallest_number = ordered_list[0] # And we print the result ...
true
18ca47e10a0af9166e4366ca61b3a726bbc74454
callmefarad/Python_For_Newbies
/sesions/stringslice.py
756
4.53125
5
# slicing simply means returning a range of character # this is done by using indexing pattern # note when dealing with range the last number is exclusive. # i.e if we are to get the last letter of digit 10, we would have a # range of number tending to 11 where the 11th index is exclusive # declaring my variable my_s...
true
f8ccced9d2f8bf8df346c5f5ff77a1fbc8d32954
callmefarad/Python_For_Newbies
/sesions/rangetype.py
367
4.125
4
# showing range type representation # declaring a variable name range_of_numbers range_of_numbers = range(40) # displaying the range of numbers print("Below shows the range of numbers") print(range_of_numbers) # displaying python representation of the output value print("Below show the python data type representation...
true
b59e530c1b2e7d8275003cde9e1b8bce78d9b43f
callmefarad/Python_For_Newbies
/sesions/membershipin.py
536
4.3125
4
# a membership operator checks if sequence is present in an object # "in" is on of the membership operator # creating a variable named " my_list = ['orange', 'bean', 'banana', 'corn'] print("List of items: ", my_list) # creating a check variable check = "banana" # prints the result print(check in my_list) """" # c...
true
fd0795fd1e3b86ce259b392b644d5ade274655f0
callmefarad/Python_For_Newbies
/sesions/func.py
1,652
4.15625
4
# # declaring a function # def dummy(): # print("this is a dummy print.") # # # callin the function # dummy() # # def add(): # user1 = float(input('Enter your firstnumber: ')) # user2 = float(input('Enter your secondnumber: ')) # sum = user1 + user2 # return sum # # # call the function # add() # x ...
true
05700d145da30b014ab880e5af9be1a13d3a0a98
callmefarad/Python_For_Newbies
/sesions/passwordChecker.py
1,122
4.125
4
# a program that checks if a password is too weak, weak and very strong # defining the function def copywrite(): print("Copywrite: Ubani U. Friday") # main function special_characters = ['!', '^', '@', '#', '$', '%', '&', '*', '(', ')', '_', '+'] special_numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']...
true
67c8770308f34f234d91c330da73e5aefee2a58c
Ilis/dawson
/useless_trivia.py
585
4.125
4
# Useless trivia name = input("Hi! What's your name? ") age = input("How old are you? ") age = int(age) weight = int(input("What is your weight? ")) print() print("If Cammings write you a letter, he write", name.lower()) print("If mad Cammings write you a letter, he write", name.upper()) called = name * 5 print("Kid...
true
d05ab90c27a5d8821c19b17cb48a2dafc78f35bc
GaboUCR/Mit-Introduction-to-python
/ps1/Ps1B.py
848
4.28125
4
total_cost = float(input("Enter the cost of your dream house ")) annual_salary = float(input("enter your annual salary ")) portion_saved= float(input("enter the percentage to be saved ")) semi_annual_raise = float(input("Enter the percentage of your raise")) current_savings = 0 annual_return = 0.04 total_months = 0 por...
true
8111dfc4110b25b75a6d8f4e3e583aa583a54d31
DoughyJoeyD/WorkLog2
/task.py
1,889
4.125
4
from datetime import datetime import os import time #handy script to clean the screen/make the program look nice def clearscreen(): os.system('cls' if os.name == 'nt' else 'clear') #how each task is constructed #name #date of task #time taken #extra notes class Task(): def __init__(self): ...
true
ae9a97b3fb40b8285182bb65d435f836de70ada6
SuryaNMenon/Python
/Functions/timeAndCalendar.py
543
4.21875
4
import calendar,time def localTime(): localtime = time.asctime(time.localtime(time.time())) print(f"Current local time is {localtime}") def displayCalendar(): c = calendar.month(int(input("Enter year: ")),int(input("Enter month: "))) print("The calendar is:\n",c) while(1): choice = int(input("Menu\...
true
8c2bbc0c0175bc8883d9fe65cbca3511dbefd81e
SuryaNMenon/Python
/Other Programs/leapYear.py
217
4.3125
4
#Program if user input year is leap year or not year = int(input('Enter the year')) if(year%4==0 or year%100==0 or year%400==0): print('Given year is a leap year') else: print('Given year is not a leap year')
true
5493d5308b986e4efd6bfed3687712872d76bc35
hyjae/udemy-data-wrangling
/DataCleaning/audit.py
2,698
4.21875
4
""" Observation of types - NoneType if the value is a string "NULL" or an empty string "" - list, if the value starts with "{" - int, if the value can be cast to int - float, if the value can be cast to float, but CANNOT be cast to int. For example, '3.23e+07' should be considered a float because it can be cast ...
true
4afad85b6bcbaf932ee7a4754308804db627d963
kalyanrohan/ASSIGNMENTS
/FIBONACCI.py
246
4.15625
4
#0,1,1,2,3,5,8 def fibonacci(n): if n <= 1: return n else: return(fibonacci(n-1) + fibonacci(n-2)) nterms = int(input("n= ")) print("Fibonacci sequence:") for i in range(nterms): print(fibonacci(i))
false
1df3bc87016ad046ffc4c7a27108e943ae84da27
kalyanrohan/ASSIGNMENTS
/level2excercise.py
1,187
4.6875
5
#LEVEL 2 """ 1.Using range(1,101), make a list containing only prime numbers. """ prime=[x for x in range(2,101) if x%2!=0 and x%3!=0 and x%5!=0 and x%7!=0] print(prime) """ 2.Initialize a 2D list of 3*3 matrix. E.g.- 1 2 3 4 5 6 7 8 9 Check if the matrix is symmetric or not. """ """ 3. Sorting refers to arranging da...
true
1ff75c4685f869eece4ada6af2fb00769e251097
JudgeVector/Projects
/SOLUTIONS/Text/CountVowels.py
636
4.1875
4
""" Count Vowels - Enter a string and the program counts the number of vowels in the text. For added complexity have it report a sum of each vowel found. """ vowels = ['a','e','i','o','u'] vowel_count = [0,0,0,0,0] def count_vowels(s): for i in range(0, len(s)): if s[i] in vowels: for j in range(0, len(vowels))...
true
53cf3eed32f2c405ee56e4b433e3180bc1aa1d77
kju2/euler
/problem033.py
1,362
4.15625
4
""" The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s. We shall consider fractions like, 30/50 = 3/5, to be trivial examples. There are exactly four non-trivial examples ...
true
a3940af34ce7d808facbdb0ac67cdbbd17d50a23
xxrom/617_merge_two_binary_trees
/main.py
2,534
4.125
4
# Definition for a binary tree node. class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right def __str__(self): return str(self.__dict__) class Solution: # print all values def printAll(self, root): if root...
true
2d425e371bd59c5a0ad3e6807a239378c5e44a12
jiaoqiyuan/Tests
/Python/python-practice/chapter5-if/toppints.py
1,428
4.25
4
requested_topping = 'mushrooms' if requested_topping != 'anchovies': print("Hold the anchovies!") answer = 17 if answer != 42: print("That is not the correct answer. Please try again!") requested_toppings = ['mushrooms', 'extra cheese'] if 'mushrooms' in requested_toppings: print("Adding mushrooms.") if 'pepperon...
true
9fac6a0305889d4cdbe3bfa868aea21272314850
mmaoga/bootcamp
/helloworld.py
711
4.21875
4
print ("hello, world") print ("hi my name is Dennis Manyara") print("This is my first code") for _ in range(10): print("Hello, World") text = "Hello my world" print(text) text = "My name is Dennis Maoga Manyara" print(text) print("hello\n"*3) name = "Dennis M." print("Hello, World, This is your one and only",n...
true
a0716d4c67188d6e9e25e3e2220fa754fad57444
NewmanJ1987/design_patterns_python
/creational/factory.py
1,487
4.25
4
# Factory pattern: Abstract away the creation of an object from the # client that is creating object. TWO_WHEEL_VEHICLE = 1 THREE_WHEEL_VEHICLE = 2 FOUR_WHEEL_VEHICLE = 3 class Vehicle(): def print_vechile(self): pass class TwoWheelVehicle(Vehicle): def __init__(self): super(TwoWheelVehicle...
false
303fbdd2815a32d580ccd80192cd28da946a2865
Tej-Singh-Rana/Code-War
/code3.py
263
4.15625
4
#!/bin/python3 #reverse !! name=input("Enter the word you want to reverse : ") print(name[::-1],end='') #to reverse infinite not adding value in parameters. print('\n') #print(name[4::-1],end='') #to reverse in max 4 index values. #print('\n')
true
0deae1c6773a018bef55d8e1bcbc5477eee7311c
yuuuhui/Basic-python-answers
/梁勇版_4.5rpy.py
964
4.34375
4
day = int(input("Enter today's day :")) daye = int(input("Enter the number of days elaspsed since today:")) dayf = day + daye dayc = dayf % 7 print(dayc) if day == 0: print("Today is Sunday") elif day == 1: print("Today is Monday") elif day == 2: print("Today is Tuesday") elif day == 3: ...
false
8057729bfad807fc5b23ed68b71e5746af7b26ee
yuuuhui/Basic-python-answers
/梁勇版_4.28rpy.py
949
4.21875
4
x1,y1,w1,h1 = eval(input("Enter r1's x-,y- coordinates,width,and height:")) x2,y2,w2,h2 = eval(input("Enter r2's x-,y- coordinates,width,and height:")) hd12 = abs(x2 - x1) vd12 = abs(y2 - y1) if 0 <= hd12 <= w1 /2 and 0 <= vd12 <= h1 / 2: print("The coordinate of center of the 2nd rect is withi...
true
dfa4ad361b159743f8ecd2f3888e6e6e1420ed3d
yuuuhui/Basic-python-answers
/梁勇版_5.24py.py
640
4.125
4
loan = eval(input("Loan Amount")) year = int(input("Number of Years:")) rate = eval(input("Annual Interest Rate:")) monthly = (loan * rate / 12) / (1 - 1 / ((1 + rate / 12) ** (year * 12))) total = monthly * 12 * year print("Monthly Payment:{:.2f}".format(monthly)) print("Total Payment:{:.2f}".format(total)) p...
false
c51001c9f85d970cba0d7e06757e021919ec132e
joseluisvzg/EnvioClickChallenge
/Python/Exercise2.py
415
4.34375
4
#!/usr/bin/env python consec_vowel = { 'a': 'e', 'e': 'i', 'i': 'o', 'o': 'u', 'u': 'a' } def vowels_changer(text): new_text = [] for char in text.lower(): if char in consec_vowel: char = consec_vowel[char] new_text.append(char) new_text = ''.join(new_text) return new_text if __name__ == "__main__": ...
false
e174013d66f9135fd27ed24b666eff412b3f49c3
Sarumathikitty/guvi
/codekata/Absolute_Beginner/check_odd_even.py
264
4.5
4
#program to check number whether its odd or even. number=float(input()) num=round(number) #check number whether it is zero if(num==0): print("Zero") #whether the number is not zero check its odd or even elif(num%2==0): print("Even") else: print("Odd")
true
a34a5cf032f82720848d4adaef67d135ad941e4c
pradyotpsahoo/P342_A1
/A1_Q2.py
500
4.46875
4
# find the factorial of a number provided by the user. # taking the input from the user. num = int(input("Enter the number : ")) factorial = 1 # check if the number is negative, positive or zero if num < 0: print("Factorial does not exist for negative numbers. Enter the positive number.") elif num == 0: ...
true
aa9b82d2376bccc0c2ee86a4458901fd1bb42707
SireeshaPandala/Python
/Python_Lesson5/Python_Lesson5/LinReg.py
936
4.15625
4
import numpy as np import matplotlib.pyplot as plt #for plotting the given points x=np.array([2.9,6.7,4.9,7.9,9.8,6.9,6.1,6.2,6,5.1,4.7,4.4,5.8]) #converts the given list into array y=np.array([4,7.4,5,7.2,7.9,6.1,6,5.8,5.2,4.2,4,4.4,5.2]) meanx=np.mean(x) #the meanvalue of x will ...
true
0006e05bf9c4ce0377506756e72398b560e3cc21
swimbikerun96/Brian-P.-Hogan---Exercises-for-Programmers
/#25 Password Strength Indicator/Password Strength Indicator - Constraints.py
1,900
4.125
4
#Create lists to check the password entered against numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'] special_characters = [' ','!','"','#','$','%','&',"'",'(',')','*','+',',','-','.','/',':',';','<','=','>','?','@','[','\'',']','^','_','`','{','|','}','~'] alphabet = ['a','b','c','d','e','f','g','h','i',...
false
7cb0fe658d8359c299ca1cca662c19c015d7441a
pvaliani/codeclan_karaoke
/tests/song_test.py
714
4.21875
4
import unittest from classes.song import Song class TestSong(unittest.TestCase): def setUp(self): self.song = Song("Beautiful Day", "U2") # - This test determines that a song exists by comparing the object self.song with attribute "name" to the value of "Beautiful Day by U2" # - self.song.name re...
true
f25ecf69bcb1c5f168f74fd923d72b9a53248763
MomSchool2020/show-me-your-cool-stuff-LisaManisa
/Lesson3.py
583
4.15625
4
print("Hello World!") # if you have a line of text that you want to remove, #"comment it out" by adding in a hashtag. # print("Hello World!") # text in Python is always in quotation marks print("Lisa") print("Hello World. Lisa is cool") print("Lisa said, 'I love you'") print('Lisa said, "I love you"') # if you put anyt...
true
821f16b00b90c79867dfbfbf7f93d92d9ce3a23b
agray998/qa-python-assessment-example
/exampleAssessment/Code/example.py
503
4.5625
5
# <QUESTION 1> # Given a string, return the boolean True if it ends in "py", and False if not. Ignore Case. # <EXAMPLES> # endsDev("ilovepy") → True # endsDev("welovepy") → True # endsDev("welovepyforreal") → False # endsDev("pyiscool") → False # <HINT> # What was the name of the function we have seen which change...
true
231b812ebd89cf804f350a03e3ca5d0b11023cb8
TonaGonzalez/CSE111
/02TA_Discount.py
1,162
4.15625
4
# Import the datatime module so that # it can be used in this program. from datetime import datetime # Call the now() method to get the current date and # time as a datetime object from the computer's clock. current = datetime.now() # Call the isoweekday() method to get the day # of the week from the current...
true
fb0055af02a4823c00e6baeaa1c44c3089dacd4a
hovell722/eng-54-python-practice-exercises
/exercise_102.py
610
4.3125
4
# # Create a little program that ask the user for the following details: # - Name # - height # - favourite color # - a secrete number # Capture these inputs # Print a tailored welcome message to the user # print other details gathered, except the secret of course # hint, think about casting your data type. name ...
true
d2d41bc519f79737818c852306c97b988e89ace7
hovell722/eng-54-python-practice-exercises
/exercise_107.py
1,370
4.46875
4
# SIMPLEST - Restaurant Waiter Helper # User Stories #1 # AS a User I want to be able to see the menu in a formated way, so that I can order my meal. #2 # AS a User I want to be able to order 3 times, and have my responses added to a list so they aren't forgotten #3 # As a user, I want to have my order read back to ...
true
12bfab7e083f2b0326e72ec60cd53c42be2dd280
monicajoa/holbertonschool-higher_level_programming
/0x0B-python-input_output/6-from_json_string.py
425
4.15625
4
#!/usr/bin/python3 """This module holds a function From JSON string to Object """ import json def from_json_string(my_str): """function that returns an object (Python data structure) represented by a JSON string Arguments: my_str {[str]} -- string to convert to object Returns: ...
true
eb8ac907b35bacba795aae007f4d3adb03a77e23
monicajoa/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/4-print_square.py
703
4.5
4
#!/usr/bin/python3 """ This module hold a function that prints a square with the character #. """ def print_square(size): """ This function prints square by the size Paramethers: size: length of the square Errors: TypeError: size must be an integer ValueError: size must be >= 0...
true
63dac65210c83675bf6c7b07e055231e7434a8ec
enkefalos/PythonCourse
/hw1_question3.py
1,184
4.28125
4
def compare_subjects_within_student(subj1_all_students :dict, subj2_all_students :dict): """ Compare the two subjects with their students and print out the "preferred" subject for each student. Single-subject students shouldn't be printed. Choice for the data structu...
true
14f7a544807a575b1ee39c99bfbdad6c7efd90b1
tyteotin/codewars
/6_kyu/is_triangle_number.py
1,168
4.15625
4
""" Description: Description: A triangle number is a number where n objects form an equilateral triangle (it's a bit hard to explain). For example, 6 is a triangle number because you can arrange 6 objects into an equilateral triangle: 1 2 3 4 5 6 8 is not a triangle number because 8 objects do not form an equila...
true
d60efd85d0348706c2262820706a4234a775df1a
Sairahul-19/CSD-Excercise01
/04_is_rotating_prime.py
1,148
4.28125
4
import unittest question_04 = """ Rotating primes Given an integer n, return whether every rotation of n is prime. Example 1: Input: n = 199 Output: True Explanation: 199 is prime, 919 is prime, and 991 is prime. Example 2: Input: n = 19 Output: False Explanation: Although 19 is prime, 91 is not. """ # Implement t...
true