blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
9ffc86036d180e3c720348674ba0a62fd1c7c23e
LalithK90/LearningPython
/privious_learning_code/String/StringCenter()Method.py
394
4.21875
4
str = "this is string example....wow!!!" print("str.center(40, 'a') : ", str.center(40, 'a')) # The method center() returns centered in a string of length width. Padding is done using the specified fillchar. # Default filler is a space. Syntax # # str.center(width[, fillchar]) # # Parameters # # width − This is the to...
true
9c181fba8db69a77b8d2e09e085b0330d83bb11a
aifulislam/Python_Demo_Five_Part
/program7.py
1,729
4.71875
5
#07/October/2020-------- #Python Operator------- #Python Arithmetic Operator-------- print("Python Arithmetic Operator--------") x = 8 y = 2 print(x+y) x = 8 y = 2 print(x-y) x = 8 y = 2 print(x*y) x = 8 y = 2 print(x/y) x = 9 y = 2 print(x%y) x = 8 y = 4 print(x**y) x = 8 y = 4 prin...
false
ba0eb3697461b90f82dac8753cc9ce4cb97dc657
aifulislam/Python_Demo_Five_Part
/program13.py
1,508
4.21875
4
#13/October/2020-------- #Python---while--Loop----- #Python---for--Loop----- i = 1 while i < 6: print(i) i+=1 print("break---------") i = 1 while i < 15: print(i) if (i == 10): break i += 1 print("Continue---------") i = 0 while i < 6: i += 1 if i== 3: ...
false
b9008846665e4ebad55a4ce314651fe99a190011
aifulislam/Python_Demo_Five_Part
/program6.py
890
4.21875
4
#06/October/2020-------- #Python Booleans------- #True or False-------- print(10>9) print(10==9) print(10<9) a = 80 b = 133 if a > b: print("a is greater than b.") else: print("b is greater than a.") print(bool("Hello")) print(bool(15)) x = "Hello" y = 15 print(bool(x)) print(bool(y)) ...
false
ca09433b3b42f4053288524ad61ad69f67d13659
scivarolo/py-ex04-tuples
/zoo.py
481
4.25
4
# Create a tuple named zoo zoo = ("Lizard", "Fox", "Mammoth") # Find an animal's index print(zoo.index("Fox")) # Determine if an animal is in your tuple by using value in tuple lizard_check = "Lizard" in zoo print(lizard_check) # Create a variable for each animal in the tuple (lizard, fox, mammoth) = zoo # Convert ...
true
2c0da1b242caabe0009335f12095c5cec1779976
AliCanAydogdu/Intro_to_Python
/chapter2_Lists.py
2,565
4.53125
5
#Here's a simple example of a list bicycles = ['trek','canonndale','redline','specialized' ] print(bicycles[0]) print(bicycles[0].title()) #Index Numbers Start at 0, Not 1 # At Index -1, python returns the last item, at index -2 second item from the end of list, so on. #Using Individual Values from the list bicycles...
true
d5b41acd88de4996f061b79ef73ec60fa68ce747
yami2021/PythonTests
/Assignment/area_traingle_new.py
585
4.125
4
def check_user_input(input): try: # Convert it into integer val1 = float(input) return val1 #return val1 #print("Input is an integer number. Number = ", val) except ValueError: print("No.. input is not a number. It's a string") area() def area(): i...
true
6b000f4ecd08235fe57b54a58d7dbe8a7d5a530f
markplotlib/treehouse
/basic-python/Lists/list_intro.py
2,201
4.1875
4
# quiz of lists dict_of_lists = { 'list("Paul")': list("Paul"), 'list(["Paul"])': list(["Paul"]), 'list(["Paul", "John"])': list(["Paul", "John"]) } def quiz_of_lists(dict_of_lists): for key, value in dict_of_lists.items(): print("=" * 44) print("What is the length of this list? ")...
true
685094695eacff77c8838ef8ba06c56b31819d95
himrasmussen/solitaire-fyeah
/testsuite.py
1,621
4.125
4
class Table(): """A class modelling the table.""" def __init__(self, deck): """Initialize the rows and stacks.""" self.stack = Stack() self.columns = {i: [] for i in range(7)} #? self.acestacks = OrderedDict() for suit in "hearts diamonds spades clubs".split(): ...
true
0e80cfb3ac5ea66678c4b99ad82e536098e09789
darrenpaul/open-pipeline
/environment/modules/data/op_dictionary.py
771
4.1875
4
def merge_dictionaries(original=None, new=None): """ This will merge two dictionaries together, the original dictionary will be updated in memory. Keyword Arguments: original {dictionary} -- The original dictionary new {dictionary} -- The new dictionary """ for key, val in new.i...
true
0c28a6e808b0ee6bf59d613d4c006b7914626eef
Pixelus/Programming-Problems-From-Programming-Books
/Python-crash-course/Chapter7/multiples_of_ten.py
218
4.28125
4
# -*- coding: utf-8 -*- """ Created on Tue Nov 29 2018 @author: PixelNew """ number = input("Enter a number please: ") if(int(number) % 2 == 0): print("Your number is even.") else: print("Your number is odd.")
true
adbd6615816af81a918cbbba0886d80be36b7879
evaseemefly/InterviewTest
/基础知识总结/demo_值类型与引用类型.py
645
4.1875
4
''' str是否为值类型 ''' str_a="abcde" # str_b=str_a str_b="abcde" str_c=str_a str_a="cedfg" print("str_a:%s,id:%s"%(str_a,id(str_a))) print("str_b:%s,id:%s"%(str_b,id(str_b))) print("str_c:%s,id:%s"%(str_c,id(str_c))) # print(str_b[0:2]) # str_b[0:2]="fg" # print(id(str_b)) print("-----------") ''' 对于引用类型 list或字典 ''' list_...
false
c7fcd6f3f827e756c6758eb9fb489bf51873e091
javacode123/learn_python
/chapter4/anonymous_func.py
490
4.15625
4
# -*- coding: utf-8 -*- # 匿名函数使用 lambda x: x * x 相当于 def f(x): return x * x print(list(map(lambda x: x * x, [1, 2, 3, 4, 5, 6]))) # 匿名函数也是一个函数对象,可以进行赋值给一个变量,匿名函数可以有效防止函数重名 f = lambda x: x * x print(f, f(5)) # 测试,构造匿名函数 def is_odd(n): return n % 2 == 1 L = list(filter(is_odd, range(1, 20))) print(L) l = list(fi...
false
c895b752f72217d3b4afe224554d861b6f09be75
chaitanyamean/python-algo-problems
/Array/monotonic.py
454
4.125
4
'''Given a non-empty array of integers, find if the array is monotonic or not ''' def isMonotonic(array): isNonIncreasing = True isNonDecreasing = True for i in range(1, len(array)): if array[i] < array[i -1]: isNonDecreasing = False if array[i] > array[i-1]: isNon...
true
df2952366ddca95d50978caaba441a94abefdf6a
AlexB196/python-exercises
/.idea/shopping.py
590
4.1875
4
shopping_list = ["milk", "pasta", "eggs", "spam", "bread", "rice"] #list is created with square brackets # for item in shopping_list: # if item != "spam": # print("Buy " + item) #CONTINUE! - mai jos # for item in shopping_list: # if item == "spam": #cand gaseste "spam", il sare si trece la urmatorul i...
false
cd6d93b45427751279adf4560ebe1717562133f9
AlexB196/python-exercises
/.idea/augmenteda_inaloop_challenge.py
521
4.40625
4
number = 10 multiplier = 8 answer = 0 # add your loop after this comment for i in range(multiplier): i = number answer += i #IMPORTANT! I don't have to use i above. I can simply type answer += number #the loop will end when the condidition becomes false, but I dont have to use that i print(answer) #i...
true
bd3e9521b7c49cfbbed1c9e2a62aefc31a827540
AlexB196/python-exercises
/.idea/motorbike.py
252
4.25
4
bike = {"make": "Honda", "model": "250 dream", "color": "red", "engine_size": 250} print(bike["engine_size"]) print(bike["color"]) #bike is a dictionary #we can access different entry from the dictionary - doesn't matter if it's a number #or a string
true
5bc0264a032c7a163c6724ebdfbbb406c53027eb
mariomf/pythonPractice
/Calculadora.py
1,624
4.1875
4
def realizar_operacion(opcion): if opcion == '1': try: a = int(input("Dame un numero ")); b = int(input("Dame otro numer ")); except ValueError: print("Eso no es un numero"); else: suma = a + b; print("La suma es: " + str(suma)); ...
false
c280890b699b21cedad4771f4fa22dff35292bc8
alexnicholls1999/Python
/BMI.py
252
4.1875
4
#User Enters weight in Kilograms print ("What is your weight? (kg)?") weight = int(input()) #User Enters Height in Metres print ("What is your height? (m)") height = float(input()) #Users BMI print ("Your bmi is","{0:.2f}".format(weight/height**2))
true
7327f9ba8d63593e2526440e5c587bcb307f9285
KhinYadanarAung/CP1404_Practicals
/Prac_05/color_names.py
502
4.34375
4
COLOR_NAMES = {"ALICEBLUE": "#f0f8ff", "ANTIQUEWHITE": "#faebd7", "ANTIQUEWHITE1": "#ffefdb", "ANTIQUEWHITE2": "#eedfcc", "ANTIQUEWHITE3": "#cdc0b0", "ANTIQUEWHITE4": "#8b8378", "AQUAMARINE1": "#7fffd4", "AQUAMARINE2": "#76eec6", "AQUAMARINE4": "#458b74", "AZURE1": "#f0ffff"} color = input("Enter color name: ").upper()...
false
7440bcf10ad32f5ceb3d333722616fd6311edff4
ValentinaSoldatova/Data_Science
/Алгоритмы и структуры данных на Python./7/les_7_task_2.py
2,118
4.125
4
# Отсортируйте по возрастанию методом слияния одномерный вещественный массив, #заданный случайными числами на промежутке [0; 50). # Выведите на экран исходный и отсортированный массивы. # вариант 1 from random import randint MAX_SIZE = 50 def merge_sort(array): if len(array) < 2: retur...
false
d6955c89a330de6c7627929e25be196741a7b298
Deep455/Python-programs-ITW1
/python_assignment_1/21.py
289
4.15625
4
def spliting(arr,n): return [arr[i::n] for i in range(n)] a=input("enter the elements of list seperated by commas : ").split(",") arr=list(a) n=int(input("enter size of splitted list u want to see :")) print("list : ") print(arr) print("list after spliting : ") print(spliting(arr,n))
true
ddd8cc2fe85fe0019c7bf9906542d47df1a68c18
Deep455/Python-programs-ITW1
/python_assignment_1/4.py
242
4.1875
4
def inserting(string,word): l=len(string) l=l//2 new_string=string[:l]+word+string[l:] return new_string string=input("enter a string : ") word=input("enter a word u want to insert : ") new_string=inserting(string,word) print(new_string)
true
85cca267caf2f35474c4786c9b939d30dc4e4450
shubham79mane/tusk
/reverse_link_list.py
1,515
4.125
4
# -*- coding: utf-8 -*- """ Created on Mon Jul 5 09:50:42 2021 @author: mane7 """ #!/bin/python3 import math import os import random import re import sys class DoublyLinkedListNode: def __init__(self, node_data): self.data = node_data self.next = None self.prev = None class DoublyLinke...
true
fbcf813a88bdde668127ea04d433328e777fa1ff
tothricsaj/-pythonLearnForMyself
/functions/multipleReturnValues/main.py
969
4.125
4
if __name__ == "__main__": print('hello multiple return values :S\n') ############################################ # using object ----> class Test: def __init__(self): self.str = "This is a string value" self.integer = 23 def func(): return Test() f = ...
false
1aa5306e1469f2dbfd4ce0891a9abd7c25570c02
fahrettinokur/python
/tuple.py
647
4.1875
4
tupleliste =(2,3,4,"Adana",(5,7,6),[]) liste=[2,3,4,"Adana",[5,8,9],()] #tuple de amaç tek seferde içlerine yazılarını yazrsın sonradan değiştiremesin. print(type(tupleliste)) print(type(liste)) print(tupleliste) print(liste) print(len(tupleliste)) print(len(liste)) print("\n\n\n\n\n") print(tupleli...
false
07a18fe8e58daff9a1f9a5761336e54106400513
fahrettinokur/python
/iteratörler.py
278
4.1875
4
sehir=["Adana","Ankara","izmir","mersin"] iteratör=iter(sehir) print(next(iteratör)) print(next(iteratör)) print(next(iteratör)) print(next(iteratör)) print("\n") #aslında ikisi aynı şey for içinde iteratorler var for i in sehir: print(i)
false
142d08a7ad923f75fd02732b4512f47af3c4b452
potatonumbertwo/Thinkp-CS-1101
/unit_4_assignment.py
1,332
4.25
4
import time start_time = time.time() def is_power(a, b): # """ define a function that a is a power of b if a is divisible by b # and a/b is a power of b ,returns True if a is a power of b""" if a == b: # base case of two arguments are equal return True if b == 1: return False # base ...
false
8a49408a77dba2167a07fc63cbbec7feb256e035
potatonumbertwo/Thinkp-CS-1101
/Unit7_discussion.py
2,114
4.1875
4
# 11.2 def histogram(s): d = dict() for c in s: if c not in d: d[c] = 1 else: d[c] += 1 return d # print(histogram('potato')) # knights = {'gallahad': 'the pure', 'robin': 'the brave'} # >>> for k, v in knights.items(): # ... print(k, v) ''' # 11.3 Looping an...
false
cb6b0d3fe2cf81a12a4ca2caee1789b48975c6f5
SophiaTanOfficial/John-Jacob
/speak.py
2,137
4.25
4
# Let's use some methods to manipulate the string stored in name. name = "John Jacob Jingleheimer Schmidt" # 1. Use print and a built-in method to print out the string "jOHN jACOB jINGLEHEIMER sCHMIDT" print(name.swapcase()) # 2. Use print and a built-in method to print out the string "JOHN JACOB JINGELHEIMER SCHMI...
true
c07018bd5edc5de46ddd36e9bff3e7c6b2a773b8
ledigofig/Selenium_com_Python_dunosauro
/Curso Introdutorio de python/16_listas_1.py
1,568
4.4375
4
#lista é definida poor [] minha_lista_compras = ['sabão', 'sabonete', 'arroz', 'moster',10,[1,2,3] ] #minha_lista_compras for item in minha_lista_compras: print(item) ''' [leandro]@[Curso Introdutorio de python]python -i 16_listas.py >>> minha_lista_compras[0] 'sabão' >>> minha_lista_compras[1] 'sabonete' >>> mi...
false
f0e8a498b38f965754c666887ae93fb7d5d2b0ed
MrzvUz/python-in-100-days
/day-002/day-2-1-exercise.py
1,440
4.4375
4
'''Data Types Instructions Write a program that adds the digits in a 2 digit number. e.g. if the input was 35, then the output should be 3 + 5 = 8 Warning. Do not change the code on lines 1-3. Your program should work for different inputs. e.g. any two-digit number. Example Input 39 Example Output 3 + 9 = 12 12 e.g...
true
8467d45c9f556014374caff485162cbe8d314ec7
MrzvUz/python-in-100-days
/day-008/day-8-2-prime_numbers.py
1,865
4.21875
4
'''Prime Numbers Instructions Prime numbers are numbers that can only be cleanly divided by itself and 1. https://en.wikipedia.org/wiki/Prime_number You need to write a function that checks whether if the number passed into it is a prime number or not. e.g. 2 is a prime number because it's only divisible by 1 and 2...
true
0edc5492367bdb71b7065c4d7a93d7b2d205cdfb
subho781/MCA-PYTHON-Assignment4
/assignment 4 Q7.py
407
4.21875
4
def bubbleSort(arr): n = len(arr) for i in range(n-1): for j in range(0, n-i-1): if arr[j] > arr[j+1] : arr[j], arr[j+1] = arr[j+1], arr[j] print("Enter number of elements: ", end="") n = int(input()) arr = [] for i in range(0, n): num = int(input("Enter element:")) arr.append(num) bubbleSort...
false
f609d07c8ad736d1d4385e74e097a6169843977b
marnyansky/stepik-python-for-beginners-complex-solutions
/unit317559 step8.py
843
4.125
4
""" URL: https://stepik.org/lesson/334150/step/8?unit=317559 boolean for a:b:c string (a: palindrome, b: prime, c: even) example: 1221:101:22 """ # my solution: def is_valid_password(p): is_palindrome = False nums = [int(i) for i in p.split(':')] if str(nums[0]) == str(nums[0])[::-1] and len(nums) == 3: ...
false
16e24a3e920b264002ab263cc9a3302ac047f84b
marnyansky/stepik-python-for-beginners-complex-solutions
/unit307930.py
758
4.28125
4
""" https://stepik.org/lesson/324754/step/8?thread=solutions&unit=307930 На первой строке вводится символ решётки и сразу же натуральное число nn — количество строк в программе, не считая первой. Далее следует nn строк кода. Нужно вывести те же строки, но удалить комментарии и символы пустого пространства в конце строк...
false
5efb9895e06699d9d2f5752779a144d73bcbd40c
CassMarkG/Python
/operations.py
1,422
4.15625
4
#Declaration of variables a = 23 b = 12 c = 2.402 name = "Tshepo" surname = "Gabonamang" #Basic operations full_name = name + surname #concatenate strings sum = a + b product = a*b sumth = a**b #exponent bb = b**2 divc = a / b subtract = a - b divs = a%b #Assignment Operators c += b d = e = f = ...
true
91e9f270dd26983d882ccb478eb8bb276c2ee93c
deboranrosa/Exercicios-Python
/Módulo_2/ESTRUTURA-DE-DADOS/Exercicios/Exercicio4.py
1,159
4.3125
4
# Crie 3 conjuntos conforme estrutura a seguir: # setx = set(["apple", "mango"]) # sety = set(["mango", "orange"]) # setz = set(["mango"]) # Faça as seguintes operações sobre conjuntos: # a) Faça a união dos três conjuntos e imprima o resultado # b) Verifique quais os elementos comuns do conjunto setx e sety e imprima ...
false
671220044cb30d7674abe64eb720fbcc42ae1043
nhernandez28/Lab7
/disjointSetForest.py
2,168
4.21875
4
""" CS2302 Lab6 Purpose: use a disjoint set forest to build a maze. Created on Mon Apr 8, 2019 Olac Fuentes @author: Nancy Hernandez """ # Implementation of disjoint set forest # Programmed by Olac Fuentes # Last modified March 28, 2019 import matplotlib.pyplot as plt import numpy as np from scipy impor...
true
f7a3d0fb6075fb2b8de4735b927687651386f815
octospark/100-Days-of-Code---The-Complete-Python-Pro-Bootcamp-for-2021
/TurtleRace/main.py
1,040
4.25
4
from turtle import Turtle, Screen import random screen = Screen() screen.setup(width=500, height=400) user_bet = screen.textinput(title="make your bet", prompt="Which turtle will win the race? Enter a color: ") colors = ["red", "orange", "yellow", "green", "blue", "purple"] turtles = [] is_race_on = False v...
true
1cacc5ee0b82ed052b05a7f6a70ba7ee2941d978
3fraa/100_days_of_programming_python
/L27.py
826
4.28125
4
a = b = 10 c = 3 if a > b : print("a is greater than b") elif a < b : print("a is less than b") else : print("a is equal to b") if len("Afraa") == len("Laila"): print("Afraa ana Laila have the same number of characters") print("a is equal to b") if a == b else print("a is not equal to b") print("<") if a <...
false
59ce1e1eb4fbc635af46b2ccb0f3d578aea98afd
3fraa/100_days_of_programming_python
/L16.py
656
4.4375
4
List = ["Afraa" , "Amal"] Tuple = ("Noha" , "Laila") print("List = " , List) print("Tuple = " , Tuple) print() List = [] Tuple = () print("List = " , List) print("Tuple = " , Tuple) print() List = [3] # if we write as follows //Tuple = (3) #it will look like item not tuple ,so we must add comma item = 3 item1 = (3...
false
70c8efd8209fc40a4085139f86bdc57e11f01346
roy355068/Algo
/Greedy/435. Non-overlapping Intervals.py
1,667
4.15625
4
# Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping. # Note: # You may assume the interval's end point is always bigger than its start point. # Intervals like [1,2] and [2,3] have borders "touching" but they don't overlap each oth...
true
54bd1b88a5ad75d1b4b7169cad68a4ee4aa5839b
roy355068/Algo
/Trees/109. Convert Sorted List to BST.py
2,264
4.1875
4
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class ...
true
4b44ac5cf8b0313a395dbcabd38f1bca1a3759b9
roy355068/Algo
/Design Problems/341. Flatten Nested List Iterator.py
2,279
4.1875
4
# """ # This is the interface that allows for creating nested lists. # You should not implement it, or speculate about its implementation # """ #class NestedInteger(object): # def isInteger(self): # """ # @return True if this NestedInteger holds a single integer, rather than a nested list. # :rt...
true
312b5b4a69cf844e106f163e1168eefd5f708d18
Siddhantmest/Data-Structures-and-Algorithms
/insertion_sort.py
471
4.1875
4
print('Welcome to the algorithm for Insertion Sort') print('Input the list you want to sort, numbers separated by space:') inplist = list(float(item) for item in input().split()) def insertionsort(a): for i in range(1,(len(a))): key = a[i] j = i - 1 while (j >= 0) and (key...
true
9474fa96b17cfc4ac3b2bf363d2c2e0f6b0dd808
whyhelin/python3_test
/helin_07/OOP_sub.py
1,653
4.125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class Animal(object): def run(self): print('Animal is running...') class Timer(object): def run(self): print('Start...') class Dog(Animal): def run(self): print('Dog is running...') class Cat(Animal): def run(self): p...
false
f9f8e7ffa801170f3e4ebcc8334335398756b439
alaqsaka/learnPython
/madlibs.py
828
4.125
4
# Python project: madlibs print("Welcome to madlibs game\n") print("Madlibs is phrasal template word game which consists of one player prompting others for a list of words to substitute for blanks in a story before reading aloud.") name = input("What is your name? ") age = input("How old are you? ") dreamJob = inpu...
true
5b40cb33ef3132079b45b3db4a5c9d11ab3467a3
BoomerPython/Week_1
/DSA_BoomerPython_Week1.py
649
4.1875
4
# This file provides an overview of commands # & code demonstrated in week 1 of the DSA 5061 Python course. # Additional course materials depict the code shown here via # the command line and also using a notebook. # The basics - math 2+3 # Storing results ans = 2 + 3 print(ans) # Printing to the scr...
true
80690807b5f4f514b81f2f4c7c104e2744bd64f1
vivek2188/Study
/Datacamp/Python/Intermediate/Dictinoaries , Pandas/pandas_4.py
645
4.15625
4
''' Your read_csv() call to import the CSV data didn't generate an error, but the output is not entirely what we wanted. The row labels were imported as another column without a name. Remember index_col, an argument of read_csv(), that you can use to specify which column in the CSV file should be used as a row label? ...
true
d1dd589301484e3010bd0d84c84bc8956cea50f7
gustavoc77/Desafios-Python
/desafio018.py
561
4.125
4
# faça um programa que leia um ângulo qualquer e mostre na tela o valor do seno, cosseno e tangente desse ângulo. import time from math import radians, sin, cos, tan angulo = float(input('Digite um ângulo: ')) print('...........CALCULANDO.........') loop = 0 time.sleep(1.2) seno = sin(radians(angulo)) cosseno = cos(ra...
false
f7652c5bfc3bb0645c86615dace8ff63ae12d624
ava6969/P0
/Task2.py
1,341
4.125
4
""" Read file into texts and calls. It's ok if you don't understand how to read files """ import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) """ TASK 2: Which telephone number spent the...
true
f84e297229c0cabf70c42e2889358cb8403b389e
rahcode7/Programming-Practice
/Python/Concepts/Classes.py
943
4.28125
4
## Classes & String Formatting #def main(): #print("Before MyClass") # class MyClass: # variable = "temp" # def f1(self): # print("Message inside {0} {1} class".format("my","first")) #myobject1 = MyClass() # print(myobject1.variable) #print(myobject1.f1) # if __name__ == '__main__': # myob...
true
57eb528ea3768dc2148dd8cef09857ace841a58f
Mr-hongji/pythonNote
/一本册子/类继承.py
474
4.15625
4
''' 继承 语法: 子类(父类) ''' #创建父类交通工具类 -- Vehicle class Vehicle: speed = 0 #速度 def driver(self, distance): #distance : 路程 print float(distance / self.speed) #创建子类汽车类 -- Car 继承父类Vehicle class car(Vehicle): fuel = 0 speed = 60 driver(100) #创建子类自行车类 ...
false
6eccdfa3b33b04759e30e781823eb57adc8b5d83
AlexandrSech/Z49-TMS
/students/Solovey/Homework/HW_4/task_4_5.py
786
4.1875
4
''' 5) Составить список чисел Фибоначчи содержащий 15 элементов. ''' # example_1 number_1 = number_2 = int(input('Enter a starting number:')) max_nums = int(input('Enter numbers maximum:')) fib_list = [] fib_list.append(number_1) fib_list.append(number_2) for i in range(2, max_nums): number_1, number_2 = number...
false
415f3857a95482a91d93336a23b14181d9052cd6
AlexandrSech/Z49-TMS
/students/Hantsevich/l11/task_11_2.py
2,590
4.3125
4
""" Создать класс Car. Атрибуты: марка, модель, год выпуска, скорость(поумолчанию 0). Методы: увеличить скорости(скорость + 5), уменьшени ескорости(скорость - 5), стоп(сброс скорости на 0), отображение скорости, разворот(изменение знака скорости). Все атрибуты приватные. """ class Car: __mark: str # Марка ...
false
18fec9e775d49a779a1fb68976e0729aa2e0088f
AlexandrSech/Z49-TMS
/students/Volodzko/Task_5/task_5_7.py
610
4.21875
4
""" Дана целочисленная квадратная матрица. Найти в каждой строке наи-больший элемент и поменять его местами с элементом главной диагонали """ matrix = [[5, 8, 2, 3], [7, 11, 1, 8], [9, 4, 6, 5], [2,12,1,3]] for i in matrix: print(i) print("\n") for item, value in enumerate(matrix): max_value = 0 for j in ...
false
1a22b93c6f135a7ec4bddb61f5941de770f72887
AlexandrSech/Z49-TMS
/students/Volodzko/Task_2/task_2_4.py
235
4.15625
4
""" Создать строку равную введенной строку без последних двух символов """ my_string = input("Введите строку: ") string_result = my_string[:-2] print(string_result)
false
204ba1c7911c19d5eaf4e5c26fd77e325a36ad8e
AlexandrSech/Z49-TMS
/students/Stalybka/hw_7/task_7_1.py
1,650
4.125
4
""" 1. Написать 12 функций по переводу: 1. Дюймы в сантиметры 2. Сантиметры в дюймы 3. Мили в километры 4. Километры в мили 5. Фунты в килограммы 6. Килограммы в фунты 7. Унции в граммы 8. Граммы в унции 9. Галлон в литры 10. Литры в галлоны 11. Пинты в литры 12.Литры в пинты Примечание: функция принимает на вход число...
false
d5faeebd8b29511a9ae7cacb171e081adb03c0d2
AlexandrSech/Z49-TMS
/students/Sachuk/HomeWork - Lesson 7/task_7_1_and_7_2.py
2,538
4.125
4
# Написать 12 функций по переводу: # Дюймы в сантиметры # Сантиметры в дюймы # Мили в километры # Километры в мили # Фунты в килограммы # Килограммы в фунты # Унции в граммы # Граммы в унции # Галлон в литры # Литры в галлоны # Пинты в литры # Литры в пинты def number(): while True: x = input('Please, ent...
false
3ea416e93667a35f1ee7117ba4db9dbc257a1456
quenrythane/DataCampExercises
/2 Data Types for Data Science in Python/3 Sets for unordered and unique data.py
2,177
4.15625
4
# Sets are created from a list list_1 = ['a', 'b', 'c', 'd', 'e'] list_2 = ['d', 'e', 'f', 'g', 'h'] # creating sets set_1 = set(list_1) set_2 = set(list_2) # compare list and sets print("list_1: -> ", list_1) print('set_1: -> ', set_1) print("list_2: -> ", list_2) print('set_2: -> ', set_2, '\n') # .union...
false
2a76c4744485d2c22d0f63dbfc8ea3dc4e584e97
ClaireDrummond/52167-Assessments
/Factorial.py
1,230
4.5
4
# Claire Drummond 2018-03-20 # Factorial Numbers Exercise 6 def factorial(n): #return the factorial of n num = 1 # Setting the variable num as 1 while n >= 1: #while n is less than or equal to 1 num = num * n # mulitply num x n n = n - 1 # setting the new variable as n - 1 return num print(...
false
a61e1f86a84ad1e6cbcea3290f29bea3d5838683
jamesli1111/ICS3U---PYTHON
/pythonquestions-fullprograms/question_1.py
262
4.375
4
''' prompts user for 2 integers, divide them, and state remainder ''' integer1 = int(input("Integer 1: ")) integer2 = int(input("Integer 2: ")) print(f"The quotient of {integer1} and {integer2} is {integer1//integer2} with a remainder of {integer1%integer2}")
true
b5ee90f664b959be85129db381087cf7950bb868
sonalalamkane/Python
/Q6.py
818
4.25
4
# Question 6: # Write a program that accepts a sentence and calculate the number of upper case letters and lower case letters. # Suppose the following input is supplied to the program: # Hello world! # Then, the output should be: # UPPER CASE 1 # LOWER CASE 9 # Hints: # In case of input data being supplied to the quest...
true
db501086065365425c81252a0954f70f524604c8
CodingGimp/learning-python
/fizz_buzz.py
409
4.15625
4
name = str(input('Please enter your name: ')) number = int(input('Please enter a number: ')) word = '' if number % 3 == 0 and number % 5 == 0: word = 'FizzBuzz' elif number % 3 == 0: word = 'Fizz' elif number % 5 == 0: word = 'Buzz' else: word = 'is neither a fizzy or a buzzy ' print('Wassup ' + ...
false
453d3fd5e296d4e654831da9d19808ef3644e49d
CodingGimp/learning-python
/RegEx/sets_email.py
262
4.28125
4
''' Create a function named find_emails that takes a string. Return a list of all of the email addresses in the string. ''' import re def find_emails(s): return re.findall(r'[-\w\d+.]+@[-\w\d.]+', s) print(find_emails("kenneth.love@teamtreehouse.com, @support, ryan@teamtreehouse.com, test+case@example.co.uk"))
true
3da13a6d7df49ccc0dd1fa2499a5c86c1ebf9383
josbp0107/data-structures-python
/arrays.py
1,487
4.34375
4
from random import randint import random """ Code used for Create an array in python Methods: 1. Length 2. List representation 3. Membership 4. Index 5. Remplacement """ class Array: """Represent an Array""" def __init__(self, capacity, fill_value=None): """ Args: ...
true
6e65533248035d6bc795c08999bf995d0a66036d
gilgamesh7/learn-python
/conditionals/tstCond.py
436
4.15625
4
def tstIf(num1,num2): if (num1 < num2): retVal="{0} is less than {1}".format(num1, num2) elif (num1 > num2): retVal="{0} is less than {1}".format(num2,num1) else: retVal="{0} and {1} are equal".format(num1,num2) return retVal if __name__ == '__main__': num1=i...
true
34fadd2875a55ebb8120f48354b99d3b14262599
Bobby-Wan/Daily-Coding-Problems
/problem27.py
900
4.34375
4
# This problem was asked by Facebook. # Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed). # For example, given the string "([])[]({})", you should return true. # Given the string "([)]" or "((()", you should return false. def are_symmetrical(l...
true
2a7ea48223400152b52a3846123a8e0d33ad0373
Bobby-Wan/Daily-Coding-Problems
/problem7.py
816
4.125
4
# This problem was asked by Facebook. # Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. # For example, the message '111' would give 3, since it could be decoded as 'aaa', 'ka', and 'ak'. # You can assume that the messages are decodable. For example, '001' ...
true
23dc26b31f41fe446d251f868c6c9d8023ffd043
Bobby-Wan/Daily-Coding-Problems
/problem29.py
1,233
4.375
4
# 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 encoded # as "4A3B2C1D2A". # Implement run-length encoding ...
true
0f9bd2ac1e4f40d6a9214eca321e8fbadcffb5b4
qwang1/my-practice
/trim.py
355
4.15625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 利用切片操作,实现一个trim()函数,去除字符串首尾的空格 def trim(s): while s[0:1] == ' ': s = s[1:] while s[-1:0] == ' ': s = s[0:-1] return s # test print(trim('ABC')) print(trim(' ABC')) print(trim(' ABC ')) print(trim('ABC ')) print(trim(' ABC '))
false
c1572b2f22444c58025bed5aadc12f1dcc5478cc
danielcinome/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/0-add_integer.py
543
4.34375
4
#!/usr/bin/python3 """function that adds 2 integers. Returns an integer: the addition of a and b a and b must be integers or floats, otherwise raise a TypeError exception with the message a must be an integer or b must be an integer """ def add_integer(a, b=98): """ a and b must be integers or flo...
true
c7ccc320d1ef482d187b0c21fbb2803d6e508835
ECE4574-5574/Decision_System
/phase_1/cache.py
1,184
4.25
4
""" Authored by Sumit Kumar on 3/22/2015 Description : Decorator class - Caches output/return values of a function for a particular set of arguments, by writing/reading a dictionary in the JSON format from a cache file. Usage : To use the caching capabilities, have the decorator coupled with the calling function ...
true
5981f5d47820ce2cdf0ebfdf0a979d5a76bceb90
Keitling/algorithms
/python/Math/newtons_sqrt_recursive.py
1,318
4.375
4
""" To compute sqrt(x): 1) Start with an initial estimate y (let's pick y = 1). 2) Repeatedly improve the estimate by taking the mean of y and x/y. Example: Estimation Quotient Mean 1 2 / 1 = 2 1.5 ((2 + 1) / 2) 1.5 2 / 1.5 = 1.333 1.4167 ((1.333 + 1.5) / 2) 1.4167 ...
true
9f688ff6f0859d6c004c467cb76a8c6e5eb6d4a5
Keitling/algorithms
/python/Sorting/insertion_sort.py
1,408
4.28125
4
def insertion_sort(alist): return_list = alist for index in range(1, len(return_list)): value = return_list[index] i = index - 1 while i >= 0: if value < return_list[i]: # Swap: return_list[i + 1] = return_list[i] return_list[i]...
true
7ef864e9be1a823d3cfd0ff3fb192f67772f319f
Keitling/algorithms
/python/Recursion/recursion_vs_iteration.py
1,967
4.1875
4
# ---------------------------------------------------------------- # Measurement of running time difference between recursion # and iteration in Python. # # To use this code from the command line: # python recursion_vs_iteration.py number_of_tests test_depth # For example, to make 100 tests with 200 recursion and # it...
true
7f5e24b711062965396d53c1c8b4345c2b6e2f69
JoshMcKinstry/Dork_Game_team_octosquad
/dork/character.py
1,614
4.125
4
''' A character module that creates an abstract representation of a character ''' class Character(): ''' A class that models an character object ''' def __init__(self, name, position, inventory): self.name = name self.position = position self.inventory = inventory def has_...
true
6d462c11f9045377e64fc354d182761a64e1248b
nickbrenn/Intro-Python
/src/dicts.py
755
4.28125
4
# Make an array of dictionaries. Each dictionary should have keys: # # lat: the latitude # lon: the longitude # name: the waypoint name # # Make up three entries of various values. waypoints = [ { "lat": 43, "lon": -121, "name": "a place" }, { "lat": 41, "lon": -123...
true
5854e4129437c03fbfa9b9f4d39deacbb82f623b
XiangyuDing/Beginning-Python
/Beginning/python3_cookbook/ch02/13-adjust_text.py
584
4.34375
4
# 2.13 字符串对齐 text = 'Hello World' left = text.ljust(20) right = text.rjust(20) center = text.center(20) print(left) print(right) print(center) right = text.rjust(20,'=') print(right) center = text.center(20,'*') print(center) print(format(text,'>20')) print(format(text,'<20')) print(format(text,'^20')) print(format(t...
false
9241a3a056057f197e74376ce9b6dc10562704e3
MarcusQuigley/MIT_Python
/IronPythonApplication1/Lecture7/PathCompleteTest.py
603
4.1875
4
def maxOfThree(a,b,c) : """ a, b, and c are numbers returns: the maximum of a, b, and c """ if a > b: bigger = a else: bigger = b if c > bigger: bigger = c return bigger #print(maxOfThree(2, -10, 100)) #Commented section is the answer #print'------...
false
f3d3ad6bf1b48814dd6a613d93b71e164b0e1b60
theresaoh/initials
/initials.py
409
4.15625
4
def get_initials(fullname): """ Given a person's name, returns the person's initials (uppercase) """ initials = "" names = fullname.split() for name in names: initials += name[0] return initials.upper() def main(): user_input = input("What is your full name? ") print("The initials ...
true
9ad9da51c85299d9790c80d1c7301ba20de83eec
jereamon/non-descending-sort
/non_descending_sort.py
1,685
4.375
4
def non_descend_sort(input_array): """ sorts array into non-descending order and counts the number of swaps it took to do so. """ swap_count = 0 while True: # We'll need a copy of our array to loop over so we're not modifying # the same array we're looping over. input_ar...
true
1c1efd615542f80f351978faf21cfd762832374c
GuilhermeUtech/udemy-python
/S12/map.py
494
4.15625
4
#lambda def fahrenheit(T): return (9/5)*T + 32 temp = [9,22,40,90,120] for t in temp: print(fahrenheit(t)) #map() -> cara isso é show de bola: redução de tamanho de código = aplica uma função sobre algum iterável #Essa função, em Python, serve para aplicarmos uma função a cada elemento de uma lista, retornando...
false
aea6710202bb1c7eb72d48776f310f9699fa8901
GuilhermeUtech/udemy-python
/S8/metodos_especiais.py
473
4.125
4
#Aula sobre métodos especiais class Book(object): def __init__(self, titulo, autor, paginas): print("livro criado") self.titulo = titulo self.autor = autor self.paginas = paginas def __str__(self): return "Título: {a}".format(a = self.titulo) def __len__(self): ...
false
f8b92e0d180a0d0c39b292293c3d54139b61d532
Arina-prog/Python_homeworks
/homework 6/task_6_1.py
680
4.3125
4
#Create constant collection of numbers, print first size of the collection and elements on even positions # Создавайте постоянный набор чисел, печатайте первый размер коллекции и элементы на четных позициях #####tuple##### numbers = (15, 24, 36, -56, 89, 24, -13, 88,) print(len(numbers)) even_pos_num = numbers[::2] pr...
false
b7cf3c1ab939e0a1d9bcdae9ceda7e468436e7d0
Arina-prog/Python_homeworks
/homeworks 5/task_5_15.py
585
4.125
4
# Define a collection of pets, that stores types of pet and its name, # find how many pets have name Johny and print the number #Определите коллекцию домашних животных, в которой хранятся типы питомца и его имя, # найдите, сколько домашних животных имеют имя Джонни, и распечатайте номер pets = {"pig": "Johny", "cat": ...
false
ceb5e1e308b6b8ecb19d05043efc6a5b594a1af4
Arina-prog/Python_homeworks
/homeworks 5/task_5_16.py
794
4.1875
4
# Create a collection for storing hotel visitors (name, country), input several visitors from console, # print how many visitors are now in hotel, what is their country, what is their name # Создайте коллекцию для хранения посетителей отеля (название, страна), введите несколько посетителей с консоли, # распечатайте, ск...
false
093720f7c20640d74d7575e31ed14b203c40ba77
Arina-prog/Python_homeworks
/homework 6/task_6_2.py
582
4.21875
4
# Create a collection for storing unique book names, add some of them from console and print results # Создайте коллекцию для хранения уникальных названий книг, # добавьте некоторые из них из консоли и распечатайте результаты #####set#### book = {"Margo taguhin", "Musa leran 40 or@", "Vardananq"} count = int(input("i...
false
61f08f63460e8e550907de25069430fabfb4f5c0
Arina-prog/Python_homeworks
/homework 7/task_7_6.py
1,844
4.5
4
# Create a calculator with different functions: 1) input numbers (one or more); # 2) calculate different power for inputed numbers; # 3) calculate how many numbers are greater than some specific number; # 4) calculate how many numbers are even; 5) get number which power 3 is greater than 100 # Создайте калькулятор с ра...
false
9ce8dd9b48fbc9282af6eb4943d8570a98ddd5e4
Arina-prog/Python_homeworks
/homeworks 5/task_5.2.py
254
4.5
4
# Input a string and get substring from start to some position # 2... Введите строку и получите подстроку от начала до некоторой позиции str1 = "tt magistr 1 curs" print(str1[:9]) print(str1[0:9])
false
a27516780c8286565c152f79c268337a74b07393
Arina-prog/Python_homeworks
/homeworks 5/task_5.1.py
320
4.25
4
# Input one string, define another one, concatenate them and print the result # 1,,* Введите одну строку, определите другую, объедините их и распечатайте результат str1 = "hellow" str2 = input("input string:\n") result = str1 + " " + str2 print(result)
false
38251a25f706269fea9f094a6354c755cd5ca692
samuduesp/learn-python
/namecondition.py
243
4.125
4
name = input("What is your name: ") if len(name) >= 6: print("your name is long") elif len(name) >= 5: print("your name is not long") elif len(name) >= 4: print ("your name is short") else: print("your name is very short")
false
9e53024d91ab04a183c86568702f998adb035d3b
samuduesp/learn-python
/work/work.py
677
4.125
4
new = {} numbers = int(input("how many numbers: ")) for i in range(numbers): name =input("enter name of the person? ") age =input("enter age of the person?") bday =input("enter your bday?: ") key = input("name") value = input("enter value") theme =input("enter year") f...
true
0c286bd36a24a29c6c2bc152aac5e53c9b9d4d87
martinstangl/iWeek_IntroducingPython
/x01_first_steps/00a_hello_world_basic_data_types.py
1,742
4.34375
4
from datetime import datetime print("Hello world!") # ein Kommentar a = 5 # eine variable print(a) print(type(a)) # Typ wird zur Laufzeit ermittelt a = "5" print(a) print(type(a)) # Typ wird zur Laufzeit ermittelt a = True print(a) print(type(a)) # Typ wird zur laufzei...
false
30bb1d3499fbb0a84409ae8b1abe12755dd69117
rupol/Computer-Architecture-Lecture
/02_bitwise/bit_masking.py
789
4.125
4
instruction = 0b10100010 # shifting by 6 should leave us with first two values shifted = instruction >> 6 # print(bin(shifted)) # 0b10 # what if we wanted to extract the two numbers in the middle? # first, convert so the bits in the middle are the last two digits shifted = instruction >> 3 # print(bin(shifted)) # 0...
true
c4cb355044d3e5c03ad2038193af42832b91ffbc
samratkaley/Developer
/Python/07_List.py
972
4.28125
4
# list Declaration:- list1 = ["Samrat","Omkar",50,315,500]; print (list1); list2 = [1,2,3,4,5,10]; list3 = [9,8,6] list4 = list1 + list2; # Concatenate two list print (list4); print (list1[2:4]); # print Range list print (list1[2:3]+list2[4:5]); #Concatinating two number from range print (list1[2]+...
true
9924ed16860c153be1779753b7e31d51cf1b229f
ethan-mace/Coding-Dojo
/Python v4/Python Fundamentals v4/Python Fundamentals/Functions Basic 1/functions_basic1.py
1,932
4.25
4
# #1 Prints 5 # def a(): # return 5 # print(a()) # #2 Prints 5 + 5 # def a(): # return 5 # print(a()+a()) # #3 Prints 5. 'return' ends the functions prior to the next line # def a(): # return 5 # return 10 # print(a()) # #4 Same as #3 # def a(): # return 5 # print(10) # print(a()) # #5 Prin...
true
668c178f0cbe2ee64a0041d5ed97c2ab271614c5
yuryanliang/Python-Leetcoode
/Daily_Problem/20191004 Count Number of Unival Subtrees.py
911
4.21875
4
"""Hi, here's your problem today. This problem was recently asked by Microsoft: A unival tree is a tree where all the nodes have the same value. Given a binary tree, return the number of unival subtrees in the tree. For example, the following tree should return 5: 0 / \ 1 0 / \ 1 0 / \ 1 1 The...
true
145d92f103d9191f48c5646c0ea84b7c098d6eca
yuryanliang/Python-Leetcoode
/recursion/101 symmetric tree.py
1,605
4.375
4
""" Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the following [1,2,2,null,3,null,3] is not: 1 / \ 2 2 \ \ 3 3 """ # Definition for a bin...
true