blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
8f97da7c54be77e69733bb92efae07666c0ab421
Didden91/PythonCourse1
/Week 13/P4_XMLinPython.py
1,689
4.25
4
#To use XML in Python we have to import a library called ElementTree import xml.etree.ElementTree as ET #The as ET is a shortcut, very useful, makes calling it a lot simpler data = ''' <person> <name>Chuck</name> <phone type="intl"> +1 734 303 4456 </phone> <email hide="yes" /> </person>''' tree = ET.from...
true
69940b6c1626270cf73c0fe36c2819bbba1523bd
Didden91/PythonCourse1
/Week 11/P5_GreedyMatching.py
929
4.28125
4
#WARNING: GREEDY MATCHING #Repeat characters like * and + push OUTWARD in BOTH directions (referred to as greedy) to match THE LARGEST POSSIBLE STRING #This can make your results different to what you want. #Example: import re x = 'From: Using the : character' y = re.findall('^F.+:', x) print (y) #So you want to find '...
true
9c74e24deb16d11cc0194504b4be55ea81bd1115
Didden91/PythonCourse1
/Week 6/6_3.py
645
4.125
4
def count(letter, word): counter = 0 for search in word: if search == letter: counter = counter + 1 return counter letterinput = input("Enter a letter: ") wordinput = input("Enter a word: ") wordinput = wordinput.strip('b ') counter = count(letterinput, wordinput) print(counter) lowe...
true
1b8b5732eeb4b7c9c767c815e5c0f2ec0676a99a
Didden91/PythonCourse1
/Week 12/P7_HTMLParsing.py
2,523
4.375
4
#So now, what do we do with a webpage once we've retrieved it into our program # We call this WEB SCRAPING, or WEB SPIDERING # Not all website are happy to be scraped, quite a few don't want a 'robot' scraping their content # They can ban you (account or IP) if they detect you scraping, so be careful when playing aroun...
true
0196fbecdcaae1f917c8d17e505e2d6ca5cb8b4f
Didden91/PythonCourse1
/Week 14/P4_Inheritance.py
1,400
4.5
4
# When we make a new class - we can reuse an existing class and inherit all the capabilities of an existing class # and then add our own little bit to make our new class # # Another form of store and reuse # # Write once - reuse many times # # The new class (child) has all the capabilities of the old class (parent) - a...
true
47e3ee0aa65599b23394a1b494508e0e6e1e753b
d-robert-buckley3/FSND
/Programming_Fundamentals/Use_Classes/turtle_poly.py
402
4.125
4
import turtle def draw_poly(sides, size): window = turtle.Screen() window.bgcolor("white") myturtle = turtle.Turtle() myturtle.shape("classic") myturtle.color("black") myturtle.speed(2) for side in range(sides): myturtle.forward(size) myturtle.right(360/sides)...
true
ed26c58769cdce9bc099d1df83b6892e238c0804
SummerLyn/devcamp_2016
/python/Nov_29_Tue/warm_up.py
527
4.1875
4
def is_odd(num): """ >>> is_odd(1) True """ if num % 2 == 0: return False else: return True def is_divisible(num1, num2): """ >>> is_divisible(4, 3) True >>> """ if num1 % num2 == 0: return True else: return False def is_palindro...
false
7186b0324e96780924078e1d1e07058c1ddc1545
SummerLyn/devcamp_2016
/python/Nov_29_Tue/File_Reader/file_reader.py
1,482
4.3125
4
# This is an example on how to open a file as a read only text document def open_file(): ''' Input: no input variables Usage: open and read a text file Output: return a list of words in the text file ''' words = [] with open('constitution.html','r') as file: #text = file.read() #...
true
549d05dd07db0861e05d1a748cd34ce3cc5ed303
SummerLyn/devcamp_2016
/python/day3/string_problem_day3.py
395
4.1875
4
# Take the first and last letter of the string and replace the middle part of # the word with the lenght of every other letter. user_input_fun = input(" Give me a fun word. >>") #user_input_shorter = input("Enter in a shorter word. >>") if len(user_input_fun) < 3: print("Error!") else: print(user_input_fun[...
true
1219597ac11a07ca8bbce48b6f18b61ca058052f
SummerLyn/devcamp_2016
/python/day7/more_for_loops.py
495
4.15625
4
#use for range loop and then for each loop to print word_list = ["a","b","c","d","e","f","g"] # for each loop for i in word_list: print(i) # for loop using range for i in range(0,len(word_list)): print(word_list[i]) #get user input #loop through string and print value #if value is a vowel break out of loop...
true
2d3d01facdd8cf1951f31bd1705391b1ccb53b68
cafeduke/learn
/Python/Advanced/maga/call_on_object.py
1,009
4.28125
4
## # The __call__() method of a class is internally invoked when an object is called, just like a function. # # obj(param1, param2, param3, ..., paramN) # # The parameters are passed to the __call__ method! # # Connecting calls # ---------------- # Like anyother method __call__ can take any number of arguments and r...
true
b6bb152dc17af5ffc19dc1a6786c57bb7da80abe
ombanna/mama
/180pyramidpatt.py
330
4.15625
4
# 180 pyramidd Pattern Printing n = int(input("How Many Number You Want To Print Pattern\n")) def pyramidpatt(n): k = 2 * n -2 for i in range(0,n): for j in range(0,k): print(end=" ") k = k -2 for j in range(0,i + 1): print("*",end=" ") print("\r") pyram...
false
fc1d3ba12a5e13e8e002d503e2a5e1f9e16e4736
RLuckom/python-graph-visualizer
/abstract_graph/Edge.py
1,026
4.15625
4
#!/usr/bin/env python class Edge(object): """Class representing a graph edge""" def __init__(self, from_vertex, to_vertex, weight=None): """Constructor @type from_vertex: object @param from_vertex: conventionally a string; something unambiguously represent...
true
7ccb83743060b18258178b414afdd1ba418acd3c
lyndsiWilliams/Sprint-Challenge--Algorithms
/recursive_count_th/count_th.py
901
4.28125
4
''' Your function should take in a single parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. ''' def count_th(word): # TBC # Set a base case for recur...
true
1d05a84eed4a783996779cc9abe70a131995d3c5
fahimfaisaal/Hello-Python
/fundamentals_of_python/3_loop-project.py
299
4.21875
4
# Odd Numbers odd_number = int(input("Enter your number for Odd: ")) for i in range(0, odd_number + 1): if i % 2 != 0: print(i) # Even number even_number = int(input("Enter your number for even: ")) for i in range(0, even_number + 2): if i % 2 == 0: print(i)
false
3a2d5f04ac2d3fc8d498335ab744caa752df7fde
balasubramanianramesh/Python_Training
/forLoop.py
302
4.4375
4
for letter in 'Python': # First Example print ('Current Letter :', letter) fruits = ['banana', 'apple', 'mango'] for fruit in fruits: # Second Example print ('Current fruit :', fruit) for index in range(1,3): print ('fruits[%d]: %s'% (index, fruits[index])) print ("Good bye!")
false
761184045db21f220fec3944baa74b7e18d6fd51
rhenderson2/python1-class
/chapter06/hw_6-7.py
418
4.125
4
# homework assignment section 6-7 friend = {'first_name': 'john', 'last_name': 'wendler', 'city': 'colorado springs'} wife = {'first_name': 'niki', 'last_name': 'henderson', 'city': 'fort wayne'} child = {'first_name': 'carrissa', 'last_name': 'griffith', 'city': 'london'} people = [friend, wife, child] for person in...
false
64742533ee6dd3747a8e1945a0ae3d74dd00bee7
rhenderson2/python1-class
/Chapter03/hw_3-5.py
627
4.25
4
# homework assignment section 3-5 guest_list = ["Abraham Lincoln", "President Trump", "C.S.Lewis"] print(f"Hello {guest_list[0]},\nYou are invited to dinner at my house.\n") print(f"Hello {guest_list[1]},\nYou are invited to dinner at my house.\n") print(f"Hello {guest_list[-1]},\nYou are invited to dinner at my house....
true
2f84d347adabaa3c9788c2b550307e366998fc6f
RobertElias/AlgoProblemSet
/Easy/threelargestnum.py
1,169
4.4375
4
#Write a function that takes in an array of at least three integers # and without sorting the input array, returns a sorted array # of the three largest integers in the input array. # The function should return duplicate integers if necessary; for example, # it should return [10,10,12]for inquiry of [10,5,9,10,12]. #...
true
060b043e11b67ad11e5ecc8dc2076dacd6efa1cf
WebSofter/lessnor
/python/1. objects and data types/types.py
695
4.21875
4
""" int - integer type """ result = 1 + 2 print(result, type(result)) """ float - float type """ result = 1 + 2.0 print(result, type(result)) """ string - string type """ result = '1' * 3 print(result, type(result)) """ list - list type """ result = ['1','hello', 'world', 5, True] print(result, type(result)) """ tu...
true
42f0dd12e80adbf732c8cef53f1deff43826049f
mwagrodzki/codecool_dojos
/poker_hand.py
995
4.15625
4
def poker_hand(table): ''' Write a poker_hand function that will score a poker hand. The function will take an array 5 numbers and return a string based on what is inside. python3 -m doctest poker_hand.py >>> poker_hand([1, 1, 1, 1, 1]) 'five' >>> poker_hand([2, 2, 2, 2, 3]) 'four...
false
e2f04c145a4836d14f933ae04557dd6598561af2
blfortier/cs50
/pset6/cash.py
1,657
4.1875
4
from cs50 import get_float def main(): # Prompt the user for the amount # of change owed until a positive # number is entered while True: change = get_float("Change owed: ") if (change >= 0): break # Call the function that will # print the amount of coins that ...
true
4164c5ecc2da48210cb32028b01493a06b111873
amymou/Python-
/masterticket.py
2,298
4.34375
4
SERVICE_CHARGE = 2 TICKET_PRICE = 10 tickets_remaining = 100 # Outpout how many tickets are remaining using the ticket_remaining variable # Gather the user's name and assign it to a new variable names = input("Please provide your name: ") # Prompt the user by name and ask how many tickets they would like print("Hi {}...
true
265462e6a06f4b50a87aecb72e05645d2a62d5e1
danriti/project-euler
/problem019.py
1,498
4.15625
4
""" problem019.py You are given the following information, but you may prefer to do some research for yourself. - 1 Jan 1900 was a Monday. - Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twenty-ni...
true
ae99ba05dfed268a96cf36014ece74a6dc8ad58c
yash1th/hackerrank
/python/strings/Capitalize!.py
418
4.125
4
def capitalize(string): return ' '.join([i.capitalize() for i in string.split(' ')]) if __name__ == '__main__': string = input() capitalized_string = capitalize(string) print(capitalized_string) # s = input().split(" ") #if i use default .split() it will strip the whitespace otherwise it will only co...
true
23b10c277a1632f5a41c15ea55f8ca3598cf43c5
FredericoIsaac/Case-Studies
/Data_Structure_Algorithms/code-exercicies/queue/queue_linked_list.py
1,696
4.28125
4
class Node: def __init__(self, value): self.value = value self.next = None class Queue: def __init__(self): # Attribute to keep track of the first node in the linked list self.head = None # Attribute to keep track of the last node in the linked list self.ta...
true
19d88c04da25f392e92c55469f8ebac6cdb5ba1b
frostickflakes/isat252s20_03
/python/fizzbuzz/fizzbuzz.py
1,291
4.15625
4
"""A FizzBuzz program""" # import necessary supporting libraries or packages from numbers import Number def fizz(x): """ Takes an input `x` and checks to see if x is a number, and if so, also a multiple of 3. If it is both, return 'Fizz'. Otherwise, return the input. """ return 'Fizz' if isinsta...
true
c062d016b88b589ffdccaa0175269439778a8ae3
sahil-athia/python-data-types
/strings.py
979
4.5625
5
# strings can be indexed and sliced, indexing starts at 0 # example: "hello", regular index: 0, 1, 2, 3, 4, reverse index: 0, -4, -3, -2, -1 greeting = "hello" print "hello \nworld \n", "hello \t world" # n for newline t for tab print greeting # will say hello print greeting[1] # will say 'e' print greeting[-1] # will...
true
80338a9ae77a07f34f570ab5af53f0eabb3c277a
Divij808/basic_programming_exercises
/basic_command_line_calulator.py
873
4.25
4
import re import math calculator = input("enter math equation") match = re.search(r'(\d+)(.+?)(\d+)', calculator.strip()) if match is None: print("Do not know the maths equation") else: first = int(match.group(1)) second = match.group(2).strip() third = int(match.group(3)) if second.strip() == "*"...
false
62c86d943e116d8cafc2e3b5f180356b56896b1a
Kiranathas/Python-para-no-programadores
/promedio_notas.py
673
4.125
4
#COMPARAR notas nota_uno=10 nota_dos=6 nota_tres=8 #promedio promedio= (nota_uno+nota_dos+nota_tres)/3 print(promedio) #mostrar si aprobó o no. if promedio >=6: print("aprobado") else: print("desaprobado") # ~ El usuario debe ingresar una nota (Suponiendo que siempre es menor que 11) # ~ Most...
false
cc726350a1aeb82295bc788c582fc1b2164faed3
mindful-ai/28092020LVC
/day_02/labs/lab_01.py
660
4.1875
4
# ------------------------------------------------- # LAB 1 # ------------------------------------------------- L = ['red', 'red', 'green', 'blue', 'orange'] # Removed one red: ['red', 'green', 'blue', 'orange'] L.remove('red') # 'golden' was added: ['red', 'green', 'blue', 'orange', 'golden'] L.append('go...
false
ecaf58ae492a1655d764d35ffebf3c8430905a61
mindful-ai/28092020LVC
/day_02/labs/lab_02_alternate_pythonic.py
365
4.25
4
# ------------------------------------------------- # LAB 2 - Determine if a number is prime or not # ------------------------------------------------- # input n = int(input('Enter a number: ')) # process for i in range(2, n): if(n % i == 0): print('The number is not prime') break...
false
bb023dfb9addee809a0c50198632e3d10f5ffecb
AlfredodlRC/github-upload
/ejercicio3.py
260
4.125
4
print("Desea continuar:") entrada=input() if entrada == "no" or entrada =="n": print("Saliendo") elif entrada =="si" or entrada =="s": print("continuando") print("Completado!") else: print("Por favor la proxima vez conteste con si o no")
false
70dbef3e266ee7b61417b37099278c4d0cc0a3f7
QAQUQvQ/Learn_Python
/learn/basic/start.py
2,579
4.21875
4
#!/usr/bin/python3 print("看到我了吗?") # 第一种注释 ''' 第二种注释 第二种注释 ''' """ 第三种注释 第三种注释 """ print('上面的都没有执行。') if True: print("True") else: print("False") word = '字符串' sentence = "这是一个句子。" paragraph = """这是一个段落, 可以由多行组成""" str = 'Runoob' print(str) # 输出字符串 print(str[0:-1]) # 输出第一个到倒数第二个的所有字符 print(str[0]) # 输出字...
false
5eea12122a9ff7e636d3e6e6d7c81eff21adaa5a
RachelKolk/Intro-Python-I
/src/lists.py
808
4.3125
4
# For the exercise, look up the methods and functions that are available for use # with Python lists. x = [1, 2, 3] y = [8, 9, 10] # For the following, DO NOT USE AN ASSIGNMENT (=). # Change x so that it is [1, 2, 3, 4] # YOUR CODE HERE x.append(4) print(x) # Using y, change x so that it is [1, 2, 3, 4, 8, 9, 10] ...
true
f73825065f2bd67c2b36947b143ebe90a9ec2ce1
Elisenochka/.vscode
/classes.py
1,207
4.21875
4
numbers = [1, 2] # Class: blueprint for creating new objects # Object: instance of a class #Class: Human # Objects: John, Mary, Jack class Point: default_color = "red" def __init__(self, x, y): self.x = x self.y = y def draw(self): print(f"Point ({self.x},{self.y})") def __...
false
0f65a069cd882e3aac41649d09c1adbfe901a479
vskemp/2019-11-function-demo
/list_intro.py
2,910
4.65625
5
# *******How do I define a list? grocery_list = ["eggs", "milk", "bread"] # *******How do I get the length of a list? len(grocery_list) # ******How do I access a single item in a list? grocery_list[1] # 'milk' grocery_list[0] # 'eggs' #Python indexes start at 0 # ******How do I add stuff to a list? grocery_list.appe...
true
81e42c23911fce65155e1da44ca35666e507bd6e
helaahma/python
/loops_task.py
1,296
4.125
4
#define an empty list which will hold our dictionary list_items= [] #While loop, and the condition is True while True: #User 1st input item= input ("Please enter \"done\" when finished or another item below: \n") # Define a conditional statement to break at "Done" input if item == "done" or item=="Done": break...
true
b55dfd6fe18a15149ff4befa6199165655c60011
mspang/sprockets
/stl/levenshtein.py
1,949
4.40625
4
"""Module for calculating the Levenshtein distance bewtween two strings.""" def closest_candidate(target, candidates): """Returns the candidate that most closely matches |target|.""" return min(candidates, key=lambda candidate: distance(target, candidate)) def distance(a, b): """Returns the case-insensitive Le...
true
e2064d9111bc5b9d73aeaf79eb3b248c25552b54
ash0x0/AUC-ProgrammingLanguagePython
/Assignment.1/Qa.py
506
4.3125
4
"""This module received three numbers from the user, computes their sum and prints the sum to the screen""" try: # Attempt to get input and cast to proper numeric type float x = float(input("First number: ")) y = float(input("Second number: ")) z = float(input("Third number: ")) except ValueError: ...
true
1ea7e928f266a8d63ec7735333632901954a1dea
ash0x0/AUC-ProgrammingLanguagePython
/Assignment.1/Qf.py
763
4.15625
4
"""This module receives a single number input from the user for a GPA and prints a message depending on the value""" try: # Attempt to get input and cast to proper numeric type float x = float(input("GPA: ")) except ValueError: # If cast fails print error message and exit with error code print("Invalid...
true
179d5d73c249b74a4056eaf0a6c1f9de6f4fc892
AmandaMoen/StartingOutWPython-Chapter5
/bug_collector.py
1,141
4.1875
4
# June 8th, 2010 # CS110 # Amanda L. Moen # 1. Bug Collector # A bug collector collects bugs every day for seven days. Write # a program that keeps a running total of the number of bugs # collected during the seven days. The loop should ask for the # number of bugs collected for each day, and when the loop is # finis...
true
2ebb6abe09a57a9ba5b4acdd4cf91b1a59b52545
mkioga/17_python_Binary
/17_Binary.py
637
4.375
4
# ================== # 17_Binary.py # ================== # How to display binary in python # Note that {0:>2} is for spacing. >2 means two spaces # and on 0:>08b means 8 spaces with zeros filling the left side # Note that adding b means to display in binary for i in range(17): print("{0:>2} in binary is {0:>08b...
true
ab96acd191ac9f8f97ec54b2de9e08b2b62261ca
zenithude/Python-Leetcode
/7-reverseDigit.py
1,380
4.21875
4
# -*- coding: utf-8 -*- """ @author : zenithude Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing with an environment which could only store integers...
false
32bdfbc9a0a8a1c6dac00220d7cd5a5f6932062b
zenithude/Python-Leetcode
/h-index.py
1,936
4.34375
4
# -*- coding: utf-8 -*- """ @author : zenithude Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at least h c...
true
0cbefae29e6cf212a779c7da538661df56063fa5
zenithude/Python-Leetcode
/removeAllGivenElement.py
2,245
4.125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: zenithude Remove Linked List Elements Remove all elements from a linked list of integers that have value val. Example: Input: 1->2->6->3->4->5->6, val = 6 Output: 1->2->3->4->5 """ class ListNode(object): """List of Nodes L...
true
661959a1cace03d1be96a892ed6d8115c734a40f
zenithude/Python-Leetcode
/reorderList.py
2,071
4.28125
4
# -*- coding: utf-8 -*- """ @author : zenithude Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You may not modify the values in the list's nodes, only nodes itself may be changed. Example 1: Given 1->2->3->4, reorder it to 1->4->2->3. Example 2: Given 1->2->...
true
753f8053bf83931bf83cf1da422b89416eeb4184
prasant73/python
/programs/m1_list_rotation.py
605
4.1875
4
from inputs import list_input import cProfile def forward_rotation(l, n): for i in range(n): for i in range(len(l)-1): l[i],l[i+1] = l[i+1],l[i] return l def backward_rotation(l, n): for i in range(n): for i in range(-len(l)-1,-1): l[i-1],l[i] = l[i],l[i-1] ret...
false
463fa32db7284ea1088d0193b26aa64f220da509
prasant73/python
/programs/shapes/higher_order_functions.py
2,063
4.4375
4
'''4. Map, Filter and Reduce These are three functions which facilitate a functional approach to programming. We will discuss them one by one and understand their use cases. 4.1. Map Map applies a function to all the items in an input_list. Here is the blueprint: Blueprint map(function_to_apply, list_of_inputs) Most...
true
c1cd86da9cab336059a84e6401ac97232302036c
TurbidRobin/Python
/30Days/Day 10/open_file.py
323
4.15625
4
#fname = "hello-world.txt" #file_object = open(fname, "w") #file_object.write("Hello World") #file_object.close() # creates a .txt file that has hello world in it #with open(fname, "w") as file_object: # file_object.write("Hello World Again") fname = 'hello-world.txt' with open (fname, 'r') as f: print(f.read...
true
bc00404073a57bad907452662f8df11bbfed47a9
makkksimka/Holidaywork
/Домашнее задание2.py
703
4.15625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- from math import sqrt if __name__ == "__main__": a = float(input("a: ")) if a != 0: b = float(input("b: ")) c = float(input("c: ")) D = b * b - 4 * a * c if D > 0: t1 = (-b - sqrt(D)) / (2 * a) t2 = (-b + s...
false
32851ca38461cdc284e106dc600c104ac3b025d7
bioright/Digital-Coin-Flip
/coin_flip.py
1,231
4.25
4
# This is a digital coin flip of Heads or Tails import random, sys #Importing the random and sys modules that we will use random_number = random.randint(1, 2) choice = "" # stores user's input result = "" # stores random output def play_game(): # the main function that calls other function instructions() d...
true
94d3b518f7ff885e83e92f4ca5310cfcbcf1341e
aes6218/hw2-python
/main.py
1,047
4.3125
4
# Author: August Sanderson aes6218@psu.edu def getGradePoint(grade): if grade=="A" or grade=="A+": p = 4.0 elif grade=="A-": p = 3.67 elif grade=="B+": p = 3.33 elif grade=="B": p = 3.0 elif grade=="B-": p = 2.67 elif grade=="C+": p = 2.33 elif grade=="C": p = 2.0 elif grade...
false
83aeea4934c224bb313c05e567c398a5e00da6d6
monicaihli/python_course
/misc/booleans_numbers_fractions.py
1,091
4.21875
4
# ********************************************************************************************************************** # # File: booleans_numbers_fractions.py # # Author: Monica Ihli # # Date: Feb 03, 2020 # # Description: Numbers and fractions in Python. Best results: use debugging to go t...
true
7dda75c52ab735158c9daa38fb3661284c19c98c
dillon-DL/PolynomialReggression
/PolynomialRegression/poly.py
1,592
4.1875
4
# Firstly the program will be using polynomial regression to pefrom prediction based on the inputs # The inputs or variables we will be anlysing to study is the relation between the price and the size of the pizza # Lastly the data will displayed via a graph which indicates the "non-linear" relationship between the 2...
true
a63943db5fcb51f37ad30040070142285cd020da
Kuznetsova-28/101programmingtasks
/28.py
481
4.15625
4
Составить алгоритм и программу для реализации логических операций «И» и «ИЛИ» для двух переменных. >>> x = input("значение x") значение x >>> a = input("значение a") значение a >>> c = input("значение c") значение c >>> if a > x and c < a or c > x : print("получится четное значение") else : print("решения нет")
false
0e55757b1762833ff73673bc95f4bcbd12ba6177
manojakondi/geeks4geeksPractice
/diffBetweenDates.py
663
4.1875
4
""" Given two dates (can be of different years), calculate the number of days between them (taking care of leap years). """ dt1 = [1,2,2000] dt2 = [1,2,2004] daysOfMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def countLeapYearsFromDate(dt): d = dt[0] m = dt[1] y = dt[2] if (m>2): ...
false
effe94d1b6bf723139b3afc02231b822d54f9d8c
Souro7/python_fundamentals
/conditionals.py
450
4.28125
4
x = 6 y = 5 # if x == y: # print(f'{x} is equal to {y}') if x > y: print(f'{x} is greater than {y}') elif x == y: print(f'{x} is equal to {y}') else: print(f'{x} is less than {y}') # membership operators - in, not in numbers = [1, 2, 3, 4, 5] if x in numbers: print(x in numbers) if x not in n...
false
0ea6d57a6bb60ffb37d296b30198750e2f837bf3
rsg17/Python
/list_tuple.py
425
4.125
4
import sys def merge_pair_list(list1,list2): l1 = len(list1) l2 = len(list2) op = [] if l1 != l2: print "Lists not of equal length" sys.exit(1) for i in range(0,l1): y = (list1[i],list2[i]) op.append(y) return op if __name__ == "__main__": input1 = ["apple", "banana", ""] input2 = ["red", "yello...
false
dc44658426c6cd5f2a53e75811e2db59f15d2c88
yama1102/python520
/Aula2/condicionais.py
1,607
4.21875
4
#!/usr/bin/python3 #input('Digite qual o caminho a ser seguido: ') #a = 'engarrafado' #b = 'livre' #if a == 'engarrafado': # print('Melhor ir pela b') #else: # print('Indo pelo Caminho a') ######### ### Estrutura de condicional ######### # nome = input('Digite seu nome: ').strip().title() # sobrenome = input ...
false
a28381495e08d45a75e21c512d06f688b9ab5dff
iwantroca/PythonNotes
/zeta.py
2,427
4.46875
4
########LISTS######## # assigning the list courses = ['History', 'Math', 'Physics', 'CompSci'] # finding length of list print(len(courses)) # using index in list print(courses[0]) # adding item to list courses.append('Art') print(courses) # using insert to add in specific location courses.insert(2, 'Art') print(...
true
f461e4886e514f6497cbe1f87d648efe3a7cf1cf
RaimbekNusi/Prime-number
/Project_prime.py
1,146
4.25
4
def is_prime(N): """ Determines whether a given positive integer is prime or not input: N, any positive integer. returns: True if N is prime, False otherwise. """ # special cases: if N == 1: return False # the biggest divisor we're going to try divisor = N // 2 ...
true
0188c28e0485e2a0ff7efe15b89e7c5286723de9
rajesh95cs/wordgame
/wordgameplayer.py
2,158
4.15625
4
class Player(object): """ General class describing a player. Stores the player's ID number, hand, and score. """ def __init__(self, idNum, hand): """ Initialize a player instance. idNum: integer: 1 for player 1, 2 for player 2. Used in informational displays in the ...
true
1d76bf2cead6e296b7e7c37893a59a66cede9957
Samk208/Udacity-Data-Analyst-Python
/Lesson_4_files_modules/flying_circus.py
1,209
4.21875
4
# You're going to create a list of the actors who appeared in the television programme Monty Python's Flying Circus. # Write a function called create_cast_list that takes a filename as input and returns a list of actors' names. It # will be run on the file flying_circus_cast.txt (this information was collected from im...
true
87a54bf9f8875f2f578c0ed361b8adb924ff866c
Samk208/Udacity-Data-Analyst-Python
/Lesson_3_data_structures_loops/flying_circus_records.py
1,018
4.1875
4
# A regular flying circus happens twice or three times a month. For each month, information about the amount of money # taken at each event is saved in a list, so that the amounts appear in the order in which they happened. The # months' data is all collected in a dictionary called monthly_takings. # For this quiz, wr...
true
319558317c1ad4f6667ebfc7b0b315e006abf084
UstehKenny/Python
/Clases/clase2Cadenas.py
1,339
4.375
4
#Cadena: #Arreglo de caracteres cadena = "Este es el Curso de Python" print(len(cadena)) print(cadena[11:16]) print(cadena[:20]) #Hasta el 20 print(cadena[20:]) #20 en adelante print(cadena[::]) #Todo #Formato de cadena print(cadena.upper()) #Cambia a mayúsculas print(cadena.lower()) #Cambia a minúsculas print(cadena.s...
false
ae66153b1a667b2fdca4e9699aba6cbffc979fef
YuriYuriHentai/Yuri
/test.py
376
4.15625
4
#я долбаеб x=float (input("Введите первое число:")) z=input ("Введите действие (+, -, /, *, //)") y=float (input("Введите второе число:")) if z=="+": res=x+y elif z=="-": res=x-y elif z=="*": res=x*y if z=="/": res=x/y elif z=="//": res=x//y print ("Результат =", res)
false
cb2a90a4869b762145f3e48160d7448ad0fda3a4
CODE-Lab-IASTATE/MDO_course
/03_programming_with_numpy/arrays.py
889
4.40625
4
#Numpy tutorials #Arrays #Import the numpy library import numpy as np a = np.array([1, 2, 3]) #print the values of 'a' print(a) #returns the type of 'a' print(type(a)) #returns the shape of 'a' print(a.shape) #prints the value of 'a' print(a[0], a[1], a[2]) # Change an el...
true
cb3c16cae8164f495dd73644ec16ea267f8c0814
NickosLeondaridisMena/nleondar
/shortest.py
1,560
4.375
4
# Create a program, shortest.py, that has a function # that takes in a string argument and prints a sentence # indicating the shortest word in that string. # If there is more than one word print only the first. # Your print statement should read: # “The shortest word is x” # Where x = the shortest word. # The wo...
true
7e13a6736cdae035792dec2400a1ec76e63289ce
SebasJ4679/CTI-110
/P5T1_KilometerConverter_SebastianJohnson.py
670
4.625
5
# Todday i will create a program that converts kilometers to miles # 10/27/19 # CTI-110 P5T1_KilometerConverter # Sebastian Johnson # #Pseudocode #1. Prompt the user to enter a distance in kilometers #2. display the formula so the user knows what calculation is about to occur #3 write a function that carri...
true
d0de9f4a94d395499f87c7c304a70cc4e6055de2
AkshatTodi/Machine-Learning-Algorithms
/Supervised Learning/Regression/Simple Linear Regression/simple_linear_regression.py
1,693
4.46875
4
# Simple Linear Regression # Formula # y = b0 + b1*X1 # y -> dependent variable # X1 -> independent variable # b0 -> Constent # b1 -> Coefficient # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Salary_Data.csv') # When...
true
81d28f7e974c142d2792a4983342723fb8e7a712
SarahMcQ/CodeWarsChallenges
/sortedDivisorsList.py
618
4.1875
4
def divisors(integer): '''inputs an integer greater than 1 returns a list of all of the integer's divisor's from smallest to largest if integer is a prime number returns '()is prime' ''' divs = [] if integer == 2: print(integer,'is prime') else: for num...
true
ef7cb3ec31fe915692c68d0d61da36bdb8004576
jfonseca4/FonsecaCSC201-program03
/program03-Part1.py
1,129
4.375
4
#Jordan Fonseca #2.1 DNA = input(str("Enter the DNA sequence")) #asks user to input a string DNA2 = [] for i in DNA: if i == "A": #if DNA is A, replaces it with a T DNA2.append("T") if i == 'G': #if DNA is G, replaces it with a C DNA2.append("C") if i == "C": ...
true
4585efdae5dffff316e6f37ff8ca74c176dadc0f
Nazzekas/python
/эния.py
455
4.125
4
#195 n = int(input("Введите количество панелей необходимых обработать: ")) a = int(input("Введите длину панели: ")) b = int(input("Введите ширину панели: ")) S = 2*a*b*n #общая площадь всех панелей, учитывая обработку с обеих сторон print("На обработку необходимо " + str(S) + " сульфида!")
false
440bd8ba94e1320d5d44451e1abe2dca051cb25d
rjmarzec/Google-CSSI---Coursera
/Algorithmic Toolbox/week2_algorithmic_warmup/4_least_common_multiple/lcm.py
523
4.125
4
# Uses python3 def lcm(a, b): current_a_mult = a current_b_mult = b a_times_b = a*b while a_times_b > current_a_mult and a_times_b > current_b_mult: if current_a_mult == current_b_mult: return current_a_mult elif current_a_mult < current_b_mult: current_a_mult ...
false
23625cceeacc7e9b9d1287a87f95eb6a24ff0a4a
mlm-distrib/py-practice-app
/00 - basics/05-operators.py
2,466
4.46875
4
# Operators # Arithmetic operators x = 10 y = 5 print('#### Arithmetic ####') print('addition :', x+y) print('subtraction:', x-y) print('multiply :', x*y) print('division :', x/y) print('modulus :', x % y) print('exponential:', x**y) print('floor division:', x//y) print('') # Assignment operators x = 15 print...
false
b5eb87686608cd0fc8e4215db1479bfc2e9a379b
mlm-distrib/py-practice-app
/00 - basics/08-sets.py
515
4.25
4
# Set is a collection which is unordered and unindexed. No duplicate members. myset = {"apple", "banana", "mango"} print(myset) for x in myset: print(x) print('') print('Is banana in myset?', "banana" in myset) myset.add('orange') print(myset) myset.update(["pineapple", "orange", "grapes"]) print(myset) print('l...
true
4cc99b2d1de0595bc2d0b6f335e7f8d1b80b906d
kannanmavila/coding-interview-questions
/quick_sort.py
714
4.28125
4
def r_quick_sort(array, start, end): # Utility for swapping two elements of the array def swap(pos1, pos2): array[pos1], array[pos2] = array[pos2], array[pos1] if start >= end: return pivot = array[start] left = start+1 right = end # Divide while left - right < 1: if array[left] > pivot: ...
true
e177b1f2ba2fb3baaef810214a9325e1e9207342
kannanmavila/coding-interview-questions
/reverse_string.py
235
4.21875
4
def reverse(string): string = list(string) length = len(string) for i in xrange((length - 1) / 2 + 1): string[i], string[length-i-1] = string[length-i-1],string[i] return "".join(string) print reverse("Madam, I'm Adam")
true
070d388659df628d00116c127f2b212c0e6033cf
kannanmavila/coding-interview-questions
/tree_from_inorder_postorder.py
1,470
4.125
4
class Node(object): def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right = right def binary_tree(inorder, postorder): """Return the root node to the BST represented by the inorder and postorder traversals. """ # Utility for recursively creating BST f...
true
668f846583dadfcd5270c9e674b3271ee7381235
kannanmavila/coding-interview-questions
/interview_cake/16_cake_knapsack.py
1,136
4.25
4
def max_duffel_bag_value(cakes, capacity): """Return the maximum value of cakes that can be fit into a bag. There are infinitely many number of each type of cake. Caveats: 1. Capacity can be zero (naturally handled) 2. Weights can be zero (checked at the start) 3. A zero-weight cake can give infinite...
true
4a46b2a0a5c8455746758351e85cbf52eaee7e72
engineeredcurlz/Sprint-Challenge--Intro-Python
/src/oop/oop2.py
1,535
4.15625
4
# To the GroundVehicle class, add method drive() that returns "vroooom". # # Also change it so the num_wheels defaults to 4 if not specified when the # object is constructed. class GroundVehicle(): def __init__(self, num_wheels = 4): # only works for immutable (cant change) variables otherwise use [] self....
true
f29173d2bf9875c2748b4cb686b2d63522dda286
AdiKaran/Project-Euler
/Problem9.py
720
4.15625
4
# A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, # a**2 + b**2 = c**2 # For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2. # There exists exactly one Pythagorean triplet for which a + b + c = 1000. # Find the product abc. sqr_roots = {} ans = [] * 3 for x in range(500) :...
false
57170eafa6f1197f2032a809dbb0981f49b507ff
a100kpm/daily_training
/problem 0029.py
983
4.1875
4
''' Good morning! Here's your coding interview problem for today. This problem was asked by Amazon. Run-length encoding is a fast and simple method of encoding strings. The basic idea is to represent repeated successive characters as a single count and character. For example, the string "AAAABBBCCDAA" would be encod...
true
003bc82579dfd89b4d1d001ee16d40d6a726da67
a100kpm/daily_training
/problem 0207.py
1,301
4.15625
4
''' Good morning! Here's your coding interview problem for today. This problem was asked by Dropbox. Given an undirected graph G, check whether it is bipartite. Recall that a graph is bipartite if its vertices can be divided into two independent sets, U and V, such that no edge connects vertices of the same set. ''...
true
0dc1cf2fcc01b34b4cf943a17ba24475df7e768a
a100kpm/daily_training
/problem 0034.py
958
4.21875
4
''' Good morning! Here's your coding interview problem for today. This problem was asked by Quora. Given a string, find the palindrome that can be made by inserting the fewest number of characters as possible anywhere in the word. If there is more than one palindrome of minimum length that can be made, return the l...
true
211d0303800ef36e5c658498aa5c8ed99b3a91e8
a100kpm/daily_training
/problem 0202.py
671
4.28125
4
''' Good morning! Here's your coding interview problem for today. 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. ''' nbr1=121 nbr2=123454321 nbr3...
true
2d3369c67839346d1e81cc29eda6163e1bf27080
a100kpm/daily_training
/problem 0063.py
1,824
4.15625
4
''' Good morning! Here's your coding interview problem for today. This problem was asked by Microsoft. Given a 2D matrix of characters and a target word, write a function that returns whether the word can be found in the matrix by going left-to-right, or up-to-down. For example, given the following matrix: [['F', ...
true
f34bef76194d77d6a5e5f5891c334c33c8d7ca10
a100kpm/daily_training
/problem 0065.py
1,407
4.15625
4
''' Good morning! Here's your coding interview problem for today. 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]] You s...
true
4be59ab979de011b3761d0744013c0ff1ff5d9d2
a100kpm/daily_training
/problem 0241.py
949
4.3125
4
''' Good morning! Here's your coding interview problem for today. This problem was asked by Palantir. In academia, the h-index is a metric used to calculate the impact of a researcher's papers. It is calculated as follows: A researcher has index h if at least h of her N papers have h citations each. If there are mu...
true
625c3d016087f104ed463b41872b3510d000a04c
Abhishek4uh/Hacktoberfest2021_beginner
/Python3-Learn/Decorators_dsrathore1.py
1,775
4.625
5
#AUTHOR: DS Rathore #Python3 Concept: Decorators in Python #GITHUB: https://github.com/dsrathore1 # Any callable python object that is used to modify a function or a class is known as Decorators # There are two types of decorators # 1.) Fuction Decorators # 2.) Class Decorators # 1.) Nested function # 2.) Function...
true
d29b902b56c3dcd3f132d6a3d699b061ccdb3bb6
michaeldton/Fall20-Text-Based-Adventure-Game-
/main.py
1,859
4.21875
4
import sys from Game.game import Game # Main function calls the menu def main(): menu() # Quit function def quit_game(): print("Are you sure you want to quit?") choice = input(""" 1: YES 2: NO Please enter your choice: """) if choic...
true
570fb365c121fcf6d5dbb573410de4b947539441
zqh-hub/python_base
/列表/列表_01_通用操作.py
758
4.3125
4
# 序列:列表、元组、字符串 # 容器:序列、映射(如:字典) # 通用序列操作:索引、切片、相加、相乘、成员资格 # 索引 print("hello"[0]) print("hello"[-1]) # res = input("year:")[3] # print(res) # 切片 tag = '<a href="http://www.python.org">Python web site</a>' print(tag[9:30]) print(tag[9:-21]) nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print(nums[7: 10]) print(nums[-3:]) prin...
false
d770011ac09cf8880cf245995f150112d1d3b1fc
LopesAbigail/UFABC-BCC-2021
/CSV/statistic-conditional-median.py
651
4.1875
4
# Ler a planilha # Receber do usuario a turma # Calcular a media e a mediana da turma recebida no passo anterior # Se a media for maior ou igual a mediana, imprima a palavra Media # Caso contrario, imprima a palavra Mediana import pandas as pd import numpy as np df = pd.read_csv( "https://www.dropbox.com/s/jqfici...
false
f6c5b9ae9be92219d025cf496286b9413eb8f434
stoneskin/mlcccCoding
/2018-03-11/10-Inheritance/shape.py
709
4.21875
4
# https://www.programiz.com/python-programming/inheritance class Shape: def __init__(self, name: str=""): self.name = name def printInfo(self): print("in shapes, Name=", self.name) class Polygon(Shape): def __init__(self, no_of_sides,name:str="Ploygon"): self.name=name; Sha...
false
5ef61d947c51a4f5793a005629f22e6ca44e4cbf
iamdeepakram/CsRoadmap
/python/regularexpressions.py
1,106
4.1875
4
# find the patterns without RegEx # some global variable holding function information test = "362-789-7584" # write isphonenumber function with arguments text def isPhoneNumber(text): global test test = text # check length of string if len(text) != 12 : return False # check area code fro...
true
b91733a9e8050ec851b412a322c4ca86224f462e
better331132/hello
/review2.py
548
4.125
4
#변수 Variables (문자열) 'hello'"world" print('hello'"world") print('hello',"world") #문자열 변수 사이의 ,는 결과에서 공백으로 나타남 message = "hello world" print(message) print(message[0:5]) print(message[:6]) #공백 또한 하나의 문자로 취급 print(message[:-4]) print(len(message)) print(len(mes...
false
b3a1e3ab177fac333bc9ee0a5a0b379751807f58
aklgupta/pythonPractice
/Q4 - color maze/color_maze.py
2,950
4.375
4
"""Team Python Practice Question 4. Write a function that traverse a color maze by following a sequence of colors. For example this maze can be solved by the sequence 'orange -> green'. Then you would have something like this For the mazes you always pick a spot on the bottom, in the starting color and try to get to...
true
2e2040449bac85c3dcabef42f995a2bef7c00966
pavit939/A-December-of-Algorithms
/December-09/url.py
444
4.1875
4
def https(s): if(s[0:8]=="https://"): return '1' else: return '0' def url(s): if (".com" in s or ".net" in s or ".org" in s or ".in" in s): return "1" else : return '0' s = input("Enter the string to check if it is an URL") c = https(s) if c =='1': u = url(s) if u...
true
63488064897109f0ba3806912b1fcf38e759a97f
Krishna-Mohan-V/SkillSanta
/Assignment101-2.py
964
4.40625
4
# Python program to find the second largest number in a list # Method 1 lst = [] num = int(input("Enter the Number of elements for the List: ")) for i in range(num): elem = int(input("Enter the list element: ")) lst.append(elem) print("List Elements are: ",lst) lst.sort() print("Second largest...
true