blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
702584ed74adaed2ef1e0a57ceb246c04bce294d | DharaniMuli/PythonAndDeepLearning | /ICPs/ICP-2/LbToKg_2.py | 406 | 3.96875 | 4 | #This is the another way to convert Lb to Kg
moredata= "yes"
weights_lb = []
weights_kg = []
while moredata[0] == 'y':
x = int(input("Enter student weights(lbs) >> "))
weights_lb.append(x)
moredata= input("Do u have more numbers(yes or no)? ")
print("Student weights list in Lbs ",weights_lb)
weights_k... |
54c7355dfa908b0d9a047bd7d844dedc027018a5 | PrimeJaken/Labwork2 | /logger.py | 968 | 3.5 | 4 | class tracer(object):
def __init__(self, func):
self.calls = 0
self.func = func
self.args = 0
self.res = dict()
self.name = self.func.__name__
def __call__(self, *args):
self.calls += 1
self.args = args
if self.res.get(str(self.args)):
return self.res[str(self.args)]
else:
self.res[str(self... |
d3513a0acfa17419f19ccb6b80997f2b1a43cdb6 | Sreyorn/Hacktoberfest2019 | /beginner/python/DrawPie.py | 587 | 3.640625 | 4 | import math
import turtle
def draw_pie(t,n,r):
polypie(t,n,r)
t.pu()
t.fd(r*2+10)
t.pd()
def polypie(t,n,r):
angle=360/n
for i in range(n):
isosceles(t,r,angle/2)
t.lt(angle)
def isosceles(t,r,angle):
y=r*math.sin(angle*math.pi/180)
t.rt(angle)
t.fd(r)
t.lt(90+ang... |
4a99e066ea16ba62275964bb78ff1e1819b99b76 | ankitsejwal/codeclub | /moonhack-2018/classes.py | 4,681 | 3.984375 | 4 | class solarSystem:
"""
A solar system
Attributes:
planets: a list of planet objects
"""
def __init__(self):
self.planets = []
def addPlanet(self, planet):
self.planets.append(planet)
# Returns planet object or False if planet not found
def getPlanet(self, name):
for plane... |
df79f1a4a72a30fe40de567859db42fbb44e8f5d | echedgy/prg105fall | /3.3 Nested Ifs.py | 1,247 | 4.21875 | 4 | package = input("Which package do you have? (A, B, C): ")
print("You entered Package " + package)
minutes_used = int(input("How many minutes did you use this month? "))
package_price = 0.0
if package == "A" or package == "a":
package_price = 39.99
if minutes_used > 450:
additional_minutes = min... |
93746c4f02729852c13d04b1de64a729a6a07dd8 | echedgy/prg105fall | /11.2 Production Worker.py | 816 | 4.28125 | 4 | # Once you have written the classes, write a program that creates an object of the ProductionWorker class and prompts
# the user to enter data for each of the object’s data attributes.
# Store the data in the object and then use the object’s accessor methods to retrieve it and display it on the screen.
import employ... |
112a19946aef220606d17f2f547e67a58da7da03 | echedgy/prg105fall | /2.3 Ingredient Adjuster.py | 1,089 | 4.46875 | 4 | # A cookie recipe calls for the following ingredients:
# 1.5 cups of sugar
# 1 cup of butter
# 2.75 cups of flour
# The recipe produces 48 cookies with this amount of ingredients. Write a program that asks the user
# how many cookies they want to make, and then displays the number of cups
# (to two decimal places... |
d6a093095c5dabe5a319e43b5ae15da2d577cd9b | echedgy/prg105fall | /10.2 Trivia Game.py | 1,723 | 3.890625 | 4 | import questions
import random
def main():
q1 = questions.question("What year did the Beatles make it big in america? ", "A. 1965", "B. 1945", "C, 1956",
"D, 1964")
q2 = questions.question("Which famous musician from the Beatles was murdered in 1980? ", "A. Ringo Starr",
... |
baf6b418adefa1c8f6a97c05d1d59eb1db357506 | echedgy/prg105fall | /8.1 initials.py | 270 | 4.0625 | 4 | def main():
name = input("Enter in your First, Middle and last name: ")
initials = ""
name_list = name.split()
print(name_list)
for part in name_list:
initials = initials + part[0:1].upper() + ", "
print(initials)
main()
|
f7fcab5036fcd12fa693f2accd5e97bb807912e1 | deeptik19/Python-for-everybody-assignments | /Homework1-DeeptiKulkarni.py | 894 | 3.65625 | 4 | # -*- coding: utf-8 -*-
"""
Created on: Thu Aug 23 19:50:12 2018
@author: Deepti Kulkarni
"""
# Chapter 2: Exercise 3: Write a program to prompt the user for hours and rate per hour to compute gross pay.
x= float(input('Enter Hours: '))
y=float(input('Enter Rate: '))
print('Pay: ',x*y)
# Chapter 2:Exercise 5: Wr... |
08e291f0d7343d98f559e10755ac64ebf74d652c | varaste/Practice | /Python/PL/Python Basic-Exercise-6.py | 1,064 | 4.375 | 4 | '''
Python Basic: Exercise-6 with Solution
Write a Python program which accepts a sequence of comma-separated numbers
from user and generate a list and a tuple with those numbers.
Python list:
A list is a container which holds comma separated values (items or elements)
between square brackets where items or e... |
6fdf3e5c757f7de27c6afb54d6728116d9f3ae55 | varaste/Practice | /Python/PL/Python Basic-Exercise-4.py | 553 | 4.3125 | 4 | '''
Write a Python program which accepts the radius of a circle from the user and
compute the area.
Python: Area of a Circle
In geometry, the area enclosed by a circle of radius r is πr2.
Here the Greek letter π represents a constant, approximately equal to 3.14159,
which is equal to the ratio of the circumf... |
0173ae9e82213f4f01ccc6239a152b7ad0c5f8ad | varaste/Practice | /Python/PL/Python tkinter widgets-Exercise-8.py | 756 | 4.21875 | 4 | '''
Python tkinter widgets: Exercise-8 with Solution
Write a Python GUI program to create three single line text-box to accept a
value from the user using tkinter module.
'''
import tkinter as tk
parent = tk.Tk()
parent.geometry("400x250")
name = tk.Label(parent, text = "Name").place(x = 30, y = 50)
ema... |
285451e05017f8598ff68eb73ae537ca2e0922a5 | varaste/Practice | /Python/PL/Python Basic-Exercise-27-28-29.py | 1,554 | 4.1875 | 4 | '''
Python Basic: Exercise-27 with Solution
Write a Python program to concatenate all elements in a list into a string and return it.
'''
def concat(list):
output = ""
for element in list:
output = output + str(element)
return output
print(concat([1, 4, 0, 0,"/" , 0, 7,"/" ,2, 0]))
... |
94bbe2bc4bdc534ae92f2f175268bf07273350f0 | varaste/Practice | /Python/Udemy - 100 Python Exercises Evaluate and Improve Your Skills/14,15,16,17,18,19,20,21.py | 529 | 3.609375 | 4 | #14
a = ["1", 1, "1", 2]
a = list(set(a))
print(a)
#15
varaste = {
"a" : 1,
"b" : 2
}
print(varaste)
sina = dict(a = 1, b = 2)
print(sina)
#16
print(sina["b"])
#17
d = {"a": 1, "b": 2, "c": 3}
print(d["a"] + d["b"] + d["c"])
#18
# NULL
#19
d = {"a": 1, "b": 2}
d["3"] = 3
d["4"]... |
0ed76e4bb935107504ffed0f3b77804d7f42cdc2 | varaste/Practice | /Python/PL/Python tkinter widgets-Exercise-7.py | 688 | 4.21875 | 4 | '''
Python tkinter widgets: Exercise-7 with Solution
Write a Python GUI program to create a Text widget using tkinter module.
Insert a string at the beginning then insert a string into the current text.
Delete the first and last character of the text.
'''
import tkinter as tk
parent = tk.Tk()
# create the ... |
de7d37e10b3538f878333b414d4ba6f08d25a0e1 | varaste/Practice | /Python/Udemy - 100 Python Exercises Evaluate and Improve Your Skills/36.py | 187 | 3.65625 | 4 | def fileWordsCount():
wordsFile = open("file.txt", "r")
wordsFileList = wordsFile.read().split(" ")
print(len(wordsFileList))
print(wordsFile.read())
fileWordsCount() |
47135e9a16367ee94342542223e88f6d305cd6b0 | varaste/Practice | /Python/PL/Python Basic-Exercise-23.py | 591 | 3.84375 | 4 |
'''
Python Basic: Exercise-23 with Solution
Write a Python program to get the n (non-negative integer) copies of the first
2 characters of a given string.
Return the n copies of the whole string if the length is less than 2.
'''
def copy2(inpot_string, n):
if len(inpot_string) < 2:
p_inpot_str... |
5cf804a53226b8b756c2baf740677cc1963c802c | varaste/Practice | /Python/Jadi Go To Class/Test2/ElIf.py | 1,160 | 3.796875 | 4 | my_list=[ 2.3, 'car', 12, 46, 'cat']
if 12 in my_list:
print('hello')
elif 6 > 4:
print('bye')
else:
print('nothing')
if 6/2:
print('three')
elif 5 :
print('five')
else:
print('zero')
if False:
print('false')
elif 2**3 == 8 :
print('true')
else:
print('none'... |
b4e51eb5d91933dc93425dcb883c9bc90466786e | knightartorias98/py-problems | /pset1/linearSearch.py | 185 | 3.6875 | 4 | def simpleSearch(ls,num):
for i in range (len(ls)):
if ls[i] == num:
return i
return -1
test_list = [1,2,3,4,5,6]
x = 6
print(simpleSearch(test_list,6))
|
36219e6ed5840b3b7cdf4af2bce4e5cfe9228ac4 | michalkasiarz/automate-the-boring-stuff-with-python | /web-scraping/seleniumModule.py | 962 | 3.71875 | 4 | from selenium import webdriver
# Selenium module
# setting up a driver
browser = webdriver.Firefox()
# navigating to a webpage
browser.get("https://www.automatetheboringstuff.com")
# finding chapter 0
elem = browser.find_element_by_css_selector(".main > div:nth-child(1) > ul:nth-child(20) > li:nth-child(1) > a:nth... |
3604cfb0531dd9798b43facc91326533df969594 | michalkasiarz/automate-the-boring-stuff-with-python | /lists/multipleAssignmentSwap.py | 261 | 4.21875 | 4 | # Multiple assignment - swap
a = "AAA" # a is AAA
b = "BBB" # b is BBB
print("a is " + a)
print("b is " + b)
print()
# swap
a, b = b, a # a is now b, i.e. a = BBB, and b = AAA
print("a is " + a) # a is BBB
print("b is " + b) # b is AAA
|
d7794bdb69d5574d4e067c8d6a1c3fd0be450132 | michalkasiarz/automate-the-boring-stuff-with-python | /functions/plusOne.py | 266 | 3.84375 | 4 | # Plus one func example
def plus_one(num):
return num + 1
newNumber = plus_one(5)
print(newNumber)
print("Hello", end=" ") # end= changes the default newline character
print("Some text.")
print("Odysek", "Parysek", "Koteu", "Pieseu", sep=" GO TEXAS! ")
|
57a1f44950afe2c517988da9246a871cfe22f83a | michalkasiarz/automate-the-boring-stuff-with-python | /regular-expressions/usingDotStartPattern.py | 224 | 3.796875 | 4 | import re
# using .* pattern, which basically means: anything
nameRegex = re.compile(r"First Name: (.*) Last Name: (.*)")
mo = nameRegex.findall("First Name: John Last Name: Kowalski")
print(mo) # [('John', 'Kowalski')]
|
897a1b3f11bc3f0352e61ed6802094bd6c341729 | michalkasiarz/automate-the-boring-stuff-with-python | /regular-expressions/usingQuestionMark.py | 499 | 4.125 | 4 | import re
# using question mark -> for something that appears 1 or 0 times (preceding pattern)
batRegex = re.compile(r"Bat(wo)?man")
mo = batRegex.search("The Adventures of Batman")
print(mo.group()) # Batman
mo = batRegex.search("The Adventures of Batwoman")
print((mo.group())) # Batwoman
# another example with ... |
9393e65692d8820d71fdda043da48ec33658b467 | michalkasiarz/automate-the-boring-stuff-with-python | /dictionaries/dataStructures.py | 686 | 4.125 | 4 | # Introduction to data structure
def printCats(cats):
for item in cats:
print("Cat info: \n")
print("Name: " + str(item.get("name")) +
"\nAge: " + str(item.get("age")) +
"\nColor: " + str(item.get("color")))
print()
cat = {"name": "Parys",... |
e34244f4eee0f75b6bb45a4774b298534fc172af | MrClement/MSSecondDay | /vramsey.py | 28,866 | 3.890625 | 4 | def do_something():
x = 3
y = 2
print('This malware brought to you by Mediocre Electronics')
while(y<=10000):
x = x*2
y = y+1
print x
def Bonobo():
bonobo = raw_input('What would you like')
if(bonobo=="go to amazon"):
print("do I look like a freaking computer.")
Bonobo()
if(b... |
c31aa899fc95b764e9c10e1de8d38a92803aed3c | StepMaster/SPL1 | /Hello-World.py | 196 | 3.921875 | 4 | # Hello World mit python
name = input ("What's your name?")
print ("Hello World!",name)
alter=input("How old are you?")
print("This year you are ", alter)
print("Next year you are ",int(alter)+1) |
c795f6ac170f96b398121ddbbc9a22cf13835061 | AshwinBalaji52/Artificial-Intelligence | /N-Queen using Backtracking/N-Queen_comments.py | 2,940 | 4.125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 1 00:42:23 2021
@author: Ashwin Balaji
"""
class chessBoard:
def __init__(self, dimension):
# board has dimensions dimension x dimension
self.dimension = dimension
# columns[r] is a number c if a queen is placed at row r and column ... |
cd744ed352c4240d96c66d9a884f5e1dad31229a | AshwinBalaji52/Artificial-Intelligence | /Missionaries and cannibals/MCP.py | 6,080 | 3.828125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 1 13:08:11 2021
@author: AshwinBalaji
"""
class Position():
def __init__(self, leftCannibal, leftMissionary, boat, rightCannibal, rightMissionary):
self.leftCannibal = leftCannibal
self.leftMissionary = leftMissionary
self.boat = boat
self.rightCannibal ... |
fe782fef8d652f885443e43c65137b2314992b91 | Lulq/Sistema-HEN | /testes.py | 2,333 | 3.515625 | 4 | import matplotlib.pyplot as plt
#parte 1 - plotando os gráficos de desenvolvimento segundo o artigo de referência
indice = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 18, 24, 36, 48, 60]
macho = [61.7, 67.6, 71.5, 74.9, 77.4, 79.5, 81.1, 82.4, 83.8, 84.9, 86.3, 87.1, 88.0, 90.4, 92.9, 97.0, 98.9, 100]
femea = [63.2, ... |
dee277547fa6e80610a419c7285ff2074e0078cf | tejadeep/Python_files | /tej_python/basics/add.py | 287 | 4.28125 | 4 | #program by adding two numbers
a=10
b=20
print"%d+%d=%d"%(a,b,a+b) #this is one method to print using format specifiers
print"{0}+{1}={2}".format(a,b,a+b) #this is one method using braces
#0 1 2
print"{1}+{0}={2}".format(a,b,a+b) # here output is 20+10=30
|
1f2a00103705ad6391966dee070b43ab99f6f491 | tejadeep/Python_files | /tej_python/basics/functions/t1.py | 334 | 3.671875 | 4 | class god:
a=10
def __init__(self,name,marks):
print name
print marks
self.name="hariiii"
self._marks=30
self.__roll=220
print self.name
print self._marks
print self.__roll
print "helllooooo"
obj=god("tej",56)
#obj.name=50
print "*******************************"
print obj.name
print obj._marks
#pri... |
b146c41874fb7e4f7bc6c0a8a6b6a0a3df06deae | tejadeep/Python_files | /tej_python/basics/p5.py | 361 | 4.09375 | 4 | #analysing a dictionaries
tej={'name':'tejadeep','ID':'1091','dept':'embedded'}
print tej #it will print entire data
print tej['ID']
print "1st name is " +tej['name']
print tej.keys() #it will print keys ie.,name,id,dept
print tej.values() #it will print values ie.,tejadeep,1091,embedded
#entire data will print i... |
39be8ba4330d77ee29f20ad5dca6ea7e999f8319 | RiRiFangRui/Python-100-Days | /Day01-15/code/Day04/n的阶乘.py | 321 | 3.65625 | 4 | """
输入非负整数n计算n!
Version: 0.1
Author: 骆昊
Date: 2018-03-01
"""
n = int(input('n = '))
result = 1
for x in range(1, n + 1):
result *= x
print('%d! = %d' % (n, result))
n = int(input('please enter integer: '))
j = 1
for i in range(1, n+1):
j = i*j
print(j)
总结:range(1,n+1) 才能加到n
|
fc95d5637c74368ce27df3223a2e8c9f4f6f809f | anwerammar12/turnover | /DL_model.py | 1,905 | 3.984375 | 4 | #Step 1 — Data Pre-processing
import pandas as pd
import numpy as np
df = pd.read_csv('HR_comma_sep.csv')
feats = ['sales','salary']
df_final = pd.get_dummies(df,columns=feats,drop_first=True)#converting the feats from categorical to numerical variables
#Step 2 — Separating Your Training and Testing Datasets
fro... |
4aefe9c7e1a659692b82337c433a970686566952 | andrewkittredge/ai_class_stuff | /queens.py | 8,307 | 3.609375 | 4 | '''
********************************************************************************
**** queens.py: Implementations of the 8 queens problem stating ****
**** that it is possible to place 8 queens on a chess ****
**** board so that no queen can take another. ... |
0ddac05ddceaa96fc1a31d35d43e91bedd70dc8e | dannikaaa/100-Days-of-Code | /Beginner Section/Day2-BMI-Calulator.py | 418 | 4.3125 | 4 | #Create a BMI Calculator
#BMI forumula
#bmi = weight/height**2
height = input("Enter your height in m: ")
weight = input("Enter your weight in kg: ")
#find out the type of height & weight
#print(type(height))
#print(type(weight))
#change the types into int & float
int_weight = int(weight)
float_height = float(hei... |
93f369d4261fa68564a4cbb841168cc60a33b2dc | alexsalr/geo-scripting-wur | /project/download_files.py | 435 | 3.59375 | 4 | import zipfile, urllib2
from os import path, remove
## Function to download required files and unpack them to the data folder
def downloadData(url, foldername):
response = urllib2.urlopen(url)
zipcontent = response.read()
filename = path.basename(url)
with open(filename, 'w') as f:
f.write(zipcontent)
zip... |
2c36c65ec38d2c8a3806e962804ec927353d0be4 | v0001/python_jw | /Basic/repeat test/repear test_exam5 copy.py | 789 | 4.1875 | 4 | # 삼각형의 밑변의 길이와 높이를 입력받아 넓이를 출력하고, "Continue? "에서 하나의 문자를 입력받아 그 문자가 'Y' 나 'y' 이면 작업을 반복하고 다른 문자이면 종료하는 프로그램을 작성하시오.
# (넓이는 반올림하여 소수 첫째자리까지 출력한다.)
# a = 'y'
# while(a.upper() == 'Y'):
# # b = input().strip().split()
# # Base = int(b[0])
# # Height = int(b[1])
# Base = int(input("Base = "))
# Heig... |
a90caf7314671e68732ffb6bdbac0ef273681484 | akashbhalotia/College | /Python/Assignment1/008.py | 235 | 3.59375 | 4 | # WAP to find the sum of squares of first N natural numbers.
# Can also use the formula: N(N+1)(2N+1)/6
def sumOfSquares(N):
s = 0
for i in range(1, N + 1):
s += i * i
return s
val = 4
print(sumOfSquares(val))
|
3fd9c30f76f11696abac88e60cc1ce28c212b729 | akashbhalotia/College | /Python/Assignment1/012.py | 554 | 4.25 | 4 | # WAP to sort a list of tuples by second item.
# list1.sort() modifies list1
# sorted(list1) would have not modified it, but returned a sorted list.
def second(ele):
return ele[1]
def sortTuples(list1):
list1.sort(key=second)
inputList = [(1, 2), (1, 3), (3, 3), (0, 3), (3, 5), (7, 2), (5, 5)]
print('Input... |
ccfb70797b1f8af6b9a2508f99d01d0f08531ce2 | rahuldshetty/Hybrid-3DES-RC4 | /WorkingTDES/utility.py | 448 | 3.53125 | 4 | def str2bin(string,fill=0):
text=list(map(ord,string))
binVal=""
for i in text:
f = [int(x) for x in "{0:b}".format(i)]
f="".join([str(x) for x in f]).zfill(fill)
binVal+=f
return binVal
def bin2str(binString,read=8):
blocks=[binString[i:i+read] for i in ra... |
afbf1542adeab2a479d49b274f4f7fa92b51af3f | nabilatajrin/competitive-programming | /LeetCode-solutions/medium/arrays-and-strings/longest-substring-without-repeating-characters.py | 626 | 3.921875 | 4 | Given a string s, find the length of the longest substring without repeating characters.
Example 1:
Input: s = "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
Example 2:
Input: s = "bbbbb"
Output: 1
Explanation: The answer is "b", with the length of 1.
Example 3:
Input: s = "pwwkew"
Outp... |
78c660338b9d366909a4afc43e01c694d67c0406 | nabilatajrin/competitive-programming | /LeetCode-solutions/easy/tree/100-same-tree.py | 770 | 3.84375 | 4 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
#The "proper" way:
def isSameTree(self, p, q):
if p and q:
return p.val == q.val ... |
c52de657a3ae4643f627703138e86bc03d8383dc | momentum-cohort-2019-02/w3d3-oo-pig-yyapuncich | /pig.py | 2,594 | 4.15625 | 4 | import random
class ComputerPerson:
"""
Computer player that will play against the user.
"""
def __init__(self, name, current_score=0):
"""
Computer player will roll die, and automatically select to roll again or hold for each turn. They will display their turn totals after each tu... |
74efb4c243126b35142961456f4a54ffaf03346c | tariqmusa/python-concepts | /Assignments/PythonAdvanced/Assignment_2.py | 375 | 3.921875 | 4 | # Assignment 2 - Generate given output using comprehension
def create_dict_from_lists(l1, l2):
# your code here. remove the line "pass" from this function once you add your code
pass
if __name__ == '__main__':
# Lists to represent keys and values
keys = ['a','b','c','d','e']
values = [1,2... |
34b3eb538a51e648aa3c9ffd2cf7fd221dda61e9 | felipemesina/CompareLists | /comparelists.py | 190 | 3.9375 | 4 |
def compare(list_one, list_two):
if list_one == list_two:
print "The lists are the same"
else:
print "The lists are not the same"
compare([1,2,5,6,2],[1,2,5,6,2])
|
a13391b9f158491b2b23e4dec2117727977a6fbd | fumarela/kids | /test/upisi_2_broja_i_zbroji.py | 356 | 3.625 | 4 |
# prvi broj - sve sto ima hash simbol na pocetku linije je komentar
a=int(input("upisi neki broj"))
b=int(input("upisi drugi broj"))
zbroj=a+b
print("zbroj ta dva broja je",zbroj)
razlika=a-b
print("razlika ta dva broja je",razlika)
kolicnik=a/b
print("kolicnik ta dva broja je",kolicnik)
umnozak=a*b
print("... |
d9b87ad56c810a913240afd6387f20a32778b2be | fumarela/kids | /spanish_words/for_petlja.py | 1,117 | 3.53125 | 4 | import string, sys
# prvi nacin
with open('lista_rijeci.txt', "r") as file:
file_as_list = file.readlines()
# readlines() cita doslovno liniju, zajedno sa newline charom.
# file_as_list ['lijevo:desno\n', 'Hola:Hello\n']
print("file_as_list", file_as_list)
for line in file_as_list:
# line = baca newl... |
70df2fe7082338a9325ae85d317ef6d500345cc6 | Konan97/pythonProject | /generateparentheses.py | 702 | 3.84375 | 4 | # given n pairs of parentheses, write a function to generate all combination of well formed parentheses.
# ex: input = 3
# output = ["((()))", "(()())", "(())()", "()(())", "()()()"]
# 1, ()
# 2, (()), ()()
# 4, (((())))), ((()())), (())(()), ()()(()), ()(())(), (())()(),
# ()((())), ((()))(), ()()()()
input = 3 # 5
o... |
d8841176453a3973cef6e64722161f958914ff67 | Konan97/pythonProject | /maxproductwordlength.py | 707 | 4.03125 | 4 | # maximum product of word lengths
# given a string array words, return the maximum value of length(word[i]) * length(word[j]) where
# the two words do not share common letters.
from collections import defaultdict
words = ["abcw", "baz", "foo", "bar", "xtfn", "abcdef"]
def maxproductwordlength():
nocommon = defau... |
6f3889ba6dbf71c6401a744761e664511f4a56cb | gkhnoisgtht/projects | /book/fizzbuzz/fizzbuzz.py | 250 | 3.78125 | 4 | def mod3(x):
return ((x % 3) == 0)
def mod5(x):
return ((x % 5) == 0)
def mod15(x):
return mod3(x) and mod5(x)
for i in range(1, 100):
if mod15(i):
print "FizzBuzz"
elif mod3(i):
print "Fizz"
elif mod5(i):
print "Buzz"
else:
print i |
e280bea93b7faf139abb79e2922efb5c88986641 | EsraaM0hamed/Python | /Assignments/Lab1/Lab_two.py | 346 | 3.921875 | 4 |
import unittest;
word=input("Please Enter Word: ");
letter=input("PLease Enter Letter: ")
def lab_two(word,letter):
res=[];
for w,char in enumerate(word):
if char==letter:
res.append(w);
return res;
print(lab_two(word,letter))
... |
0cfb4bb46b81d6361e69ab5c73e87c0d809c4d53 | EsraaM0hamed/Python | /Assignments/Lab1/Lab_four.py | 649 | 3.84375 | 4 |
def calcArea(shape):
if shape=="r":
w=float(input("Enter width: "));
h=float(input("Enter Height: "));
area=w*h;
print(area);
elif shape=="c":
r=float(input("enter Radius: "));
area=2*r*r;
print(area);
elif shape=="t":
... |
3e0f47ea1ba3d98113dc99641caeca47b67b347e | EsraaM0hamed/Python | /Assignments/Lab2/Lab_one.py | 3,385 | 3.578125 | 4 | import re;
class Person:
def __init__(self,name,salary,mood,healthRate):
self.name=name;
self.salary=salary;
self.mood=('Happy','tired','Lazy');
self.healthRate=healthRate;
def buy(self,itemNum):
if itemNum==1:
self.salary-=25;
... |
285a567e333f6ce45f9252d0ba8a38c730017a49 | anesta95/Statistics_in_Python | /Statistics_Fundamentals_Sampling.py | 35,557 | 4.03125 | 4 | import pandas as pd
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
#1. INTRODUCTION
#In previous courses, we learned to perform basic data analysis and data
#visualization.
#We learned about some fundamental statistical metrics like the mean or the median,
#and we plotted histograms, ... |
a4a11f7041d8c615bd3fb4f1eb9f1449275eb1ae | anesta95/Statistics_in_Python | /Multi_Category_Chi_squared_tests.py | 11,043 | 3.71875 | 4 | #!/home/anesta95/.virtualenvs/Stats/bin/python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import chisquare
from scipy.stats import chi2_contingency
# 1. MULTIPLE CATEGORIES
income = pd.read_csv('income.csv')
# In the last mission, we looked at the gender frequencies ... |
c828e34f6dce0c66c994efd1352c6994c1db2284 | anesta95/Statistics_in_Python | /Mobile_App_for_Lottery_Addition.py | 17,901 | 4 | 4 | import pandas as pd
# A medical institute that aims to prevent and treat gambling addictions wants to
# build a dedicated mobile app to help lottery addicts better estimate their chances of winning.
# The institute has a team of engineers that will build the app,
# but they need us to create the logical core of ... |
7f737cdc52b1c52dea37705c117807f0c8ad545d | ericwangg/cse_coursework | /cse2050_python_ood_and_data-structures/Lab/Lab 06_ Implementing SortedList using Python List Starter Code/Starter Code/sortedlist.py | 4,122 | 3.734375 | 4 | class SortedList:
def __init__(self, L = [], cmpIn = None):
self._L = L
self._cmp = cmpIn
self.ctComparisons = 0
self.selectionSort()
# Selection sort provided to you
def selectionSort(self):
self.ctComparisons = 0
for i in range(len(self._L)):
mi... |
a5e54fa82adfb7b27704ef94ddb41554cd419c91 | dengas-khan/rohs | /Game.py | 472 | 3.578125 | 4 | import random
import player
def gain_devotion(player):
x = input('Enter which devotion to gain: ')
elements = [player.devotion1, player.devotion2]
if x in elements:
player.x = player.x + 1
return player.x
else:
return gain_devotion()
def main():
x = ran... |
4cc7df20838e25ebd525a0872975566979604fa2 | non-friends/CSV2JSON | /csvfinal.py | 2,039 | 3.921875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: Bryan .
@Bryan .
Made with love by Bryan .
==================================
DESC:
Will return the parsed CSV file given as
a python dict or JSON. This is meant to be
read and has functions that you may use in
other projects.
============================... |
6495e5770b1082082c083a1703bbdc9751f06482 | gimmizz/Data-Structure-Algorithm | /Programmers/Python/정렬_H-Index.py | 467 | 3.578125 | 4 | import re
def solution(citations):
answer = 0
citations.sort()
for h in range(citations[-1], -1, -1):
if h in citations:
cursor = citations.index(h)
else:
for i in range(len(citations)):
if citations[i] >= h:
cursor = i
... |
3f31b50a18c3804b732917fe0c51ca9a031b6f96 | harrymunro/Analysis | /regression.py | 1,583 | 3.5 | 4 | """
Created on Thu Dec 15 10:40:11 2016
@author: harrymunro
Takes a dataframe as input from a csv file organised as a standard tabular spreadsheet.
Creates a numpy array from required columns and transforms data for implementation in sklearn.
Option to do linear regression (X on Y) for two variables.
Option to do lin... |
48ac65657968af71a82a5206fa5ea2e4887f0d61 | alfonsogmar/DAI-UGR | /P1/ejercicios/ej3.py | 1,277 | 3.875 | 4 | """
Alfonso García Martínez
Desarrollo de Aplicaciones para Internet
Práctica 0
Ejercicio 3
La Criba de Eratóstenes es un sencillo algoritmo que permite
encontrar todos los números primos menores de un número natural dado. Prográmelo.
"""
import math
from itertools import compress
def eratosthenes_sieve(n):
... |
841d9d950df0be424f41110044c77465e32c75bb | ZakirovRail/GB_Python_Faculty | /1_quarter/Python_basic/Basic_course_Lesson_7/test.py | 569 | 3.875 | 4 | matrix_list = [[31, 22, 15], [37, 43, 18], [51, 86, 26]]
def print_matrix_list(matrix_list):
for row in range(len(matrix_list)):
for number in range(len(matrix_list[row])):
print('{:5d}'.format(matrix_list[row][number]), end="")
print()
print_matrix_list(matrix_list)
# def printMat... |
61ab97ec0dc7c9822c41516798d768831c4fd2d3 | ZakirovRail/GB_Python_Faculty | /1_quarter/Python_Algos_alexey_petrenko/Lesson_3/HW_3/task_5_max_negativ_number.py | 1,269 | 3.75 | 4 | import random
# LENGTH = 15
# START = -101
# STOP = -1
#
# neg_list = [random.randint(START, STOP) for i in range(LENGTH)]
# print(neg_list)
#
# max_num = START
# min_num = int
#
# for i in neg_list:
# if i > max_num:
# max_num = i
# # print(max_num)
# print(f'The max num in the list is: {max_num} ... |
4d18f46a29fd6dc0aea20c6edfb887862084b2c2 | ZakirovRail/GB_Python_Faculty | /1_quarter/Python_Algos_alexey_petrenko/Lesson_6/HW_6/03_revers_min_max.py | 729 | 3.78125 | 4 | # В массиве случайных целых чисел поменять местами минимальный и максимальный элементы.
import random
from sum_memory_2 import sum_memory
SIZE = 10
MIN_ITEM = -100
MAX_ITEM = 100
array = [random.randint(MIN_ITEM, MAX_ITEM) for _ in range(SIZE)]
print(array)
idx_min = 0
idx_max = 0
for i in range(len(array)):
i... |
10acda48e124a1de9ed342e17e4987b5f766e39e | ZakirovRail/GB_Python_Faculty | /1_quarter/Python_basic/Basic_course_Lesson_1/Basic_course_Lesson_1_5_HW_Rail_Zakirov.py | 1,310 | 4.28125 | 4 | """
5. Запросите у пользователя значения выручки и издержек фирмы. Определите, с каким финансовым результатом работает
фирма (прибыль — выручка больше издержек, или убыток — издержки больше выручки). Выведите соответствующее сообщение.
Если фирма отработала с прибылью, вычислите рентабельность выручки (соотношение приб... |
54c94a35853182a9803110cda8e11b5bb5c918de | ZakirovRail/GB_Python_Faculty | /1_quarter/Python_Algos_alexey_petrenko/Lesson_2/HW_2/task_9_max_sum_.py | 497 | 3.890625 | 4 | BASE = 10
def sum_digits(number):
if number < BASE:
return number
return number % BASE + sum_digits(number // BASE)
num = int(input('Enter natural number. The zero is exit'))
max_sum = 0
max_num = 0
while num != 0:
spam_num = num
spam_sum = sum_digits(num)
if spam_num > max_sum:
... |
eb590b0bae1a19ef167dca656de2a065a8b6e147 | ZakirovRail/GB_Python_Faculty | /1_quarter/Python_Algos_alexey_petrenko/Lesson_7/HW_7/task_1_improved_bubble_sort.py | 462 | 3.9375 | 4 | import random
START = -100
STOP = 99
BASE = 10
arr = [random.randint(START, STOP) for i in range(BASE)]
print(f'original list is {arr}')
def reverse_bubble_sort(some_list):
n = 1
while n < len(some_list):
for i in range(len(some_list) - 1):
if some_list[i] < some_list[i + 1]:
... |
d7a48ae670d23be563e366954a019493f919da19 | ZakirovRail/GB_Python_Faculty | /1_quarter/Python_basic/Basic_course_Lesson_4/Basic_course_Lesson_4_3_HW_Rail_Zakirov.py | 475 | 4.03125 | 4 | """
3) Для чисел в пределах от 20 до 240 найти числа, кратные 20 или 21. Необходимо решить задание в одну строку.
Подсказка: использовать функцию range() и генератор.
"""
# list_numbers = [i for i in range(20, 240) if (i % 20 == 0 or i % 21 == 0)]
# print(list_numbers)
# Solution from teacher
print([x for x in range... |
b91fa84d9b4c884a9352139ac4f13742ef577212 | ZakirovRail/GB_Python_Faculty | /1_quarter/Python_basic/Basic_course_Lesson_3/Basic_course_Lesson_3_2_HW_Rail_Zakirov.py | 1,294 | 4.34375 | 4 | """
2) Реализовать функцию, принимающую несколько параметров, описывающих данные пользователя: имя,
фамилия, год рождения, город проживания, email, телефон. Функция должна принимать параметры как именованные аргументы.
Реализовать вывод данных о пользователе одной строкой.
"""
# def user_data(name, surname, birth_yea... |
1b3778562130f696a40b1fe719b377958601c739 | ZakirovRail/GB_Python_Faculty | /1_quarter/Python_Algos_alexey_petrenko/Lesson_5/task_1.py | 784 | 3.671875 | 4 | from collections import Counter
a = Counter()
b = Counter('abrakadabra')
c = Counter({'cats': 10, 'dogs': 5})
print(a, b, c, sep='\n')
print(b['z'])
b['z'] = 3
# **************************************************
print('*'*50)
print(b) # Counter({'a': 5, 'z': 3, 'b': 2, 'r': 2, 'k': 1, 'd': 1})
print(b.most_common... |
b6d518a4d5c829045cc4b19c1a0630422cf38050 | SwethaVijayaraju/Python_lesson | /Assignments/Loops/Biggest number divisible.py | 522 | 4.25 | 4 | #write a function that returns the biggest number divisible by a divisor within some range.
def biggest(num1,num2,divisor):
bignum=None
while num1<=num2:
if (num1%divisor)==0:
bignum=num1
num1=num1+1
return bignum
print(biggest(1,10,2)) #answer should be 10
#write a function that returns the biggest nu... |
d8f21efa392b08610f8a18262c71b0d9f2034e4a | SwethaVijayaraju/Python_lesson | /Assignments/Conditions/Hogwarts sorting.py | 459 | 3.671875 | 4 | student = "harry"
def house(student):
if student == "ron" or student == "harry":
return "Griffindor"
elif student == "Draco":
return "Slytherin"
elif student == "Penelope":
return "Ravenclaw"
elif student == "Cedric":
return "Hufflepuff"
else:
return "unknow... |
0c303b2ae10529b5cfa2ec2e5896c5b6d7507303 | SwethaVijayaraju/Python_lesson | /Assignments/Loops/Palindrome.py | 549 | 4.15625 | 4 | # check if the given string is palindrome or not #a="swetha" then a[0] equals 's'
def reverse(word):
length = len(word)
final = ""
for a in word:
final = final + word[length - 1]
length = length - 1
return final
def palindrome(word):
return word == reverse(word)
print(palindrome... |
b7cdff128ff40762e373beddcd9bd3f95afbf5a8 | Nebrok/Physics-Simulator | /Grav_Function.py | 888 | 3.515625 | 4 | import math
def gravforce(gravobx, gravoby, objectx, objecty, gravobmass):
x_diff = gravobx - objectx
y_diff = gravoby - objecty
mag = math.sqrt(x_diff**2 + y_diff**2)
x_force = x_diff/mag * (gravobmass/1000)
y_force = y_diff/mag * (gravobmass/1000)
if objectx < gravobx:
... |
3a160588ec768a4c94929f6c4f8e0174af9946b5 | gkabbe/MiniPython | /15.11.2016/4_bool.py | 2,846 | 4.15625 | 4 | """Boolesche Ausdrücke und if-Statements
Bisher waren unsere Programme noch recht simpel gestrickt und waren nicht in der Lage, mehr als ein
gewöhnlicher Taschenrechner zu machen.
Hier wird nun gezeigt, wie man ein Programm schreibt, das gewissermaßen Entscheidungen treffen kann,
d.h. auf unterschiedliche Situationen ... |
ea4127a1823824961d5a5892a1cf0dec14930aa0 | AyeniTrust/python-for-everybody | /Python Data Structures/Chapter 8/Assignment 8.5.py | 389 | 3.875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 16 09:25:10 2017
@author: atse
"""
file = input('Please enter file name:')
handle = open(file)
count = 0
for line in handle:
line = line.rstrip()
if not line.startswith('From '):
continue
line = line.split()
print(line[1])
count = count+1
print('T... |
b94ba87215cf59b39e1fcc95a3bd1fd640e68308 | zelti/python | /number_guess.py | 991 | 3.71875 | 4 | import random
def playAgain():
again = str(input('¿Quieres volver a jugar?[s/n] =>'))
if(again == 's'):
run()
elif(again == 'n'):
return
else:
playAgain()
def needHelp(attempts, number, number_random):
attempts += 1
if(attempts >= 2):
attempts = 0
stg = 'menor'
if(number > number_random):
st... |
98f770ad0c2cf76b6a7217f798f03ae944bf30f8 | ewartboonstra/Kenteken-drone-py | /legacy/myMath.py | 347 | 3.5 | 4 | import math
class myMath:
def distance_between_points(self, p1, p2):
#p[0] = x, p[1] = y
#c^2 = (xA - xB)^2 + (yA - yB)^2 =
#c = root((xA - xB)^2 + (yA - yB)^2)
return abs(math.sqrt(math.pow((p1[0] - p2[0]), 2) + math.pow((p1[1] - p2[1]), 2)))
def ratio(self, n1, n2):
... |
3cfb10f64da5a13dbdb6864fb58ab328bdc8259b | SV-ZeroOne/Python-Projects | /Random/serverSockets1.py | 465 | 3.6875 | 4 | import socket
#create a socket object
s = socket.socket()
print('Socket successfully created.')
#reserve a port number on the host machine
port = 12345
#bind to the port
s.bind(('',port))
print('Socket binded to %s' %(port))
#put the socket into listening mode
s.listen(4)
print('Socket is now listening')
#a forever... |
7c93e6ef267ab94aedb3dd1a09651d4201ffdef9 | SV-ZeroOne/Python-Projects | /Random/pythonHelloWorld.py | 9,282 | 4.53125 | 5 | import sys
print ('hello world')
# comment is a hashtag
print()
print('####'*10)
print('Numbers in python')
print('####'*10)
print('Modulo Mod operator allows you to find out what is an even number')
print(50 % 5)
print(50 % 3)
print()
print('To the power of uses 2 stars like so 2 ** 4')
print(2 ** 4)
print(1/2)
print(... |
29e3a4df6630f0504b0f5eb69f333cba72c98fec | SV-ZeroOne/Python-Projects | /Hacking Scripts/sql_injection/sqli_blind_hashextract_ord.py | 3,837 | 3.90625 | 4 | import requests
"""
The first check is to find if the character in X position is an alphabet or not. If so, it is checked if it belongs to [a-f] group or the rest. If it’s a hash, it’ll always belong to a-f group which is “alpha1” in the below code.
If it’s not an alphabet, it’s checked if the number belongs to [0-4] g... |
c56f6822121028fdeed3d7ff22d57bea449b0ccd | SV-ZeroOne/Python-Projects | /Pen Testing for Developers/request_login_time.py | 1,866 | 3.515625 | 4 | # Timing attack exploit on the login form for hackerNote
# You can increase your success chance by adding your own username to the top of the list
# Assumes you have at least ONE correct username, create an account and use that!
import requests as r
import time
import json
URL = "http://localhost:8081/api/user/login"
U... |
dd53403eb4b3a84807481903e29de2f731eac8fb | SV-ZeroOne/Python-Projects | /Python 3 - 2021 Projects/dates_and_time.py | 777 | 3.9375 | 4 | '''
Working with Dates and Time
'''
import datetime
# Todays date
today = datetime.date.today()
print(today)
print(today.day)
print(today.month)
print(today.year)
create_day = datetime.date(2022, 3, 4)
print(f'My next birthday is: {create_day}' )
# How close to end of this year?
new_year = datetime.date(2022, 1, 1)... |
b110959f9da1fca54db686b8d4b3756887e5d655 | DavidSpielmaker/CeasarCipher | /Rot13Decode.py | 959 | 3.953125 | 4 | ciphertext = input("Ciphertext: ").replace(' ', '').lower()
rotation = 0
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def rot_gen(alphabet, rotation, ciphertext):
rot_alphabet = []
counter = 0
solve = []
w... |
a539e736b880f3537b7e19f1384602dabf489ab6 | EgoSay/show--me-the-code | /004/004.py | 652 | 3.5625 | 4 | # @Author : adair_chan
# @Email : adairchan.dream@gmail.com
# @Date : 2019/3/1 下午5:45
# @IDE : PyCharm
import re
from collections import Counter
from functools import reduce
def create_list(filename):
word_list = list()
with open(filename, 'r') as f:
# 利用正则表达式,‘\b’匹配一个单词边界,即字与空格间的位置,‘+’等价于匹配... |
21e9e101142cd6b8c6fd345a3184d858c00633ab | geekavan/SortAndBinaryTree | /job.py | 6,336 | 4.09375 | 4 | # tkinter为python的GUI库
import tkinter as tk
import os
# 创建tkinter.Tk对象,名字为window实际上就是窗口对象
window = tk.Tk()
# 窗口上显示的名字
window.title("my graduate work")
# 窗口的大小
window.geometry("970x600")
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ... |
5c0d8aaaa866127b36c7e76bb05597f1a9ebfb3a | evelasquez-4/SUMMER_BOOTCAMP_2018_Python | /lesson6/task5/continue_keyword.py | 98 | 3.75 | 4 | print("NUMEROS IMPARES : ")
for i in range(1,100):
if i % 2 == 0:
continue
else:
print(i)
|
235004658488e941884a00dc079dd55c1f436038 | evelasquez-4/SUMMER_BOOTCAMP_2018_Python | /lesson3/task9/string_methods.py | 165 | 3.78125 | 4 | cadena = "CADENA EN MAYUSCULAS"
mayusculas = "cadena en minusculas"
print(cadena.lower())
print(mayusculas.upper())
print(mayusculas[0].upper() + mayusculas[1:]) |
aa4bcd8ae7ac707bd55c754d4099591812279e0e | evelasquez-4/SUMMER_BOOTCAMP_2018_Python | /lesson3/task3/string_indexing.py | 124 | 3.8125 | 4 | cadena = "Esto es una cadena"
print(cadena[5])
print(cadena[-1])
caracter = cadena[2]
print(caracter)
print(len(cadena)) |
4cef245046486f2526d594ed9103d89b8e074b7f | evelasquez-4/SUMMER_BOOTCAMP_2018_Python | /lesson6/task4/break_keyword.py | 177 | 3.59375 | 4 | cont = 1
while True:
print(cont)
cont += 1
if cont == 11:
break
lista = ['a','b','c','d','e']
while True:
letra = lista.pop()
print(letra)
if letra == 'a':
break |
85ddd1f6c24e2d4b7d7030b2c5e3b29d5bf41cf6 | zbumjin97/2019S_Python_Programming | /Python_programming/finalterm_2.py | 1,524 | 3.875 | 4 | '''
학번: 2016116457
이름: 박범진
2. dictionary 자료를 정렬하는 함수를 람다식을 이용하여 구현하시오.
'''
def dsort(dic, index, desc):
if index == 0:
dic = sorted(dic.items(), key=(lambda x: x[0]), reverse=desc)
else:
try:
dic = sorted(dic.items(), key=(lambda x: x[1][index - 1]), reverse=desc)
... |
2406868bf7318d7d0dfc079a7d9073553dc19ca6 | zbumjin97/2019S_Python_Programming | /Python_programming/lotto.py | 728 | 3.703125 | 4 | '''
학번: 2016116457
이름: 박범진
과제명: 로또 번호 생성 프로그램
'''
import random
def create_lotto_number():
purchase_number = 1
random_num = random.randint(1, 45)
while purchase_number != 0:
purchase_number = int(input("로또를 몇장 구매하시겠습니까? "))
if purchase_number == 0:
print("종료합니다.")... |
924def5857009434eb9474960a230a4e5266be9a | bagindakarli/RPC-Python3.7 | /[Solusi] Tugas 2 - RPC/01.webserver_1.py | 1,384 | 3.796875 | 4 | # import library socket karena akan digunakan request reply protocol sederhana
import socket
# definisikan IP dan port dari webserver yang akan kita gunakan. Port HTTP adalah 80
HOST, PORT = '127.0.0.1', 80
# buat socket bertipe TCP
listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# lakukan binding ... |
8462d80bc820f1aaa425726e524d6041ba0dc6e7 | noik2139/Kiddy_boys | /old_skil_noi/just_some_shit/drink.py | 305 | 3.6875 | 4 | def decide(num):
sum = 0
for i in range(1,num):
if num%i == 0:
sum += i
if sum == num:
return str(num) + "is a perfect number."
elif sum < num:
return str(num) + "is deficient."
else:
return str(num) + "is abundant."
print(decide(6))
|
e04c4b02fa573547b573ff504338630024414fcb | noik2139/Kiddy_boys | /old_skil_noi/skil_6_galmalt/population.py | 3,784 | 3.5 | 4 |
#gefur 1 ef bók/tölustafur en annars 0
def is_number_or_letter(char):
if char.isalpha():
return 1
try:
float(char)
except:
try:
int(char)
except:
return 0
else:
return 1
else:
return 1
#tekur á móti skjali og breyt... |
ca0a9dade9ba8d88bcd3cdbd41346ca10fba8c2c | chocotorroblue/quiz09 | /excercise1.py | 471 | 3.578125 | 4 | def raiz(r):
h= r/2
l= h+1
while(h!=l):
z= r/h
l= h
h= (h+z)/2
return h
def hipo(h1,l1,h2,l2):
a= (h2-h1)
b= (l2-l1)
h= (a*a)+(b*b)
l= raiz(h)
return l
h1=int(input("Give me the posicion h1 of the triangle "))
h2=int(input("Give me the posicion h2 of the tria... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.