blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
ac349eb4da08279d11d242bf2bb67556729f4393
zeirn/Exercises
/Week 4 - Workout.py
815
4.21875
4
x = input('How many days do you want to work out for? ') # This is what we're asking the user. x = int(x) # These are our lists. strength = ['Pushups', 'Squats', 'Chinups', 'Deadlifts', 'Kettlebell swings'] cardio = ['Running', 'Swimming', 'Biking', 'Jump rope'] workout = [] for d in range(0, x): # This is ...
true
3186c75b82d1877db3efe13a8a432355503ec9f3
TMcMac/holbertonschool-higher_level_programming
/0x0B-python-input_output/1-number_of_lines.py
526
4.28125
4
#!/usr/bin/python3 """This will get a line count on a text file""" def number_of_lines(filename=""): """ A function to get a line count on a file parameters - a file """ line_count = 0 with open(filename, 'r') as f: """ Opens the file as f in such as way that we don't n...
true
5c8df2051d971311883b58f15fbf17a1987655fd
TMcMac/holbertonschool-higher_level_programming
/0x06-python-classes/102-square.py
831
4.46875
4
#!/usr/bin/python3 """Defines class square and takes in a size to intialize square""" class Square(): """Class Square for building a square of #s""" def __init__(self, size=0): """Initializes an instance of square""" self.size = size def area(self): """Squares the size to get the ...
true
6985fbb424941dc0c0736f334e4ab35fe944c74e
kurrier/pytest1
/math2.py
1,207
4.15625
4
#!/usr/bin/python print "Python Calculator\n" nonum = "Error: no number" firstnum = "What is the first number?" secnum = "What is the second number?" def division(n1,n2): div = n1/n2 print "%d divided by %d is: %d" % (n1, n2, div) return div def multiply(n1,n2): mult = n1 * n2 print "%d multiplied...
false
6191e450436393fc4ac30c36d1e16665b9cebdb2
wahahab/mit-6.0001
/ps1/ps1c.py
1,204
4.21875
4
# -*- coding: utf-8 -*- import math from util import number_of_month SCALE = 10000 if __name__ == '__main__': months = 0 current_savings = 0 portion_down_payment = .25 r = .04 min_portion_saved = 0 max_portion_saved = 10000 best_portion_saved = 0 semi_annual_raise = .07 total_cos...
true
bc9a56767843484f90d5fe466adee8c1289a9052
JohanRivera/Python
/GUI/Textbox.py
1,360
4.125
4
from tkinter import * raiz = Tk() myFrame = Frame(raiz, width=800, height=400) myFrame.pack() textBox = Entry(myFrame) textBox.grid(row=0,column=1) #grid is for controlate all using rows and columns #Further, in .grid(row=0, column=1, sticky='e', padx=50) the comand padx o pady move the object, in this case #50 pixel...
true
21d92cf2e0027b977d30c7f7af3383d0331e1ed0
baejinsoo/TIL
/4th/파이썬/python_programming_stu/Practice/prac_2.py
577
4.125
4
# # 일반적인 함수 정의 # def add(x, y): # return x + y # # # print(add(10, 20)) # # # 람다식 사용 # my_add = lambda x, y: x + y # print(my_add(10, 34)) # # square = lambda x: x ** 2 # print(square(4)) # # multi = lambda x, y: x * y # print(multi(40, 3)) # # division = lambda x, y: x / y # print(division(50, 5)) my_arr = [1, 2...
false
7e67906a790f004df57e8eed1a38fd0de53a1a25
Shaileshsachan/Algoexpert_problem_solution
/sorting/selection_sort.py
552
4.21875
4
def SelectonSort(list1): print(f'Unsorted Array: {list1}') for i in range(len(list1) - 1): min_index = i for j in range(i+1, len(list1)): if list1[j] < list1[min_index]: min_index = j if list1[i] != list1[min_index]: list1[i], list1[min_index] = li...
false
0b4d0a0812579e02606085ed5eb59145f57eaa03
PhurbaGyalzen/Gyalzen
/exercise2/4.py
361
4.28125
4
number_1=int(input('number_1:')) number_2=int(input('number_2:')) number_3=int(input('number_3:')) if number_3 > number_2 and number_3 > number_1: print(f"{number_3} is greatest.") elif number_2 > number_3 and number_2 > number_1: print(f"{number_2} is greatest.") elif number_1 > number_2 and number_1 > number_...
false
42bb143238a706d20b33822544bacab53aab5d98
egene-huang/python-learn
/test-all/pyclass/access.py
2,128
4.4375
4
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ## 访问控制 class Person(object): def __init__(self,name,age): self.name = name self.age = age def toString(self): print('我是%s,我%s岁了.' %(self.name,self.age)) p = Person('palm',25) p.toString() ## 我是palm,我25岁了. ## 可以随意修改 这个对象的属性值 p.name ...
false
820a54904cce0d1da89522eebfd0247017a801bc
egene-huang/python-learn
/test-all/pyclass/cls.py
2,797
4.21875
4
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ## 在学习面向对象的时候, 我自做聪明误认为 __init__就是python class的构造方法, 其实不是 ## 查阅资料得知, 在执行 p = Person('测试',23)这行代码的时候, 首先调用的是 __new__这个类方法 ## __init__这个是实例方法,是在实例构造完成后 使用来处理实例属性值等类似工作的 地一个参数self 就是__new__构造出来的实例 # __ new__(cls, *args, **kwargs) 创建对象时调用,返回当前对象的一个实例;注意:这里的第一个参数是cls即class本身...
false
5f004bd21d1553a87a446be505865cba2acd19a7
JustinCThomas/Codecademy
/Python/Calendar.py
2,021
4.125
4
"""This is a basic CRUD calendar application made in Python""" from time import sleep, strftime NAME = "George" calendar = {} def welcome(): print("Welcome", NAME) print("Opening calendar...") sleep(1) print(strftime("%A %B %d, %Y")) print(strftime("%H:%M:%S")) sleep(1) print("What would you like to do...
true
603eca56497eacb11201e688b496dc85e92f3c81
penroselearning/pystart_code_samples
/Student Submission Isha Reddy.py
1,061
4.125
4
print('Student Grade Calculator') student_scores = [] try: student_scores = [input("Enter Student Name: "), (int(input("Enter English Score (Max 100): \n")), int(input("Enter Math Score (Max 100): \n")), int(input("Enter Chemistry Score (Max 100): \n")), ...
false
765d21e3ef208f0a197c71a5b1543f71fd7aa4dc
penroselearning/pystart_code_samples
/16 Try and Except - Division.py
415
4.125
4
print('Division') print('-'*30) while True: try: dividend = int(input("Enter a Dividend:\n")) divisor = int(input("Enter a Divisor:\n")) except ValueError: print("Sorry! You have not entered a Number") else: try: result = dividend/divisor except ZeroDivisionError: print("Division ...
true
4c95d508fe4cbcdd35f32a1c7fd10ff63315a2d0
penroselearning/pystart_code_samples
/10 For Loop - Remove Vowels from a Word.py
297
4.3125
4
longest_word='pneumonoultramicroscopicsilicovolcanoconiosis' new_word_without_vowels='' vowels=['a','e','i','o','u'] for letter in longest_word: if letter not in vowels : new_word_without_vowels += letter print(f'The worlds longest word without vowels - {new_word_without_vowels.upper()}')
false
6716efaf012f7ed75775f9dca8dad3593c5a4773
venkatakaturi94/DataStructuresWeek1
/Task4.py
1,271
4.21875
4
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv list_tele_marketers=[] with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) list_from =[] list_to =[] for to in texts: list_from.append(to[0]) list_to.append(to...
true
c4c760f5840cd67678114569f3fe0cc890f501ac
codeguru132/pythoning-python
/basics_lists.py
526
4.34375
4
hat_list = [1, 2, 3, 4, 5] # This is an existing list of numbers hidden in the hat. # Step 1: write a line of code that prompts the user # to replace the middle number with an integer number entered by the user.li hat_list[2] = int(input("ENter a number here: ...")) # Step 2: write a line of code that removes...
true
32e14721978cac96a0e1c7fe96d1e7088f928658
rciorba/plp-cosmin
/old/p1.py
1,246
4.21875
4
#!/usr/bin/python # Problem 1: # Write a program which will find all such numbers which are divisible by 7 but # are not a multiple of 5, between 2000 and 3200 (both included). # The numbers obtained should be printed in a comma-separated sequence on a # single line. # to nitpick: min and max are builtin functions...
true
a57e1fe462002e2797275191cba5b2ebd0d2cfc5
ak45440/Python
/Replace_String.py
667
4.1875
4
# Write a Python program to find the first appearance of the substring 'not' and 'poor' from a given string, # if 'not' follows the 'poor', replace the whole 'not'...'poor' substring with 'good'. Return the resulting string. # Sample String : 'The lyrics is not that poor!' # 'The lyrics is poor!' # Expected Result :...
true
55ce803bd9272354d37b9adb0398bfa6abcf0bd5
ChennakeshavaNT/Python-Programming
/Turtle_Graphics/ChessBoard/chessboard.py
1,676
4.21875
4
#this code prints a chessboard using turtle graphics #Input: No Input #output: Chessboard representaion import turtle ck = turtle.Turtle() #Creation of a turtle named ck ck.clear() ck.forward(80) ck.left(180) ck.forward(80) ck.right(180) #iterative Approach is used for a in range(4): ck.pendown() for i in rang...
false
41126620e671d2c5298381eeda1f0a67b8f6a560
Wei-Mao/Assignments-for-Algorithmic-Toolbox
/Divide-and-Conquer/Improving QuickSort/quicksort.py
2,645
4.5
4
# python3 from random import randint from typing import List, Union def swap_in_list(array, a, b): array[a], array[b] = array[b], array[a] def partition3(array: List[Union[float, int]] , left: [int], right: [int]) -> int: """ Partition the subarray array[left,right] into three parts such that: array[...
true
669c96051159e28260689b5bee2f33c71e4ef8b6
SEugene/gb_algo
/hw_07_01.py
1,128
4.1875
4
""" Отсортируйте по убыванию методом "пузырька" одномерный целочисленный массив, заданный случайными числами на промежутке [-100; 100). Выведите на экран исходный и отсортированный массивы. Сортировка должна быть реализована в виде функции. По возможности доработайте алгоритм (сделайте его умнее). """ from random impor...
false
26ab13287b1ea07319831266fe190de1762bb084
pombredanne/Revision-Scoring
/revscores/languages/language.py
591
4.125
4
class Language: """ Constructs a Language instance that wraps two functions, "is_badword" and "is_misspelled" -- which will check if a word is "bad" or does not appear in the dictionary. """ def __init__(self, is_badword, is_misspelled): self.is_badword = is_badword self.is_missp...
true
10fed729debcd5ba51cfa9da23c2a6e548f6a0ac
kunalrustagi08/Python-Projects
/Programming Classroom/exercise7.py
920
4.21875
4
''' We return to the StringHelper class, here we add another static method called Concat, this method receives a single parameter called Args, which is a "Pack of parameters", which means that we can pass as many parameters as we want, then, within this function there will be A variable called Curr that will be ini...
true
580438f74309cbffd7841166b374f8814c04eea3
kunalrustagi08/Python-Projects
/Programming Classroom/exercise3.py
1,441
4.46875
4
''' Create a class called Calculator. This class will have four static methods: Add() Subtract() Multiply() Divide() Each method will receive two parameters: "num1" and "num2" and will return the result of the corresponding arithmetic operation. Example: The static addition method will return the sum of num1 and num2...
true
130d9e5dd29b1f817b661e9425ffe278ccc44e8d
rebht78/course-python
/exercises/solution_01_04.py
347
4.125
4
# create first_number variable and assign 5 first_number = 5 # create second_number variable and assign 5 second_number = 5 # create result variable to store addition of first_number and second_number result = first_number + second_number # print the output, note that when you add first_number and second_number you ...
true
39e669b95b5b08afdab3d3b16cb84d673aecbf8e
ctsweeney/adventcode
/day2/main.py
2,106
4.375
4
#!/usr/bin/env python3 def read_password_file(filename: str): """Used to open the password file and pass back the contents Args: filename (str): filepath/filename of password file Returns: list: returns list of passwords to process """ try: with open(filename, "r") as f: ...
true
5cb50cc07e8cb2a28b8ed06a403dd8d69db1a33d
isailg/python_notes
/condition.py
293
4.1875
4
# age = int(input("Type your age: ")) # if age > 18: # print("You are of age") # else: # print("You are a minor") number = int(input("Type a number: ")) if number > 5: print("Greater of 5") elif number == 5: print("Equal to 5") elif number < 5: print("Less than 5")
false
017a3268e5de015c8f0c25045f44ae7a4ffe7a50
dky/cb
/legacy/fundamentals/linked-lists/03-08-20/LinkedList.py
1,893
4.1875
4
class Node: def __init__(self, item, next=None): self.item = item self.next = next class LinkedList: def __init__(self): # We always have a dummy node so the list is never empty. self.head = Node("dummy") self.size = 0 def __str__(self): out = "" cu...
true
105e9536a5a82cde5cf7c204e0d3316ceab5867d
dky/cb
/legacy/educative/lpfs/functions-as-arguments.py
470
4.28125
4
""" def add(n1, n2): return n1 + n2 def subtract(n1, n2): return n1 - n2 def multiply(n1, n2): return n1 * n2 def divide(n1, n2): return n1 / n2 """ def calculator(operation, n1, n2): return operation(n1, n2) # Using the 'operation' argument as a function #...
false
9390e6095c6140ba0117bfd18fb63844189d7a68
abhijnashree/Python-Projects
/prac1.py
218
4.28125
4
#Read Input String i = input("Please insert characters: ") #Index through the entire string for index in range(len(i)): #Check if odd if(index % 2 == 0): #print odd characters print(i[index])
true
e0c62280d0a17510b152d5aff2671bc89e0de4d4
DevOpsStuff/Programming-Language
/Python/PythonWorkouts/NumericTypes/run_timings.py
488
4.125
4
#!/usr/bin/env python def run_timing(): """ Asks the user repeatedly for numberic input. Prints the average time and number of runs """ num_of_runs = 0 total_time = 0 while True: one_run = input('Enter 10 Km run time: ') if not one_run: break num_of_runs ...
true
ad810639d9f0b8b4545b3641e6bd0c0cd976f916
aswathyp/TestPythonProject
/Sessions/2DArray.py
910
4.25
4
# Two-Dimensional List a = [[1,2], [3,4], [5,6]] # Via Indices for i in range(len(a)): for j in range(len(a[i])): print(a[i][j], end=' ') print('\n') # Via Elements for row in a: for element in row: print(element, end=' ') print('\n') # Generate 2D n = 3 m = 4 arr = [[0] * m] * n #doe...
false
1aa76c29644208c7094733bfbb3a876c1ffb9b83
aswathyp/TestPythonProject
/Assignments/Loops/2_EvenElementsEndingWith0.py
362
4.1875
4
# Even elements in the sequence numbers = [12, 3, 20, 50, 8, 40, 27, 0] evenElementCount = 0 print('\nCurrent List:', numbers, sep=' ') print('\nEven elements in the sequence: ') for num in numbers: if num % 2 == 0: print(num, end=' ') evenElementCount = evenElementCount + 1 print('\n\nTotal Co...
true
e0fe9a4a068ebbdd0956bbfc525f83551b75b2b0
gowtham9394/Python-Projects
/Working with Strings.py
788
4.40625
4
# using the addition operator without variables [String Concatenation] name = "Gowtham" + " " + "Kumar" print(name) # using the addition operator with variables first_name = "Gowtham" last_name = "Kumar" full_name = first_name + " " + last_name print(full_name) # using the new f strings [after python 3.6] print( f"...
true
f9bfecf22f03336080907a61c1f21adc95668396
pinnockf/project-euler
/project_euler_problem_1.py
490
4.3125
4
''' Multiples of 3 and 5 Problem 1 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. ''' def main(threshold): multiples = [] for number in range(threshold): if number...
true
b56e0272c2632b3b85657535568dc242c7504b62
shefali-pai/comp110-21f-workspace
/exercises/ex05/utils.py
1,572
4.28125
4
"""List utility functions part 2.""" __author__ = "730466264" # Define your functions below from typing import List def main() -> None: """Entry of function.""" list_1: List[int] = [1, 3, 5] list_2: List[int] = [1] a_list: List[int] = [1, 2, 3, 4, 5] number_1: int = 1 number_2: int = 4 ...
false
3654c2a1ca8756660b6da99b2d571c6a508a9568
shefali-pai/comp110-21f-workspace
/exercises/ex07/data_utils.py
2,561
4.15625
4
"""Utility functions.""" __author__ = "730466264" from csv import DictReader def read_csv_rows(filename: str) -> list[dict[str, str]]: """Read the rows of a csv into a 'table'.""" result: list[dict[str, str]] = [] file_handle = open(filename, "r", encoding="utf8") csv_reader = DictReader(file_handle...
true
57b07d75c2d81356bab342880380353f6debbc25
meginks/data-structure-notes
/Queues/queues.py
2,152
4.15625
4
class ListQueue: def __init__(self): self.items = [] self.size = 0 def enqueue(self, data): """add items to the queue. Note that this is not efficient for large lists.""" self.items.insert(0, data) #note that we could also use .shift() here -- the point is to add the new t...
true
319d2d9261047ba9218b7b696fb33ad7fc1895a3
neelindresh/try
/VerificationFunctions.py
2,729
4.1875
4
import numpy as np import pandas as pd import operator def check_column(df, ops, first_mul, col_name, oper, value): ''' This function will return the list of valid and invalid rows list after performing the operation first_mul * df[col_name] oper value ex: [ 1*df['age'] >= 25 ]. ''' valid_...
true
d8d791d01895b3a173b4d8003b2e2b648905b3da
AlirezaTeimoori/Unit_1-04
/radius_calculator.py
480
4.125
4
#Created by: Alireza Teimoori #Created on: 25 Sep 2017 #Created for: ICS3UR-1 #Lesson: Unit 1-04 #This program gets a radius and calculates circumference import ui def calculate_circumferenece(sender): #calculate circumference #input radius = int(view['radius_text_field'].text) #process ...
true
a06ef912a2f2ffaa962b974f273f8d465d3dfe7f
daikiante/python_Udemy
/python_basic/lesson_002.py
620
4.25
4
# helpコマンド  関数、ライブラリの機能が表示される # import math # print(help(math)) # '' "" \n ==> 改行 print('say "I don\'t know"') print('hello \n how are you') # インデックスとスライス word = 'Python' print(word[0]) print(word[1]) print(word[-1]) print(word[0:2]) print(word[2:5]) print('----------------------------') ''' インデックスの...
false
e2c0ea3f0638d3d181a0d291eb488839f1596001
Yasin-Yasin/Python-Tutorial
/005 Conditionals & Booleans.py
1,415
4.375
4
# Comparisons # Equal : == # Not Equal : != # Greater Than : > # Less Than : < # Greater or Equal : >= # Less or Equal : <= # Object Identity : is # if block will be executed only if condition is true.. if True: print("Conditinal was true") if False: prin...
true
f17feb86a3277de3c924bcecb2cc62dee8801e1b
Yasin-Yasin/Python-Tutorial
/014 Sorting.py
1,686
4.28125
4
# List li = [9,1,8,2,7,3,6,4,5] s_li = sorted(li) print("Sorted List\t", s_li) # This function doesn't change original list, It returns new sorted list print('Original List\t', li) li.sort() # sort method sort original list, doesn't return new list, this method is specific to List obj print('Original List, Now So...
true
074ac0d3a6836dbf02831280eb8cd55adb3a508d
ZHANGYUDAN1222/Assignment2
/place.py
1,282
4.3125
4
""" 1404 Assignment class for functions of each place """ # Create your Place class in this file class Place: """Represent a Place object""" def __init__(self, name='', country='', priority=0, v_status=''): """Initialise a place instance""" self.name = name self.country = country ...
true
79144ad6f7efd0fcdc7d3fe20e04a881cb1b544a
Diwyang/PhytonExamples
/demo_ref_list_sort3.py
1,206
4.40625
4
# A function that returns the length of the value: #list.sort(reverse=True|False, key=myFunc) #Sort the list descending cars = ['Ford', 'BMW', 'Volvo'] cars.sort(reverse=True) print(cars) #Sort the list by the length of the values: # A function that returns the length of the value: def myFunc(e): return len(e) ...
true
ba6e01baaa2b69497ede48f24737831c8d35fa68
Diwyang/PhytonExamples
/Example4.py
531
4.21875
4
# My Example 3 """There are three numeric types in Python: int - Int, or integer, is a whole number, positive or negative, without decimals, of unlimited length. float - Float, or "floating point number" is a number, positive or negative, containing one or more decimals. complex - Complex numbers are writt...
true
a6158f2bf6ce87e6213cb5de60d4b82d9cd5000c
guoguozy/Python
/answer/ps1/ps1b.py
648
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: ')) semi_annual_raise = float(input('Enter the semi­annual raise, as a decimal: ')) current_savings =...
true
123f44d763fe59334151321a24a1c3a3cf7b284c
Ret-David/Python
/IS 201/Concept Tests/CT05_David_Martinez.py
689
4.21875
4
# David Martinez # Write a pseudo code to design a program that returns the # of occurrences of # unique values but sorted from the list. For example, with the input list # [1, 2, -2, 1, 0, 2, 4, 0], the program should provide the output as follows: # unique value (# of occurrences) # -2(1) # ...
true
879206042b294d5da53faf0c85858394a2e7b28e
Ret-David/Python
/IS 201/Module 1/HOP01.py
1,789
4.34375
4
# HOP01- David Martinez # From Kim Nguyen, 4. Python Decision Making Challenge # Fix the program so that the user input can be recognized as an integer. # Original Code guess = input("Please guess a integer between 1 and 6: ") randomNumber = 5 if (guess == randomNumber): print("Congrats, you got it!") else: ...
true
0d022905006e7bb3113a9726c9780b13eb55b544
Ret-David/Python
/IS 201/Practical Exercises/PE05_David_Martinez_4.py
1,725
4.34375
4
# David Martinez # Make two files, cats.txt and dogs.txt. # Store at least three names of cats in the first file and three names of dogs in # the second file. # Write a program that tries to read these files and print the contents of the file # to the screen. # Wrap your code in a try-except block to catch the...
true
92acf42a33fefc55d10db64cb4a2fd7856bc21de
Ret-David/Python
/IS 201/Concept Tests/CT09_David_Martinez.py
616
4.375
4
# David Martinez # Write a pseudo code to design a program that returns I-th largest value # in a list. For example, with the input list [3, 2, 8, 10, 5, 23] # and I = 4, the program prints the value 5 as it is 4 th largest value. # ========== My Pseudo Code ========== # >> 5 is in index 4 position but is the...
true
5e7b828d0d74462a10fefbbee34d14c3f29f4c0c
ChloeDumit/holbertonschool-higher_level_programming
/0x0C-python-almost_a_circle/models/square.py
1,674
4.28125
4
#!/usr/bin/python3 """ Write the class Rectangle that inherits from Base""" from .rectangle import Rectangle """ creating new class """ class Square(Rectangle): """ class Square """ def __init__(self, size, x=0, y=0, id=None): "initializes data" self.size = size super().__init__(sel...
true
015e8232f2a297ecc7e8d0ebe7a25038125f13eb
dyfloveslife/SolveRealProblemsWithPython
/Practice/student_teacher.py
1,166
4.15625
4
class Person(object): """ return Person object """ def __init__(self, name): self.name = name def get_details(self): """ return string include person's name """ return self.name class Student(Person): """ return Student Object,include name,branch,y...
false
8a2cc39e3dd9799e46aa0bd8f8b922fad8c99d8a
hahaliu/LeetCode-Python3
/654.maximum-binary-tree.py
1,420
4.15625
4
# ex2tron's blog: # http://ex2tron.wang # 我的思路:先求max,然后分成左右,最后左右分别递归 # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def constructMaximumBinaryTree(self, nums): """ :...
false
5592f8f04714d6862c6ac90e03e5a83d0c4cd814
Aritiaya50217/CompletePython3Programming
/section13_Gui/lecture98_event.py
765
4.125
4
# Event Driven Programming การเขียนโปรแกรมตามลำดับเหตุการณ์ from tkinter import * def leftClickButton(event): print("Left Click !! ") def rightClickButton(event): print("Right Button !! ") def doubleClickLeft(event): print("DoubleClick Left !!") def doubleClickRight(event): print("DoubleClick Right !...
false
b12bbaf3e31c5362fd198c6512d76d858470ac8d
jinayshah86/DSA
/CtCI-6th-Edition/Chapter1/1_6/string_compression_1.py
1,653
4.1875
4
# Q. Implement a method to perform basic string compression using the counts # of repeated characters. For example, the string 'aabcccccaaa' would become # 'a2b1c5a3'. If the "compressed" string would not become smaller than the # original string, your method should return the original string. You can # assume the stri...
true
bfb24a739c79bffb1f60dbb54481ceb9ecd13ceb
BoynChan/Python_Brief_lesson_answer
/Char7-Import&While/char7.1.py
511
4.125
4
car = input("What kind of car do you want to rent?: ") print("Let me see if I can find you a "+car) print("------------------------------") people = input("How many people are there?: ") people = int(people) if people >= 8: print("There is no free table") else: print("Please come with me") print("-----------...
true
529402a5a5de14174db8206be4d1d24cef30396b
veshhij/prexpro
/cs101/homework/1/1.9.py
422
4.21875
4
#Given a variable, x, that stores #the value of any decimal number, #write Python code that prints out #the nearest whole number to x. #You can assume x is not negative. # x = 3.14159 -> 3 (not 3.0) # x = 27.63 -> 28 (not 28.0) x = 3.14159 #DO NOT USE IMPORT #ENTER CODE BELOW HERE #ANY CODE ABOVE WI...
true
3ebe34a84dced2da2dd210256e0213ba2fdf39a4
Heez27/python-basics
/03/operator-logical.py
804
4.28125
4
# 논리연산자 (not, or, and) a = 30 b1 = a <= 30 # not # not True -> False # not False -> True b2 = not b1 # or(논리합) # False or False -> False # True or False -> True # False or True -> True # True or True -> True b3 = (a <= 30) or (a >= 100) # and(논리곱) # False and False -> False # True and False -> False # False or True...
false
01ccaa78ebe6cc532d8caca853365d8d05f29b22
francomattos/COT5405
/Homework_1/Question_08.py
2,021
4.25
4
''' Cinderella's stepmother has newly bought n bolts and n nuts. The bolts and the nuts are of different sizes, each of them is from size 1 to size n. So, each bolt has exactly one nut just fitting it. These bolts and nuts have the same appearance so that we cannot distinguish a bolt from another bolt, or a nut fro...
true
db0682bd8033187a2ec73514dd2d389fb30ff2d0
wpiresdesa/hello-world
/stable/PowerOf2.py
639
4.5625
5
#!/usr/bin/env python3 # _*_ coding: utf-8 _*_ # Add this line today - 29/October/2018 11:08Hs # Add another line (this one) today 29/October/2018 11:10Hs # Add another line (this one) today 29?october/2018 11:18Hs # Python Program to display the powers of 2 using anonymous function # Change this value for a differe...
true
88074bfed63c071d5aa3558c1a9fe1798b3af34c
frsojib/python
/Code with herry/07_tamplate.py
225
4.4375
4
letter = ''' Dear <|NAME|>, You're selected! Date <|DATE|> ''' name = input('Enter your name: ') date = input('Enter date: ') letter= letter.replace("<|NAME|>", name) letter= letter.replace("<|DATE|>", date) print(letter)
false
d974cd6b8c7f5e8ea7672f0e935acac30dbd82a9
mleue/project_euler
/problem_0052/python/e0052.py
840
4.15625
4
def get_digits_set(number): """get set of char digits of number""" return set((d for d in str(number))) def is_2x_to_6x_permutable(number): """check if all numbers 2x, 3x, 4x, 5x, 6x contain the same digits as number""" digits_set = get_digits_set(number) multipliers = (2, 3, 4, 5, 6) for m in multipliers:...
true
4ff167bec52d0c1ab4196536b6ec81be4f3d13fe
gunit84/Code_Basics
/Code Basics Beginner/ex20_class_inheritance.py
1,288
4.34375
4
#!python3 """Python Class Inheritance... """ __author__ = "Gavin Jones" class Vehicle: def general_usage(selfs): print("General use: transportation") class Car(Vehicle): def __init__(self): print("I'm Car ") self.wheels = 4 self.has_roof = True def specific_usage(self)...
true
d10ced02db8f0c93bd026b745cf916c1519fe4ef
gunit84/Code_Basics
/Code Basics Beginner/ex21_class_multiple_inheritance.py
572
4.46875
4
#!python3 """Python Multiple Inheritance Example... """ __author__ = "Gavin Jones" class Father(): def skills(self): print('gardening, programming') class Mother(): def skills(self): print("cooking, art") # Inherits from 2 SuperClasses above class Child(Father, Mother): def skills(se...
true
12a7da2b3332e10ffd87ff76ba3a2125060083ef
wanggao1990/PythonProjects
/= Fishc bbs/43 魔法方法 算术运算2.py
2,213
4.15625
4
# int()、float()、str()、len()、tuple()、list() 等函数调用时,就创建一个相应的实例 ####### 算术运算符 ## ## __add__(self, other) 定义加法的行为:+ ## __sub__(self, other) 定义减法的行为:- ## __mul__(self, other) 定义乘法的行为:* ## __truediv__(self, other) 定义真除法的行为:/ ## __floordiv__(self, other) 定义整数除法的行为:// ## __mod__(self, other) 定...
false
98888d25ea574d342d4a9b3d79854bdb27f09447
wanggao1990/PythonProjects
/= Fishc bbs/16 序列(str,list,tuple转换) 序列运算.py
2,155
4.46875
4
# list、tuple、str 统称 序列(能迭代) # 1 通过索引获得 # 2 默认索引值都是从0开始 # 3 分片方法获得元素的集合 # 4 操作符 (重复 拼接 关系) ## str,tuple => list # 不带参数 空列表 a = list(); print(a) # str转list,str每个字符都成为list元素 ['1', 'a', '2', 'b', '3', 'c'] a='1a2b3c'; a= list(a); print(a) # tuple转list,每个元素都成为list元素 [1, 1, 2, 3, 5, 8, 13, 21] a=(1,1,2,3,5,8,13,21); a= ...
false
5b3ae06bb5ab6d7fbedf32e70113462324728453
lilsweetcaligula/sandbox-online-judges
/leetcode/easy/number_of_segments_in_a_string/py/solution.py
528
4.125
4
# # In order to count the number of segments in a string, defined as # a contiguous sequence of non-space characters, we can use the # str.split function: # https://docs.python.org/3/library/stdtypes.html#str.split # # Given no parameters, the string is split on consecutive runs of # whitespace and produce a list of...
true
80e5adbdcb0cf56f35ea9676103e5dad73771473
lilsweetcaligula/sandbox-online-judges
/leetcode/easy/move_zeroes/py/solution.py
1,633
4.125
4
# # We use a slow/fast pointer technique. The fast pointer (index) is running ahead, # reporting whether the value it is pointing to is a zero value or not. # # If nums[fast] is not a zero value, we copy the value to nums[slow] and increment # the slow pointer. This way, by the time the fast pointer reaches the end of...
true
4733063008b4fc20e5876d956ed4f79c8519992a
LuAzamor/exerciciosempython
/crescente.py
219
4.15625
4
num1= int (input ("primeiro número: ")) num2= int (input ("segundo número: ")) num3= int (input ("terceiro número: ")) if num1 < num2 < num3: print ("crescente") else: print ("não está em ordem crescente")
false
155e3da4e2113cb57fa186f3f887ab42c3fe40d0
marcoslorhanbs/PharmView
/DataBaser.py
835
4.125
4
import sqlite3 # conectando... conn = sqlite3.connect('Data/Remedios.db') # definindo um cursor cursor = conn.cursor() # criando a tabela (schema) cursor.execute(""" CREATE TABLE IF NOT EXISTS Remedios ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Nome TEXT NOT NULL, Preco...
false
f93a0e365415b56b37ddc49187da509706235061
Tanmay-Thanvi/DSA-and-Leetcode-Walkthroughs
/Trees/Root_to_leaf_paths_binary_tree.py
1,489
4.40625
4
#1. Idea here is we want to return a list of strings which contains all of the root to leaf paths in the binary tree. #2. So initialize a list (path_list) then we are going to make a recursive call function. In the function we will pass the root of the binary tree and a empty string which we will modify and add node v...
true
4c4b94ca6467f49e4d8309393d0b64723a85c59c
Tanmay-Thanvi/DSA-and-Leetcode-Walkthroughs
/Trees/Max_path_sum_in_binary_tree.py
2,107
4.4375
4
#1. Firstly, understand what the question wants. It wants the MAX PATH. Recall a path is a sequence or iteration of nodes in a binary tree where there are no cycles. #2. Now, I want you to approach the recursion this way - "What work do I want to do at EACH node?" Well at each node we want to find the value of its lef...
true
e864f950f6954159af078f6592af6e7d894202ad
violazhu/hello-world
/closure.py
1,769
4.15625
4
""" 实现计数器统计函数调用次数 """ # def createCounter(): # """ 方法1:list的原理类似C语言的数组和指针,不受作用域影响 # 直接改变值对应的地址。也就是说不是改变值的引用,而是永久改变值本身 """ # L=0 # def counter(): # L=+1 # return L # return counter def createCounter1(): """ 方法1:list的原理类似C语言的数组和指针,不受作用域影响 直接改变值对应的地址。也就是说不是改变值的引用,而是永久改变值本身 ""...
false
63bdbe4ccee706b12c9632d3c9e7054497660dbe
Multiverse-Mind/MIPT-programming-practic
/lab2/Упр 9.py
512
4.125
4
import turtle from math import sin, pi def polygon(n, r): for i in range(n): turtle.forward(2 * r * sin(2 * pi / (2 * n))) turtle.left(180 - (((n - 2) * 180) / n)) turtle.shape('turtle') turtle.penup() r = 20 turtle.forward(r) turtle.pendown() for n in range(3, 13): turtle.le...
false
12cbb9b004d8360c72ca0e797b88094b86037cdb
ctec121-spring19/programming-assignment-2-beginnings-JLMarkus
/Prob-3/Prob-3.py
1,055
4.5
4
# Module 2 # Programming Assignment 2 # Prob-3.py # Jason Markus def example(): print("\nExample Output") # print a blank line print() # create three variables and assign three values in a single statement v1, v2, v3 = 21, 12.34, "hello" # print the variables print("v1:", v1) ...
true
db0479a9cb64020a74d3226af0b38ebbda140e66
joyonto51/Programming_Practice
/Python/Old/Python Advance/Practise/Factorial_by_Recursion.py
347
4.21875
4
def factorial(number): if number == 0: return 1 else: sum = number * factorial(number - 1) return sum number=int(input("please input your number:")) ''' num=number-1 num1= number for i in range(num,0,-1): sum=num1*i print(num1,"*",i,"=",sum) num1=sum ''' ...
true
90d6f45188cd37274453b2b944ad5432de3a60d5
sunshine55/python-practice
/lab-01/solution_exercise1.py
2,140
4.1875
4
def quit(): print 'Thank you for choosing Python as your developing tool!' exit() def choose(choices=[]): while True: choice = raw_input('Please choose: ') if len(choices)==0: return choice elif choice in choices: return choice else: print 'You must choose from one of the following: ', sorted(choic...
true
671443c555f412d1c03018de29760dbf5bb67f82
nicap84/mini-games
/Guess the number/Guess the number.py
2,218
4.125
4
# template for "Guess the number" mini-project # input will come from buttons and an input field # all output for the game will be printed in the console #import simplegui try: import simplegui except ImportError: import SimpleGUICS2Pygame.simpleguics2pygame as simplegui import random # initialize global var...
true
1df218be5a5e105a13eed8c63f469f4acddda353
AnthonySimmons/EulerProject
/ProjectEuler/ProjectEuler/Problems/Problem20.py
607
4.15625
4
#n! means n (n ? 1) ... 3 2 1 #For example, 10! = 10 9 ... 3 2 1 = 3628800, #and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. #Find the sum of the digits in the number 100! def Factorial(num): fact = num for i in reversed(range(1, num)): fact *= i return fac...
false
f99b9d736330ed66277e98311ccfb3a07b984f9e
Louis95/oop-in-python
/Exception/OnlyEven.py
595
4.125
4
''' While this class is effective for demonstrating exceptions in action, it isn't very good at its job. It is still possible to get other values into the list using index notation or slice notation. This can all be avoided by overriding other appropriate methods, some of which are double-underscore methods. ''' cl...
true
77464bdc55273ce06381c5005b445a5e4c34f2a2
jorgegarcia1996/EjerciciosPython
/Ejercicios Diccionarios/Ejercicio4.py
700
4.15625
4
# Suponga un diccionario que contiene como clave el nombre de una persona # y como valor una lista con todas sus “gustos”. # Desarrolle un programa que agregue “gustos” a la persona: # Si la persona no existe la agregue al diccionario con una lista que contiene un solo elemento. # Si la persona existe y el gusto ...
false
8a81a67dad68f690099e1e4f435c44a990b96ed4
khadeejaB/Week10D2A2
/questionfile.py
749
4.3125
4
#In this challenge, a farmer is asking you to tell him how many legs can be counted among all his animals. The farmer breeds three species: chicken = 2 cow = 4 dog = 4 #The farmer has counted his animals and he gives you a subtotal for each species. You have to implement a script or function that returns the ...
true
359824127dd9b48c34a2df72f7f21fd85077d9ff
Armin-Tourajmehr/Learn-Python
/Number/Fibonacci_sequence.py
950
4.28125
4
# Enter a number and have the program generate # The Fibonacci sequence number or the nth number def Fibonacci_sequence(n): ''' Return Fibonacci :param n using for digit that user want to calculator Fibonacci: :return sequence number as Fibonacci : ''' # Initialization number a = 1 b =...
true
7d6df544ae614235cd5c0238cbfaaaaca8350e6b
Armin-Tourajmehr/Learn-Python
/Number/Get_pi.py
864
4.21875
4
# Getting pi number # Use Nilakantha formula from time import sleep # Calculate Pi Number def calc_pi(num): Pi = 3 op = 1 for n in range(num): if n % 2 == 0 and n > 1: yield Pi Pi += 4 / ((n) * (n + 1) * (n + 2) * op) op *= -1 def valid_number(): while T...
false
c64ac69d915f54109e959d046f6317348650a460
evan-nowak/other
/generic/date_range.py
2,881
4.53125
5
#!/usr/bin/env python """ ######################### Date Range ######################### :Description: Generates a date range based on starting/ending dates and/or number of days :Usage: Called from other scripts :Notes: The function needs exactly two of the three arguments to work Wh...
true
0a5f2461b362405b244867ba8a8b44c21a363e51
ferdiansahgg/Python-Exercise
/workingwithstring.py
493
4.34375
4
print("Ferdi\nMIlla") print("Ferdi\"MIlla") phrase = "Ferdiansah and MilleniaSaharani" print(phrase.upper().isupper())#checking phrase is uppercase or not, by functioning first to upper and check by function isupper print(len(phrase))#counting the word print(phrase[0])#indexing the character print(phrase.index("F"))#ph...
true
d17d862ebd5e5f3705a868607c7c255fe4b44dce
yaseen-ops/python-practice2
/13while_loop.py
276
4.1875
4
i = 1 while i <= 5: print(i) # i = i + 1 # OR i += 1 print("Done with Loop") print("---------------------------------") i = 1 while i <= 5: print(i) if i == 4: print("Loop gonna end") # i = i + 1 # OR i += 1 print("Done with Loop")
false
53255ace53f8e0265529c46a5bcacee089a7d404
Patrick-Ali/PythonLearning
/Feet-Meters.py
381
4.15625
4
meterInches = 0.3/12 meterFoot = 0.3 footString = input("enter feet: ") footInt = int(footString) inchString = input("enter inches: ") inchInt = int(inchString) footHeightMeters = meterFoot*footInt inchHeightMeters = meterInches*inchInt heightMeters = round(footHeightMeters + inchHeightMeters, 2) pri...
true
21bd8642f4b1c392d4dc764373f03a4347a73fe7
OsProgramadores/op-desafios
/desafio-04/Nilsonsantos-s/python/xadrez.py
2,240
4.125
4
""" Autor: Nilsonsantos-s Propósito: Desafio 4 """ def verifica_string(numero): """ :param numero: Exclui qualquer número que não se encaixe no padrão correto. :return: retorna um número no padrão. """ contador_de_erros = 0 dicionario = {1: numero.isnumeric(), 2: len(numero)...
false
96bd7cf3b01c88c7faa2c6eeaaa0fb469c6d4eb5
OsProgramadores/op-desafios
/desafio-03/edipocba/python/desafio-03.py
844
4.1875
4
"""Algoritmo para identificação de números palíndromos em um intervalo de valores digitados pelo usuário.""" def palindromo(vi, vf): """Função que identifica quais números são palíndomos em um intervalor de valores.""" for numero in range(vi, vf+1): aux = str(numero) if aux == aux[::-1]: ...
false
95b1186e9ed087445b4bf5346b5c6eee221df1b4
OsProgramadores/op-desafios
/desafio-02/bessavagner/python/desafio02_osprimos.py
1,836
4.25
4
"""Desafio 02 de https://osprogramadores.com/desafios Escreva um programa para listar todos os números primos entre 1 e 10000, na linguagem de sua preferência. """ import argparse def seive_eratosthenes(num) : """Uses the seiv of Eratosthenes to map primes. The returned list is a mask of True/False values, ...
false
a092e63cdfed3394aae4902d689b13140d1e42b9
sarahsweeney5219/Python-Projects
/dateDetectionRegex.py
1,663
4.75
5
#date detection regex #uses regular expression to detect dates in the DD/MM/YYYY format (numbers must be in min-max range) #then tests to see if it is a valid date (based on number of days in each month) import re, calendar #creating the DD/MM/YYYY regex dateRegex = re.compile('(3[01]|[12][0-9]|0?[1-9])\/(0?[1-9]|1[0...
true
0c468539c35d7cb5043d109dc2955c9d7c71112c
dheidenr/ipavlov_course
/coursera/DS/tutor.py
1,653
4.21875
4
# Так было бы в 2-й версии python: print 'Hello' print('Hello') # Во втором python необходимо самостоятельно привести одно из пременных деления к float # в третьем автоматически при делении получается тип float print(10/2) ll = [] ll.append(1) print(ll) ll.insert(0, 3) print(ll) ll.pop() print(ll.pop()) print('Hell...
false
e3f79676946c1033ea1fe9d58bfbd310ff011a69
mashd3v/inteligencia_artificial
/Inteligencia Artificial y Machine Learning/Python/Básico/013 - Tuplas.py
976
4.65625
5
# Tuplas ''' En Python, una tupla es un conjunto ordenado e inmutable de elementos del mismo o diferente tipo. Las tuplas se representan escribiendo los elementos entre paréntesis y separados por comas. Una tupla puede no contener ningún elemento, es decir, ser una tupla vacía. Funciones que aplican a tupl...
false
668ad30aa1f83949b47022cfab2e8f92a3938af3
dishant888/Python-Basics
/questions/FarToCel.py
214
4.15625
4
#Convert Fahrenheit to Celcius #F to C f = float(input('Enter Fahrenheit: ')) print('%.2f'%eval('(f-32)*5/9'),' Celcius') #C to F c = float(input('Enter Celcius: ')) print('%.2f'%eval('(c*9/5)+32'),' Fahrenheit')
false
76330f9dfd49d09599509e9909d2ef0715eeb9c3
JeffreybVilla/100DaysOfPython
/Beginner Day 13 Debugging/debugged.py
1,709
4.1875
4
############DEBUGGING##################### # # Describe Problem # def my_function(): # """ # Range function range(a, b) does not include b. # 1. What is the for loop doing? # The for loop is iterating over a range of numbers. # # 2. When is the function meant to print 'You got it'? # If...
true
c0b096fa60b91b859fac13c0bf6a804116140dfc
hlainghpone2003/SFU-Python
/Sets.py
2,214
4.15625
4
#Sets includes a data type for sets. Curly braces or the set() fuction can be used to create sets. basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'} print(basket) #show that duplicates have been removed 'orange' in basket # fast member testing 'crabgrass' in basket Demonstrate set operation on unique ...
true
2be5ff41a0dd3029786f149dd7674ead6a9f07f1
titojlmm/python3
/Chapter2_Repetition/2_01_RockPaperScissors.py
1,346
4.25
4
import random # This program plays the game known as Rock-Paper-Scissors. # Programmed by J. Parker Jan-2017 print("Rock-Paper_Scissors is a simple guessing game.") print("The computer will prompt you for your choice, ") print("which must be one of 'rock', 'paper', or 'scissors'") print("When you select a choice the c...
true