blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
d84f54932db5b2e1da02567f9eccf3db50b2b72b
puhaoran12/python_note
/61.字符串的查询操作.py
746
4.53125
5
#字符串是不可变序列 # 查询方法: s='hello,hello' # 1.index() 查找字符串substr第一次出现的位置,如果查找的子串不存在时,则抛出ValueError print(s.index('lo')) #print(s.index('k'))#ValueError: substring not found # 2.rindex() 查找字符串substr最后一次出现的位置,如果查找的子串不存在时,则抛出ValueError print(s.rindex('lo')) #print(s.rindex('k'))#ValueError: substring not found # 3.find() 查找字符串s...
false
b565872eea2c84d9c7ebf162f5c2c8cb470d3e6d
puhaoran12/python_note
/65.字符串判断的相关方法.py
642
4.40625
4
# 判断字符串操作 s='hello,python' # 1.isidentifier() 判断指定的字符串是不是合法的标识符 print('1',s.isidentifier()) # 2.isspace() 判断指定的字符串是否全部由空白字符组成(回车,换行,水平制表符) print('2',s.isspace()) # 3.isalpha() 判断指定的字符串是否全部由字母组成 print('3','sfef'.isalpha()) # 4.判断指定的字符串是否全部由十进制的数字组成 print('4','13235'.isdecimal()) # 5.判断指定的字符串是否全部由数字组成 print('5','34'.isnu...
false
43a5434f3ebce881b0baf474822522f08af9e18b
leomessiah10/Operations
/fibonacci_series.py
657
4.125
4
print('In this program we will play with fibonacci sequence') first_num = 1 sec_num = 1 fibo_list = [1,1] count = 0 while(count == 0): num = eval(input('Upto which number you want the sequence\n:-')) for i in range(num-2): temp = sec_num + first_num first_num = sec_num sec_num = temp ...
true
a88857c51d81f2bd872b60c9c42d6219b701e936
gvillena76/Tic-Tac-Toe-Game
/GUI.py
1,573
4.25
4
# import the tkinter module import tkinter def main(): # create the GUI application main window root = tkinter.Tk() # customize our GUI application main window root.title('CS 21 A') # instantiate a Label widget with root as the parent widget # use the text option to specify which t...
true
3ce98143dd5154e2dfe8ccf33ebd0fc502849ee5
antongulyakov/.py
/task2.py
577
4.34375
4
#!/usr/bin/env python # python3 import check def is_year_leap(year): "Chek the leap year" if -45 <= year < -8: if year % 3 == 0: return True elif -8 <= year < 1582: if (year % 4 == 0) and (year is not 0): return True elif year >= 1582: if (year % 4 == ...
false
87883b97eb61df26cc428afb1b4c6cb4f8457c3f
oraocp/pystu
/primitive/base/lambda_expr.py
726
4.125
4
""" 文档目的:演示Python中lambda表达式的概念和用法 创建日期:2017/11/14 演示内容包括: 1. lambda表达式的概念 lambda只是一个表达式,函数体比def简单很多。 lambda表达式是起到一个函数速写的作用。允许在代码内嵌入一个函数的定义。 lambda的主体是一个表达式,而不是一个代码块。仅仅能在lambda表达式中封装有限的逻辑进去。 2.lambda表达式的用法 """ from functools import reduce def factorial(n): ''' 求数n的阶乘 :param n: 数n :return: 数n的阶乘 ...
false
b50c1702b58fe728e04f26409a0d44dbb0a0287c
lunAr-creator/learning_python
/while_loops.py
1,427
4.375
4
''' Loops are used repeat a certain action multiple times. Python gives us two options for this: while and for ''' #This loop will print the numbers 1-5 because every time the loop is run (until count = 5) 1 is added to count count = 1 while count <= 5: print(count) count += 1 #Cancelling a loop using break while...
true
22679ff1d5e51d6f15bb9302712c0c6b914636b1
amssdias/python-books_db
/csv/app.py
1,408
4.28125
4
from utils import database USER_cHOICE = """ Enter: - 'a' to add a new book - 'l' to list all books - 'r' to mark a book as read - 'd' to delete a book - 'q' to quit Your choice:""" def menu(): database.create_book_table() menu = { 'a': prompt_add_book, 'l': list_books, 'r': prompt_r...
true
1d9b536b3134f72446d97acc5c1fa40ef07da0a2
FlorianWi89/A-problem-a-day
/Parking_System.py
1,117
4.375
4
# Design a parking system for a parking lot. The parking lot has three kinds of # parking spaces: big, medium, and small, with a fixed number of slots for each size. # # Implement the ParkingSystem class: # ParkingSystem(int big, int medium, int small) Initializes object of the ParkingSystem class. # The number of slo...
true
41a14ab4052b768976c05db596a32c9b22f02ff8
varvara-spb99/DevOps
/hw2v.py
1,200
4.15625
4
"""Встроенная функция input позволяет ожидать и возвращать данные из стандартного ввода в виде строк (весь введенный пользователем текст до нажатия им enter). Используя данную функцию, напишите программу, которая: 1. После запуска предлагает пользователю ввести текст, содержащий любые слова, слоги, числа или их комбин...
false
185abf614bf1127fc988f9d0175cb82095735c64
OLABOSS123/Hello-World
/List.py
669
4.1875
4
# name = ["Olamide","Olu", "John", "Bola"] # age = ["4", "5", "7", "8"] # # print(age.pop(3)) # # print(age) # # print(age[2]) # # print(age[0:3]) # print(name[0:3]) # lst = [1,2,3,4,5] # lst2= ["Jane","Kemi","Obi","Musa"] # lst3 = [1, "john", 2, "ada"] # print(len(lst)) # print(len(lst2)) # print(lst[1::2]) #This pri...
false
bfec17ebabe824f54629f37961125a9033f5425b
Simranbassi/python_grapees
/ex4a.py
214
4.21875
4
year=int(input("enter the year ")) if year%4==0: print("the year you enter is a leap year") elif year%400==0: print("the year you enter is a leap year") else: print("the year you enter is not a leap year")
false
f615fb290428d9575c761455dbdf98ba9a98c89a
Simranbassi/python_grapees
/ex3i.py
309
4.125
4
ram=int(input("enter the age of ram : ")) shyam=int(input("enter the age of shyam : ")) ajay=int(input("enter the age of ahay : ")) if ram<shyam and ram<ajay : print("Ram is youngest ") if shyam<ram and shyam<ajay : print("shyam is youngest ") if ajay<ram and ajay<shyam : print("ajay is youngest")
false
e262eee555c5f359df24f443b21d660799969cfa
Simranbassi/python_grapees
/ex2f.py
340
4.125
4
kilometer=int(input("enter the distance (in kilometer) between two cities")) meter=1000*kilometer print("the distance in meter is",meter) feet=kilometer*3280.8 print("the distance in feet is",feet) inch=kilometer*39370.078 print("the distance in feet is",inch) centimeter=kilometer*100000 print("the distance in ...
true
b8b0a1f73d8f245317e7235cd061ce7dc39bcacb
bopopescu/python-practice
/pycharm/telusko/generator.py
270
4.34375
4
#----- Generator is used to create iterators instead of using __iter__ and __next__ functions def square(): n = 1 while n <= 10: sq = n*n yield sq n+=1 sqvalues = square() print(sqvalues.__next__()) for i in sqvalues: print(i)
true
3896844aa193a1cd92560202a592fbcffde8a491
bopopescu/python-practice
/pycharm/telusko/fibonacci.py
441
4.1875
4
fn = int(input("Please enter length of fibonacci series : ")) #------- Fibonacci series -1 def fibonacci(n): if n <= 0: print("Number is negative number") elif n == 1: a=0 print(a) else: a=0 b=1 print(a) print(b) for i in range(2,fn): ...
false
17a886fd906d09f08e10d59579334896757d4063
bopopescu/python-practice
/functions.py
1,665
4.1875
4
#-- Required arguments def printme(str): "This functions expects the required number of arguments to be passed" print(str) return; printme("Purushotham") #-- keyword arguments def keywordarguments(name,age): "This function expects the keyword arguments to be passed" print("My name is" + name + " ...
true
6666d89a9c98a30a2bc454f62c9c4ab22007edfa
bopopescu/python-practice
/lists.py
2,170
4.65625
5
#-- creating a list mylist = [] print("printing the empty list") print(mylist) #-- adding element to the list mylist=['purushotham'] print("adding element to the list") print(mylist) #-- Adding multiple elements to the list mylist=['hello','purushotham','reddy'] print('adding multiple elements to the list') print(...
true
1027ce9e3efc931b56863be135062b8c450804ee
Avlbelikov/python-homeworks
/homework_1_5.py
775
4.125
4
income = int(input('Укажите доход компании: ')) spending = int(input('Укажите расходы компании: ')) if income > spending: print('Доходы превышают расходы: Ваша компания приносит прибыль!') print('Ваша прибыль: ', income - spending , 'Рублей') workers = int(input('Укажите количество сотрудников вашей компани...
false
9cfd82a7813c3d1042be99a1eea0155439d7fb03
CristinaPineda/Python-HSMuCode
/Exemplo_recursao/funcao_recursao.py
1,783
4.53125
5
""" Em programação, a recursão envolve problemas em que uma função chama a si mesma. Toda função recursiva possui uma condição base para que ela seja finalizada. O que é recursão? Recursão é um método de resolução de problemas que envolve quebrar um problema em subproblemas menores e menores até chegar a um problema ...
false
e373cc2c3e63856ecd859da7629f9ec0f4d75d77
CristinaPineda/Python-HSMuCode
/Exemplos_strings/media_semestre.py
694
4.375
4
""" No terceiro exemplo, será calculada a média semestral de um aluno. O semestre é composto por três notas, cada uma com os pesos 2, 4 e 6, respectivamente. Como primeiro passo, o programa deve solicitar a entrada das três notas. Em seguida, precisa calcular a média ponderada por causa dos pesos na composição das no...
false
169c04e53dafc83ebc3e03841ccec520321ab17a
xerifeazeitona/PCC_Alien_Invasion
/exercises/12_04_rocket/super_rocket.py
2,904
4.25
4
""" 12-4. Rocket: Make a game that begins with a rocket in the center of the screen. Allow the player to move the rocket up, down, left, or right using the four arrow keys. Make sure the rocket never moves beyond any edge of the screen. """ import sys import pygame from settings import Settings from rocket import Roc...
true
b2be5653b22bacfd4355128b90e3ca9efb9e15b2
iamanobject/Lv-568.2.PythonCore
/HW_5/OliaPanasiuk/Home_Work5_Task_1.py
407
4.25
4
#a = range(11) #for x in a: #if x % 2 == 0: # print(x) #continue #print("This numbers are divisible by 2") #a = range(11) #for x in a: #if x % 3 == 0: # print(x) #continue #print("This numbers are divisible by 3") a = range(11) for x in a: if x % 2 != 0 and x % 3 != 0: ...
false
d328ed927f8ee05cc60eab542643e77fd3621419
iamanobject/Lv-568.2.PythonCore
/HW_5/serhiiburnashov/convert-boolean-values-to-strings-yes-or-no.py
275
4.21875
4
def bool_to_word(boolean): """ Method that takes a boolean value and return a "Yes" string for true, or a "No" string for false. """ message = "Yes" if boolean else "No" return message #Yes print(bool_to_word(True)) #No print(bool_to_word(False))
true
da99ef0ac07b7619c844d5c773d0b2b867bd6182
iamanobject/Lv-568.2.PythonCore
/HW_6/ruslanliska/Home_Work6_Task_1.py
558
4.25
4
def largest_number(a, b): """The function returns bigger numbers Input is 2 digits Output is bigger number """ # a = input("Please enter first number: ") # b = input("Please enter second number: ") if a>b: return ("First number {} is bigger than second number {}".format(a, b)) el...
true
dade4188c910ed8807267fb86e0d73723c13c9a1
iamanobject/Lv-568.2.PythonCore
/HW_3/serhiiburnashov/Home_Work3_Task_3.py
391
4.125
4
first_variable = input("Enter first variable: ") second_variable = input("Enter second variable: ") print( "Before:" ) print( "First variable:", first_variable, "Second variable:", second_variable ) first_variable, second_variable = second_variable, first_variable print( "After:" ) print( "First vari...
true
ce1ff5ae00abba12c3d9375fe612cda63b6a7727
iamanobject/Lv-568.2.PythonCore
/HW_6/ruslanliska/Home_Work6_Task_3.py
330
4.40625
4
def count_symbols (word): """This function calculates all symbols in string""" letter_dict = {} for letter in word: if letter not in letter_dict: letter_dict[letter] = 1 else: letter_dict[letter] = letter_dict[letter]+1 return letter_dict print(count_symbols(input("Please, enter your st...
true
d4f4a0bc5af0d6298952b9f1a2a6a7d98dab6607
iamanobject/Lv-568.2.PythonCore
/HW_9/Taras_Smaliukh/HW9_task2.py
368
4.15625
4
def dayName(day_num): days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] return days[day_num-1] if 0 < day_num <= len(days) else None try: day_num = int(input('Enter the number of the day in the week : ')) if day_num == int(day_num): print(dayName(day_num)) except ValueErr...
true
a88171d80c41aaf2ff8a57f17c1328a8bb175bbc
iamanobject/Lv-568.2.PythonCore
/HW_8/serhiiburnashov/grasshopper-summation.py
300
4.21875
4
def summation(num): """ Function that finds the summation of every number from 1 to num. """ result = sum(list(range(num + 1))) return result # 1 print(summation(1)) # 36 print(summation(8)) # 253 print(summation(22)) # 5050 print(summation(100)) # 22791 print(summation(213))
true
393d64a2b8d98827137d8d22987c360418940da1
iamanobject/Lv-568.2.PythonCore
/HW_7/ruslanliska/Home_Work7_Task_2.py
1,317
4.28125
4
import re def password_check(): """This function validates password cheks if there is at least 1 capital letter if there us more than 6 or less than 16 characters, if there at least 1 lowercase letter, if there at least 1 specific character and 1 digit """ password = input("Please enter you...
true
1b9d5dbddc0dfdb51ba5828c0b54bb49227ae886
iamanobject/Lv-568.2.PythonCore
/HW_5/ruslanliska/Kata_1.py
367
4.1875
4
distance_to_pump = int(input("What is the distance to pump? ")) mpg = int(input("How many miles your car takes per gallon? ")) fuel_left = int(input("How many fuel left in your car?'")) def zero_fuel(distance_to_pump, mpg, fuel_left): if fuel_left >= distance_to_pump / mpg: return True return False pri...
true
8e263e425e01c92e470ac17ea59413f66368decc
snowtiger42/Shapes-01
/rectangle.py
1,227
4.15625
4
from shape import Shape class Rectangle(Shape): def __init__(self, name, width, height): self.__name = name self.__width = width self.__height = height # def set_name(self, name): # self.__name = name def get_name(self): if self.__name is not "Recta...
false
50ba71168512a6c00adbe4cb45b92071aad8edf8
cdvillegas/datastructures
/datastructures/hash_table.py
1,323
4.21875
4
class HashTable: """ A HashTable is a data structure that provides a mapping between keys and values using a hashing function. It allows efficient retrieval, insertion, and deletion of elements. The keys are hashed into indices of an array, and values are stored at those indices. In case of hash collisions,...
true
3fc439fa20e1220659f7f5060341f242e3e25879
amiraHag/python-basic-course2
/set/set4.py
979
4.40625
4
# ------------------------------- # --------- Set Methods --------- # ------------------------------- # issuperset() return true if the set contains all elements in the second set set1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } set2 = { 1, 2, 3, 4 } set3 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } set4 = { "A", "B", "C" } print(set...
true
8c7985276536f988e7a4f8752f9ebc06802b363c
amiraHag/python-basic-course2
/function/function2.py
1,135
4.4375
4
# --------------------------------------- # -- Function Parameters And Arguments -- # --------------------------------------- a, b, c = "One", "Two", "Three" print(f"Number {a}") print(f"Number {b}") print(f"Number {c}") print("*"*40) # def => Function Keyword [Define] # say_hello() ...
false
ca1a99a20be44463289093dd275f453413a6177b
amiraHag/python-basic-course2
/function/function8.py
479
4.25
4
# ------------------------ # -- Function Recursion -- # ------------------------ # --------------------------------------------------------------------- # -- To Understand Recursion, You Need to First Understand Recursion -- # --------------------------------------------------------------------- def cleanWord(word): ...
false
a158334fdb3a8b335d0562453ee976d13512057b
Sanjay567-coder/NumberGuessingGame
/Number Guessing Game.py
1,098
4.28125
4
print("Number Guessing Game") #importing randit from random from random import randint guessesTaken = 0 print("What's your Name?") myName=input() #Telling the computer to pick a number between 1 and 15 number=randint(1,15) print("Hello!,", myName,",I am thinking a number between 1 and 15") print("You have on...
true
31259ca678b11249f5aa50a17427ed26e49ba71a
TechNestOwl/DigitalCrafts-COR
/Python/thursdayPython.py
321
4.25
4
# lists # --- How to create groceries = ["milk","eggs","bread","salmon"] print (groceries[-2]) print (groceries[-3]) # Adding to a list groceries.append("bacon") print(groceries) # How to remove items popped_item = groceries.pop(3) print(groceries) print(popped_item) # Remvoe bread del groceries[2] print(groceries)...
true
983e609a02c1e0095eb1fdfc1ef63484bfaba889
hugo-wsu/python-hafb
/Day1/gen.py
1,672
4.1875
4
#!/usr/bin/env python3 """ Author : hvalle <me@wsu.com> Date : 8/9/2021 Purpose: """ def take(count, iterable): """ Take items for the front of the iterable :param count: The maximum number or items to retrieve :param iterable: The source series :yield: At most 'count' items for 'iterable ""...
true
b3bc30b824184a28aaff4b8d48776d74f6fe3d2a
thalytacf/PythonClass
/pre_codility/atv2.py
1,822
4.28125
4
# CyclicRotation # # Uma matriz A consistindo de N inteiros é fornecida. # A rotação da lista significa que cada elemento é deslocado para a direita por um índice, # e o último elemento da lista é movido para o primeiro lugar. # Por exemplo, a rotação da lista A = [3, 8, 9, 7, 6] é [6, 3, 8, 9, 7] # (os elementos são d...
false
0bd33d1a36f0cba21689f4b2a1314219e2152827
umutcaltinsoy/Objected-Oriented-Programming
/oop_005.py
1,632
4.59375
5
#Special (Magic/Dunder[Double Underscores]) Methods: #These special methods allow us to emulate some built-in behavior within Python #And it's also how we implement operator overloading #These special methods are always surrounded by double underscores(dunder) #So a lot of people call the double underscores dunder # ...
true
1a716957853b41768565e2b262bc9e638e3fa55c
BhargavReddy461/Coding
/Binary Tree/Flip_BinaryTree_clockwise.py
1,463
4.4375
4
# Python3 program to flip # a binary tree # A binary tree node class Node: # Constructor to create # a new node def __init__(self, data): self.data = data self.right = None self.left = None def flipBinaryTree(root): # Base Cases if root is None: ...
true
f657636d845dea0e6870ab0fb92c26e63ddd2f96
BhargavReddy461/Coding
/LinkedList/insert_in_a_sorted_SLL.py
1,116
4.125
4
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def push(self, new_data): new_node = Node(new_data) new_node.next = self.head self.head = new_node def t...
true
4ed287357b0c476a892091e0ac62a12e8f58ed0b
Pavana16/scripting-language
/prg2.py
568
4.46875
4
#demo classes in python #concept:use of delete attribute of obj and obj itself class Person: def __init__(self,name,age): #constructor of the class Person self.name=name; self.age=age; p1 = Person('supandi',14) print("\n the name of person1 is:",p1.name) print("\n the age of person1 is:",p1.age) print("\n **...
true
806f186357f7f6e9be6e07a8a7d67d11f126c8d9
data-modeler/prod-ready-ml
/src/models/train_model.py
581
4.125
4
''' Train Model ----------- Runs the training for the model. ''' def sample(x: int=1, letters: str='ABC') -> bool: '''Is a sample function. Note: This is an example of complete documentation. Args: x: The first value to pass in. letters: The second argument. Retur...
true
61980a8f48ea05db7f7e59d0f2d79db1bf3c61b2
sharamamule/Py_Learn
/Py_Udemy1/Numbers.py
831
4.125
4
int_num = 1000 # this is the way we define the number in python float_num = 20.5 print(int_num) print(float_num) print ('*******') a=10 b=50 add = a+b print(add) sub =b-a print(sub) multi = a*b print(multi) div = a/b print(div) exponents = 10 ** 20 # 10 to the power of 20 (10*10...20 time...
true
fcd418d51797e43cff669f3955752ac909c26ac3
sharamamule/Py_Learn
/Py_Udemy1/Postional-Optional Parameters.py
527
4.1875
4
""" Postiional Parameters They are like optional paramters And can be assigned a default value, if no value is provided from outside """ def sum_nums (n1=2, n2=4): # Optional Paramters # def sum_nums (n1,n2=4): we can declare this also return n1 + n2 sum1 = sum_nums(n1=5,n2=5) print(sum1) print("...
true
b6686802837e75137cdf323cc7026a399fea6e75
bharathmc92/python-coding
/conditional_changes_output.py
272
4.1875
4
num_knights = int(input("Enter the number of knights \n")) day = input("Enter the day of the week \n") if num_knights < 3 or day == "Monday": print("Retreat!") elif num_knights >=10 and day == "Wednesday": print("Trojan Rabbit!") else: print("Truce?")
false
2c37d21ac32355a8bf6ca792e3a83fd8f8157e67
bharathmc92/python-coding
/challenge_1.py
316
4.1875
4
#program to check the age of a person and allow if he is eligible for 18-30 holiday name = input("Enter your Name:") age = int(input("Enter your age: ")) if 17 < age < 31: print("Welcome to the Holiday {0}".format(name)) else: print("Sorry, you are not eligible for this holiday trip {0}".format(name))
true
532c6aa9d1d02517bf96d2e51558c220b7aa24e6
kys1234561/pycharmprojects
/Pre_course_links/day2_06_01.py
892
4.34375
4
''' num_list = [1,5,2,3,9] num_list.sort() print(num_list) num_list = [1,5,2,3,9] print(sorted(num_list)) print(num_list) num_list.reverse()#reverse本身的意思有反向,reverse表示反向排序 print(num_list) num_list = [] l1 = [1,2,3] print(num_list) num_list.append(l1) print(num_list) ''' num_list = [] l1 = [1,2,3] l2 = [4,5,6] l1.appen...
false
a4d89857aa782981d9fc2bb1e4dd738b89d51444
jraman/algos
/python/backtracking/permutations.py
822
4.125
4
''' Backtracking: Find all the permutations of the characters in a string or elements in an array. Note: * Time complexity: O(n!) * If letters are repeated in the input, the output set will have repeated strings. Ref: * http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/ '''...
true
91843d3128c930fd947ff1eda05117f518179197
ChawEiPhyu308/CP1404
/Prac_1/loops.py
329
4.15625
4
for i in range(1, 21, 2): print(i, end=' ') print() for i in range(0, 110, 10): print(i, end=' ') print() for i in range(20, 0, -1): print(i, end=' ') print() star = int(input("Enter a number :")) while i <= star: print('*', end=' ') i += 1 print('') for i in range(1, star+1): print('*'*i) ...
false
de688eb65832a432ccc8f4490c9edee48e350710
dalukyanov/PythonAlgorithms
/algorithms/integers/recursive_sum_of_digits.py
936
4.21875
4
def sum_of_digits(n): """ Функция вычисляет сумму всех разрядов в числе """ sm = 0 while n > 0: d = n % 10 n = n // 10 sm += d return sm def recursive_sum_of_digits(n): """ Функция вычисляет рекурсивно сумму всех цифр, входящих в число "n" до тех пор пока не ост...
false
20a908651e8b18c44e4a207b8599a4a62aee6a13
eiadshahtout/Python
/python3/fruit.py
370
4.15625
4
favouriteFruits = ["Bananas","Apples","Mangoes"] if "Bananas" in favouriteFruits: print("You like bananas") else: print("You don't like bananas") if "Peacjes" in favouriteFruits: print("You like peaches") else: print("You don't like peaches") if "Apples"in favouriteFruits: print("You really like ap...
false
2d4568d32b5f180dae7ac6d5928b971ffb2f5ec4
eiadshahtout/Python
/python3/album.py
798
4.34375
4
def make_album(artistName, albumTitle, numberOfSongs = None): album = { "Name": artistName, "Title" : albumTitle } if numberOfSongs: album["Number_Songs"] = numberOfSongs return album while True: print("--------------------------------------------") artist_n = input("What is the name o...
true
9d3f54aa3279a1a32f2be807b3b0e842460fce7f
Kritika05802/Functions
/Functions.py
451
4.28125
4
#!/usr/bin/env python # coding: utf-8 # In[ ]: #prints the letters in a string in decreasing order of frequency # In[4]: a=input("Please enter a string: ") def most_frequent(string): mydict=dict() for key in string: if key not in mydict: mydict[key]=1 else: mydict[...
true
35e2f1c5272886912bcc246e81a67fb08f1bf8a7
Trago18/master-python-programming-exercises
/exercises/11-Swap_digits/app.py
315
4.15625
4
#Complete the fuction to return the swapped digits of a given two-digit-interger. def swap_digits(num): first = num//10 second = num%10 return (str(second) + str(first)) #return ((second*10) + first) #Invoke the function with any two digit interger as its argument print(swap_digits(30))
true
3728125e0d0893a76937e51aa63c613a123d6c08
Talibov333/Python3-for-beginner-az
/python3/strngmetods.py
1,615
4.125
4
teststring = 'py is a wonderfull' print(len(teststring)) # len funksiyasi stringin xarekter sayini gosterir # len() funks ile hemcinin input meselelrinde ist edilir teststring = 'py is a wonderfull' print(teststring.upper()) # stringin xarexterlerini boyutmek ucun .upper() ist edlr # stringi orijinalini deyisdirmir ...
false
4c73dd2b34e4f810b6ee3250239ae0e98d3f4c49
icpc0928/MyFirstPython
/Leo/Leo012.py
349
4.25
4
# tuple 固定長度固定元素的串列 tpl = ("1", "2", "3", "4", 5) print(tpl) print(tpl[1]) a, b, c, d, e = tpl # 將tpl的所有元素一一給到每個變數內(變數數量與元素數量一樣) print(a) print(c) # tuple 因為不能修改的特性 所以不能有append/ extend的方法 # 好處是占用較少 元素不會任意更動
false
7772d90cf1bad0eba6595d44255a550f3113fba3
JerameKim/CS325HW4
/mergeSort.py
1,873
4.21875
4
def merge_sort(my_list, sort_func: lambda x, y: x < y): # 1. Exit Statement # only gets called n number of times if len(my_list) <= 1: return my_list middle_idx = len(my_list) // 2 # 2. Recurse # left = merge_sort(my_list[0:middle_idx]) # will return a sorted list from "left sid...
true
93a83fcfd32fe85193cbc98707f5d8dc66ace4d9
lastbyte/dsa-python
/problems/easy/square_root.py
967
4.1875
4
''' 69. Sqrt(x) Given a non-negative integer x, compute and return the square root of x. Since the return type is an integer, the decimal digits are truncated, and only the integer part of the result is returned. Note: You are not allowed to use any built-in exponent function or operator, such as pow(x, 0.5) or x **...
true
3d46ad9e5bf15a187f1c7fef9c3f04b550cc3c58
lastbyte/dsa-python
/problems/medium/duplicate_number.py
950
4.125
4
''' Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated number. Example 1: Input: nums = [1,3,4,2,2] Output: 2 Example 2: Input: nums = [3,1,3,4,2] Output: 3 Example 3: Input: nums = [1,1] Outpu...
true
5bc257f8a71d3b297bb6174ef5e758be4cfa25b1
SamuelKelechi/My_First_Python_Calculator
/calc.py
1,656
4.125
4
# A simple Calculator Program Designed By Samuel, A Product of BrighterDays Codelab # This function will add two numbers def add(a, b): return a + b # This function will subtract two numbers def sub(a, b): return a - b # This function will multiply two numbers def mul(a, b): return a * b #...
true
1663882dd777611609d05eaa588123d377ef7ce0
philippzhang/leetcodeLearnPython
/leetcode/lc0284/PeekingIterator.py
754
4.1875
4
class PeekingIterator(object): def __init__(self, iterator): """ Initialize your data structure here. :type iterator: Iterator """ self.iter = iterator self.val = self.iter.next() self.hasnext = True def peek(self): """ Returns the next el...
false
839bb0fdcdaebf2954f4672c0b62f54d3804ac7b
spacetime314/python3_ios
/extraPackages/matplotlib-3.0.2/examples/ticks_and_spines/major_minor_demo.py
2,677
4.3125
4
""" ================ Major Minor Demo ================ Demonstrate how to use major and minor tickers. The two relevant userland classes are Locators and Formatters. Locators determine where the ticks are and formatters control the formatting of ticks. Minor ticks are off by default (NullLocator and NullFormatter). ...
true
f7d45210da3224eabc6a14b690d8eeb7b1abd9b0
spacetime314/python3_ios
/extraPackages/matplotlib-3.0.2/examples/mplot3d/polys3d.py
1,696
4.125
4
""" ============================================= Generate polygons to fill under 3D line graph ============================================= Demonstrate how to create polygons which fill the space under a line graph. In this example polygons are semi-transparent, creating a sort of 'jagged stained glass' effect. """ ...
true
45c1fcf62ecb2e1a1c1fca798373f537ea217eea
spacetime314/python3_ios
/extraPackages/matplotlib-3.0.2/examples/pyplots/annotation_basic.py
947
4.21875
4
""" ================= Annotating a plot ================= This example shows how to annotate a plot with an arrow pointing to provided coordinates. We modify the defaults of the arrow, to "shrink" it. For a complete overview of the annotation capabilities, also see the :doc:`annotation tutorial</tutorials/text/annota...
true
7cc9f9191275137a2f96164977cf17db7eec7d0f
mmattano/example_repo
/example_repo/linreg.py
1,848
4.46875
4
"""Example module.""" __all__ = ["LinearRegression"] import numpy as np class LinearRegression: """Linear Regression. Uses matrix multiplication to fit a linear model that minimizes the mean square error of a linear equation system. Examples -------- >>> import numpy as np >>> from ex...
true
c852c9b76434a825abd0564d4238e37720ac5360
heronsilva/udacity-unscramble-cs-problems
/Task4.py
1,427
4.21875
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 4: The telephone company want to i...
true
3c4813856d32ecd0aeb72075f7cbe93624d06a3b
CheolminConanShin/PythonTakeNote
/Day1/src/Day1/PassVSContinue.py
249
4.28125
4
list = [1,2,3,4,5,6,7] for item in list: print("inside for loop : " + str(item)) if item > 3: pass print("inside if statement : " + str(item)) # pass if ȿִ ó skip, continue for skip
true
a4ee30d6f29af76459338db82a548ece62994d27
nellybella/ICodeAI
/Set_adt.py
2,683
4.5625
5
class Set: """ implementation of the set ADT using lists """ def __init__(self): """ initialize the set adt """ self.set_ = [] def add_item(self,item): """ add an element to the set Algorithmic complexity: ...
true
889c0c0a5a954098078a1353f872dfcb800d5faa
oa0311/NetworkChuck-Python-Tutorial
/main.py
556
4.28125
4
#printing single strings with several print functions. #print("Hello there!!!") #print("I am Iron Man") #print("No, I am Tony Stark") #print("No, blah blah") #Pound sign is how you comment in Python. #This comment is just to test the Version Control #printing a Multiline string with one print function. #print("""I'm...
true
e78aea815a8195d1016d64bea3bc4e6c93e279ee
mshehan/pythonPractice
/MatthewShehanLab3.py
2,637
4.25
4
#################################################################### # CIS 117 Internet Programming # Lab #3: "Super Secret Password" #################################################################### # This program checks to see if a user provided password # is super secret enough. # a password is considered super s...
true
ef1d339722bc8734a041ba7337930aeeb4756844
Richardbmk/PythonFundamentals
/sqlite/friends2_SQL.py
451
4.21875
4
# 364. Selecting With Python import sqlite3 conn = sqlite3.connect("my_friends.db") # Create cursor object c = conn.cursor() #c.execute("SELECT * FROM friends") #c.execute("SELECT * FROM friends WHERE first_name IS 'Steve'") c.execute("SELECT * FROM friends WHERE closeness > 5 ORDER BY closeness") #for result in c:...
true
be06ce5c3dff120a3df341c463c0bcfc8f62a7be
Richardbmk/PythonFundamentals
/09dictionaries.py
2,984
4.28125
4
# Dictionaries in python instructor = { "name": "Colt", "owns_dog": True, "num_courses": 4, "favorite_language": "Python", "is_hilarious": False, 44: "my favorite number!" } cat = {"name": "blue", "age": 3.5, "isCute": True} # A combination of a list and Dictionaries cart = [{"name": "blue", "...
true
cfc3471428d81b3068444730ef162e7e491fb46f
IsaacStalley/Course_Open_Platforms
/laboratorio5.py
2,674
4.125
4
#!/usr/bin/python3 """ Created on Friday July 10 10:19:04 2020 @author: Isaac Stalley Matriz class, takes 2 parameters for rows and columns and creates a matrix, contains useful methods for modifying the matrices, like adding and subtracting them or printing them. """ class Matriz(): # Constructor me...
true
367c4bb8d8804e38efcbf13d208f90e13d21d879
PyQIT/Python-Distance-Converter
/Converter.py
2,315
4.28125
4
# Author Przemysław Pyk # Maracui # 25.09.2018 def milesToKilometersConverter(): print("Write distance in miles: ") miles = float(input()) distanceInKilometers = miles * 1.609344 print("Your distance in kilometers is equal ", distanceInKilometers) def kilometersToMilesConverter(): print("Write ...
false
7a16a32c9b73fe4733b1e44255904fb6aacb7937
pranavv1251/python-programs
/Prac3/P33.py
222
4.3125
4
list1 = [] largest = '' line = input("Enter words:") while(line != ''): if(len(largest) <= len(line)): largest = line line = input() print(f'The largest word is {largest} and its length is {len(largest)}')
true
fb1a65926ab7532c0776af46ed234e868420b86a
gopi-123/Speech_To_Text
/convert_audio_mp3_file_to_text.py
912
4.15625
4
""" Audio transcription works by a few steps: input: .mp3 file output: .wav file ++ text recognized ouput How it works: first converts mp3 to wav conversion, loading the audio file, feeding the audio file to a speech recongition system """ import speech_recognition as sr from os import path from pydub import A...
true
ab3f0f0ff62d8bd50d79e0ffcde2beca51e477e9
alyslma/HackerRank
/Python/Strings/SwapCase.py
841
4.3125
4
# https://www.hackerrank.com/challenges/swap-case/problem # You are given a string and your task is to swap cases. In other words, convert all lowercase letters to uppercase letters and vice versa. # Examples: Www.HackerRank.com → wWW.hACKERrANK.COM || Pythonist 2 → pYTHONIST 2 #####################################...
true
77e61338c8b2849a671112c1ee59e03b303fae63
imckl/leetcode
/easy/263-ugly-number.py
724
4.25
4
# Write a program to check whether a given number is an ugly number. # Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. # https://leetcode.com/problems/ugly-number/ class Solution(object): def isUgly(self, num: int) -> bool: if num == 0: return False if num =...
true
c594a9615ed48036d5cf76d83d151f56aae70f19
imckl/leetcode
/easy/58-length-of-last-word.py
621
4.25
4
# 给定一个仅包含大小写字母和空格 ' ' 的字符串,返回其最后一个单词的长度。 # # 如果不存在最后一个单词,请返回 0 。 # # 说明:一个单词是指由字母组成,但不包含任何空格的字符串。 # # 来源:力扣(LeetCode) # 链接:https://leetcode-cn.com/problems/length-of-last-word # 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 class Solution: def lengthOfLastWord(self, s: str) -> int: try: return len(s.spli...
false
7b3fd8bb8a7002bb4802f813a8c1e4fe976e64ca
karthikm999/python_101
/ex21.py
1,026
4.4375
4
# Python program to find the largest number among the three input numbers # change the values of num1, num2 and num3 # for a different result num1 = 10 num2 = 14 num3 = 12 # uncomment following lines to take three numbers from user num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: "...
true
0ff1ba5fe60d9f7c578f8f2b4aaecc313eea190f
VicArDAl/python-labs
/03_more_datatypes/2_lists/03_11_split.py
514
4.15625
4
''' Write a script that takes in a string from the user. Using the split() method, create a list of all the words in the string and print the word with the most occurrences. ''' script=str(input("type a script please: ")) script_split=script.split() print(script_split) bigger_amount=0 solution=[] for i in script_sp...
true
c852938281a5be533f6586233a236829987e4835
VicArDAl/python-labs
/02_basic_datatypes/2_strings/02_08_occurrence.py
317
4.15625
4
''' Write a script that takes a string of words and a letter from the user. Find the index of first occurrence of the letter in the string. For example: String input: hello world Letter input: o Result: 4 ''' string=str(input("Write a script:\n")) letter=str(input("letter to find:\n")) print(string.find(letter))
true
7ec3728efe5497597f628dd87260a4428a2557c1
VicArDAl/python-labs
/01_python_fundamentals/01_01_run_it.py
959
4.5625
5
''' 1 - Write and execute a script that prints "hello world" to the console. 2 - Using the interpreter, print "hello world!" to the console. 3 - Explore the interpreter. a - Execute lines with syntax error and see what the response is. * What happens if you leave out a quotation or parentheses? * How...
true
7a09cbb56692751dfcbc007cc84141193cedb2a8
HenriqueSaKi/Python-Fundamentos-Para-Analise-De-Dados
/Lab/calculadora_v1.py
866
4.1875
4
# Calculadora em Python # Desenvolva uma calculadora em Python com tudo que você aprendeu nos capítulos 2 e 3. # A solução será apresentada no próximo capítulo! # Assista o vídeo com a execução do programa! print("\n******************* Python Calculator *******************") # Funções da Calculadora soma = lambda a...
false
d283c5db3961b3978c9c098ce5fbfe2a5a268dd3
Jokertion/Learn-Python-the-Hard-Way
/ex33-5.py
277
4.125
4
i = 0 numbers = [] maxium = int(input("请输入列表最大值: ")) step = int(input("请定义数字间隔(范围1-10): ")) for loop in range(0, maxium, step): numbers.append(i) i = i + step print ("The numbers: ") for num in numbers: print (num)
false
cb4c7047893f4165a75c1337931e95f6cca11b35
savirnosaj/codingDojo
/python_stack/Python/python_OOP/car.py
1,455
4.21875
4
# Assignment: Car # Create a class called Car. In the __init__(), allow the user to specify the following attributes: price, speed, fuel, mileage. # If the price is greater than 10,000, set the tax to be 15%. Otherwise, set the tax to be 12%. # Create six different instances of the class Car. In the class have a met...
true
2f2324f5026319012a5e608cc1343c9afa109a2c
dipesh1011/class6_functions
/combination.py
331
4.125
4
def factorial(num): res = 1 for i in range(1, num + 1): res = res * i return res def combination(): n = int(input("Enter value for 'n':")) r = int(input("Enter value for 'r':")) combi = factorial(n) / (factorial(r) * factorial(n-r)) print("The combination is:",combi) co...
true
0bb2d79bdf58353a16f346aff38be8afefee9815
pyav/labs
/src/python/nested_dictionary.py
946
4.625
5
#!/usr/bin/env python ''' Following program demonstrates nested dictionary access techniques. Output (python nested_dictionary.py) ------ {'Second': {'Second_1': 'Second_1_1', 'Second_2': 'Second_2_1'}, 'First': {'First_1': 'First_1_1', 'First_2': 'First_2_1'}} First_2_1 First_1_1 Second_2_1 __author__ = "pyav" ''...
false
717bca05b8a8d2018645de701f06918e166c9a41
viicrow/yes_no
/main.py
1,136
4.15625
4
# functions go here... def yes_no(question): valid = False while not valid: response = input(question).lower() if display_instructions == "yes" or display_instructions == "y": response = "yes" return response elif display_instructions == "no" or display_instructions == "n": resp...
true
efc3651e5beee8826f1307db4c171f096bdb6fe6
mooney79/python-number-guessing-game
/leveltwo.py
495
4.21875
4
from random import randint lucky_number = input('Enter the number for the computer to guess: ') guesses_remaining = 3 while guesses_remaining > 0: computer_guess = randint(1, 10) if computer_guess == int(lucky_number): print("Correct! The computer wins!") break elif computer_guess > int...
true
691c501f6686e05d6f053e1b28a5591bb70e5b6a
AJHudson2003/the-final-project
/final project.py/the-final-project.py
2,427
4.15625
4
''' AJ Hudson 3.7.19 This is a questions game that i am using for this fun questions game. this will ask five random questions for you to answer. This will be a few questions that will have a few different questions for you to answer. I hope that you will have ''' welcome = input('Welcome to the Questions game!') d...
true
528a6d078a64137c9f5d10bc97b78be7459c38b5
AHecky3/Arthas
/Chapter4_Challenge/Challenge_1.py
1,008
4.15625
4
""" 1) Write a program that counts for the user. Let the user enter the starting number, then ending number, and the amount by wich to count. """ #Andrew Hecky #10/23/2014 #Opening Regards print(""" Hello There! I will count for you! Please enter the number you wish to start at, end at, and what we ...
true
500901f608d092467c08aa375f8215a5a16a68c5
clebertonf/Python-course
/001-Python-basico/028-desempacotamento.py
459
4.15625
4
# Desempacotamento em python list_names = ["Cleber", "Lucas", "Maria", "Paulo", "Carlos", "João"] nome_1, nome_2, *resto = list_names print(resto) # recebe um array com os valores restantes da lista list_ages = [18, 27, 35] age_1, age_2, age_3 = list_ages print(age_2) list_numbers = [1, 5, 8, 12, 10] # Apos o ...
false
1c0cf5c29e9b454d9201bac8ee8a34d8b916e7c9
clebertonf/Python-course
/001-Python-basico/008-desafio-pratico.py
512
4.125
4
from datetime import date year_current_date = date.today().year def get_info(name, age, height, weight): year_birth = year_current_date - age imc = round(weight / (height ** 2), 2) print(f"{name} tem {age} anos, {height} de altura e pesa {weight} KG.") print(f"O IMC do {name} é: {imc}") print(f"{...
false
8059fafca80a43306a4a2ba4eda90c027e83c9d7
clebertonf/Python-course
/001-Python-basico/017-formatando-valores.py
950
4.1875
4
# Formatando valores com modificadores """ :s - Strings :d - Int :f - Float :. - Quantidade de casas decimais Float : - Caractere (> ou < ou ^) (Quantidade) (Tipo s, d ou f) > esquerda < direita ^ centro """ # exemplo do uso da formatação :. (:f :d) numero_1 = 10 numero_2 = 3 divisao ...
false
42487628f83a437a8c08983138a0ec7d82d64957
clebertonf/Python-course
/001-Python-basico/016-desafio-pratico-2.py
862
4.1875
4
from datetime import datetime # Desafio numero par ou impar number = input('Digite um numero inteiro: ') try: number = int(number) if number % 2 == 0: print('Numero é par!') else: print('numero é impar!') except: print('Digite somente numeros inteiros!') # Desafio hora atual com saud...
false
3d0dec4941eaeaa712e39ed1495879189e2429b4
essweinjacob/School
/ProgLanguages/project4.py
2,226
4.3125
4
'''' Jacob Esswein Professor Galina Completed 11/3/2019 This program has a 'Product' class and two child classes 'Book' and 'Movie' that inherit 'Product''s constructor and in that, its private variables name, price and discount percent. ''' # Parent class 'Product' class Product: name = "" price = 0 disc...
true