blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 3.06M | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 3.06M |
|---|---|---|---|---|---|---|
d5b0d5d155c1733eb1a9fa27a7dbf11902673537 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/FunctionExercise/4.py | 1,166 | 4.1875 | 4 | # 4. Automobile Costs
# Write a program that asks the user to enter the monthly costs for the following expenses incurred from operating his or her automobile:
# loan payment, insurance, gas, oil, tires, andmaintenance.
# The program should then display the total monthly cost of these expenses,and the total annual... |
e51cbe700da1b5305ce7dfe9c1748ad3b2369690 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/Dictionaries and Sets/Sets/notes.py | 2,742 | 4.59375 | 5 | # Sets
# A set contains a collection of unique values and works like a mathematical set
# 1 All the elements in a set must be unique. No two elements can have the same value
# 2 Sets are unordered, which means that the elements are not stored in any particular order
# 3 The elements that are stored in a set can be ... |
0ce57fc5296a09864fb1e75080a20c684bceef98 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Inheritance/car_truck_suv_demo.py | 1,521 | 4.1875 | 4 | # This program creates a Car object, a truck object, and an SUV object
import vehicles
import pprint
def main():
# Create a Car object
car = vehicles.Car('Bugatti', 'Veyron', 0, 3000000, 2)
# Create a truck object
truck = vehicles.Truck('Dodge', 'Power Wagon', 0, 57000, '4WD')
# Create... |
8a747dfb6d959c1e4774543b9dd4fa42eeda228a | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Tkinter/tkinter_intro.py | 1,459 | 3.890625 | 4 | '''
GUI - a graphical user interface allows the user to interact with the operating system and other programs using
graphical elements such as icons, buttons, and dialog boxes.
In python you can use the tkinter module to create simple GUI programs
There are other GUI modules available but tkinter comes with ... |
d2e06b65113045bf009e371c53cc73750f8184a7 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Hard Stuff/Recursion/Practice/7.py | 1,181 | 4.21875 | 4 | """
7. Recursive Power Method
Design a function that uses recursion to raise a number to a power. The function should
accept two arguments: the number to be raised and the exponent. Assume that the exponent is a
nonnegative integer.
"""
# define main
def main():
# Establish vars
int1 = int... |
fafa7582c917c253c46b4e773ebe8ea1c0e84af7 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Inheritance/vehicles.py | 3,642 | 4.4375 | 4 | # The Automobile class holds general data about an auto in inventory
class Automobile:
# the __init__ method accepts arguments for the make, model, mileage, and price. It initializes the data attributes with these values.
def __init__(self, make, model, mileage, price):
self.__make = make
... |
f149ee1bf7a78720f53a8688d83d226cb00dc5eb | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Practice/Cars.py | 2,383 | 4.8125 | 5 | """
2. Car Class
Write a class named Car that has the following data attributes:
• __year_model (for the car’s year model)
• __make (for the make of the car)
• __speed (for the car’s current speed)
The Car class should have an __init__ method that accept the car’s year model ... |
eaa53c820d135506b1252749ab50b320d11d53b5 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Practice/5 - RetailItem.py | 1,427 | 4.625 | 5 | """
5. RetailItem Class
Write a class named RetailItem that holds data about an item in a retail store. The class
should store the following data in attributes: item description, units in inventory, and price.
Once you have written the class, write a program that creates three RetailItem objects
and stores the fol... |
b046b95c144bbe51ac2c77b5363814b8b5d2b5cc | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/LoopsPractice/6.py | 503 | 4.46875 | 4 | # 6. Celsius to Fahrenheit Table
# Write a program that displays a table of the Celsius temperatures 0 through 20 and theirFahrenheit equivalents.
# The formula for converting a temperature from Celsius toFahrenheit is
# F = (9/5)C + 32 where F is the Fahrenheit temperature and C is the Celsius temperature.
# You... |
6da08424b01dfcfcebb93cbeff93e76e72c53ea9 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Hard Stuff/Unit Testing and Multithreading/MultiThreading/Multithreadingclassdemo1/multithreading5.py | 950 | 3.625 | 4 | # For editing further without losing multithreading og file
'''
Prove that these are actually coming in as they are completed
Lets pass in a range of seconds
Start 5 second thread first
'''
import concurrent.futures
import time
start = time.perf_counter()
def do_something(seconds):
print(f'Sle... |
9e6bdd3adc3e850240f3c9a94dd766ecdd4abe97 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/FileExercises/9.py | 1,013 | 4.28125 | 4 | # 9. Exception Handing
# Modify the program that you wrote for Exercise 6 so it handles the following exceptions:
# • It should handle any IOError exceptions that are raised when the file is opened and datais read from it.
# Define counter
count = 0
# Define total
total = 0
try:
# Display first 5 line... |
c7576a385b6019af0393ec97ebdd0cf3c5aee69e | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Hard Stuff/Algorithms and Data Structures/collections_lecture.py | 2,840 | 3.8125 | 4 | '''
collection - a group of 0 or more items that can be treated as a conceptual unit. Things like strings, lists, tuples, dictionaries
Other types of collections include stacks, queues, priority queues, binary search trees, heaps, graphs, and bags
************** Collection Types **************... |
f1639f9b273a097c08d8e3d6236acf50befd9a99 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/regex/Practice/1.py | 285 | 3.75 | 4 | """
1. Recognize the following strings: “bat”, “bit”, “but”, “hat”,
“hit”, or “hut”.
"""
import re
string = '''
bat bit but hat hit hut
'''
pattern = re.compile(r'[a-z]{2}t')
matches = pattern.finditer(string)
for match in matches:
print(match)
|
2118efbe7e15e295f6ceea7b4a4c26696b22edb1 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Hard Stuff/Unit Testing and Multithreading/MultiThreading/Multithreadingclassdemo1/multithreading.py | 1,434 | 4.15625 | 4 | '''
RUnning things concurrently is known as multithreading
Running things in parallel is known as multiprocessing
I/O bound tasks - Waiting for input and output to be completed
reading and writing from file system, network
operations.
These all benefit... |
5c78846587a1485c8a39a77ef8f4ec10dfe0f2bb | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Test Stuff/First Test/study/knowledge_lists_and_tuples.py | 3,523 | 4.15625 | 4 | """
Multiple Choice
1. This term refers to an individual item in a list.
a. element
b. bin
c. cubby hole
d. slot
2. This is a number that identifies an item in a list.
a. element
b. index
c. bookmark
d. identifier
3. This is the... |
f1923bf1fc1a3ab94a7f5d32c929cd6914fc7605 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Test Stuff/First Test/shapes1.py | 2,305 | 4.25 | 4 | class GeometricObject:
def __init__(self, color = "green", filled = True):
self.color = color
self.filled = filled
def getColor(self):
return self.color
def setColor(self, color):
self.color = color
def isFilled(self):
... |
cd2b8237503c74dfc7864dd4ec64d7f334c9ecb0 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Practice/8 - trivia.py | 2,521 | 4.4375 | 4 | """
8. Trivia Game
In this programming exercise you will create a simple trivia game for two players. The program will
work like this:
• Starting with player 1, each player gets a turn at answering 5 trivia questions. (There
should be a total of 10 questions.) When a question is displayed,... |
2ae55026f82e336bd28809f87822da12d2a8f0a6 | Hackman9912/PythonCourse | /NetworkStuff/09_NetworkingExtended/Practice/04 Modules/04-5.py | 679 | 4.03125 | 4 | '''
### Working With modules ( sys, os, subprocess, argparse, etc....)
5. Create a script that will accept a single integer as a positional argument, and will print a hash symbol that amount of times.
'''
import os
import sys
import time
import subprocess
import argparse
def get_arguments():
parser = argparse.Ar... |
1658b421c637ec8ab3524446baccd8f30da4470c | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/Lists/tuples.py | 394 | 4.25 | 4 | # tuples are like an immutable list
my_tuple = (1, 2, 3, 4, 5)
print(my_tuple)
# printing items in a tuple
names = ('Holly', 'Warren', 'Ashley')
for n in names:
print(n)
for i in range(len(names)):
print (names[i])
# Convert between a list and a tuple
listA = [2, 4, 5, 1, 6]
type(... |
8b72f14467bc40821bc0fb0c7c2ad9f05be58cd0 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Inheritance/Practice/Inheritance Exercises - 3.py | 2,460 | 4.46875 | 4 | """
3. Person and Customer Classes
Write a class named Person with data attributes for a person’s name, address, and
telephone number. Next, write a class named Customer that is a subclass of the
Person class. The Customer class should have a data attribute for a customer
number and a Boolean da... |
ab93e5065c94a86f8ed6c812a3292100925a1bb5 | Hackman9912/PythonCourse | /Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/IfElsePractice/5.py | 1,575 | 4.4375 | 4 | # 5. Color Mixer
# The colors red, blue, and yellow are known as the primary colors because they cannot be
# made by mixing other colors. When you mix two primary colors, you get a secondary color,
# as shown here:
# When you mix red and blue, you get purple.
# When you mix red and yellow, you get orange.
# When ... |
5a57c7b45ccb3df1adb3ebad30f2a4d2defba1d7 | stephaniecheng1124/CIS-01 | /InClassB.py | 941 | 3.984375 | 4 | # Stephanie Cheng
# CIS 41B Spring 2019
# In-class assignment B
# Problem B1
#
# This program writes a script to perform various basic math and string operations.
def string_count():
name = raw_input("Please enter your name: ")
print(name.upper())
print(len(name))
print(name[3])
name2 = nam... |
d2d9ad0905e398f8509b6ad6e70f59ee578f0adc | stephaniecheng1124/CIS-01 | /InClassC.py | 871 | 3.6875 | 4 | # Stephanie Cheng
# CIS 41B Spring 2019
# In-class assignment C
# Problem C1
#
#List Script
from copy import deepcopy
def list_script():
list1 = [2, 4.1, 'Hello']
list2 = list1
list3 = deepcopy(list1)
print("list1 == list2: " + str(list1==list2))
print("list1 == list3: " + str(list1==list3)... |
1821805f1bd83a8add850ac70f9ad17bf5a27431 | shaamimahmed/MITx---6.00.1x | /BFS.py | 700 | 3.859375 | 4 | class node():
def __init__(self,value,left,right):
self.value = value
self.left = left
self.right = right
def __str__(self):
return self.value
def __repr__(self):
return 'Node {}'.format(self.value)
def main():
g = node("G", None, None)
h = node("H", None, None)
i = node("... |
1b2a7905075802782b7f57df0b08520ee13aaea4 | shaamimahmed/MITx---6.00.1x | /recursion.py | 730 | 3.828125 | 4 | def iterPower(base, exp):
'''
base: int or float.
exp: int >= 0
returns: int or float, base^exp
'''
total= base
if exp == 0:
total = 1
for n in range(1, exp):
total *= base
return total
def recurPower(base, exp):
'''
base: int or float.
exp: int >= 0
... |
890f3be1a967335d2aa8f3c4d31a5c5d33626428 | Kediel/DataScienceFromScratch | /chapter5.py | 1,230 | 3.53125 | 4 | # Statistics
from collections import defaultdict, Counter
num_friends = [100,49,41,40,25,21,21,19,19,18,18,16,15,15,15,15,14,14,13,13,13,13,12,12,11,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,8,8,8,8,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,6... |
47332606f558cc9927e5f1d415dde6ce2ddfbf6d | smpss97058/c109156217 | /4-2D座標判斷及計算離原點距離.py | 860 | 3.84375 | 4 | x=int(input("X軸座標:"))
y=int(input("Y軸座標:"))
a=0
if x>0:
if y>0:
a=x**2+y**2
print("該點位於第一象限,離原點距離為根號"+str(a))
elif y<0:
a=x**2+y**2
print("該點位於第四象限,離原點距離為根號"+str(a))
else:
a=x**2+y**2
print("該點位於X軸上,離原點距離為根號"+str(a))
if x<0:
if y>0:
a=x**2+y**2
... |
77acd1d223437c765fa54b6c2148332653bbe731 | smpss97058/c109156217 | /32新公倍數.py | 252 | 3.71875 | 4 | n=int(input("輸入一整數:"))
while n<11 or 1000<n:
n=int(input("輸入一整數(11<=n<=1000):"))
if n%2==0 and n%11==0:
if n%5!=0 and n%7!=0:
print(str(n)+"為新公倍數?:Yes")
else:
print(str(n)+"為新公倍數?:No") |
fcf81e26402c78334170997fe6b6f4f98807d47e | elizamakkt1218/CSVFileCombination | /main.py | 4,241 | 4.03125 | 4 | import tkinter as tk
from tkinter.filedialog import askdirectory
import csv
import os
import utilities
absolute_file_paths = []
def get_file_path():
"""
Prompts user to select the folder for Combining CSV files
:parameter: None
:return: The relative paths of all files contained in the folder
:ex... |
dc1bbcc31eb28b89d15dac95bf107b5627667593 | JianyanLiang/SkyDrive | /Server/查看当前用户.py | 149 | 3.609375 | 4 | import sqlite3
conn = sqlite3.connect('Users.db')
cur = conn.cursor()
sql = 'select * from users'
cur.execute(sql)
print(cur.fetchall())
a = input()
|
d63f59488d65ba81d647da41c15424a0901d18b4 | DimitrisMaskalidis/Python-2.7-Project-Temperature-Research | /Project #004 Temperature Research.py | 1,071 | 4.15625 | 4 | av=0; max=0; cold=0; count=0; pl=0; pres=0
city=raw_input("Write city name: ")
while city!="END":
count+=1
temper=input("Write the temperature of the day: ")
maxTemp=temper
minTemp=temper
for i in range(29):
av+=temper
if temper<5:
pl+=1
if temper>maxTe... |
bafeb62820714891cf4f2082f45487e8d3db63a0 | treylitefm/euler | /misc-algos/tictactoe.py | 1,605 | 3.65625 | 4 | #arr = [['x','x','x'],['o','o','x'],['x','o','o']]
#rr = [['x','o','x'],['o','o','o'],['x','o','o']]
#arr = [['x','o','x'],['o','x','o'],['x','o','x']]
#arr = [['a','o','x'],['b','x','o'],['c','o','x']]
arr = [['a','b','g'],['d','g','f'],['g','h','i']]
def print_grid(grid):
for row in grid:
print row
def... |
7592ee5998b54cc6e7b4f7773c45e960d0b1e80c | viniciuskurt/LetsCode-PracticalProjects | /2-AdvancedStructures/Inserindo_Novo_Valor_Lista.py | 313 | 3.53125 | 4 | # podemos inserir novos valores através do METODO INSERT
cidades = ['São Paulo', 'Brasilia', 'Curitiba', 'Avaré', 'Florianópolis']
print(cidades)
cidades.insert(0, 'Osasco')
print(cidades)
# Inserido vários valores
cidades.insert(1, 'Bogotá');
print(cidades)
cidades.insert(4, 'Manaus')
print(cidades)
|
0e878016fadab1f137f3dd61c37197ecafa4511e | viniciuskurt/LetsCode-PracticalProjects | /2-AdvancedStructures/Listas_com_While.py | 438 | 4.09375 | 4 | # Uma forma inteligente de trabalhar é combinar Listas com Whiles
numeros = [1, 2, 3, 4, 5] #Criando e atribuindo valores a lista
indice = 0 #definindo contador no índice 0
while indice < 5: #Definindo repetição do laço enquanto menor que 5
print(numeros[indice]) #Exibe p... |
4d1e19c830d0f41e51c4837a8792b8a054ee6655 | viniciuskurt/LetsCode-PracticalProjects | /1-PythonBasics/aula04_Operadores.py | 1,578 | 4.40625 | 4 | '''
OPERADORES ARITMETICOS
Fazem operações aritméticas simples:
'''
print('OPERADORES ARITMÉTICOS:\n')
print('+ soma')
print('- subtração')
print('* multiplicacao')
print('/ divisão')
print('// divisão inteira') #não arredonda o resultado da divisão, apenas ignora a parte decimal
print('** potenciação')
print('% resto... |
298f3dd303082910f64b333d378934a1184f2694 | viniciuskurt/LetsCode-PracticalProjects | /1-PythonBasics/Laco_Rep_Loop_Infinito.py | 534 | 4.09375 | 4 | """
Laço de repetição com loop infinito e utilizando break
NÃO É RECOMENDADO UTILIZAR ESSA FORMA.
"""
contador = 0
# while contador < 10:
while True: # criando loop infinito
if contador < 10: # se a condição passar da condição, é executado tudo de novo
contador = contador + 1
if contador == 1:
... |
e2f5debc42e10a689eeb1836901ce285481da9ce | viniciuskurt/LetsCode-PracticalProjects | /1-PythonBasics/Validacao_Entrada.py | 207 | 3.984375 | 4 | # Exemplo básico de validação de senha de acesso
texto = input("Digite a sua entrada: ")
while texto != 'LetsCode':
texto = input("Senha inválida. Tente novamente\n")
print('Acesso permitido') |
5a008394476ccf00e21f8de67622c2c683f933fc | maxicraftone/informatics | /shortest_path.py | 13,569 | 4.15625 | 4 | #!/usr/bin/python
import math
import time
import sys
class Node:
def __init__(self, name: str) -> None:
"""
Node class. Just holds the name of the node
:param name: Name/ Title of the node (only for representation)
"""
self.name = name
# Set string representation of no... |
8faa0216ee950c7fbfd1dec6cb28a47d9c5aff7f | DCTyxx/opencv_study | /class25_分水岭算法.py | 2,272 | 3.53125 | 4 | #分水岭变换
#基于距离变换
#分水岭的变换 输入图像->灰度化(消除噪声)->二值化->距离变换->寻找种子->生成Marker->分水岭变换->输出图像->end
import cv2 as cv
import numpy as np
def watershed_demo():
print(src.shape)
blurred = cv.pyrMeanShiftFiltering(src,10,100)#边缘保留滤波
gray = cv.cvtColor(src,cv.COLOR_BGR2GRAY)
ret,binary = cv.threshold(gray,0,255,cv.THRE... |
9bf5a15c654b19ab6457ad83a3d0a763bb301892 | wangyunge/algorithmpractice | /eet/Restore_IP_Addresses.py | 1,293 | 3.90625 | 4 | '''
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
For example:
Given "25525511135",
return ["255.255.11.135", "255.255.111.35"]. (Order does not matter)
Subscribe to see which companies asked this question
Show Tags
'''
class Solution(object):
def res... |
e8116a0ec63ed32ab24c42650a5e9c51789b5cd8 | wangyunge/algorithmpractice | /int/389_Valid_Sudoku.py | 858 | 3.890625 | 4 | '''
Determine whether a Sudoku is valid.
The Sudoku board could be partially filled, where empty cells are filled with the character ..
Notice
A valid Sudoku board (partially filled) is not necessarily solvable. Only the filled cells need to be validated.
Have you met this question in a real interview? Yes
Clarifi... |
79db945c27a3797a29b9de46201352fa9e4f0a1b | wangyunge/algorithmpractice | /int/110_Minimum_Path_Sum.py | 888 | 3.859375 | 4 | '''
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Notice
You can only move either down or right at any point in time.
Have you met this question in a real interview? Yes
'''
class Solution:
"""
@param gri... |
352bf4ce999b1f9d03c6b96f79e8cdbb2f7230bf | wangyunge/algorithmpractice | /int/98_Sorted_List.py | 1,324 | 3.953125 | 4 | '''
Sort a linked list in O(n log n) time using constant space complexity.
Have you met this question in a real interview? Yes
Example
Given 1->3->2->null, sort it to 1->2->3->null.
'''
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next... |
1bd27fbaa4aa4a3017d24929b4698cf48c3c1dbb | wangyunge/algorithmpractice | /int/82_Single_Number.py | 476 | 3.65625 | 4 | '''
Given 2*n + 1 numbers, every numbers occurs twice except one, find it.
Have you met this question in a real interview? Yes
Example
Given [1,2,2,1,3,4,3], return 4
'''
class Solution:
"""
@param A : an integer array
@return : a integer
"""
def singleNumber(self, A):
res = 0
for ... |
6e34a6e1dcf7b985b56e0b928a27b284d0c96c99 | wangyunge/algorithmpractice | /eet/Best_Time_to_Buy_and_Sell_Stock_IV.py | 1,809 | 4.0625 | 4 | '''
Say you have an array for which the i-th element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most k transactions.
Note:
You may not engage in multiple transactions at the same time (ie, you must sell the stock before you buy again).
Example 1:
Inpu... |
ea76677bfc6bfc1c602ddd530ccc593258bd27c0 | wangyunge/algorithmpractice | /eet/01_Matrix.py | 526 | 4 | 4 | """
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.
The distance between two adjacent cells is 1.
Example 1:
Input:
[[0,0,0],
[0,1,0],
[0,0,0]]
Output:
[[0,0,0],
[0,1,0],
[0,0,0]]
Example 2:
Input:
[[0,0,0],
[0,1,0],
[1,1,1]]
Output:
[[0,0,0],
[0,1,0],
[1,2,1]]
""... |
431e4b3687f6e41381331f315f13108fc029d396 | wangyunge/algorithmpractice | /eet/Check_Completeness_of_a_Binary_Tree.py | 1,354 | 4.21875 | 4 | """
Given the root of a binary tree, determine if it is a complete binary tree.
In a complete binary tree, every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between 1 and 2h nodes inclusive at the last level h.
Example 1:
Input:... |
d9cdb986d5d7d796156e0ef1cc51c21cd096f9b7 | wangyunge/algorithmpractice | /eet/Longest_Increasing_Path_in_a_Matrix.py | 3,306 | 4.125 | 4 | """
Given an integer matrix, find the length of the longest increasing path.
From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outside of the boundary (i.e. wrap-around is not allowed).
Example 1:
Input: nums =
[
[9,9,4],
[6,6,8],
[2,1,1]
]
O... |
597bdffceea740761f6280470d81b9deaf73f400 | wangyunge/algorithmpractice | /int/517_Ugly_Number.py | 926 | 4.125 | 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. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.
Notice
Note that 1 is typically treated as an ugly number.
Have you met this ... |
6ae3a55543601626d59949db457edce81a02b2b9 | wangyunge/algorithmpractice | /eet/Add_Two_Numbers_II.py | 1,225 | 4.03125 | 4 | """
You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Fo... |
53b1b4043d4949f1aec2b18d909993cc049772e8 | wangyunge/algorithmpractice | /cn/572.py | 978 | 3.890625 | 4 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def isSubtree(self, s, t):
"""
:type s: TreeNode
:type t: TreeNode
... |
2e3a39178816c77f9f212cb1629a8f17950da152 | wangyunge/algorithmpractice | /int/171_Anagrams.py | 692 | 4.34375 | 4 | '''
Given an array of strings, return all groups of strings that are anagrams.
Notice
All inputs will be in lower-case
Have you met this question in a real interview? Yes
Example
Given ["lint", "intl", "inlt", "code"], return ["lint", "inlt", "intl"].
Given ["ab", "ba", "cd", "dc", "e"], return ["ab", "ba", "cd", ... |
f99cf09f6bdb40dd270f2a7845f6aa530f614795 | wangyunge/algorithmpractice | /eet/Find_K_Pairs_with_Smallest_Sums.py | 1,749 | 3.875 | 4 | """
You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k.
Define a pair (u,v) which consists of one element from the first array and one element from the second array.
Find the k pairs (u1,v1),(u2,v2) ...(uk,vk) with the smallest sums.
Example 1:
Input: nums1 = [1,7,11], nums2... |
cbc345e64aaa1883a5626e834e998addae622309 | wangyunge/algorithmpractice | /int/488_Happpy_Number.py | 979 | 3.78125 | 4 | '''
Write an algorithm to determine if a number is happy.
A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle ... |
14e00c017aa35b3d0901ec3b9f83bf5d51c345be | wangyunge/algorithmpractice | /cn/234.py | 653 | 3.671875 | 4 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
stack = []
cu... |
1f4cd6fa5f100f5fec1f7ebcadf8eb99dbf09fe6 | wangyunge/algorithmpractice | /eet/Counting_Bits.py | 1,765 | 3.765625 | 4 | """
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.
Example 1:
Input: 2
Output: [0,1,1]
Example 2:
Input: 5
Output: [0,1,1,2,1,2]
Follow up:
It is very easy to come up with a solution with r... |
c730b160e62fd19ed56a4dbd8740dceed38583c2 | wangyunge/algorithmpractice | /eet/Android_Unlock_Patterns.py | 1,583 | 4 | 4 | """
我们都知道安卓有个手势解锁的界面,是一个 3 x 3 的点所绘制出来的网格。用户可以设置一个 “解锁模式” ,通过连接特定序列中的点,形成一系列彼此连接的线段,每个线段的端点都是序列中两个连续的点。如果满足以下两个条件,则 k 点序列是有效的解锁模式:
解锁模式中的所有点 互不相同 。
假如模式中两个连续点的线段需要经过其他点,那么要经过的点必须事先出现在序列中(已经经过),不能跨过任何还未被经过的点。
以下是一些有效和无效解锁模式的示例:
无效手势:[4,1,3,6] ,连接点 1 和点 3 时经过了未被连接过的 2 号点。
无效手势:[4,1,9,2] ,连接点 1 和点 9 时经过了未被连接过的 5 ... |
1ae166cb04757e11a8ca03fe3c83cbd2e3c602f1 | wangyunge/algorithmpractice | /int/106_Convert_Sorted_List_to_Balanced_BST.py | 1,193 | 3.890625 | 4 | '''
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
Have you met this question in a real interview? Yes
Example
2
1->2->3 => / \
1 3
'''
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=No... |
3e5582033c67af1213ba003cff4b3095dabb15b5 | wangyunge/algorithmpractice | /eet/Lowest_Common_Ancestor_of_a_Binary_Tree.py | 2,220 | 4.0625 | 4 | """
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itse... |
854d5d19c39b60ed8b67150778a4bb015918c88b | wangyunge/algorithmpractice | /eet/Nth_Digit.py | 852 | 3.9375 | 4 | """
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...
Note:
n is positive and will fit within the range of a 32-bit signed integer (n < 231).
Example 1:
Input:
3
Output:
3
Example 2:
Input:
11
Output:
0
Explanation:
The 11th digit of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9... |
e39cd00b68b6eff21de3d1b8364de609b687a309 | wangyunge/algorithmpractice | /int/392_House_Robber.py | 1,002 | 3.625 | 4 | '''
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken int... |
e3ee7499abf955e0662927b7341e93fa81843620 | wangyunge/algorithmpractice | /eet/Arithmetic_Slices.py | 960 | 4.15625 | 4 | """
An integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.
For example, [1,3,5,7,9], [7,7,7,7], and [3,-1,-5,-9] are arithmetic sequences.
Given an integer array nums, return the number of arithmetic subarrays of nums.
A ... |
6c899e296237b144ba623fbbab473202cd0410ca | wangyunge/algorithmpractice | /eet/Insertion_Sorted_List.py | 887 | 3.9375 | 4 | '''
Sort a linked list using insertion sort.
'''
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def insertionSortList(self, head):
"""
:type head: ListNode
:rtype: ListNode... |
36039a9ac17ee24da100aebe9dd7b00cd17ab7f3 | wangyunge/algorithmpractice | /eet/Palindrome_Partitioning_II.py | 1,029 | 3.859375 | 4 | """
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
Example 1:
Input: s = "aab"
Output: 1
Explanation: The palindrome partitioning ["aa","b"] could be produced using 1 cut.
Example 2:
Input: s = "a"
Output... |
9735ec4ad9479d0b9fe83a05b0f7a597d2b0ddd7 | wangyunge/algorithmpractice | /int/408_Add_Binary.py | 1,126 | 3.671875 | 4 | '''
Given two binary strings, return their sum (also a binary string).
Have you met this question in a real interview? Yes
Example
a = 11
b = 1
Return 100
'''
class Solution:
# @param {string} a a number
# @param {string} b a number
# @return {string} the result
def addBinary(self, a, b):
lo... |
9495b0f644bec8ff8727429271b3b4ffd1f11bbc | wangyunge/algorithmpractice | /int/426_Restore_IP_Address.py | 1,307 | 3.875 | 4 | '''
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
Have you met this question in a real interview? Yes
Example
Given "25525511135", return
[
"255.255.11.135",
"255.255.111.35"
]
Order does not matter.
'''
class Solution:
# @param {string} s the IP st... |
6eb1182dc9674ff9514f860b80c6eacaa3b54487 | wangyunge/algorithmpractice | /eet/Recover_Binary_Search_Tree.py | 3,165 | 3.8125 | 4 | '''
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n) space is pretty straight forward. Could you devise a constant space solution?
Subscribe to see which companies asked this question
Show Tags
'''
# Definition for a binar... |
3859966faca648ffe0b7e83166049c07676ba93b | wangyunge/algorithmpractice | /eet/Maximum_Units_on_a_Truck.py | 2,304 | 4.125 | 4 | """
You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]:
numberOfBoxesi is the number of boxes of type i.
numberOfUnitsPerBoxi is the number of units in each box of the type i.
You are also given an integer truckSize... |
fd3f8f5c834978e65253411de28c9177994120f9 | wangyunge/algorithmpractice | /int/186_Max_Points_on_a_Line.py | 1,782 | 3.609375 | 4 | '''
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
Example
Given 4 points: (1,2), (3,6), (0,0), (1,3).
The maximum number is 3.
'''
# Definition for a point.
# class Point:
# def __init__(self, a=0, b=0):
# self.x = a
# self.y = b
class Solutio... |
76c084094d90c838b553d1e58b78252f55852e3d | wangyunge/algorithmpractice | /eet/Contiguous_Array.py | 893 | 4.0625 | 4 | """
Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.
Example 1:
Input: [0,1]
Output: 2
Explanation: [0, 1] is the longest contiguous subarray with equal number of 0 and 1.
Example 2:
Input: [0,1,0]
Output: 2
Explanation: [0, 1] (or [1, 0]) is a longest contiguous s... |
181bd6428a741980af6e7ce9d2947b88a579cc8e | wangyunge/algorithmpractice | /eet/Pairs_of_Songs_With_Total_Durations_Divisible_by_60.py | 1,133 | 3.8125 | 4 | """
You are given a list of songs where the ith song has a duration of time[i] seconds.
Return the number of pairs of songs for which their total duration in seconds is divisible by 60. Formally, we want the number of indices i, j such that i < j with (time[i] + time[j]) % 60 == 0.
Example 1:
Input: time = [30,20... |
e8f4d5ca11f339e1fa8c13b85ae55e7de66c0bcd | wangyunge/algorithmpractice | /int/73_Construct_Binary_Tree_from_Preorder_and_Inorder_Travesal.py | 1,895 | 3.921875 | 4 | '''
Given preorder and inorder traversal of a tree, construct the binary tree.
Notice
You may assume that duplicates do not exist in the tree.
Have you met this question in a real interview? Yes
Example
Given in-order [1,2,3] and pre-order [2,1,3], return a tree:
2
/ \
1 3
'''
"""
Definition of TreeNode:
clas... |
d620071842e6003015b2a9f34c72b85a64e00a04 | wangyunge/algorithmpractice | /eet/Multiply_Strings.py | 1,183 | 4.125 | 4 | """
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.
Example 1:
Input: num1 = "2", num2 = "3"
Output: "6"
Example 2:
Input: num1... |
b956afb98967e9ca2fb6c320bcd360691e20b9f0 | wangyunge/algorithmpractice | /cn/29.py | 558 | 3.546875 | 4 | class Solution(object):
def divide(self, dividend, divisor):
"""
:type dividend: int
:type divisor: int
:rtype: int
"""
sign = 1 if dividend * divisor > 0 else -1
divisor = abs(divisor)
dividend = abs(dividend)
def _sub(res):
x = di... |
bdfc9caa3090f7727fd227548a83aaf19bf66c14 | wangyunge/algorithmpractice | /eet/Unique_Binary_Search_Tree_II.py | 1,269 | 4.25 | 4 | '''
Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should return all 5 unique BST's shown below.
1 3 3 2 1
\ / / / \ \
3 2 1 1 3 2
/ / ... |
9eba4c97143250a68995688a62b41145ab39485f | wangyunge/algorithmpractice | /int/165_Merge_Two_Sorted_Lists.py | 944 | 4.125 | 4 | '''
Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the nodes of the two lists and sorted in ascending order.
Have you met this question in a real interview? Yes
Example
Given 1->3->8->11->15->null, 2->null , return 1->2->3->8->11->1... |
1ed697d41f7a62305a2bb7d82c3e945e47ac65b4 | wangyunge/algorithmpractice | /int/167_Add_Two_Numbers.py | 894 | 3.859375 | 4 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param l1: the first list
# @param l2: the second list
# @return: the sum list of l1 and l2
def addLists(self, l1, l2):
# write your code here
... |
a1e44328e89eccd44eccdf0f5bcad629ac9c4688 | wangyunge/algorithmpractice | /cn/445.py | 1,087 | 3.640625 | 4 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"... |
8bbc714ce6bbf0420e2d320b0f9bccef01187ae8 | wangyunge/algorithmpractice | /eet/First_Unique_Character_in_a_String.py | 771 | 3.859375 | 4 | """
Given a string, find the first non-repeating character in it and return its index. If it doesn't exist, return -1.
Examples:
s = "leetcode"
return 0.
s = "loveleetcode"
return 2.
Note: You may assume the string contains only lowercase English letters.
"""
class Solution(object):
def firstUniqChar(self,... |
c09cd743358e384ed520289eb8c09dab719ca8b3 | wangyunge/algorithmpractice | /int/101_Remove_Duplicates_from_Sorted_Array.py | 543 | 3.859375 | 4 | '''
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is now [1,1,2,2,3].
'''
class Solution:
"""
@param A: a list of integers
@return an integer
"""
def removeDuplicates... |
47de9e81d4e95399dc6113ca3522b8f968f8e44d | wangyunge/algorithmpractice | /eet/86_Binary_Search_Tree_Iterator.py | 1,280 | 3.90625 | 4 | '''
Design an iterator over a binary search tree with the following rules:
Elements are visited in ascending order (i.e. an in-order traversal)
next() and hasNext() queries run in O(1) time in average.
Have you met this question in a real interview? Yes
Example
For the following binary search tree, in-order traversal ... |
e1e3e1744e5e347e72bfcedaa53c873c09ad25f4 | wangyunge/algorithmpractice | /int/120_Word_Ladder.py | 1,302 | 3.796875 | 4 | '''
Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:
Only one letter can be changed at a time
Each intermediate word must exist in the dictionary
Notice
Return 0 if there is no such transformation sequence.
All words have the same le... |
7f5784b154c1472c0df8058521a96fa1233f257f | wangyunge/algorithmpractice | /eet/301_Remove_Invalid_Parentheses.py | 536 | 4.03125 | 4 | """
Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.
Return all the possible results. You may return the answer in any order.
Example 1:
Input: s = "()())()"
Output: ["(())()","()()()"]
Example 2:
Input: s = "(a)())()"
Output... |
3bd025a7c52e92aedca526c54a1beeb5895a0a3e | wangyunge/algorithmpractice | /eet/Reverse_Linked_List_II.py | 2,241 | 4.09375 | 4 | '''
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.
Subscribe to see which companies asked this question
Show Tags
Show Simi... |
9438d60a669a59fd1aa3f1d0d43ee3dc3c67f072 | wangyunge/algorithmpractice | /eet/Add_and_Search_Word.py | 2,265 | 4.03125 | 4 | '''
Design a data structure that supports the following two operations:
void addWord(word)
bool search(word)
search(word) can search a literal word or a regular expression string containing only letters a-z or .. A . means it can represent any one letter.
For example:
addWord("bad")
addWord("dad")
addWord("mad")
sea... |
3f35390e3175f4c4d33e169a5078781b12ad839d | wangyunge/algorithmpractice | /cn/450.py | 1,530 | 3.953125 | 4 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def deleteNode(self, root, key):
"""
:type root: TreeNode
:type key:... |
ae968f7561fab037f39dba5e47eb745058a1ba24 | UchihaSean/ReinforcementLearningForDialogue | /bleu.py | 1,534 | 3.703125 | 4 | # -*- coding: UTF-8 -*-
import csv
import numpy as np
def evaluation_bleu(eval_sentence, base_sentence, n_gram=2):
"""
BLEU evaluation with n-gram
"""
def generate_n_gram_set(sentence, n):
"""
Generate word set based on n gram
"""
n_gram_set = set()
for i in ran... |
133a87b450bcdb2cf9374d11cba74108cca68358 | seanws2/Using-search-to-operate-robot-arm | /mp2-code/template/search.py | 2,311 | 3.796875 | 4 | # search.py
# ---------------
# Licensing Information: You are free to use or extend this projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to the University of Illinois at Urbana-Champaign
#
# Created... |
45dd8e0c59db48f7f557a9d084454d9fe00da97e | egill12/machine_learning | /dataset/document/generate_trend.py | 1,306 | 3.640625 | 4 | '''
Author: Ed Gill
This is a process to return a randomly generated series of numbers.
change alpha from -0.2 to 0.2 to move from mean reversion to strong trend.
'''
import numpy as np
import pandas as pd
from create_model_features import trends_features
def generate_trend(n_samples, alpha, sigma):
'''
:retu... |
168300928e12bcc8b469a010346a5632e2e98041 | JDOsborne1/Advent-of-code | /Day2/Puzzle1.py | 1,354 | 3.796875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 2 11:05:09 2018
@author: Joe
"""
# Puzzle 1
## Get the checksum
## Data import
#%% dictonary link for individual letter
alphanum = {'a':1,
'b':2,
'c':3,
'd':4,
'e':5,
'f':6,
'g':7,
... |
6988fe01eceba6c5f8bdba8dee341cdf6022f4b7 | iuliaL/dna_sequencing | /De_Bruijn_Graph.py | 799 | 3.84375 | 4 | def buildDeBruijnGraph(string, k):
""" Return a list holding, for each k-mer, its left
(k-1)-mer and its right (k-1)-mer in a pair """
edges = []
nodes = set()
for i in range(len(string) - k + 1):
curr_kmer = string[i:i+k]
left = curr_kmer[:-1]
right = curr_kmer[1:]
... |
8552f778aaf03e105a5d42e2e5421ec3acd522cd | cSquaerd/ccDiceSumming | /ccDiceSumming.py | 7,375 | 3.796875 | 4 | # Imports
import numpy as np
import matplotlib.pyplot as plot
# Recursively calculates how many ways to roll a value from a list of dice
def ways(value : int, diceCount : int, dice : list) -> int:
if value < 1 or diceCount < 1:
return 0
elif diceCount == 1:
return int(value <= dice[0])
else:
return sum(
way... |
7f262c239659a7bc67048b7d88ad9890d6592260 | 9aa9/tabling | /tabling.py | 730 | 3.5625 | 4 | '''
$ Email : huav2002@gmail.com'
$ Fb : 99xx99'
$ PageFB : aa1bb2
'''
def TABLING(lines):
num = len(max(lines))
nums = [0 for i in range(num)]
for line in lines:
for a in range(len(line)):
if len(line[a]) > nums[a]:nums[a] = len(line[a])
for a in range(len(lines)):
lines[a]... |
4022746f6eea714070df77e4d463a166801f3566 | alexanderankin/CSV-SQL-Import-Scripts | /create_counts_table.py | 1,473 | 3.625 | 4 | #!/usr/bin/python3
"""
This will produce a table definition from the length count matrix
"""
from sqlalchemy.dialects import mysql
from sqlalchemy.schema import CreateTable
from sqlalchemy import Table, Column, String, MetaData
import fileinput
import sys
import csv
def main():
table_name = 'import'
if len(s... |
87ef927974942deb7d3140c57200e281ceaa389e | manh100004104234761/otodochoi | /findpath.py | 7,576 | 3.703125 | 4 | from math import sqrt
def getPossibleX(points):
set_x = set()
for point in points:
set_x.add(point[0])
return set_x
def getPossibleY(points):
set_y = set()
for point in points:
set_y.add(point[1])
return set_y
def findStartingAngle(start_point, next_point):
if start_point[0]... |
c0e2797affe5d5bfde8219c5ef6ee717af281169 | tasver/python_course | /lab5_1.py | 125 | 4.0625 | 4 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
import sys
print("Enter your number: ")
num = int(input())
print(not(num&num-1))
|
f70962dff39951264b72468373fadb78663ea583 | tasver/python_course | /lab9_4.py | 1,905 | 4.0625 | 4 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
def input_number() -> int:
"""This function returns input number"""
number = input('Enter your number: ')
return number
def input_rome_number() -> str:
"""This function returns input rome number"""
number = input('Enter your rome number: ')
return n... |
ba2b9d296a98edfb414c89aba262142b031014ea | tasver/python_course | /lab7_4.py | 782 | 4.375 | 4 |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
def input_str() -> str:
""" This function make input of string data"""
input_string = str(input('Enter your string: '))
return input_string
def string_crypt(string: str) -> str:
""" This function make crypt string"""
result_string = str()
string = string.lower()
for ... |
c79e8895e05e1640469fb9d4ea21fbbf11f01262 | tasver/python_course | /lab8_1.py | 747 | 3.59375 | 4 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
def input_number() -> list:
""" This function make input of your data"""
number_step = []
number_step.append(input('Enter soldiers number: '))
number_step.append(input('Enter step killing: '))
return number_step
def killing_soldiers(number_step:list) -> int:
number, s... |
611f5ff5305ad4db517bb39313296f77acd0b773 | tasver/python_course | /lab17_tests.py | 430 | 3.75 | 4 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
import unittest
import math
def formula(a:float, b:float)-> float:
x = (math.sqrt(a*b))/(math.e**a * b) + a * math.e**(2*a/b)
return x
def output(x:float) -> str:
print(x)
class tests(unittest.TestCase):
def test_equal_first(self):
self.assertEqual(formula(0,1),0.0)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.