blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
15ea8695f41f7a946ad704915e69947be30a0c89
gicici/python
/lists.py
853
4.1875
4
my_list=[1,2,3] print(my_list) #Lists can hold different types of numbers, strings or even floating point numbers my_list= ['string',1,0.3,67, 'o'] print(my_list) #len stands foor length print(len(my_list)) my_list = ['one','two', 'three', 4,5] #grabs elements on the index and that is 1 print(my_list[0]) l = [1,4,5] l...
true
40c8dfe529c86ddbcdb60cf52e31600c9e64b669
gicici/python
/ex2.py
2,697
4.21875
4
print("I could have code like this") #and the comment after #You can also use a comment to "disable" or comment out #print("This wont run") l = [1,2,3] print(l.append(4)) #objects are things on the real world print(l.count(3))#this is used to check the type while count()is used to 'count ' the number of times something...
true
0747db47499bee241d6c2685bb29641204bd3576
joydip10/Python-Helping-Codes
/errorsandexceptions2.py
633
4.125
4
class Animal: def __init__(self,name): self.name=name def sound(self): raise NotImplementedError("You haven't implemented this method in this particular subclass") #abstract method class Dog(Animal): def __init__(self,name,breed): super().__init__(name) se...
true
04005a5d88f72a3afa481f52fbd5478a3fb87316
joydip10/Python-Helping-Codes
/args.py
1,253
4.125
4
def total(*nums): total=0 print("Type of *nums: "+str(type(nums))) print("Packed as tuple: ") print(nums) #packed print("Unpacked: ") print(*nums) #unpacked for i in nums: total+=i return total print(total(1,2,3,4,5,6,7,8,9,10)) print("\n\n\n\n\n") l=[i for i in range(1,11)] t=...
true
258a1180264a716ab49e134082c6e03c1e191ff8
pkopy/python_tests
/csv/csv_reader.py
336
4.125
4
import csv def csv_reader(file_object): ''' Read a CSV file using csv.DictReader ''' reader = csv.DictReader(file_object, delimiter=',') for line in reader: print(line["first_name"]), print(line["last_name"]) if __name__ == "__main__": with open("data.csv") as f_obj: c...
true
96127e3f4f8472101b61feea8c732ff990fe709b
oliveirajonathas/python_estudos
/pacote-download/pythonProject/exercicios_python_guanabara/ex103.py
636
4.1875
4
""" Faça um programa que tenha uma função chamada ficha(), que receba dois parâmetros opcionais: o nome de um jogador e quantos gols ele marcou. O programa deverá ser capaz de mostrar a ficha do jogador, mesmo que algum dado não tenha sido informado corretamente. """ def ficha(nome='', gols=0): if nome == '': ...
false
9274f65c1ce2cd7c5c7f286b0c6cb5cfe88a3c7a
oliveirajonathas/python_estudos
/pacote-download/pythonProject/exercicios_python_guanabara/ex026.py
477
4.15625
4
#Faça um programa que leia uma frase pelo teclado e mostre: #Quantas vezes aparece a letra "A" #Em que posição ela aparece a primeira vez #Em que posição ela aparece a última vez frase = str(input('Digite uma frase qualquer: ')) frase = frase.upper().strip() print('Sua frase tem {} letras "A"'.format(frase.count('A')))...
false
85a08b66a1d2b7b3dcee108a204733fa8faf9005
oliveirajonathas/python_estudos
/pacote-download/python_e_django/cap09-funções_personalizadas/valor_referencia.py
907
4.15625
4
def quadrado_por_valor(x): """ Eleva x ao quadra, usando passagem por valor :param x: :return: """ print(f'Recebido o valor {x}') x = x * x print(f'Devolvido o valor {x}') return x def quadrado_por_ref(lista, x): """ Recebe uma lista e um valor x. Eleva x ao quadrado, e arm...
false
3400dfcfb0474d3cf2a0934d3891a52f90ffb277
oliveirajonathas/python_estudos
/pacote-download/pythonProject/exercicios_python_guanabara/ex075-professor.py
918
4.125
4
""" Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final, mostre: A) Quantas vezes apareceu o valor 9 B) Em que posição foi digitado o primeiro valor 3 C) Quais foram os números pares """ num = (int(input('Digite um número: ')), int(input('Digite outro número: ')),int(input('D...
false
d5011d5d4c99dbbc004dcb866f29119bc9ceb356
oliveirajonathas/python_estudos
/pacote-download/pythonProject/exercicios_python_guanabara/ex068.py
1,545
4.21875
4
""" Faça um programa que jogue par ou ímpar com o computador. O jogo só será interrompido quando o jogador PERDER, mostrando o total de vitórias consecutivas que ele conquistou no final do jogo """ from random import randint print('*'*20) print('Jogo do par ou ímpar') print('*'*20) vitoria = 0 while True: # Comput...
false
afd4a657a274651e77a674001aae5fe5b448dc72
oliveirajonathas/python_estudos
/pacote-download/pythonProject/exercicios_python_guanabara/ex076.py
948
4.25
4
""" Crie um programa que tenha uma tupla única com os nomes de produtos e seus respectivos preços, na sequência. No final, mostre uma listagem de preços, organizando os dados de forma tabular. """ print(60*'-') print('{:^60}'.format('MERCADINHO J&R')) print(60*'-') produtos = ('Manteiga', 2.50, 'Pasta de Dente', 3.00,...
false
5b266103eec47df939bfc388de3d8470f78b26bf
oliveirajonathas/python_estudos
/pacote-download/pythonProject/exercicios_python_guanabara/ex105.py
1,125
4.125
4
""" Faça um programa que tenha uma função notas() que pode receber várias notas de alunos e vai retornar um dicionário com as seguintes informações: - Quantidade de notas - A maior nota - A menor nota - A média - A situação (opcional) Adicione também as docstrings da função """ def notas(*notas, sit=False): """ ...
false
e6eec83a6b8c5cc929fc6d02d274ea88d2ff5553
whoissahil/python_tutorials
/advancedListProject.py
948
4.40625
4
# We're back at it again with the shoes list. I have provided you with the shoes list from the last exercise. # In this exercise, I want you to make a function called addtofront, which will take in two parameters, a list and a value to add to the beginning of that list. # Once you have made your function, add this li...
true
29be997f377f217335d050d19795fe8c889b4dde
srikanth8951/AssignmentWeek1
/ReverseList.py
367
4.25
4
# -*- coding: utf-8 -*- """ Created on Sat Sep 26 15:36:21 2020 @author: hvsri """ def reverselist(list1): list2 = [] print("After Reversing list") for i in range(len(list1)-1, -1,-1): list2.append(list1[i]) print(list2) list1 = [10, 20, 30, 40, 50] print("List Be...
false
5824b0576b6bd3977296ab653a51cdc1f483c839
Wall-Lai/COMP9021
/final sample/10_27_gai_gai_not_one_line/sample_3.py
2,908
4.125
4
''' Given a word w, a good subsequence of w is defined as a word w' such that - all letters in w' are different; - w' is obtained from w by deleting some letters in w. Returns the list of all good subsequences, without duplicates, in lexicographic order (recall that the sorted() function sorts strings in lexicographic...
true
1f6b22d7f7903e1c207096966e2bdfcd1a1ba55d
Timothy-Myers/Automate-The-Boring-Stuff-Projects
/Projects/collatz.py
919
4.5625
5
#this program shows how the Collatz sequence works by having a user enter a number and using the sequence to get the number down to 1 #definition where the number is analyzed def collatz(number): #continues until number is 1 while number != 1: #examines if number is even if number % 2 ==...
true
189da249379adfb2f49a05d8dc55df795958ef4e
takuhartley/Python_Practice
/Dictionaries/dictionaries.py
717
4.15625
4
cars = { "brand": "Tesla", "model": "Model X", "year": 2019 } people = { "name": "Robert", "age": 22, "gender": "Male" } print(cars) x = cars["model"] print(x) x = cars.get("model") print(x) people["age"] = 1995 print(people) for x in people: print(x) for x in people: print(people[x]) for x in pe...
true
8c68f853d4619feb42df22d15058ae25a383fde0
vitorAmorims/python
/lista_remover.py
734
4.34375
4
# Python - Remover itens da lista thislist = ["apple", "banana", "cherry"] thislist.remove("banana") print(thislist) # Remover Índice Especificado # O pop()método remove o índice especificado. thislist = ["apple", "banana", "cherry"] thislist.pop(1) print(thislist) # Se você não especificar o índice, o pop()método re...
false
8a1c165897fcb5222f6513d69810a7e0e3fcbb87
TaynaValle/CursoEmVideo
/ex005.py
239
4.125
4
''' Faça um programa que leia um número inteiro e mostre na tela o seu sucessor e seu antecessor ''' n = int(input('Digite um número:')) print('Analisando o valor {}, seu sucessor é {} e o seu antecessor é {}'.format(n, n+1, n-1))
false
a5381669b79f9d6dab81037a9a02070097328348
NickCampbell91/CSE212FinalProject
/Final/Python/stack_2.py
1,152
4.21875
4
""" Python3 code to delete middle of a stack without using additional data structure. Write the deleteMid function where st is the call to the Stack class, n is the size of the stack, and curr is the current item number. """ class Stack: def __init__(self): self.items = [] def isEmpty...
true
fcd000e9f9879c7ef9455eb7c7d94db2f343c398
terranigmark/code-wars-python
/6th-kyu/replace_with_alphabet_position.py
643
4.40625
4
""" Welcome. In this kata you are required to, given a string, replace every letter with its position in the alphabet. If anything in the text isn't a letter, ignore it and don't return it. "a" = 1, "b" = 2, etc. Example alphabet_position("The sunset sets at twelve o' clock.") """ import string def alphabet_posit...
true
3aaa7165b3aa1f34332771efee0612b25c2f494d
fwchj/cursoABMPythonPublic
/EjemplosCodigo/03_Input.py
310
4.15625
4
# Example on how to read input from the console (e.g. ask the user for an input) print("Favor de ingresar un primer número") a = float(input()) #usamos float() para convertir todo a float print("Gracias, favor de ingresar un segundo número") b = float(input()) print("La suma de %s y %s es %s" % (a,b,a+b))
false
48d0be95e3516bb22190dc11fcf34233a624da02
fwchj/cursoABMPythonPublic
/EjemplosClase/list.py
754
4.125
4
# Ejemplos de list mi_lista = [1,2,3,4] print(mi_lista) print(type(mi_lista)) # Imprimir un elemento en particular (tercero) print(mi_lista[2]) print(type(mi_lista[2])) # Agregar un 2.5 entre el 2 y el 3 mi_lista.insert(2,2.5) print(mi_lista) print(mi_lista[2]) print("El tamanio es: %s" % len(mi_lista)) # Eliminam...
false
56da0d684688b9093e915e5559b1c431981b921c
fwchj/cursoABMPythonPublic
/EjemplosCodigo/04_OperacionesMatematicas.py
1,413
4.28125
4
# Ejemplos de operaciones matemáticas básicas y avanzadas # 1) Operaciones matemáticas básicas # 2) Operaciones de asignacion compuesta # 3) Operaciones matematicas mas avanzadas # 1) Operaciones matemáticas básicas a = 5 # Definimos una variable 'a' y ponemos el valor de 5 b = 10 # idem c = 8 # idem d = a +...
false
2d8292045564876ab2c3caa27664982daf0c2965
fwchj/cursoABMPythonPublic
/EjemplosCodigo/20_Hierarchy2_herencia.py
1,100
4.1875
4
# OOP with inheritance # Defining the class class Individual: # Constructor def __init__(self,salary,name,age,tenure,female): self.salary = salary self.name = name self.age = age self.tenure = tenure self.female = female # Method printing some basic information ...
true
5dbbf8d13447181eb29b7730c7881e3a28de0bbb
AntonyRajeev/Python-codes
/positivelist.py
299
4.25
4
#to find and print all positive numbers in a range list=[] n=int(input("enter the no of elements and the respective elements in the list ")) for i in range(0,n): i=int(input()) list.append(i) print("The positive integers are -") for k in list: if k>=0: print(k)
true
9ace8eb7b294e485f61ef6184f33773428071cd2
JaredVC672/PrimerRepo
/prog3.py
1,232
4.15625
4
print("Operaciones") print("S. Suma") print("R. Resta") print("M. Multiplicacion") print("D. Division") print("A. Salir") opcion = input("¿Qué opción elige?: ") while opcion.upper()=="S": num1 = float(input("Dame un numero: ")) num2 = float(input("Dame otro numero: ")) res = (num1 + num2) print("El re...
false
bd33a8347b98dbd6d6ef23b3404284fe4594168d
arrenfaroreuchiha/condicionales
/condicional2.py
228
4.15625
4
# -*- coding: utf-8 -*- print "menor de dos numeros" a = int(raw_input("numero 1:")) b = int(raw_input("numero 1:")) if a == b: print "son iguales" elif a < b: print "el menor es: %s" % a else: print "el menor es: %s" % b
false
dabd439f38d4e1ffbff4e5f40c4b2f72240e932c
roytalyan/Python_self_learning
/Leetcode/String/Valid Palindrome.py
746
4.3125
4
# -*- coding: utf-8 -*- """ Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, we define empty string as valid palindrome. Example 1: Input: "A man, a plan, a canal: Panama" Output: true Example 2: Input: "race a car...
true
a85bb8418f65b352eb78a56db24be3a9b3f28212
clarkkarenl/codingdojoonline
/python_track/filter-by-type.py
1,876
4.25
4
# Assignment: Filter by Type # Karen Clark # 2018-06-02 # Assignment: Filter by Type # Write a program that, given some value, tests that value for its type. Here's what you should do for each type: # Integer # If the integer is greater than or equal to 100, print "That's a big number!" If the integer is less than 100...
true
b2219014425c2fd302f4cbf370390c6fadf60301
RapheaSiddiqui/AI-Assignment-1
/q11(checking vowel).py
328
4.25
4
print ("\t\t\t***CHECKING FOR A VOWEL***") letter = input ("Enter a letter: ") if letter == 'a' or letter == 'A' or letter == 'e' or letter == 'E' or letter == 'i' or letter == 'I' or letter == 'o' or letter == 'O' or letter == 'u' or letter == 'U' : print (letter, "is a vowel!") else: print (letter, "is a cons...
false
a999e0ce0226ee0082a3228d9df34f98fac04d5c
RapheaSiddiqui/AI-Assignment-1
/q2(checking sign of a given number).py
233
4.1875
4
print ("\t\t\t***CHECKING NATURE OF A NUMBER***") num = float(input("Enter any number: ")) if (num == 0): print("It's a Zero!") if (num < 0): print("It's a Negative number!") if (num > 0): print("It's a Positive number!")
true
bf847e692c05e126f0a3fe34ce54dccf46e6b501
RapheaSiddiqui/AI-Assignment-1
/q20(converting time into seconds).py
277
4.1875
4
print ("\t\t\t***TIME IN SECONDS***") hrs = float (input("Enter hours: ")) mins = float (input("Enter minutes: ")) sec1 = hrs * 3600 sec2 = mins * 60 sec = sec1 + sec2 print (hrs,"hours =",sec1,"seconds") print (mins,"minutes =",sec2,"seconds") print ("Total =",sec,"seconds!")
false
f019103d9d581f8f77b246cb553d964410d5300c
tnmas/python-exercises
/unit-6-assignment.py
839
4.125
4
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ # first we need to define the function and ask for to arguments def compare(a,b): #case 1 when the first number is greater than the second number if a > b : return 1 # case 0 when the twon numbers are equals elif a == b: retu...
true
98cdd8dadc1c159f49ee1a880d3326640e1a25e2
Success2014/Leetcode
/stringtoInteger.py
2,225
4.21875
4
# -*- coding: utf-8 -*- """ Created on Tue Jun 02 09:46:34 2015 Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this problem to be speci...
true
d357165d011143acf66bcdc431c0e0f144ac2230
Success2014/Leetcode
/reverseLinkedListII.py
2,256
4.15625
4
# -*- coding: utf-8 -*- """ Created on Sun Aug 09 12:08:25 2015 Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m, n satisfy the following condition: 1 ≤ m ≤ n ≤ length of list. Tags Linked ...
false
ef4941567063ba507df1933c92f2ada872766ceb
Success2014/Leetcode
/spiralMatrix.py
1,863
4.125
4
# -*- coding: utf-8 -*- """ Created on Thu Jul 02 13:32:07 2015 Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] You should return [1,2,3,6,9,8,7,4,5]. @author: Neo """ cl...
true
e2851deac5f5546d0c421f4edfa8b1251820531c
rahulsrivastava30/python
/Calculator.py
615
4.125
4
def calculator(first_num,second_num,operation): if(operation=='add'): return first_num+second_num elif(operation=='subtract'): return first_num-second_num else: return "error" first=(int)(input("Enter first num: ")) second=(int)(input("Enter second num: ")) symbol=input("Ent...
true
d18ce7428e4636d54f94e94b3384374a1c8f8d74
anigautama/PythonProgramming
/DataStructures/Stack/infix2postfix.py
692
4.125
4
#anil def prior(i): if i=='*' or i=='/' or i=='%': return 1 elif i=='+' or i=='-': return 2 elif i=='(': return 3 from stacks import Stack exp = input("Enter an infix expression: ") + ')' op = Stack() postfix = [] op.push('(') for i in exp: if i.isalpha(): postfix.appe...
false
ea2b8dd0a42bbbc763c14b8510031d2eb5df1530
iri02000/rau-webappprogramming1
/seminar5/intro_612.py
404
4.1875
4
n = input("Please enter a number: ") print(type(n), n) n = int(n) print(type(n), n) n = float(n) print(type(n), n) s = "This is a string" parts = s.split(" ") print(parts) parts = s.split("is") print(parts) a = 13 % 2 # find out modul print(a) # line comment # other line comment """ This is a block of comments....
true
9daed156e8c67658b9d83de8c43676b705d9c054
lzdyd/Python
/Lab1/7.py
1,072
4.28125
4
# Правильная дата (7) # Написать функцию date, принимающую 3 аргумента — день, месяц и год. Вернуть True, # если такая дата есть в нашем календаре, и False иначе. def date(d, m, y): if(d <= 0 or d >= 32 or m <= 0 or m >= 13 or y <= 0): return False if (is_year_leap(y) and m == 2): if (d <= 29)...
false
febf94ee44cc42fe235e73fd460d14436e8534ec
Haroldov/holbertonschool-higher_level_programming
/0x01-python-if_else_loops_functions/8-uppercase.py
240
4.1875
4
#!/usr/bin/python3 def uppercase(str): for ind, char in enumerate(str): ascii = ord(char) if ascii >= 97 and ascii <= 122: ascii -= 32 print("{}".format(chr(ascii)), end="") else: print()
false
6b8812204a60737efe13a509304f24f92a695919
sprakaha/Python-CyberSecurity101
/Modules/Ciphers/DataConversions/convtask1.py
548
4.15625
4
## TODO: Get the user to input a number ## Return the number in binary, WITHOUT using the bin() function ## Only has to work for positive numbers ## Conver the number to binary, return as an int # DO NOT CHANGE FUNCTION NAME OR RETURN TYPE def toBinary(digit): ## Your Code Here pass ## Print out the ...
true
9e5669f5534a0b67417f3fcfebad14ece9791935
sprakaha/Python-CyberSecurity101
/Modules/Ciphers/CipherReviews/cipherintro.py
2,323
4.3125
4
## Strings Review # strings are a list of characters # "hello" -> 'h', 'e', 'l', 'l', 'o' greeting = "Hello! How are you?" # Get first character of a string # print(greeting[0]) # Get last character of a string # print(greeting[len(greeting) - 1]) # print(greeting[len(greeting)]) # this will give an error - IndexE...
true
b453b5d57be9bbdc53d67e3cd6b9b72cc1a3ae5b
octopus84/w3spython
/lambdas.py
1,111
4.5625
5
#Lambda # A lambda function is a small anonymous function. # A lambda function can take any number of arguments, # but can only have one expression. # Syntax # lambda arguments : expression x = lambda a : a + 10 print(x(4)) x = lambda a, b : a * b print(x(5,5)) x = 5#int(input("Ingresa 3 números: ")) y = 3#int(...
true
f020dd09c72558fcd5361e11b888357320142c5a
Lance117/Etudes
/leetcode/greedy/435_non_overlapping_intervals.py
775
4.1875
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. Input: [[1,2],[2,3],[3,4],[1,3]] Output: 1 Explanation: [1,3] can be removed and the rest of intervals are non-overlapping. Greedy algorithm: 1. Select interval with the ear...
true
d4837b1ae7b35db2030dc2b7606a6d550b382483
Lance117/Etudes
/leetcode/tree/144_binary_tree_preorder_traversal.py
942
4.125
4
""" Given a binary tree, return the preorder traversal of its nodes' values. """ class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None def preorder_traversal_rec(root): """ Time complexity: O(n) Space complexity: O(h) since size of call stack de...
true
e860fe06a18873f6a7581828e49082bad6eeacb4
nawjanimri/uned_fund_programacion
/libro/125_perimetro.py
1,859
4.1875
4
# Programa: Perimetro # Descripción: # Programa para calcular el perimetro de un triángulo dado por sus tres vértices from math import sqrt (xA, yA, xB, yB, xC, yC) = (0, 0, 0, 0, 0, 0) # Coordenadas de los puntos perimetro = 0 # Valor del perimetro ''' Procedimiento para leer las co...
false
dda83eb38db783203e4b9d73b21f8de326f857b6
Arthanadftz/Codeacademy_ex
/BankAccount.py
1,703
4.15625
4
class BankAccount(object): balance = 0 def __init__(self, name): self.name = name def __repr__(self): return '%s\'s acoount has balance: $%.2f' %(self.name, self.balance) def show_balance(self): print('Balance: $%.2f' %(self.balance)) def deposit(self, amount): if amount <= 0: print('You...
true
58080d48d94741434048c39bd74cbd3f7b2a9b23
Arthanadftz/Codeacademy_ex
/sorting_algs.py
1,190
4.15625
4
#Array sorting algorythms def insert_sort(A): """ Sortring A list by inserting """ N = len(A) for top in range(1, N): k = top while k > 0 and A[k-1] > A[k]: A[k], A[k-1] = A[k-1], A[k] k -= 1 def choise_sort(A): """ Sortring A list by choise """ N = len(A) for pos in range(N-1): for k in range(pos+1,...
false
8463ec73798d9ed61757ff21d49f7da15f6068c9
Maimit/python3_basic
/exercise_2.py
265
4.25
4
num1, num2, num3 = input("Enter number1, number2, number3 by comma separated: ").split(",") average = (int(num1) + int(num2) + int(num3)) / 3 print(f"Average of {num1},{num2},{num3} is: {average}") name = input("Enter name: ") print("Reverse name: ", name[-1::-1])
false
675c46c9b05e7fa7f74a9113a2b15f50d6bbdf21
mastermind2001/Problem-Solving-Python-
/snail's_journey.py
1,349
4.3125
4
# Date : 23-06-2018 # A Snail's Journey # Each day snail climbs up A meters on a tree with H meters in height. # At night it goes down B meters. # Program which takes 3 inputs: H, A, B, and calculates how many days it will take # for the snail to get to the top of the tree. # Input format : # 15 # For H # 1 # F...
true
9003b3a8093b7aeb22e8bbb03fe54c294f50082f
mastermind2001/Problem-Solving-Python-
/tower_of_hanoi.py
1,993
4.15625
4
# Date : 7-05-2018 # Write a program to find solution for # Tower of Hanoi Problem """ This code uses the recursion to find the solution for tower of Hanoi Problem. """ # Handle the user input try: # No. of disks (a positive integer # value greater than zero) disk = int(input("")) # Error h...
true
132764e4ca174a49d6f2d24fa51334f72bec0771
running-on-sunshine/python-exercises
/Python Exercises-102/hello.py
688
4.25
4
# ======================================================================= # # Exercises - Python 102 # # ======================================================================= # # Begin here: # ======================================================================...
true
65a3483498b5b0cedc45e141c9f57a8c2e3db83a
gophers-latam/pytago
/examples/contains.py
867
4.125
4
def main(): # Iterables should compare the index of the element to -1 a = [1, 2, 3] print(1 in a) print(4 in a) print(5 not in a) # Strings should either use strings.Compare or use strings.Index with a comparison to -1 # While the former is more straight forward, I think the latter will be ...
true
e989dd43715b32a55bcdea03163bb8f9ebf10826
kpoznyakov/py_lvl2_hw
/lesson_01/hw_task_02.py
532
4.1875
4
# 2. Каждое из слов «class», «function», «method» записать в байтовом типе без преобразования # в последовательность кодов (не используя методы encode и decode) # и определить тип, содержимое и длину соответствующих переменных. words = (b"class", b"function", b"method") for word in words: print(type(word), "дли...
false
e85d2015fd1c22f8479bcb5e68487fa6b6e0696a
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/DATA_STRUC_PYTHON_NOTES/python-prac/learn-python/src/control_flow/test_try.py
2,117
4.53125
5
"""TRY statement @see: https://www.w3schools.com/python/python_try_except.asp "try" statement is used for exception handling. When an error occurs, or exception as we call it, Python will normally stop and generate an error message. These exceptions can be handled using the try statement. The "try" block lets you te...
true
b28ca804bf8a7ddd093b5aac170a3f3a8b7596c9
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/_External-learning-resources/02-pyth/python-ds-master/data_structures/graphs/check_if_graph_is_tree.py
1,245
4.125
4
""" A graph is a tree if - 1. It does not contain cycles 2. The graph is connected Do DFS and see if every vertex can be visited from a source vertex and check for cycle """ from collections import defaultdict class Graph: def __init__(self, vertices): self.vertices = vertices self.graph = defau...
true
4a2d64f6ae9f0e76d0278e807c0669dd8ce6ff5d
bgoonz/UsefulResourceRepo2.0
/_PYTHON/DATA_STRUC_PYTHON_NOTES/course-work/cs-guided-project-binary-search-trees/src/demonstration_2.py
1,131
4.34375
4
""" You are given a binary tree. You need to write a function that can determin if it is a valid binary search tree. The rules for a valid binary search tree are: - The node's left subtree only contains nodes with values less than the node's value. - The node's right subtree only contains nodes with values greater th...
true
d640ce7c735a28d7a21522a4ba324a81ea7f400d
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/DATA_STRUC_PYTHON_NOTES/python-prac/leetcode/Sort_an_Array.py
1,079
4.25
4
# Given an array of integers nums, sort the array in ascending order. # # Example 1: # # Input: nums = [5,2,3,1] # Output: [1,2,3,5] # Example 2: # # Input: nums = [5,1,1,2,0,0] # Output: [0,0,1,1,2,5] def sortArray(nums): def helper(nums, start, end): if start >= end: return pivot =...
true
6f3983b4248adcadbd968a9cd95fdc01bfb3789f
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/DATA_STRUC_PYTHON_NOTES/course-work/cs-guided-project-hash-tables-i/src/guided.py
2,080
4.25
4
# d = { # 'banana': 'is a fruit', # 'apple' : 'is also a fruit', # 'pickle': 'vegetable', # } # a hash fucntion # -must take a string # -return a number # -must always return the same output for the same input # -should be fast storage = [None] * 8 # has a size of 8/ static array def hash_func(string, ...
true
10e97a74c79d2a0710d60765fd974f9e01866c46
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/DATA_STRUC_PYTHON_NOTES/python-prac/learn-python/src/control_flow/test_break.py
798
4.21875
4
"""BREAK statement @see: https://docs.python.org/3/tutorial/controlflow.html The break statement, like in C, breaks out of the innermost enclosing "for" or "while" loop. """ def test_break_statement(): """BREAK statement""" # Let's terminate the loop in case if we've found the number we need in a range fro...
true
fbb262b3510cc4bce1df1e37005b59c96c6ad556
bgoonz/UsefulResourceRepo2.0
/_PYTHON/DATA_STRUC_PYTHON_NOTES/python-prac/leetcode/Symmetric_Tree.py
1,352
4.25
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 class TreeNode: def __init__(self, x): self.val = x self.left = None self.rig...
true
7decaf49edca172e937bb29d316a9da7cb00348c
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/DATA_STRUC_PYTHON_NOTES/WEEKS/wk17/CodeSignal-Solutions/52_-_longestWord.py
381
4.15625
4
def longestWord(text): longest = [] word = [] for char in text: if ord("A") <= ord(char) <= ord("Z") or ord("a") <= ord(char) <= ord("z"): word.append(char) else: if len(word) > len(longest): longest = word word = [] if len(word) > len(...
false
8c3570abe515e660d278df1a404825b3d8a6f9fd
bgoonz/UsefulResourceRepo2.0
/GIT-USERS/TOM-Lambda/CS35_DataStructures_GP/problems/smallest.py
2,205
4.25
4
def smallest_missing(arr, left, right): """ run a binary search on our sorted list because we know that the input should already be sorted and this would give us a O(log n) time complexity over doing a linear search that would yield a time complexity of O(n) """ # check if...
true
5e867b0d715586f32ea76ce11d893c5979852f68
bgoonz/UsefulResourceRepo2.0
/_MY_ORGS/Web-Dev-Collaborative/blog-research/Data-Structures/1-Python/sort/bogo_sort.py
740
4.15625
4
import random def bogo_sort(arr, simulation=False): """Bogo Sort Best Case Complexity: O(n) Worst Case Complexity: O(∞) Average Case Complexity: O(n(n-1)!) """ iteration = 0 if simulation: print("iteration",iteration,":",*arr) def is_sorted(arr): #c...
true
444a0336a3282012b8c9e2c627097b7f0d926c3f
bgoonz/UsefulResourceRepo2.0
/GIT-USERS/TOM-Lambda/CSEU4_DataStructures_GP/interview_questions/problem3.py
962
4.125
4
class Node: def __init__(self, value): self.value = value self.next = None def add(self, value): self.next = Node(value) def reverse(self): cur = self new = cur.next <<<<<<< HEAD cur.next = None # new tail? ======= cur.next = None # new tail? >>>>>>...
false
9e8a845992e85e0c5c4b3b0d7b64232969850061
bgoonz/UsefulResourceRepo2.0
/_PYTHON/DATA_STRUC_PYTHON_NOTES/python-prac/learn-python/src/functions/test_function_default_arguments.py
925
4.71875
5
"""Default Argument Values @see: https://docs.python.org/3/tutorial/controlflow.html#default-argument-values The most useful form is to specify a default value for one or more arguments. This creates a function that can be called with fewer arguments than it is defined to allow. """ def power_of(number, power=2): ...
true
f456218d7e16eec46de4f5f1259fe046207246a3
bgoonz/UsefulResourceRepo2.0
/_REPO/MICROSOFT/c9-python-getting-started/python-for-beginners/10_-_Complex_conditon_checks/code_challenge_solution.py
1,347
4.34375
4
# When you join a hockey team you get your name on the back of the jersey # but the jersey may not be big enough to hold all the letters # Ask the user for their first name first_name = input("Please enter your first name: ") # Ask the user for their last name last_name = input("Please enter your last name: ") # if fi...
true
bdfb941afe94f555350eef11bdd5549dde16bad1
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/web-dev-notes-resource-site/2-content/Python/pcc_2e-master/chapter_09/dog.py
714
4.1875
4
class Dog: """A simple attempt to model a dog.""" def __init__(self, name, age): """Initialize name and age attributes.""" self.name = name self.age = age def sit(self): """Simulate a dog sitting in response to a command.""" print(f"{self.name} is now sitting.") ...
true
8fb3d4d97fc3decf83bf2953b66dd4311fa580ff
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/_External-learning-resources/02-pyth/algorithms-master/algorithms/maths/pythagoras.py
674
4.4375
4
""" input two of the three side in right angled triangle and return the third. use "?" to indicate the unknown side. """ def pythagoras(opposite, adjacent, hypotenuse): try: if opposite == str("?"): return "Opposite = " + str(((hypotenuse ** 2) - (adjacent ** 2)) ** 0.5) elif adjacent...
true
02ed1b0abb9e3d1d05e95fdf17eec352182ba901
bgoonz/UsefulResourceRepo2.0
/_MY_ORGS/Web-Dev-Collaborative/blog-research/Data-Structures/1-Python/arrays/longest_non_repeat.py
2,614
4.375
4
""" Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the length is 3. Given "bbbbb", the answer is "b", with the length of 1. Given "pwwkew", the answer is "wke", with the length of 3. Note that the answer must be a substring,...
true
fb292ced4358a81ef561965389cda19bcb7ff34d
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/PYTHON_PRAC/leetcode/Maximize_Distance_to_Closest_Person.py
1,219
4.15625
4
# In a row of seats, 1 represents a person sitting in that seat, and 0 represents that the seat is empty. # # There is at least one empty seat, and at least one person sitting. # # Alex wants to sit in the seat such that the distance between him and the closest person to him is maximized. # # Return that maximum distan...
true
2cb7a4362a8cf521043affd8e6918a425f4b320e
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/INTERVIEW-PREP-COMPLETE/notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/_PyAlgo-Tree/Recursion/First Index/first_index_of_array.py
601
4.125
4
# To find first index of an element in an array. def firstIndex(arr, si, x): l = len(arr) # length of array. if l == 0: # base case return -1 if ( arr[si] == x ): # if element is found at start index of an array then return that index. return si return firstIndex(arr, si +...
true
f253ed9ff0e143d23edaf116b2f0a76878bdeccb
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/Data-Structures/1-Python/arrays/top_1.py
947
4.28125
4
""" This algorithm receives an array and returns most_frequent_value Also, sometimes it is possible to have multiple 'most_frequent_value's, so this function returns a list. This result can be used to find a representative value in an array. This algorithm gets an array, makes a dictionary of it, finds the most freq...
true
8b8eb1e64a7760cc3eb480d2f2ec608fb8728951
bgoonz/UsefulResourceRepo2.0
/GIT-USERS/TOM-Lambda/CSEUFLEX_Data_Structures_GP/stack.py
1,626
4.3125
4
""" A stack is a data structure whose primary purpose is to store and return elements in Last In First Out order. 1. Implement the Stack class using an array as the underlying storage structure. Make sure the Stack tests pass. 2. Re-implement the Stack class, this time using the linked list implementation as the...
true
53c4afdf08f7e0ec27d981d51a6db6c7b280da3d
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/web-dev-notes-resource-site/2-content/Data-Structures/1-Python/dfs/maze_search.py
1,105
4.3125
4
""" Find shortest path from top left column to the right lowest column using DFS. only step on the columns whose value is 1 if there is no path, it returns -1 (The first column(top left column) is not included in the answer.) Ex 1) If maze is [[1,0,1,1,1,1], [1,0,1,0,1,0], [1,0,1,0,1,1], [1,1,1,0,1,1]], the answer ...
true
f611a878a16540a8544d96b179da3dbe91d2edf7
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/INTERVIEW-PREP-COMPLETE/notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/_Another-One/Project Euler/Problem 04/sol1.py
872
4.1875
4
""" Problem: A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 x 99. Find the largest palindrome made from the product of two 3-digit numbers which is less than N. """ from __future__ import print_function limit = int(input("limit? ")) # fe...
true
43815ab10b7af65236aff86fec476d95b2231dc7
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/web-dev-notes-resource-site/2-content/ciriculumn/week-17/python/Introduction-Programming-Python/Solutions/Module7TaxesChallengeSolution.py
1,675
4.3125
4
# Declare and initialize your variables country = "" province = "" orderTotal = 0 totalWithTax = 0 # I am declaring variables to hold the tax values used in the calculations # That way if a tax rate changes, I only have to change it in one place instead # of searching through my code to see where I had a specific nume...
true
31f32bc2b4e184cccc98e3a1e08f707a7d3b4138
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/PYTHON_PRAC/python-mega-algo/bit_manipulation/count_number_of_one_bits.py
755
4.1875
4
def get_set_bits_count(number: int) -> int: """ Count the number of set bits in a 32 bit integer >>> get_set_bits_count(25) 3 >>> get_set_bits_count(37) 3 >>> get_set_bits_count(21) 3 >>> get_set_bits_count(58) 4 >>> get_set_bits_count(0) 0 >>> get_set_bits_count(256)...
true
a3845d1c4997ab5729ac3d57d09b96bc3636a5be
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/DATA_STRUC_PYTHON_NOTES/python-prac/Overflow/Beginners-Python-Examples-master/algorithms/analysis/count.py
877
4.28125
4
#!/usr/bin/python # -*- coding: utf-8 -*- # Simple algorithm to count # number of occurrences of (n) in (ar) # Sudo: Algorithm # each time (n) is found in (ar) # (count) varible in incremented (by 1) # I've put spaces to separate different # stages of algorithms for easy understanding # however isn't a good practi...
true
acdb65d6e812f3f98073ac68414d41fec6da9136
bgoonz/UsefulResourceRepo2.0
/_PYTHON/DATA_STRUC_PYTHON_NOTES/WEEKS/wk17/d2/code-signal/return-index-of-string-in-list.py
894
4.375
4
# Write a function that searches a list of names(unsorted) for the name "Bob" and returns the location in the list. If Bob is not in the array, return -1. # # Examples: # # csWhereIsBob(["Jimmy", "Layla", "Bob"]) ➞ 2 # csWhereIsBob(["Bob", "Layla", "Kaitlyn", "Patricia"]) ➞ 0 # csWhereIsBob(["Jimmy", "Layla", "James"])...
true
9016bf310d2a3796cf746f8dce4bdf3eca7ff56f
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/INTERVIEW-PREP-COMPLETE/notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/_PyAlgo-Tree/Sorting/Quick Sort/quick_sort.py
2,006
4.21875
4
# Program to implement QuickSort Algorithm in Python """ This function takes last element as pivot, places the pivot element at its correct position in sorted array, and places all smaller(smaller than pivot) to left of pivot and all greater elements to right of pivot """ def partition(arr, low, high): """ ...
true
d4c4ae8d85acbc6ee1e558adf68f81ee46e5e50f
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/DATA_STRUC_PYTHON_NOTES/python-prac/leetcode/Queue_Using_Stack.py
1,397
4.4375
4
# Implement the following operations of a queue using stacks. # # push(x) -- Push element x to the back of queue. # pop() -- Removes the element from in front of queue. # peek() -- Get the front element. # empty() -- Return whether the queue is empty. # Example: # # MyQueue queue = new MyQueue(); # # queue.push(1); # q...
true
5bbce313a69a231f379074df30877d764b26835f
bgoonz/UsefulResourceRepo2.0
/GIT-USERS/TOM-Lambda/CSEUFLX_Algorithms_GP/00_demo.py
239
4.1875
4
import math radius = 3 area = math.pi * radius * radius <<<<<<< HEAD print(f'The area of the circle is {area:.3f} ft\u00b2') ======= print(f"The area of the circle is {area:.3f} ft\u00b2") >>>>>>> 23fb4d348bb9c7b7b370cb2afcd785793e3816ea
true
f920a8d5c1a3bbcb5fb2de8de1f6fc16268a2966
bgoonz/UsefulResourceRepo2.0
/_PYTHON/DATA_STRUC_PYTHON_NOTES/course-work/cs-guided-project-python-i/src/demonstration_01.py
348
4.21875
4
""" Challenge #1: Create a function that takes two numbers as arguments and return their sum. Examples: - addition(3, 2) ➞ 5 - addition(-3, -6) ➞ -9 - addition(7, 3) ➞ 10 """ def addition(a, b): # Your code here print("i am inside the function") return a + b print("this lives outside the function") pr...
true
737a88c7ed53a9bcc2ce17afb8abf4ab5a1c8ba4
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/INTERVIEW-PREP-COMPLETE/notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/_PyAlgo-Tree/Sorting/Shell Sort/shell_sort.py
1,601
4.15625
4
# Python program for implementation of Shell Sort """ Shell sort is a highly efficient sorting algorithm and is based on insertion sort algorithm. Shell sort is the generalization of insertion sort which overcomes the drawbacks of insertion sort by comparing elements separated by a gap of several positions. Shell sor...
true
5b8e3a233922c9dfe86b8d43004bdd9debfbbfb5
bgoonz/UsefulResourceRepo2.0
/_MY_ORGS/Web-Dev-Collaborative/blog-research/ciriculumn/week.16-/python-lecture/15a-input-validation1.py
350
4.15625
4
# Input Validation # - prompt # - handle empty string # - make it a number # - handle exceptions # - require valid input age = 1 while age: age = input("What's your age? ") if age: try: age = int(float(age)) print(f'Cool! You had {age} birthdays.') except: pr...
true
c378476b8691a23f63afab909e338f8f400c2f29
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/INTERVIEW-PREP-COMPLETE/Practice/QueueWithTwoStacks/model_solution.py
1,123
4.15625
4
class Queue: def __init__(self): # Stack to hold elements that get added self.inStack = [] # Stack to hold elements that are getting removed self.outStack = [] def enqueue(self, item): self.inStack.append(item) def dequeue(self): # if the outStack is empty ...
false
34ace4f7e6af7e263ba09ea7c1547a54b1dbd804
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/Lambda-Resource-Static-Assets/1-projects/lambda/LambdaSQL/LambdaSQL-master/LambdaSQL.py
998
4.125
4
import sqlite3 as sql connection = sql.connect("rpg_db.sqlite3") print( *connection.execute( """ SELECT cc.name, ai.name FROM charactercreator_character AS cc, armory_item AS ai, charactercreator_character_inventory AS cci WHERE cc.character_id = cci.character_id AND ai.item_id = cci.item_id LIMIT 10; """...
true
04556c7505ff2a77185611cf43a9796df0fd2293
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/_External-learning-resources/_PYTHON/Python-master/factorial.py
643
4.28125
4
import math def factorial(n): if n == 0: return 1 else: return n * factorial(n - 1) n = int(input("Input a number to compute the factiorial : ")) print(factorial(n)) """ Method 2: Here we are going to use in-built fuction for factorial which is provided by Python for user conveniance. Step...
true
f2d4fc82f7fda06b56265a8369998c0318b65c47
bgoonz/UsefulResourceRepo2.0
/_OVERFLOW/Resource-Store/01_Questions/_Python/enum.py
507
4.28125
4
#!/usr/bin/python # -*- coding: utf-8 -*- # Enum function # yields a tuple of element and it's index def enum(ar): for index in range(len(ar)): yield ((index, ar[index])) # Test case_1 = [19, 17, 20, 23, 27, 15] for tup in list(enum(case_1)): print(tup) # Enum function is a generator does not # ret...
true
e1707172df8425f34b1ff548061e6459fb73ae08
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/web-dev-notes-resource-site/2-content/Python/intro_programming-master/notebooks/rocket.py
991
4.25
4
from math import sqrt class Rocket: # Rocket simulates a rocket ship for a game, # or a physics simulation. def __init__(self, x=0, y=0): # Each rocket has an (x,y) position. self.x = x self.y = y def move_rocket(self, x_increment=0, y_increment=1): # Move the rocket...
true
e648a1d072498fa610f6de94960414ff7105d28e
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/Data-Structures/1-Python/strings/validate_coordinates.py
1,689
4.28125
4
"""" Create a function that will validate if given parameters are valid geographical coordinates. Valid coordinates look like the following: "23.32353342, -32.543534534". The return value should be either true or false. Latitude (which is first float) can be between 0 and 90, positive or negative. Longitude (which is s...
true
11e1edbecab930d3e1e4d95fe9fb83602849a167
bgoonz/UsefulResourceRepo2.0
/_PYTHON/DATA_STRUC_PYTHON_NOTES/course-work/cs-guided-project-python-i/src/demonstration_09.py
736
4.5
4
""" Challenge #9: Write a function that creates a dictionary with each (key, value) pair being the (lower case, upper case) versions of a letter, respectively. Examples: - mapping(["p", "s"]) ➞ { "p": "P", "s": "S" } - mapping(["a", "b", "c"]) ➞ { "a": "A", "b": "B", "c": "C" } - mapping(["a", "v", "y", "z"]) ➞ { "a"...
true
755287b03fd2fc73be13ad660015e28a119e87ca
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/Data-Structures/1-Python/maths/find_primitive_root_simple.py
2,240
4.25
4
import math """ For positive integer n and given integer a that satisfies gcd(a, n) = 1, the order of a modulo n is the smallest positive integer k that satisfies pow (a, k) % n = 1. In other words, (a^k) ≡ 1 (mod n). Order of certain number may or may not be exist. If so, return -1. """ def find_order(a, n): if...
true
4b29471c64eb3d3005ba1b7484d0fb9bf72ee325
bgoonz/UsefulResourceRepo2.0
/_PYTHON/DATA_STRUC_PYTHON_NOTES/course-work/Python-Brain-Teasers/hamming_weight.py
1,004
4.28125
4
""" Given an unsigned integer, write a function that returns the number of '1' bits that the integer contains (the [Hamming weight](https://en.wikipedia.org/wiki/Hamming_weight)) Examples: - `hamming_weight(n = 00000000000000000000001000000011) -> 3` - `hamming_weight(n = 00000000000000000000000000001000) -> 1` - `ha...
true
99d4b3a3a7bd6e1455cd7fed0e538cca41a634b1
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/_External-learning-resources/_PYTHON/Python-master/Guessing_Game.py
1,523
4.15625
4
from random import randint from time import sleep print("Hello Welcome To The Guess Game!") sleep(1) print("I'm Geek! What's Your Name?") name = input() sleep(1) print(f"Okay {name} Let's Begin The Guessing Game!") a = comGuess = randint( 0, 100 ) # a and comGuess is initialised with a random number between 0 and...
true
1fcc988f266d75b8a780b95ffa2bd64f6883aa8f
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/ciriculumn/week-17/python/Introduction-Programming-Python/Solutions/Module4MortgageCalculatorChallengeSolution.py
1,140
4.3125
4
# Declare and initialize the variables monthlyPayment = 0 loanAmount = 0 interestRate = 0 numberOfPayments = 0 loanDurationInYears = 0 # Ask the user for the values needed to calculate the monthly payments strLoanAmount = input("How much money will you borrow? ") strInterestRate = input("What is the interest rate on t...
true
610a0d008ceef29a052a5cbac5629c90cb572906
bgoonz/UsefulResourceRepo2.0
/_PYTHON/DATA_STRUC_PYTHON_NOTES/python-prac/leetcode/Binary_tree Paths.py
813
4.125
4
# Given a binary tree, return all root-to-leaf paths. # # Note: A leaf is a node with no children. # # Example: # # Input: # # 1 # / \ # 2 3 # \ # 5 # # Output: ["1->2->5", "1->3"] # # Explanation: All root-to-leaf paths are: 1->2->5, 1->3 class TreeNode: def __init__(self, x): self.val = x ...
true