blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
c84a065c48fcf55dfb3b9cabef4b7ebb3a5daa30
karolinanikolova/SoftUni-Software-Engineering
/1-Python-Programming-Basics (Sep 2020)/Course-Exercises-and-Exams/01_First-Steps-in-Coding/00.Book-Exercise-2.1-09-Celsius-to-Fahrenheit.py
409
4.5
4
# cantilever converter - from degrees ° C to degrees ° F # Write a program that reads degrees on the Celsius scale (° C) and converts them to degrees on the Fahrenheit scale (° F). # Search the Internet for a suitable formula to perform the calculations. Round the result to 2 characters after the decimal point . celsi...
true
8ab62ad0f771f7a9ff9584f8658ba95b43e9eeca
karolinanikolova/SoftUni-Software-Engineering
/1-Python-Programming-Basics (Sep 2020)/Course-Exercises-and-Exams/01_First-Steps-in-Coding/00.Book-Exercise-2.1-02-Inch-to-cm.py
216
4.5
4
# transfer from inches to centimeters # Let's write a program that reads a fractional number in inches and turns it into centimeters: inches = float(input('Inches = ')) cm = inches * 2.54 print('Centemeters = ', cm)
true
8234875c60ac230a706483af3dafb4607ee676a2
karolinanikolova/SoftUni-Software-Engineering
/2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/05-Lists-Advanced/02_Exercises/01-Which-are-in.py
544
4.125
4
# 1. Which Are In? # Given two lists of strings print a new list of the strings that contains words from the first list which are substrings # of any of the strings in the second list (only unique values) first_string = input().split(", ") second_string = input().split(", ") result = [] result = [el_1 for el_1 in fi...
true
a0789b7ead629decb63e12a02a564f5714f3662f
karolinanikolova/SoftUni-Software-Engineering
/2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/01-Basic-Syntax-Conditional-Statements-and-Loops/01_Lab/02_Number-Definer.py
655
4.375
4
# 2. Number Definer # Write a program that reads a floating-point number and prints "zero" if the number is zero. # Otherwise, print "positive" or "negative". Add "small" if the absolute value of the number is less than 1, # or "large" if it exceeds 1 000 000. number = float(input()) if number == 0: print('zero')...
true
ab300331451196893a2ee98a123402acfcf8ac20
karolinanikolova/SoftUni-Software-Engineering
/3-Python-Advanced (May 2021)/01-Lists-as-Stacks-and_Queues/02_Exercises/06-Balanced-Parentheses.py
1,592
4.125
4
# 6. Balanced Parentheses # You will be given a sequence consisting of parentheses. Your job is to determine whether the expression is balanced. # A sequence of parentheses is balanced if every opening parenthesis has a corresponding closing parenthesis that occurs # after the former. There will be no interval symbols ...
true
a99ae46ca13a1dc80d2c1f8e9ccda8c1bb8d7186
karolinanikolova/SoftUni-Software-Engineering
/2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/00-Exam-Prep/01_Mid_Exam_Prep/04-Programming-Fundamentals-Mid-Exam/02-Shopping-List.py
1,797
4.21875
4
# Problem 2. Shopping List # It’s the end of the week and it is time for you to go shopping, so you need to create a shopping list first. # Input # You will receive an initial list with groceries separated by "!". # After that you will be receiving 4 types of commands, until you receive "Go Shopping!" # • Urgent {item}...
true
12a2374d1ad6933ce1c608be3db936c602be1563
karolinanikolova/SoftUni-Software-Engineering
/2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/05-Lists-Advanced/02_Exercises/04-Office-Chairs.py
2,135
4.1875
4
# 4. Office Chairs # So you've found a meeting room - phew! ' \ # 'You arrive there ready to present, and find that someone has taken one or more of the chairs!! ' \ # 'You need to find some quick.... check all the other meeting rooms to see if all of the chairs are in use. # You will be given a number n re...
true
74894d7a10bd1878b8975413aa84e9eff487c2e0
karolinanikolova/SoftUni-Software-Engineering
/2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/04-Functions/02_Exercises/01-Smallest-of-Three-Numbers.py
415
4.34375
4
# 1. Smallest of Three Numbers # Write a function which receives three integer numbers and returns the smallest. Use appropriate name for the function. def smallest_of_three_numbers(num1, num2, num3): return min(num1, num2, num3) first_number = int(input()) second_number = int(input()) third_number = int(input()...
true
72e0d3596a600d4c1366bd720c0048b3e7497a40
karolinanikolova/SoftUni-Software-Engineering
/2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/04-Functions/01_Lab/01-Grades.py
695
4.3125
4
# Write a function that receives a grade between 2.00 and 6.00 and prints the corresponding grade in words # • 2.00 – 2.99 - "Fail" # • 3.00 – 3.49 - "Poor" # • 3.50 – 4.49 - "Good" # • 4.50 – 5.49 - "Very Good" # • 5.50 – 6.00 - "Excellent" def convert_grade_to_text_grade(grade_as_num): if 2 <= grade_as_num <= 2....
true
65d9e7e6eb505218efc0da6b5ff7fbe8f7797d46
shivamrastogi4/MyProject
/Matrix.py
1,109
4.1875
4
from numpy import * arr = array([('shivam', 22, 3, 4), (1, 2, 3, 4)]) arr1 = array([ [1, 2, 3, 4, 5, 6], [5, 6, 7, 8, 9, 10] ]) arr11 = array([ [1, 2, 3, 4], [5, 6, 7, 8] ]) # print(arr.dtype) print(arr1.ndim) print(arr.shape) print(arr.size) # size of entire block i.e. how manny element...
true
3adb3e9b17f458acec92bbbeb30f66846ed55d4a
SACHSTech/ics2o-livehack1-practice-Tyler-Ku
/minutes_days.py
667
4.3125
4
""" ------------------------------------------------------------------------------- Name: minutes_days.py Purpose: Write a program that lets you enter a number of minutes, and that will calculate the number of days, hours and minutes that represents (Hint: use the modulus operator). Author: Ku.T Created: 02/09...
true
02590ed7b8c9120798df10e7182a9afc2a1e35ca
Lormenyo/Data-Structures-And-Algorithms
/linkedlist.py
2,357
4.4375
4
# singly linked list is a collection of nodes # head and tail of a linkedlist # going through the nodes is called traversing the linkedlist(link hopping or pointer hopping) # Linked list does not have a predetermined fixed size # It uses space proportionally to the number of elements # nodes are pointers ...
true
ab122b9bc224e4f975015703d25328507ddf681a
SEEVALAPERIYA/python
/palindrome or not .py
288
4.15625
4
num=input('enter any number:') try: val=int(num) if num==str(num)[::-1]: print('the given number is palindrome') else: print('the given number is not palindrome') except value error: print("that' 5 not a valid number,try again!")
true
55cdc37d569e34e14015d514f9cf82701915a070
ebnezerdaniel/PythonPractise
/CircleArea.py
400
4.15625
4
#!/usr/bin/env python # coding: utf-8 # In[9]: #solving directly using the formula # In[12]: Circle=float(input('Radius of Circle:')) Area=(22/7)*(Circle**2) print('Area of a circle', Area) # In[ ]: # In[10]: #importing math package and pi function # In[11]: from math import pi Circle=float(input...
true
e7534d1e0ccaf9b3818a4d2852c2a6780805899b
game-racers/Python-Projects
/Computer Science 131/Lab4/Lab4Q1 RPS.py
2,784
4.1875
4
import random userWins = 0 compWins = 0 ties = 0 playing = "yes" cF = 1 while playing == "yes" or playing == "Yes" or playing == "y": while cF == 1: player = str(input("Rock, Paper, or Scissors? ")) if player == "rock" or player == "Rock": cF = 0 player = "Rock...
true
76bcdf6d4d3ee2ebeefff6d67e251ff771086103
iAbhishek91/algorithm
/basics/20_for.py
240
4.5
4
# for loops are used for special purpose, looping through collection for example for char in "cat": print(char) for item in [10, 20, 30]: print(item) for index in range(5): print(index) for num in range(3, 8): print(num)
true
e2abc9a3b5f54cd6699b37968bd9ebd06907ff56
siuols/Python-Basics
/strings.py
2,216
4.21875
4
def init(): input_string = input("Enter a string: ") count = 0 upper_string(input_string) lower_string(input_string) count_string(input_string) convertion_to_list(input_string) indexing(input_string) count_string(input_string) reverse(input_string) slicing(input_string) start...
true
87301903697605cf31598371c50d0ca080f70a40
tigju/Data-Structures
/stack/stack.py
2,016
4.1875
4
""" A stack is a data structure whose primary purpose is to store and return elements in Last In First Out order. 1. Implement the Stack class using an array as the underlying storage structure. Make sure the Stack tests pass. 2. Re-implement the Stack class, this time using the linked list implementation as th...
true
77b7c59fe238344aa47f0bc163b949029bec514b
roseleonard/Calculator
/clac.py
2,554
4.25
4
# print("Hello calculator") # #Add 2 numbers # number1 = input("Give me a number.") # number2 = input("What's the second number?") # def addition(number1,number2): # step1 = int(number1) + int(number2) # return step1 # def mulitplication(number1,number2): # step1 = int(number1) * int(number2) # retur...
true
48855e160b7e907ba6f977f791d3214bde446487
nidhi76/PPL20
/assign4/shapes/s-p/inhe14.py
683
4.5625
5
# draw color filled circle in turtle import turtle # creating turtle pen t = turtle.Turtle() # taking input for the radius of the circle r = int(input("Enter the radius of the circle: ")) # taking the input for the color col = input("Enter the color name or hex value of color(# RRGGBB): ") # set the fillco...
true
cc20bebc598d46425282f7fea40b75d09d2a005c
tapanprakasht/Simple-Python-Programs
/palindrome.py
420
4.375
4
#!/usr/bin/python3 # Program to check the given string is palindrome or not def main(): str=input("Enter the string:") length=len(str) length=length-1 i=0 flag=True while i<=length: if str[i]!=str[length]: flag=False break i+=1 length-=1 if flag==False: print("{} is not palindr...
true
72e1c0f68d30f93c2a3f3c6cbee42dfc803e226d
tapanprakasht/Simple-Python-Programs
/Amstrong.py
595
4.15625
4
#!/usr/bin/python3 # Program to check whether the given number is amstrong or not class Amstrong: def __init__(self): self.num=0 def getNumber(self): self.num=int(input("Enter the number:")) def checkNumber(self): n=self.num mod=0 s=0 while n>0: mod=n%10 s=s+(mod*m...
true
70b93e79428b23c6689a33ed1e295ee3562395b5
allualexander333/Python-Workshop
/BB-Level1-Assignment.py
993
4.28125
4
#!/usr/bin/env python #Print the current date and time at the start of the program (hint: use the datetime library and search the internet) import datetime now = datetime.datetime.now() print ("Current date and time using str method of datetime object : ") print (now) #Print out all the even numbers from the below...
true
01a0a97d8baf150e6e2a7d587192440ee134760d
sageetemple/Templeton_Sage
/Py.Lesson04/average_global.py
344
4.15625
4
num1=float(input("What is your first number: ")) num2=float(input("What is your second number: ")) num3=float(input("What is your third number: ")) avg=0 def average(): global avg avg =(num1+num2+num3)/3 def display(): print("The average of", num1, ",", num2, ", and", num3, "is", "{:00.5f}".format(avg)) a...
true
86b10245d0bec09d06900d1a6cbfc5ae0ad734ef
psavery/python-ci-test
/python_ci_test/dot_product.py
488
4.28125
4
#!/usr/bin/env python3 """ Calculate the dot product of two lists. """ def dot_product(list_a, list_b): """ Calculate the dot product of two lists. Args: list_a: the first list list_b: the second list Returns: The dot product of the two lists. """ if len(list_a) != len(list_...
true
342893be942041b1bc3a7a15ee61fbcb154c1a5d
rkechols/Advent2020
/day23/cup_game.py
2,545
4.15625
4
import time from typing import Dict, Tuple STARTING_CUP_ORDER = "916438275" SECTION_SIZE = 3 BIGGEST_CUP_NUMBER = 1000000 MOVE_COUNT = 10000000 def get_starting_cup_dict(big: bool) -> Tuple[Dict[int, int], int, int, int]: cups_list = [int(label) for label in STARTING_CUP_ORDER] biggest = max(cups_list) if big: ...
true
04a646303d7f530ef9f49333b6a3c777c36d3b8a
joseeden/notes-cbt-nuggets-devasc
/Notes_0-9/4-Observer.py
1,652
4.21875
4
#******************************************************************************************************************# # 4-Observer.py #******************************************************************************************************************# # 2021-01-04 05:43:06 # This is the code used in '2-Understanding...
true
a920371734dc8a37ddb9632212616fcd5049cb95
Oliveira-Renato/ThinkPythonExercices
/ch01/exer1.py
824
4.3125
4
#1. In a print statement, what happens if you leave out one of the parentheses, or both? #print('Hello, World!' #R:SyntaxError: invalid syntax #2. If you are trying to print a string, what happens if you leave out one of the quotation marks,or both? #print('Here we go) #R: EOL while scanning string literal #3. You ...
true
3956bde95df92f0d42cfe5b3971f0ec8be4b61a1
momentum-cohort-2018-10/w1d2-house-hunting-meagabeth
/house_hunting.py
611
4.21875
4
annual_salary = float(input("Enter your annual salary: ")) portion_saved = float(input("Enter the percent of your salary to save, as a decimal: ")) total_cost = float(input("Enter the cost of your dream home: ")) # portion_down_payment = total_cost*.25 # current_savings = current_savings + current_savings*r/12 num_of_...
true
a66060ca33414a76e51665db90a2aaea6c00bc63
williechow97/String-Lists---Palindrome
/String List -- Palinedrome.py
1,880
4.21875
4
# Palindrome # Ask the user for a string and print out whether this string # is a palindrome or not. (A palindrome is a string that reads the same forwards and backwards.) ''' fix to catch numbers make so ignores spaces and exclamation best to separate string into list of char and check conditions and create...
true
8dc25f4ce9c7d748f487d04975862f4a25d5496c
jjmanjarin/MathNStats
/_build/jupyter_execute/03_Graphs_with_Pandas.py
2,954
4.375
4
# Graphics with Pandas We have seen how to use **matplotlib** to generate the basic graphs we may need in our statistical analysis. However, since the main data structure we are going to work with is the data frame which is defined in **pandas**, we may want to fully use this library to make the graphs. If we use thi...
true
b244c6a422b05a1ea159cdbc5cb207f23c793e51
pereiradaniel/python_experiments
/raw_input/greeting.py
441
4.15625
4
# Prompt user for name name = input("What is your name?: ") # Print name if name is greater than 0 and consists of alphabetic characters if len(name) > 0 and name.isalpha(): print ("Hello " + name) # Print everything from the second letter onward first = name[0] new_word = name + first + "ay" new_w...
true
f1efa39e2e495d688f5737ce11ee14be81256a4c
c34809368/260201053
/lab8/example5.py
607
4.28125
4
def password_checker(password): level=0 if (len(password)<8) or (" " in password): print("It is not valid") return level else: for char in password: if char.isdigit(): level+=1 break for char in password: if char.isalpha(): level+=1 break for char in...
true
3df662f8b4851d35f4af76d83f49e05e71711efe
iguerrexo/111
/111/intro.py
871
4.15625
4
print('Hello form Python') last_name = 'Guerrero' age = 20 found = False total = 13.44 print(last_name) print("Nora"+last_name) print(age + age) #this will give an error print(last_name + str(age)) print (age + total) #math print('----------------------------------') print(1 + 1) print(42 - 21) p...
true
f55009a4529b27991dda38b278478ce5aae01d3c
takashimokobe/algorithms
/lab3/array_list.py
2,678
4.3125
4
import unittest from sys import argv # A List is one of # None # A reference to an arrary and a int representing size class List: def __init__(self, list, size): self.list = list self.size = size def __eq__(self, other): return (type(other) == List and self.list == other.list an...
true
4706aa47eeac1008a1289a7a9958364916fe43e0
shrikantpadhy18/interview-techdev-guide
/Algorithms/Searching & Sorting/Insertion Sort/InsertionSort.py
1,088
4.15625
4
class InsertionSort(): def __init__(self, list_to_sort): self.sorted_list = list_to_sort self.__sort() def __sort(self): i = 1 while i < len(self.sorted_list): x = self.sorted_list[i] j = i - 1 while j >= 0 and self.sorted_list[j] > x: ...
true
0d94ee7adf61e4e1c20935b03cc42db3f408698e
quantacake/Library
/backend.py
2,430
4.1875
4
# Archive Application (Backend) import sqlite3 """ Backend: Attach functions to all objects (e.g. listbox, butotns, entries, etc) which will retreive data from an SQLite database. """ class Database: # initializer / constructor # this gets executed when you call an instance of the class. ...
true
0ad89a8b136632ad52a1fdd383702bf6642a14c5
AAJAL/Simple-Python-Programs
/alphabet.py
525
4.40625
4
def display_alphabet_by_code(preference): if preference == "lowercase": number = 97 for i in range(26): print(chr(number)) number += 1 elif preference == "uppercase": number = 65 for i in range(26): print(chr(number)) number += 1 ...
true
16b6c2d14666968fe3be9d1f6f167c65b5637887
aadithpm/code-a-day
/py/Isograms.py
479
4.15625
4
""" An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains only letters is an isogram. Assume the empty string is an isogram. Ignore letter case. is_isogram("Dermatoglyphics" ) == true is_isogram("aba" ) == false is_isogra...
true
f77bb1ffce190ffa43009580fa1374d3bf911776
UmbertoFasci/CodewarsWriteups
/Give_me_a_diamond.py
1,388
4.46875
4
#! /usr/bin/python3 """ Jamie is a programmer, and James' girlfriend. She likes diamonds, and wants a diamond string from James. Since James doesn't know how to make this happen, he needs your help. You need to return a string that looks like a diamond shape when printed on the screen, using asterisk(*) characters. T...
true
132d82ea41a401eac464184e1c8045aa20df014b
neeleshcrasto/Assignments
/100Plus/quest8.py
458
4.28125
4
#-------------------------------------------------------------------------------------# ## This accepts a comma separated sequence of words as input ## ## Then prints the words in a comma-separated sequence after sorting them alphabetically ## #---------------------------------------------------------------------------...
true
4d7998320a4e5dae8ecff7148d07892f1e59c774
neeleshcrasto/Assignments
/100Plus/quest4.py
378
4.28125
4
#---------------------------------------------------------------------------------# ## Accept a string of comma separated values and print out as list & tuple ## #---------------------------------------------------------------------------------# values = input('Enter values separated by comma\n') liszt = values.spli...
true
8225842771ab1017d304cf92c62de5b86f86bd65
nkhaja/Data-Structures
/queue.py
1,379
4.125
4
#!python from linkedlist import LinkedList class Queue(LinkedList): def __init__(self, iterable=None): """Initialize this queue and enqueue the given items, if any""" super(Queue, self).__init__() if iterable: for item in iterable: self.enqueue(item) def _...
true
f2926a48ba00c6344cfab1dd4ee6c280c6352071
TeoBlock/cti110
/M3T1_AreaOfRectangles_McIntireTheodore.py
1,693
4.5625
5
# CTI-110 # Module 3 Tutorial 1 # Theodore McIntire # 05 October 2017 # This program gets user input and then outputs which rectangle has the greater area # variables for rectangle 1 and 2 length and width length1 = 0 width1 = 0 area1 = 0 length2 = 0 width2 = 0 area2 = 0 # initial variable values are set...
true
734f158b54c8d856de0a2e81e59397b69399ddbf
TeoBlock/cti110
/M5T2_McIntireTheodore.py
1,073
4.34375
4
# CTI-110 # Module 5 Tutorial 2 # Theodore McIntire # 12 October 2017 # This program totals the number of bugs collected in a week #def main() uses a for loop def main(): # This program uses these variables # ? ? ? I DO NOT UNDERSTAND WHY THIS PROGRAM DOES NOT RUN # IF THESE VARIABLES ARE DEFIN...
true
6f71141dc458512bd412f4f4351ae6ca9ad029fa
Trex275/C---97
/C97.py
468
4.1875
4
#Write a program to count the number of words in the input by user userinput = input("Enter any sentence :") print(userinput) numberofwords = 1 numberofcharachters = 0 for i in userinput: if i==' ': numberofwords = numberofwords + 1 else: numberofcharachters = numberofcharachters + 1...
true
f71b8ff05499b70dc7d062c09c60ffa566ce9e2e
jashburn8020/design-patterns
/python/src/prototype/prototype_test.py
1,907
4.21875
4
"""Prototype pattern example.""" import copy class Address: """A person's address.""" def __init__(self, street: str, city: str, country: str): self.country = country self.city = city self.street = street def __eq__(self, other: object) -> bool: """Two `Address` objects ...
true
4a8634e9e9e8b767a7c36e57c6a1ee559c271a5e
sidhanshu2003/Python-assignments-letsupgrade
/Batch 6 Python Day 3 Assignment.py
871
4.125
4
#!/usr/bin/env python # coding: utf-8 # In[36]: # Sum of n numbers with help of while loop #Input from user num = eval(input("Please enter the number ")) sum = 0 while num >0: sum = sum + num print(f"Number is --> {num} Sum is --> {sum}") num= num -1 print ("Final Sum is ", sum) print (f"Final Sum is ...
true
5ec55686e4dfb98d372ea6537a8a01c2ed893fb1
asleake/AdventOfCode2020
/Day3.py
740
4.21875
4
"""Day 3 of Advent of Code 2020. Running this file will print out the correct answers to the two puzzles from Day 3.""" from common.imports import importAdventFile from common.slope_functions import findTreesOnSlope data = importAdventFile('data/Day3Input') def FirstPart(): """ Find the number of trees for the gi...
true
c52d1872447e2ae0d2fce6e2b62517f892ac1af2
SACHSTech/ics2o1-livehack---2-GavinGe3
/problem1.py
966
4.21875
4
""" ------------------------------------------------------------------------------- Name: problem1.py Purpose: Given an input of the number of antennas and eyes, determines the alien lifeform Author: Ge.G Created: 23/02/2021 ------------------------------------------------------------------------------ """ pri...
true
c3d9fbf50cc43b31032aa5a80a0433998774fa75
Bedrock02/Interview-Practice
/CSSpartans/quiz3.py
1,457
4.15625
4
''' Implement the function makeChange(cents, coins) Given an input cents and coins, makeChange should output an object that contains the minimum amount of coins needed to equate to cents in value. Coins is an array that contains the coin values. Input makeChange will take in 2 parameters, an integer cents, and a...
true
357f133aa1d44da3baa30b32d2260f7edfcf0d51
Bedrock02/Interview-Practice
/Array_Strings/string_compression.py
1,259
4.34375
4
''' Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2blc5a3. If the "compressed" string would not become smaller than the original string, your method should return the original string My Solution 1. Iterat through string...
true
cff73d26ab370d55660d3817b6b4d41527228fdc
Bedrock02/Interview-Practice
/Stacks_Queues/sort_stack.py
1,536
4.1875
4
'''Write a program to sort a stack in ascending order. You should not make any assump- tions about how the stack is implemented. The following are the only functions that should be used to write this program: push | pop | peek | isEmpty.''' # Solution Explanation # In order to sort a stack we need another stack # 1 ...
true
2affdb4fbe889a193f4f33973d3de94c63e76325
PhoenixTAN/CS-591-Parallel-Computing
/Code/merge-k-lists/merge_lists_pairs.py
2,298
4.34375
4
import random from typing import List def merge_lists(inputs: List[List[int]]) -> List[int]: """ Merges an arbitrary number of sorted lists of integers into a single sorted list of integers. Iterates over the input list of lists. On each iteration, selects pairs (a, b) of lists to merge, copyi...
true
183c733935f791b6a73f6b6e45e176a9e5b12f0d
engemp/holbertonschool-higher_level_programming
/0x0B-python-input_output/1-number_of_lines.py
320
4.125
4
#!/usr/bin/python3 ''' Returns the number of lines in a txt ''' def number_of_lines(filename=""): ''' Returns the number of lines in a txt ''' numberLines = 0 with open(filename, mode='r', encoding='utf-8') as filet1: for line in filet1: numberLines += 1 return numberLines
true
3e39177428ef1421e0e47fd943c17924c9a45570
whiterabbitsource/pyhello
/hello.py
361
4.21875
4
# Hello! World! print("Hello, World!") # Learning Strings my_string = "This is a string" ## Make string uppercase my_string_upper = my_string.upper() print(my_string_upper) # Determine data type of string print(type(my_string)) # Slicing strings [python is zero-based and starts at 0 and not 1] print(my_string[0:4]) pri...
true
0d1f9138991dee73f157d07adff1dba350647ba2
NagaManjunath/algorithms
/stack/is_sorted.py
1,238
4.34375
4
""" Given a stack, a function is_sorted accepts a stack as a parameter and returns true if the elements in the stack occur in ascending increasing order from bottom, and false otherwise. That is, the smallest element should be at bottom For example: bottom [6, 3, 5, 1, 2, 4] top The function should return false bottom...
true
40f29fc621c51c189e097f3515a0ce7507e88d8d
manisha2412/SimplePythonExercises
/exc17.py
829
4.34375
4
""" Write a version of a palindrome recognizer that also accepts phrase palindromes such as "Go hang a salami I'm a lasagna hog.", "Was it a rat I saw?", "Step on no pets", "Sit on a potato pan, Otis", "Lisa Bonet ate no basil", "Satan, oscillate my metallic sonatas", "I roamed under it as a tired nude Maori", "Rise to...
true
048aefeb9045a6163d2707a54c4bc9b256ab231a
doron04/dsf
/block_1/sort_algorithms.py
1,469
4.125
4
import random import time num_elements = 10000 S = [random.randint(0,1000000) for x in range(num_elements)] def bubble_sort(array): '''Bubble Sort Algorithm. Takes an unsorted list as input and returns a sorted list''' k = len(array) S = array while k>0: for i in range(k-1): if S...
true
36e9aeb82022742bc55ff804dff18410942d2bf5
ikapoor/Project-Euler-
/palindromeChecker.py
450
4.1875
4
string = str(input("Please Enter a word: ")) string = string.replace(" ","") length = len(string) forwardString = [] for x in range(len(string)): forwardString.append(string[x]) backwardsString = [] for x in range(len(string)): backwardsString.append(string[length-1]) length = length -1 if (forwardSt...
true
add28130e02da71486ecdba1da96381c2d983f96
shincap8/holbertonschool-machine_learning
/math/0x00-linear_algebra/2-size_me_please.py
273
4.15625
4
#!/usr/bin/env python3 """Function to return the shape of the matrix""" def matrix_shape(matrix): """Function to return the shape of the matrix""" shape = [] x = matrix while type(x) is list: shape.append(len(x)) x = x[0] return shape
true
1610f9978876e43a5a97fe90a43bcb8fbe22f58e
ravichalla/wallbreaker
/week4/implement_stacks_using_queues.py
1,764
4.21875
4
''' QUESTION: 225. Implement Stack using Queues Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top() -- Get the top element. empty() -- Return whether the stack is empty. Example: MyStack stack = new MyStack(); stac...
true
88a14c40c2dd670acdd6ac98d4c40893e7f5502c
skyaiolos/AByteOfPython3
/SEC08-Func/func_param.py
317
4.15625
4
def printMax(a, b): if a > b: print(f'{a} > {b}, {a} is the maximum') elif a == b: print(f'{a} = {b} , {a} is equal to {b}') else: print(f'{a} < {b} , {b} is the maximum') printMax(3, 4) # directly give literal valuse x = 5 y = 7 printMax(x, y) # give variables as arguments
true
cd74a9c17acda27bbafb8496da772ef319d467a6
BrandonLMorris/InterviewPrep
/CrackingTheCodingInterview/Python/Chapter1/q3.py
709
4.1875
4
#!/usr/bin/env python3 """Solution to question 3 of chapter 1""" def is_perm(s1, s2): """Return true if s1 is a permutation of s2, assuming spaces count""" if len(s1) != len(s2): return False # Add for occurences in s1, subtract for occurences in s2 counts = [0 for _ in range(128)] for c i...
true
39349ad653d01cf8eeaeed04e271b9057c770eb1
ImagClaw/Python_Learning
/Classes&Objects/pet.py
1,419
4.28125
4
#! /bin/usr/env python3 # # Author: Dal Whelpley # Project: Pet Class build and then instantiation or the class # Date: 4/25/2019 class Pet: def __init__(self, name, animal_type, age): self.__name = name self.__animal_type = animal_type self.__age = age def set_name(self, name): ...
true
e1670d7b94b07d53ff54f582e94097ee1b31409f
ImagClaw/Python_Learning
/proj4.py
477
4.28125
4
#! /bin/usr/env python3 # # Author: Dal Whelpley # Project: Project 4 (convert Celsius to Fehrenheit) # Date: 4/22/2019 print("Converts Celsius to Fehrenheit.") # Tells user about program c = input("Enter the temp in Celsius: ") # input tempurature in celsius f = float(9/5)*float(c)+32 # converts input t...
true
4451ca66232d7465fa9084de2b3cb3085e61069f
lbs1991/py
/isnotin.py
482
4.21875
4
#!/usr/bin/python27 x = [x for x in range(1,10)] print(x) y =[] result = True if 12 not in x else False # this is the best way print(result) result = True if not 12 in x else False # this way just like as " (not 12) in x" print(result) print(x is y) print(x is not y) # this is the best way print(not x is y) # ...
true
946b7da8a38704cd49fd96392a2a61deefbd8680
tamarameisman/cse210-student-mastermind
/mastermind/game/player.py
2,391
4.125
4
class Player: """A person taking part in a game. The responsibility of Player is to keep track of their identity and last guess. Stereotype: Information Holder Attributes: _name (string): The player's name. _guess (guess): The player's last guess. """ def __init__...
true
bab22d104eb534c15aa529daab3e577603aca08d
KRHS-GameProgramming-2018/Lucas-and-Owen-Madlibs
/getInput.py
2,985
4.125
4
def getMenuInput(): goodInput = False while not goodInput: response = raw_input(" > ") if (response == "1" or response == "One"): response = "1" goodInput = True elif (response == "2" or response == "Two"): response = "2" ...
true
d562002df8df8225ecc1f967b62807c98208c089
prachived/PlagiarismDetector
/PlagiarismDetector/plagiarism-detector/factorial1.py
294
4.28125
4
#Test for comments def factorial(): #this is a comment if number < 0: print("Sorry, factorial does not exist for negative numbers") elif number == 0: print("The factorial of 0 is 1") else: for i in range(1,number + 1): fact = fact*i print("The factorial of",number,"is",fact)
true
bc94f3dd8cc1a0a90e16dd506213791166996311
1232145/Rock_paper_scissor
/Rock_Paper_Scissor.py
1,123
4.15625
4
from random import randint computer = randint(0,2) if computer == 0: computer = "rock" if computer == 1: computer = "scissor" if computer == 2: computer = "paper" def main(): run = True while run: player = input("rock, paper, or scissor? ").lower() if player == "rock" or player == "paper"...
true
bbf0d945f52849a9bf1c0e67ade855e1716c9d49
Nmewada/hello-python
/15_lists.py
323
4.1875
4
# List # Create a list using [] a = [1, 2 , 4, 50, 6] print(a) # Print the list using print() function # List Indexing # Access using index using a[0], a[1], a[2] print(a[2]) # Change the value of list using a[0] = 90 print(a) # We can create a list with items of different types b = [15, "Nitin", False, 6.9] print...
true
bf117ed9ea57d686ca00d55fe788f1cbd2dac122
alainno/fibras
/old_fibergen/rotation.py
626
4.125
4
import math import matplotlib.pyplot as plt def rotate(origin, point, angle): """ Rotate a point counterclockwise by a given angle around a given origin. The angle should be given in radians. """ ox, oy = origin px, py = point qx = ox + math.cos(angle) * (px - ox) - math.sin(angle) * (py ...
true
868e5fc193c8a6982c1de1937e0f089adb9f9455
vaibhavg12/Problem-Solving-in-Data-Structures-Algorithms-using-Python3
/Algorithms/2 Array Recursion/Segrigate.py
1,568
4.1875
4
"""Segregate even odd. """ def SegregateEvenOdd(arr): first = 0 second = len(arr) - 1 while first < second: if arr[first] % 2 == 0: first += 1 elif arr[second] % 2 != 0: second -= 1 else: arr[first], arr[second] = arr[second], arr[first] """ Segr...
true
9f592349b2200db2fd3fa16a555026eb5d6781aa
vaibhavg12/Problem-Solving-in-Data-Structures-Algorithms-using-Python3
/Algorithms/2 Version/minimalSwap.py
1,861
4.28125
4
""" Minimum swaps required to bring all elements less than given value together at the start of array. Use quick sort kind of technique by taking two index from both end and try to use the given value as key. Count the number of swaps that is answer. """ def minSwaps(arr, val): swapCount = 0 first = 0 ...
true
e1f076daa1983954c7c42fb70a35e2b2b428a50d
anjaandric/Midterm-Exam-2
/task3.py
572
4.25
4
""" =================== TASK 3 ==================== * Name: Recursive Sum * * Write a recursive function that will sum given * list of integer numbers. * * Note: Please describe in details possible cases * in which your solution might not work. * * Use main() function to test your solution. =========================...
true
b7bd510c8bac072a3183ce280105511722fa7f71
pranshu1921/RockPaperScissors
/rock_paper_scissors.py
1,048
4.1875
4
# -*- coding: utf-8 -*- """ Created on Sun Sep 6 17:25:10 2020 @author: Pranshu Kumar """ from random import randint #creating play options list t = ['Rock', 'Paper', 'Scissors'] #assigning random play to computer computer = t[randint(0,2)] #player set to False player = False while player == Fa...
true
ef2bea49c58a2e7dda39534533fae90292d44f72
SACHSTech/ics2o-livehack1-practice-SurelyH
/days_hours.py
531
4.34375
4
''' ------------------------------------------------------------------------------- Name: days_hours.py Purpose: Hours to days Author: Huang.S Created: date in 03/12/2020 ------------------------------------------------------------------------------ ''' # input number of hours hours = float(input("Enter the number...
true
7274e6dfff8a8a440251c5540b5486ab0851adef
Helblindi/ProjectEuler
/21-40/Problem30.py
1,157
4.15625
4
""" Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: 1634 = 1^4 + 6^4 + 3^4 + 4^4 8208 = 8^4 + 2^4 + 0^4 + 8^4 9474 = 9^4 + 4^4 + 7^4 + 4^4 As 1 = 1^4 is not a sum it is not included. The sum of these numbers is 1634 + 8208 + 9474 = 19316. Find the sum of all...
true
631e0b3445d7469c373ee3b920de47c5f78d395e
Helblindi/ProjectEuler
/21-40/Problem26.py
1,144
4.1875
4
""" A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given: 1/2 = 0.5 1/3 = 0.(3) 1/4 = 0.25 1/5 = 0.2 1/6 = 0.1(6) 1/7 = 0.(142857) 1/8 = 0.125 1/9 = 0.(1) 1/10 = 0.1 Where 0.1(6) means 0.166666..., and has a 1-digit recurring cycle. ...
true
0ac6d8684baa9490415a0c5e3df994b575040647
Helblindi/ProjectEuler
/21-40/Problem35.py
1,891
4.15625
4
""" The number, 197, is called a circlar prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. How many circular primes are there below one million? """ import time # driver function for our p...
true
2aabdcae8e38d6ab206ce7ab6973cd82073d425b
IMDCGP105-1819/portfolio-DarrylJF
/ex8.py
853
4.21875
4
portion_deposit = 0.2 current_savings = 0 r = 0.04 months = 0 annual_salary = float(input("Enter your annual salary: ")) semi_annual_raise = float(input("What is the semi-annual raise you expect to recieve (As a decimal): ")) portion_saved = float(input("Enter the percentage of your salary to save (As a decimal): ")) ...
true
13abb2314b335eae9c64df4c716899c62a12e100
IMDCGP105-1819/portfolio-DarrylJF
/ex4.py
732
4.15625
4
# replace these with your own values! my_name = 'Chris Janes' my_age = 21 # maybe my_height = 67 # inches my_weight = 160 # pounds my_eyes = 'Green' my_hair = 'Ginger' is_heavy = my_weight > 3000 to_kilo = my_weight * 0.45 # kilograms to_cent = my_height * 2.54 # centimetres print(f"Let's talk about {my_name}.") # swa...
true
8359343663507cf04b96b677d7aa9ce22d8df538
vikumkbv/Hacktoberfest-2k19
/python/isPrime.py
821
4.21875
4
# Run `python isPrime.py` for a standalone prime number checker. # Import `check_prime` function if integrating into another program. from math import sqrt def check_prime(val): if val <= 1: return False else: for i in range(2, int(sqrt(val)) + 1): if val % i == 0: return False return True def main...
true
126d2d9e537ba919529a95f6304ca38408756d3e
CTEC-121-Spring-2020/mod-3-programming-assignment-blymatthew20
/Prob-4/Prob-4.py
1,502
4.28125
4
# Module 3 # Programming Assignment 4 # Prob-4.py # Matthew Bly # Author: Bruce Elgort # Date: July 12, 2017 """ The Elgorte coffee shop sells coffee at $16.50 a pound plus the cost of shipping. Each order ships for $0.76 per pound plus $1.25 fixed cost for overhead. If the number of pounds of the coffee order...
true
be3dd70643347324b6611aff9577ab07fe706d27
guptaavani/Image-Filter
/Code.py
887
4.1875
4
#! /usr/bin/env python3 from PIL import Image im=Image.open(input("Enter image path \n")) #Taking the image path as input and saving it to im print("This is the original image you entered \n") im.show() #Showing the original image while(True): n=int(input(" Enter 1 for black and white filter \n Enter 2 for ma...
true
2d6678f45d8734eefe8ff7033927e0df2337bf39
LimZheKhae/DPL5211Tri2110
/Lab5.3.py
1,024
4.125
4
#Student ID :1201200825 #Student Name :Lim Zhe Khae #display the menu # ask user to enter their choice [1 or 2]. #if choice is 1 call function get_cm() #if choice is 2 call function get_meter() # Else print "Invalid choice" # In get_cm(); #Get the value of centimetre from the user # Call function cm_to_meter()...
true
168774838d17c2fffdae061bfb064a9430102ce6
pekkipo/DataStructures
/Queue/linkedqueue.py
675
4.25
4
from linkedlist import LinkedList class LinkedQueue: """ This class is a queue wrapper around a LinkedList. This means that methods like `add_to_list_start` should now be called `push`, for example. """ def __init__(self): self.__linked_list = LinkedList() def push(self, node): ...
true
3da2bf281a303c2d0010173ffcf1441300c66c58
patdflynn95/Recreational-Projects
/primefactors.py
944
4.46875
4
# Python program to print prime factors import math # A function to print all prime factors of # a given number n def primefactors(n): if n < 2: primefactors(int(input("Please choose a number greater than 1: "))) return None # First check if number is even if n %...
true
2220e3c8cd04f1a04524e4e0b9c8d0753695c0f7
moura-pedro/CS106A
/assignment02/khansole_academy.py
785
4.34375
4
""" File: khansole_academy.py ------------------------- Add your comments here. """ import random GOAL = 3 def main(): correct = 1 while (correct <= GOAL): num1 = random.randint(10, 99) num2 = random.randint(10, 99) answer = num1 + num2 print(f"What is {num1} + {num2}?") ...
true
ea7c6189e4214742f6ac654205a0687596bdc9a5
Nithy-Sree/Crazy-Python-
/colorChanger tkinter.py
938
4.3125
4
# pip install tkinter # random is built-in module in python import tkinter as tk import random colours = [ 'red', 'blue', 'green', 'pink','black', 'yellow', 'orange','white','purple', 'brown'] # create a GUI Window root = tk.Tk() # set the size of the window root.geometry("400x400")...
true
fe5710b591c22d818d09fe50e1b2a115ca424b42
gauffa/mustached-dubstep
/wip/ch4ex10.py
1,125
4.90625
5
## Matthew Hall ## ISY150 ## Chapter 4 ## Exercise 10 ## 09/23/2013 ##Write a program that calculates and displays a person's BMI. The BMI is ##often used to determine whether a person is overweight or underweight ##for their height. ##A person's BMI is calculated with the following formula: ##BMI = weight *...
true
d7fba79908b4eca52d30955abdb6282c917b7e83
gauffa/mustached-dubstep
/ch7/ch7ex7.py
700
4.15625
4
#Matt Hall #ISY 150 #Chapter 7 Exercise 7 #10/14/2013 #Write a program that writes a series of random numbers to a file. #Each random number should be in the range of 1 through 100. #The application should let the user specify how many random numbers #the file will hold. import random def main(): #take u...
true
a0bf4ef24f31754d6916877dea5de800a6bb8a29
gauffa/mustached-dubstep
/complete/ch3exr6.complete.py
817
4.90625
5
## Matthew Hall ## ISY150 ## Chapter 3 ## Exercise 6 ## 09/16/2013 ##Write a program that calculates and displays a person's BMI. The BMI is ##often used to determine whether a person is overweight or underweight ##for their height. ##A person's BMI is calculated with the following formula: ##BMI = weight * ...
true
59d2d20a01653c324ec54b86a61e6d15232eda93
gauffa/mustached-dubstep
/complete/ch2exr9.complete.py
2,585
4.4375
4
## Matthew Hall ## ISY150 ## Chapter 2 ## Exercise 9 ## 09/05/2013 ## Write a program that converts Celsius temperatures to Fahrenheit temperatures. ## The formula is as follows: F = (9/5) * C + 32 ##triple check this formula! ## The program should ask the user to enter a temperature in Celsius, and then ## display th...
true
580f2b7cbc7424123d3c8d0a6ce57af596740384
gauffa/mustached-dubstep
/ch9/ch9ex5.py
2,746
4.53125
5
#Matt Hall #ISY 150 #Chapter 9 Exercise 5 #10/27/2013 #Write a program that asks the user to enter a 10-character telephone number in #the format XXX-XXX-XXXX. The program should display the telephone number with any #alphanetic characters that appeared in the orignal translated to their numeric #equivalent. For examp...
true
95950e0f1122293126a093150b3ae6154a305f49
SusyVenta/TrigoPy
/radians_degrees_converter.py
913
4.1875
4
import math def convert_to(number, to="radians"): """ :param number: number to convert :param to: end unit of measure. default = 'radians'. Alternative = 'degrees' :return: converted number """ if to == "degrees": print("--------------- degrees to radians: deg * 180 / pi") retu...
true
44e548fe4582127455aab4aa14d5e87aca51b4a6
Akshatha-Udupa/AITPL2108
/larestofthree.py
529
4.28125
4
#largest of 3 numbers a = 100 b= 500 c = 00 if a > b and a > c: print("{0} is largest number".format(a)) elif b > c: print("{0} is largest number".format(b)) else: print("{0} is largest number".format(c)) #using function def largest(a,b,c): if a > b and a > c: print("{0} is larg...
true
ea2a65c9fb49c5b2270268739807fbc7b24f0af3
Ruturaj4/leetcode-python
/easy/confusing-number.py
1,181
4.125
4
# Given a number N, return true if and only if it is a confusing number, which # satisfies the following condition: # # We can rotate digits by 180 degrees to form new digits. When 0, 1, 6, 8, 9 are # rotated 180 degrees, they become 0, 1, 9, 8, 6 respectively. When 2, 3, 4, 5 and 7 # are rotated 180 degrees, they...
true
c2832722502bbe1f382ea21c6cee47aae524f067
reiinakano/personal_exercises
/CTCI19.8.py
641
4.1875
4
def find_all_pairs(array, sum): my_dict = {} for number in array: difference = sum - number if difference in my_dict: for i in range(my_dict[difference]): print str(difference) + ", " + str(number) if number in my_dict: my_dict[number] += 1 else: my_di...
true