blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
477f2532c0d3d9ce12dd00971e918843320bc931 | Aurel2607/KMES | /WS_KMES/TestPyDev/Src/09_ZCasino.py | 1,813 | 3.9375 | 4 | '''
Created on 24 avr. 2019
@author: apajadon
'''
import random
import math
minNumAlea = 0
maxNumAlea = 49
if __name__ == '__main__':
somme = int(input("Somme de départ?: "))
tour = 1
while somme > 0:
print("")
print("-------")
print("Tour n°", tour)
print("-------")
... |
54fc075a8eedbc8974dbe0e2972fea360b3ac9f6 | DodiyaParth/Program_Storage | /PROGRAMS/ACM-DSA-18-master/Parth_Dodiya_Assignment-3/check_tree_isBST.py | 828 | 3.96875 | 4 | from Binary_Search_Tree import *
def checkNode(p,l,u):
if p.left==None and p.right==None:
return True
if p.left!=None:
if p.left.value<p.value and p.left.value>l:
lc=checkNode(p.left,l,p.value)
else:
return False
if p.right!=None:
if p.right.value>p.va... |
f116aac79104f4161c929057e318dbb72cfc0b4a | DodiyaParth/Program_Storage | /PROGRAMS/Python/linkedList_3.py | 637 | 3.921875 | 4 | class node:
def __init__(self,val=None,nxt=None):
self.value=val
self.next=nxt
class LinkedList:
def __init__(self):
self.head=node()
def insert(self,val):
if self.head.value==None:
self.head=node(val)
else:
self.head=node(val,self.head)
... |
7236ca80230ccc04cb18c669efd9a2c107ebb383 | DodiyaParth/Program_Storage | /PROGRAMS/ACM-DSA-18-master/Vithik/qs.py | 2,480 | 4.1875 | 4 | class Stack:
"""Defines a Stack linked list
attributes: top - a pointer to the first node object
"""
def __init__(self):
self.top=None
def push(self,x):#push inside stack
if self.top==None:
self.top=ListNode(x)
else:
temp=Lis... |
ff43b8ede10873f2586fef8735a13686da423dad | jonathanxqs/lintcode | /55.py | 802 | 3.71875 | 4 | class Solution:
"""
@param A : A string includes Upper Case letters
@param B : A string includes Upper Case letters
@return : if string A contains all of the characters in B return True else return False
"""
def compareStrings(self, A, B):
# write your code here
def hashLize(s)... |
a7393cd03180a47e4b5d4624e4e4d9251dcad8d3 | zihuiye/leetcode | /101.对称二叉树.py | 1,109 | 3.9375 | 4 | #
# @lc app=leetcode.cn id=101 lang=python3
#
# [101] 对称二叉树
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
if... |
f5cc2ffebe2d0937df0200218dd9249d097e6818 | jedz5/VCNN | /learning/bolzman.py | 2,694 | 3.578125 | 4 | import numpy as np
import matplotlib.pyplot as plt
def coconuts_and_islanders():
'''椰子与岛民 一共1000个人'''
num = 30
'''每个人初始20块钱'''
money_list = np.zeros((num,),dtype=int) + 3
rge = 15
interv = 1
xmap = np.zeros((rge,),dtype=int)
'''实验这么多次,每次随机找个人给一块钱给另外一个人'''
eps = int(10000)
for e... |
f96aeabad51a39c2d087db026582aa437c776dc6 | WillJarvis-Cross/Will-Jarvis-Cross-Repository | /a2/player.py | 18,889 | 3.703125 | 4 | """CSC148 Assignment 2
=== CSC148 Winter 2020 ===
Department of Computer Science,
University of Toronto
This code is provided solely for the personal and private use of
students taking the CSC148 course at the University of Toronto.
Copying for purposes other than this use is expressly prohibited.
All forms ... |
3d972c34116f4d8d585f1a7caf51bc101ba52bf9 | Melissa201197/Trabajos_de_python | /pyton spider/Lista2.py | 233 | 3.5 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 8 11:25:46 2021
@author: USER
"""
lista=["R1",'R2',4,5.8,True]
print(lista)
print(type(lista))
print(len(lista))
print(lista[-5])
lista[4]=False
print(lista)
del lista[4]
print(lista) |
41a93a9eabcdd483ef9d9ec33c364258ef0c1245 | Melissa201197/Trabajos_de_python | /pyton spider/If - elif.py | 331 | 3.9375 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 15 11:30:39 2021
@author: USER
"""
print ("INICIO")
acl=int(input('Ingrese el # de ACL: '))
if acl >=1 and acl <=99:
print ("Es una ACL estandar")
elif acl >=100 and acl <= 199:
print ('Es una ACL extendida')
else:
print ('El # ingresado no es de una ACl')
pr... |
f30e5a2c4749ccb226e1944ea1df747db1667ca5 | Adrncalel/holbertonschool-higher_level_programming | /0x05-python-exceptions/0-safe_print_list.py | 485 | 3.890625 | 4 | #!/usr/bin/python3
def safe_print_list(my_list=[], x=0):
a = 0
for n in range(x):
try:
print("{}".format(my_list[n]), end="")
a += 1
except IndexError:
break
print()
return(a)
# print(*(my_list[n] for n, m in zip(range(x), my_list)))
# print(*([m... |
a7b8bbf3d035e668c2f91c46d3d97b540d313b57 | Adrncalel/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/8-uppercase.py | 182 | 4.09375 | 4 | #!/usr/bin/python3
def uppercase(str):
for n in str:
up = ord(n)
if 97 <= up <= 122:
up -= 32
print("{}".format(chr(up)), end='')
print()
|
38d97e2221ffac2e259555568851459ff2cbeda0 | Adrncalel/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/6-print_comb3.py | 164 | 3.734375 | 4 | #!/usr/bin/python3
for n in range(100):
a = n % 10
b = (n / 10)
if b >= a:
continue
print("{:02}".format(n), end='\n' if n == 89 else ', ')
|
5a1290387ea61d39f8a44a9bec59cec940648271 | Adrncalel/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/12-fizzbuzz.py | 289 | 3.78125 | 4 | #!/usr/bin/python3
def fizzbuzz():
str = ["Fizz", "Buzz", "FizzBuzz"]
for num in range(1, 101):
str1 = (str[2] if num % 15 == 0 else
(str[0] if num % 3 == 0 else
(str[1] if num % 5 == 0 else num)))
print("{}".format(str1), end=' ')
|
09b58c59af4c68e9c381ab8d8ec8b5f003e8b8dd | kimchhengheng/learning_python | /tic_tac_toe_singlePlayer.py | 5,474 | 4.21875 | 4 | """
display the board
get the number of place where he want
check if it is availble and not overide the other
check win row colume and diagonal or tie
check the winner
alternate the turn to computer
input will be get as a string only
"""
import random
import sys
board = []
for var in range(9):
board.append("-")
w... |
3c1c265c7f24cba09f4b385497022eabbbfc38b2 | kimchhengheng/learning_python | /Analog_clock.py | 2,135 | 4 | 4 | import turtle
import time
wn = turtle.Screen() # Screen is the class
wn.title("Analog by kimchheng heng")
wn.bgcolor("black")
wn.setup(width=700, height=700)
wn.tracer(0) # turn off the animation stop the win from update manual
# turn off animate by tracer(0) and update
pen = turtle.Turtle()
pen.hideturtle()
pen.s... |
8310f0ce5cb6f9d1de5dfbd844f2a1d296449d7f | akshaybosamiya/hackerrank-solutions | /Practice/python/6-Itertools/itertools-permutations.py | 286 | 3.765625 | 4 | #https://www.hackerrank.com/challenges/itertools-permutations
from itertools import permutations
string,k = input().split()
#print(string,k)
#print("\n".join(map(str,permutations(sorted(string),int(k)))))
print(*[''.join(i) for i in permutations(sorted(string),int(k))],sep='\n')
|
fe15793930a0f3f732b1f104143b1da387cf560f | akshaybosamiya/hackerrank-solutions | /Practice/Algorithm/2-Implementation/bon-appetit.py | 316 | 3.546875 | 4 | #https://www.hackerrank.com/challenges/bon-appetit
n,k = map(int, input().split())
costI = [int(costI_tmp) for costI_tmp in input().strip().split()]
bCharged = int(input().strip())
bActual = (sum(costI)-costI[k])//2
if(bCharged - bActual):
print(bCharged - bActual)
else:
print("Bon Appetit")
|
7a4fd866c53f676aa26bc0c799ae1cd9744e627f | akshaybosamiya/hackerrank-solutions | /Practice/Algorithm/2-Implementation/strange-advertising.py | 199 | 3.671875 | 4 | #https://www.hackerrank.com/challenges/strange-advertising
n = int(input())
noLike = 0
initNo = 5
while(n>0):
noLike += (initNo//2)
initNo = (initNo//2) * 3
n -= 1
print(noLike)
|
3d2aad6e8a3c31257fdaee9801632f3e704493ac | akshaybosamiya/hackerrank-solutions | /Practice/python/3-Strings/find-a-string.py | 171 | 3.859375 | 4 | string = input()
substring = input()
count = 0
for i in range(len(string)):
if(string[i:i+len(substring)] == substring):
count = count + 1
print(count)
|
c5ade2d3cd18f0669d32fad4898151b61d88bc39 | akshaybosamiya/hackerrank-solutions | /Practice/python/3-Strings/python-mutation.py | 109 | 3.546875 | 4 | string = input()
i = input().split(" ")
n=int(i[0])
string = string[:n]+i[1]+string[(n+1):]
print(string) |
ab2a1de333f73ad04d8b96eed97b3aa0485773f1 | Baburam208/numerical-method | /assignment.py | 1,176 | 3.734375 | 4 |
# class MaxSizeArr():
# def __init__(self,n):
# self.size = n
# self.innerarr = []
# def push(self, obj):
# self.innerarr.append(obj)
# if len(self.innerarr) > self.size:
# self.innerarr.pop(0)
# def getarr(self):
# return self.innerarr
# class CreateArr(MaxSizeArr):
# def __init__(self,n):
# ... |
cc84a65b32e7609e58effa496fe1a00339e59fe0 | sherman617/cryptopals-crypto-challenges | /libcrypto.py | 3,529 | 3.65625 | 4 | # -*- coding: utf-8 -*-
#
# Library of crypto functions used for CryptoPals challenges
import os
from cryptography.hazmat.primitives.ciphers import (
Cipher, algorithms, modes
)
def detect_ecb(ct):
"""Detect if crypto text, ct, looks like it is encoded with ECB."""
blocksize = 16
match = False
nu... |
8555887ea26f17a2c54b5d34ffc7fd15c589c6fa | sherman617/cryptopals-crypto-challenges | /challenge1.py | 505 | 3.53125 | 4 | # -*- coding: utf-8 -*-
# Cryptopals Cryptochallenge #1
# Convert hex to base64
# The string:
# 49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d
# Should produce:
# SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t
src = '49276d206b696c6c696e6720796f75722... |
5fcc10036eb0ae48d752d7e6c98632f431871c9d | Spencer-Janus/python-Learning-process | /统计输入的每个字母的个数.py | 314 | 3.6875 | 4 | letters=input('请输入若干大写字母')
list_1=list(letters)
dict_1=dict.fromkeys([chr(i) for i in range(ord('A'),ord('z')+1)],0) #chr(i)括号里为ASCII码,返回对应字符, ord('i')括号里为字符,反回相应的ASCII
for i in list_1:
dict_1[i]+=1
print(dict_1)
|
30a9e7a0ad6748dd375019b27508247faffed295 | Spencer-Janus/python-Learning-process | /控制台五子棋.py | 349 | 3.78125 | 4 | BOARD_SIZE=15
#定义一个二位列表来表示棋盘
board=[]
def initboard():
for i in range(BOARD_SIZE):
row=['+']*BOARD_SIZE
board.append(row)
def printboard():
for i in range(BOARD_SIZE):
for j in range(BOARD_SIZE):
print(board[i][j],end='')
print('')
initboard()
printboard(... |
a27ac03950623779eeb9b7c8d918115482382855 | Spencer-Janus/python-Learning-process | /求n个数的立方和.py | 105 | 3.921875 | 4 | def f(n):
sum_=0
for i in range(1,n+1):
n=i**3
sum_+=n
print(sum_)
f(3) |
24aff48af81677718882080b9b1e45e19d0a97c7 | kacerchio/CS350 | /hw3/hw3.py | 6,702 | 3.515625 | 4 | '''
Kristel Tan (ktan@bu.edu)
CAS CS350 Spring 2016 - Professor Bestavros
hw3 - hw3.py
'''
import random
import math
from enum import Enum
# Enumerated type of event types (i.e. death and birth)
class EventType(Enum):
death = 0
birth = 1
# Event object with initialized with arrival time, service sta... |
4c10ce4319d634e3f9c9cc4ec3b539c797cbc9c0 | cmawer97/Advent-Of-Code-2020 | /Day 6/Day6-2.py | 376 | 3.609375 | 4 | def countGroupAnswers(group):
allanswers = []
for answer in group:
allanswers.append(set(answer))
return len(set.intersection(*allanswers))
with open("Day 6/input.txt") as f:
data = f.read().split("\n\n")
groups = []
for i in data:
groups.append(i.splitlines())
total = 0
for i in g... |
b111817091709e8c887c0dcb8b36795feaca5991 | jshen212/pythonExercises | /KMeans.py | 1,323 | 3.609375 | 4 | from numpy import random, array
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
from sklearn.preprocessing import scale
from numpy import random, float
def createClusteredData(N, k):
#createss consistent random seed to start with
random.seed(10)
#creates a set number of points, per cluster
... |
d3732ab2e7713977a4f86a1f153a59b74d79a756 | ahmadkilani/Microsoft-DAT210x | /Module 6/assignment5.py | 4,259 | 3.53125 | 4 | '''
author Lama Hamadeh
'''
import pandas as pd
#https://archive.ics.uci.edu/ml/machine-learning-databases/mushroom/agaricus-lepiota.names
#
# TODO: Load up the mushroom dataset into dataframe 'X'
# Verify you did it properly.
# Indices shouldn't be doubled.
# Header information is on the dataset's website at the... |
c297db3d7f00baa8efbcf44c5527dab3e4dcfe8f | ngupta10/Python_Learnings | /Basic Python Scripts/Quiz_For_Practise/Assignment_4.py | 4,517 | 4.3125 | 4 | # 1.Build an interactive application which should simulate a Quiz contest. The following questions might be asked as
# input from user:
#Choose level (easy, intermediate, and hard): --> 3 modes of difficulty and user should input one of these choices.
#Please give us the number of question you want to attempt: --> ... |
b70caaf8a7b54ea3f060e3f088df72182a5735d2 | ngupta10/Python_Learnings | /Basic Python Scripts/StringMethods.py | 1,862 | 4.4375 | 4 | """
len() and str() practice:
1.create a variable and assign it the string "Python"
2.create another variable and assign it the length of the string assigned to the variable in step 1
3.create a variable and use string slicing and len() to assign it the length of the slice "yth" from
the string assigned to the ... |
408bef0b0379936aeba9206b9d00c00007f4ebfe | ngupta10/Python_Learnings | /Basic Python Scripts/PrintProblems.py | 1,030 | 4.46875 | 4 | """
String Concatenation:
1.create a variable and assign it the phrase "hello world" by concatenating the strings "hello" and " world"
2.create a variable and assign it the integer 11
3.create a variable and assign it the integer 38
4.create a variable and use the variables from steps 2 and 3 and string concaten... |
2bcbcef887aeb76b4ffe8d4b7dea98809572034b | ngupta10/Python_Learnings | /Basic Python Scripts/WhileLoop.py | 1,165 | 4.34375 | 4 | """
1.While Loop Basics
a.create a while loop that prints out a string 5 times (should not use a break statement)
b.create a while loop that appends 1, 2, and 3 to an empty string and prints that string
c.print the list you created in step 1.b.
2.while/else and break statements
a.create a while loop that does... |
cfe1eba08b9998a152702c2c9da4c6121505e8fe | Anahis259/information-request | /zip_code.py | 195 | 4.28125 | 4 | import re
zipCode_string=input("Enter a valid zip code: ")
match_zipcode=re.search('^\d{5}-\d{4}$',zipCode_string)
if match_zipcode:
print('Valid zip code')
else:
print('Not valid zip code')
|
39358191aee4e9fa189a19ff938f53a15e54dcbe | LiorMoshe/Cryptopals | /cryptopals.py | 43,218 | 3.84375 | 4 | # coding: utf-8
'''Implementation of the cryptopals crypto challenges.
The program will get TWO command line arguments.
The first argument will represent the number of set of the crypto challenges
we will run and the second number will represent the number of challenge in this set
that will be run.
In this program I as... |
9edb2056f5a8edab4d5d72bcb59a5c5dbff9d23c | SmartComputerMonkey/python | /monkey_study/myFirstPy.py | 556 | 4.03125 | 4 | #数据类型
print('''i
... am
... Monkey''');
#布尔类型
age = 20;
if age > 18:
print("adult");
else:
print("teenager");
#变量 动态变量
monkeyA = 100;
print("动态变量-->", monkeyA);
monkeyA = "i like JWJ";
print("动态变量-->", monkeyA);
#两种除法
#一种除法 /
a = 10/3;
print("一种除法 / --> 10 / 3 =", a);
a = 9 / 3;
print("一种除法 / --> 10 / 3 =", a... |
8c5ac4b1bc9660b4d7f6a4a319fdc850f2dbf229 | rmpsc/LeetCode | /Linked Lists/234. Palindrome Linked List.py | 801 | 3.765625 | 4 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
# Time: O(n) Space: O(1)
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
slow = fast = head
# slow pointer will stop at mid... |
0a91e3f9ffda2cfb3ae0d21eaae773ccea89670e | TOOFACK/DailyCodingPy | /LeetCode/1329. Sort the Matrix Diagonally.py | 849 | 3.5 | 4 | import collections
class Solution:
def diagonalSort(self, mat):
# print(mat)
diag = {}
for i in range(len(mat)):
for j in range(len(mat[0])):
if (i-j) in diag:
tmp = diag[(i-j)]
tmp.append(mat[i][j])
dia... |
4ed6e10fa190da2563dfd4cb7e53ebb812b16d53 | TOOFACK/DailyCodingPy | /LeetCode/1457. Pseudo-Palindromic Paths in a Binary Tree.py | 883 | 3.71875 | 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
import collections
class Solution(object):
ans = 0
def pseudoPalindromicPaths(self, root):
"""
... |
d50f7c4363448317cebcf7b9e50075ef49ac7077 | TOOFACK/DailyCodingPy | /YaPracRestart/Sprint2/I.py | 812 | 3.890625 | 4 | class Queue:
def __init__(self,n):
self.queue = [None]*n
self.max_n = n
self.head = 0
self.tail = 0
self.size = 0
def peek(self):
if self.size != 0:
x = self.queue[self.head]
return x
else:
return "None"
def is_emp... |
847321bbadf31459eac645de91a531cec7fad54d | TOOFACK/DailyCodingPy | /LeetCode/102. Binary Tree Level Order Traversal.py | 1,345 | 3.6875 | 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
import collections
class Solution(object):
def levelOrder(self, root):
"""
:type root: TreeNode
... |
5a8b54689ef81ac9d5e1923e37ebb21653f9a3cb | TOOFACK/DailyCodingPy | /Yandex_Algo_Training/HW4/A.py | 183 | 3.578125 | 4 | n = int(input())
a = {}
b = {}
for i in range(n):
w1, w2 = input().split()
a[w1] = w2
b[w2] = w1
word = input()
if word in a:
print(a[word])
else:
print(b[word])
|
b9ef4b6b0c3ab3268e0379ab0aeb8028cb57d2b4 | TOOFACK/DailyCodingPy | /LeetCode/1418. Display Table of Food Orders in a Restaurant.py | 1,298 | 3.8125 | 4 | class Solution(object):
def displayTable(self, orders):
"""
:type orders: List[List[str]]
:rtype: List[List[str]]
"""
dish = set()
for i in orders:
dish.add(i[2])
dish_list = sorted(dish)
tables_order = {}
for i in orders:
... |
5c672f1b860a8864ccec55d4719a0044aef840b6 | TOOFACK/DailyCodingPy | /LeetCode/1123. Lowest Common Ancestor of Deepest Leaves.py | 783 | 3.71875 | 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 __init__(self):
self.DCA = 0
self.lca = None
def lcaDeepestLeaves(s... |
dde5704e8d27e56a268bcbe1db04d20e38f6c3d3 | TOOFACK/DailyCodingPy | /LeetCode/22. Generate Parentheses.py | 568 | 3.59375 | 4 | class Solution(object):
def __init__(self):
self.ans = []
def generateParenthesis(self, n):
"""
:type n: int
:rtype: List[str]
"""
def generate(str, open, close):
if open + close == 2*n:
# print(str)
self.ans.append(st... |
5ff577f6e522b628a6c89e0ef367698c82c82fc6 | ehsanyousefzadehasl/SIE | /02-common_elements_of_two_list/P1_1.py | 214 | 3.78125 | 4 | def Intersection(lst1, lst2):
return set(lst1).intersection(lst2)
# Driver Code
list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))
print(Intersection(list1, list2)) |
dfd74e888515402a103d1077e459c6cba51ce815 | ParasPandey/Python-Training | /Assignment 2.py | 1,167 | 4.03125 | 4 | print("MESSAGE SENDER")
print("Hello Mit Cell")
k=int(input("Please enter k value to shift transform message: "))
if k<20 and k>1: #check range of k
print("The value of k should be between 1 and 20: ")
msg=input("Enter Your Message: ")
newmsg=""
for i in msg:
if i.isalnum(): #Check for alphabet or num... |
f6813fe04c805686bc0e28c01a3039f44319b60a | lorarjohns/bitesofpy | /adventofcode/day1.py | 668 | 3.71875 | 4 | def fuelCounter(stars):
total = 0
for star in stars:
total += star//3 - 2
return total
def fuel(mass):
return max(mass//3 - 2, 0)
def total_fuel_amount(starMass):
if fuel(starMass) == 0:
return 0
return fuel(starMass) + total_fuel_amount(fuel(starMass))
with ope... |
301156f68f6c95ce86a26a57e056f846ccec0be7 | Junghyo/pycharm | /data_science/basic/01_data_type/practice04_list.py | 5,901 | 4.4375 | 4 | """
# list
동적배열(Dynamic Array)
list 안의 요소(element)들은 그 값을 자유롭게 변경할 수 있는 Mutable type
list = [element1, element2, ...., elementn]
"""
# how to make list?
ex1 = [1, 2, 3, 4, 5]
ex2 = []
print(ex1) # [1, 2, 3, 4, 5]
print(ex2) # []
print("list length:", len(ex1)) # list length: 5
print("list type:", type(ex2)) # l... |
0443953061a1ff7b3f4bea101fc7861a488868a9 | Junghyo/pycharm | /data_science/basic/03_def_input_output_file/practice01_def.py | 3,541 | 4.21875 | 4 | """
def ( function )
def 함수명(parameter):
문장1
문장2
[return 리턴값]
paramter = 매개변수, 입력 인수
"""
# ex1. 전달받은 2개의 수를 더하여 결과값(return)으로 돌려주기
def sumDef(a, b):
x = a + b
return x
print(sumDef(3, 4)) # 7
c = 7
d = 12
result = sumDef(c, d)
print(c, d, result) # 7 12 19
"""
parameter값이 없는 def
"""
d... |
918838556fe733d3f25b5934f94e616120da5b95 | Junghyo/pycharm | /data_science/basic/04_class_module_packages/practice01_class1.py | 10,489 | 3.921875 | 4 | '''
Created on 2017-07-21 09:55
@ product name : PyCharm Community Edition
@ author : yoda
'''
"""
Python : 객체지향 프로그래밍(Object Oriented Programming)
class : 설계 도면. 뽑키틀
class's member : 메서드(method), 속성(property), 클래스 변수(class variable), 인스턴스 변수(instance variable),
초기자(initializer), 소멸자(des... |
a86d8f08468171ad03750ca862b95dd41789efdf | Junghyo/pycharm | /lesson/a01_start/a10_sequence.py | 639 | 3.59375 | 4 | '''
Created on 2017. 7. 19.
@author: kitcoop
'''
str="Korea"
print(str[0])
print(str[-2])
print(str[1:3])
print(str[0:5:2])
print(str[:-1])
print(str[::-1])
'''
확인예제..
입력으로 주민번호 입력
생년월일 : @@@ 년 @@ 월 @@ 일
성별 : 남자/여자
'''
civilnum = input("주민번호입력")
biryear = "19"+civilnum[0:2]
birmon = civilnum[2:4]
birdate = civilnum... |
367d207f5517e854fe5a7eeca2dcb750926f0703 | Junghyo/pycharm | /data_science/basic/08_programmig/practice01_mTable.py | 509 | 3.796875 | 4 | '''
Created on 2017-07-24 20:22
@ product name : PyCharm Community Edition
@ author : yoda
'''
# 구구단
def mTable1(x):
result = []
for i in range(1, 10):
result.append(x * i)
return result
print(mTable1(2))
def mTable2(x):
result = []
i = 1
while i < 10:
result.append(x * i... |
f4e62d3f490350dd9ba027ee6da14afef0e43f4b | taylor-curran/code_signal_practice | /run_time_complexity/two_sum_py.py | 2,058 | 4.21875 | 4 | """
Given an array of integers `nums` and an integer `target`, return the indices
of the two numbers that add up to the `target`.
Examples:
- two_sum(nums = [2,5,9,13], target = 18) -> [1,3]
- two_sum(nums = [2,5,9,13], target = 7) -> [0,1] (nums[0] + nums[1] == 7)
- two_sum(nums = [4,3,5], target = 8) -> [1,... |
b8fdb695256b28d4bf136afe13f3cfb657b0cbac | hugheskat/markdown-to-docx | /scripttime.py | 1,490 | 3.515625 | 4 | def runningtime(starttime, endtime):
# imports
import datetime
import re
# get the number of seconds as an hhmmss string
hhmmss = str(datetime.timedelta(seconds=(endtime - starttime)))
# set default string values
strhr = ' hrs'
strmin = ' mins'
strsec = ' secs'
# get time data
... |
2f8e791d8b59b75b07ca4b1d89f44fb0d552e1b9 | khalillakhdhar/exercices_python_et_codes | /repeting.py | 190 | 4.25 | 4 | r='o'
while r=='o':
x=int(input("donner un entier"))
if(x%3==0):
print("divisible")
else:
print("n'est pas divisible")
r=input("continuer? (o) oui ")
|
a53ad23e3f6031f8e6d92c2808fc36cadd214c9e | fs412/codingsamples | /p2-fsabetpour.py | 1,002 | 4.4375 | 4 | """ My name is Fran Sabetpour and the purpose of the script is to ask the user a quiz score and convert the score to a letter grade. """
try:
score = float(input("Enter a score to get your equivalent letter grade:" ))
if score >= 93 and score <= 100:
print("Your letter grade is an A.")
elif sco... |
35d66c14b2f25df87b84f4a4122c81d2573e4493 | fs412/codingsamples | /p3-fsabetpour.py | 785 | 4.40625 | 4 | """ My name is Fran Sabetpour and the purpose of this script is to be able to make a function that provides the maximum of the 3 values given by the user. """
def maxOfThree():
if maxOfThree1 >= maxOfThree2 and maxOfThree1 >= maxOfThree3:
maximum = maxOfThree
elif maxOfThree2 >= maxOfThree3 and maxO... |
d75e1451478b67566fee19cf1069d3e27734c834 | fs412/codingsamples | /p11-fsabetpour2.py | 1,388 | 3.84375 | 4 | """ My name is Fran Sabetpour and this is the script for P11: Browsing the Web. """
import urllib.request
import urllib.parse
import re
def browsing_web():
try:
url = input("Including either http:// or https://, enter a URL to count the number of links: ")
feedback = ""
except:
... |
4800508e5e02dd467e6358da5b65612dee4c2e15 | JayChenFE/python | /fundamental/python_crash_course/exercise/ch06/6-11.py | 735 | 4.03125 | 4 | # 6-11
# 城市 :
# 创建一个名为cities 的字典,
# 其中将三个城市名用作键;对于每座城市,都创建一个字典,
# 并在其中包含该城市所属的国家、人口约数以及一个有关该城市的事实。
# 在表示每座城市的字典中,应包含country 、population 和fact 等键。
# 将每座城市的名字以及有关它们的信息都打印出来。
cities = {
'shanghai': {
'country': 'China',
'population': '200,000,000'
},
'tokyo': {
'country': 'Japan',
... |
46e3a53a36b528ec9ddd0f4208ef087f3c16586b | JayChenFE/python | /fundamental/python_crash_course/exercise/ch06/6-9.py | 560 | 4.03125 | 4 | # 6-9
# 喜欢的地方 :
# 创建一个名为favorite_places 的字典。
# 在这个字典中,将三个人的名字用作键;对于其中的每个人,都存储他喜欢的1~3个地方。
# 为让这个练习更有趣些,可让一些朋友指出他们喜欢的几个地方。
# 遍历这个字典,并将其中每个人的名字及其喜欢的地方打印出来。
favorite_places = {
'jay': {'a','b','c'},
'mike': {'d','e'}
}
for k,v in favorite_places.items():
print("\n{}'s favourite place are :".format(k))
pri... |
063afde8b5b9dbe94abaf012648718110146d686 | JayChenFE/python | /fundamental/python_crash_course/exercise/ch07/7-3.py | 509 | 3.890625 | 4 | # 7-3
# 10的整数倍 :
# 让用户输入一个数字,并指出这个数字是否是10的整数倍。
# py中没有 variable= expression ? b : c的三目运算符,替代为:
# (1) variable = a if expression else b
# (2)variable = (expression and [b] or [c])[0]
# (3) variable = expression and b or c
number = input('plz input a number and i wll tell u if it is the multiple of 10 : ')
is_multiple ... |
23d2bfc2b5326e3bd88a9eb7aec6da7e38fc02f7 | JayChenFE/python | /fundamental/python_crash_course/exercise/ch07/7-2.py | 363 | 3.90625 | 4 | # 7-2
# 餐馆订位 :
# 编写一个程序,询问用户有多少人用餐。
# 如果超过8人,就打印一条消息,指出没有空桌;
# 否则指出有空桌。
number = input('plz input the number of People : ')
has_table = ' '
if int(number) > 8:
has_table = ' not '
print('there are{}enough table for {} People'.format(has_table,number))
|
f30c2298e4a7c9a6777a5f929115126aae8c3c33 | JayChenFE/python | /fundamental/python_crash_course/exercise/ch09/9-6.py | 796 | 4.125 | 4 | # 9-6 冰淇淋小店 :
# 冰淇淋小店是一种特殊的餐馆。
# 编写一个名为IceCreamStand 的类,让它继承你为完成练习9-1或练习9-4而编写的Restaurant 类。
# 这两个版本的Restaurant 类都可以,挑选你更喜欢的那个即可。
# 添加一个名为flavors 的属性,用于存储一个由各种口味的冰淇淋组成的列表。
# 编写一个显示这些冰淇淋的方法。
# 创建一个IceCreamStand 实例,并调用这个方法。
from restaurant import Restaurant
class IceCreamStand(Restaurant):
def __init__(self, name,... |
2f5767f6be1f74f1cecedd5d4420ef62a5afab58 | noelhx/littletable | /table.py | 19,524 | 3.875 | 4 | import pprint
import csv
class Table():
EMPTY = ""
def __init__(self):
self.headers = []
self.rows = []
self.indices = {}
def append_column(self, column_name, column_fill=None):
""" Add an empty column with name 'column_name' to the table
>>> t = Table()
... |
e1bb6e5e463338d6eb2c976ad712b1409f736b7f | gentrym2/Project1 | /main.py | 3,399 | 3.78125 | 4 | """
Searches deep inside a directory structure, looking for duplicate file.
Duplicates aka copies have the same content, but not necessarily the same name.
"""
__author__ = "Mackenna Gentry"
__email__ = "gentrym2@myerau.edu"
__version__ = "1.0"
# noinspection PyUnresolvedReferences
from os.path import getsize,... |
8201a17800d3d323963bd66da50b0534b5c582fc | mjohnson9/ros-address-list-sync | /ros_address_list_sync/address_list.py | 984 | 3.6875 | 4 | class AddressList(object):
"""Represents a firewall address list on a RouterOS device
Attributes:
cidrs (list[str]): All of the CIDRs within this address list
"""
def __init__(self, pairs):
"""Initializes the address list
Args:
pairs ((str, str)): The (index, cidr) ... |
cba078185592e79b5bd714174a240964f89279a2 | pranabsarkar/Algorithm-Pratice-Questions-LeetCode | /Delete Node in a BST.py | 2,560 | 4.09375 | 4 | # Given a root node reference of a BST and a key, delete the node with the given key
# in the BST. Return the root node reference (possibly updated) of the BST.
#
# Basically, the deletion can be divided into two stages:
#
# Search for a node to remove.
# If the node is found, delete the node.
# Note: Time complexity s... |
8d5a089446e28711784812d58792bd114cd42988 | ivo-nikolaev/blackjack-python | /player.py | 772 | 3.640625 | 4 | class Player(object):
def __init__(self, p_name=None, p_cash=0):
self.name = p_name
self.cash = p_cash
@property
def name(self):
return self._name
@name.setter
def name(self, new_name):
if type(new_name) == str: #type checking for name property
self._nam... |
016432400758ec38d858df6e605de13747f60e02 | TengIanKhoo/Song_Words_Trie | /Song_Words_Trie.py | 13,669 | 3.828125 | 4 | """
Name: Teng Ian Khoo
Created: 3rd October 2019
Last Modified: 11th October 2019
"""
# imported regex library for use
import re as re
# A Basic trie Data Structure Class
class Trie():
def __init__(self):
self.root = Node()
def search_lookup(self, word):
current = self.root
return se... |
f806768475e34852af59d974c068751b1b8acacc | jefersonlima/Courses | /Cursos/UdemyProgramacaoEmPythonDoBasicoAoAvancado/guppe/secao_19_TrabalhandoComDataEHoraEmPython/deltas.py | 859 | 3.546875 | 4 | # -*- coding: UTF-8 -*- # Configuração para não da problema nos comentário
"""
Trabalhando com deltas de data e hora
data_inicial = dd/mm/yyyy 12:55:34.9999999
data_final = dd/mm/yyyy 12:55:34.9999999
import datetime
# Temos a data de hoje
data_hoje = datetime.datetime.now()
# Data para ocorrer um determinado eve... |
0f2e7f867d4496a40a981e6d5aa83cb9c0578438 | jefersonlima/Courses | /Cursos/UdemyProgramacaoEmPythonDoBasicoAoAvancado/guppe/secao_23_ChecagemDeTiposEmPython/annotations.py | 1,342 | 3.8125 | 4 | # -*- coding: UTF-8 -*- # Configuração para não da problema nos comentário
"""
Annotations
# Correto annotation em variavéis
texto: str
# Incorreto annotation em variavéis
texto:str
texto : str
# Correto annotation em funçao
) -> str
# Incorreto annotation em funçao
)->str
) ->str
# Correto annotation em var... |
a2e43ca35dd23e16214c5f6ddcdd4449b80f6c3a | jefersonlima/Courses | /Cursos/UdemyProgramacaoEmPythonDoBasicoAoAvancado/guppe/secao_10_ExpressoesLambdasEFuncoesIntegradas/sorted.py | 2,359 | 4.65625 | 5 | """
Sorted
OBS: Não comfunda, apesar do nome, com a função sort() que já estudamos em Listas. O sort()
só funciona em listas.
Podemos utilizar o sorted() com qualquer interável.
Como o próprio nome diz, sorted() serve para ordenar.
OBS: O sorted, SEMPRE retorna uma lista com os elementos do interável ordenados
OB... |
daac5f2ae81980b986cb09429706442ee8ab81e6 | jefersonlima/Courses | /Cursos/UdemyProgramacaoEmPythonDoBasicoAoAvancado/guppe/secao_23_ChecagemDeTiposEmPython/mypy.py | 464 | 3.859375 | 4 | # -*- coding: UTF-8 -*- # Configuração para não da problema nos comentário
"""
Checagem de Tipos com Mypy
"""
def cabecalho(texto: str, alinhamento: bool = True) -> str:
if alinhamento:
return f"{texto.title()}\n{'-' * len(texto)}"
else:
return f"{texto.title()} ".center(50, '#')
print(cabeca... |
a7b541bf8dfeab436c39ccdf834b9272f03baed0 | xiaobaozi1993aa/meiyin | /Tool/qiege.py | 421 | 3.53125 | 4 | #!/usr/bin/python
# -*- coding:utf-8 -*-
'''
@versoin:V-1.8.0
@author:xiaobao
@file:qiege.py
@time:2020年8月25日
'''
a = input('输入url:')
number = a.count('=') #获取data个数
b = a.split('?')[1] #URL分割成路径和数据
url = a.split('?')[0]
print(url)
c = b.split('&')
e = []
data = {}
for i in range(number):
d = c[i].split('='... |
f8f4a7e3775717d321cbe4305f063a1756f98911 | JohnJGreen/1310Python | /hw08/hw08_task1.py | 1,495 | 4.25 | 4 | # John Green
# 1001011958
# 11/8/13
"""
the program prints out
keys
values
key and value pairs
key and value pairs in order of key
key and value pairs in order of value
"""
def main():
d = {'a':15, 'f':35, 'b':120}
keys = list(d.keys())
print("The keys are: ", end = "")
for i in keys: # prints the ... |
fc622a858f46741c8918b80025d834112e81e666 | JohnJGreen/1310Python | /hw04/hw04_task1.py | 769 | 3.640625 | 4 | # John Green
# 1001011958
# 9/30/13
# In the table header, all column names are be centered.
# The data in the left column of the table are left alligned.
# The data in the center column of the table are centered.
# The data in the right column of the table are right alligned.
# Printed numbers in the table are floats.... |
5c8a63b52983e5db3b8ff6bb19aeaf2b1ca68f1f | JohnJGreen/1310Python | /hw04/hw04_task3.py | 833 | 4.28125 | 4 | # John Green
# 1001011958
# 9/30/13
# The program asks the user to think of a number.
# the program then asks if the number is in the first half of the interval
# the program only accepts y or Y for yes and n or N for no.
#
low_int = 1
high_int = 100
print("Think of a number between 1 and 100 (inclusive)")
print("An... |
68cda5339a3de13928cf112894b6e90ffd25de87 | cwcyau/PhD_DNNpractice | /code/week2.py | 2,615 | 3.5 | 4 | ##################################
# Data visualisation
##################################
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
# use sklearn for PCA
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
## %matplotlib inline
import matplotlib.pyplot as plt
##... |
5ef8b1b692a26b1c64bed9b3f6e6bfb55e878ce7 | sawaseemgit/AppsUsingConditionals | /RockPaperScissorApp.py | 1,930 | 4 | 4 | import random as r
print('Welcome to the Rock, Paper, Scissors App')
rounds = int(input('How many rounds you want to play: '))
p_points = 0
c_points = 0
moves = ['rock', 'paper', 'scissors']
for i in range(1, rounds + 1):
print(f'Round# {i}\nPlayer score:{p_points}\t\tComputer score: {c_points}')
c_index = r... |
a4140bce2245df7d5d21c3d3b05ba16cfb24932c | defance/edu-hw-python-demo | /homework03/homework.py | 2,675 | 3.578125 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Dmitry Ivanyushin"
import mymath
from dictionary import add_entry, has_entry, get_entry, remove_entry, get_entries, update_entries
def main():
def help():
print("Список допустимых команд:")
print(" fun - выбор хеширующей функции")
... |
181d2cc5ccf318c3a5b64669151feda281637dc7 | robertlagrant/codeeval | /Moderate/101/solution.py | 1,741 | 3.578125 | 4 | import sys
def distance(c1, c2):
xdist = abs(c1[0] - c2[0])
ydist = abs(c1[1] - c2[1])
# Just keep it as squared dists, as this is just for comparisons
return xdist ** 2 + ydist ** 2
with open(sys.argv[1], 'r') as f:
for line in f:
line = line.strip()
if not line:
... |
aa2a9176eaad66df37810dad30a2028ca9c103c5 | robertlagrant/codeeval | /Moderate/45/solution.py | 630 | 3.859375 | 4 | import sys
def reverse(num):
return int(str(num)[::-1])
def is_palindrome(num):
s = str(num)
l = len(s)
if l % 2 == 0:
left, right = s[:int(l/2)], s[int(l/2):]
else:
left, right = s[:int(l/2)], s[int(l/2)+1:]
return left == right[::-1]
with open(sys.argv[1], 'r') as f:
... |
241c919e4bb9d0be053834fea8fbdbc8ba951eeb | robertlagrant/codeeval | /Moderate/41/solution.py | 344 | 3.6875 | 4 | import sys
with open(sys.argv[1], 'r') as f:
for line in f:
line = line.strip()
if not line:
continue
nums = set()
for x in line.split(';')[1].split(','):
if x not in nums:
nums.add(x)
else:
print(... |
c693a140329db72a5f01a5776deef1f2bd8b5bee | setayesh1866/scratch | /Term 2/Birth certificate.py | 645 | 3.53125 | 4 | import turtle as tr
def get_ID (ID):
"""
input: "name, family, age, birth place"
output: ["setayesh", "pasandideh", 13, "tehran"]
"""
ID = ID.split()
ID[2] = int(ID[2])
return ID
s = input("Enter your name, family, age, and birth place: ")
name, family, age, b_p = get_ID(s)
for i in ra... |
69d27beb2be151f31522b69d42a411f6444e2fc2 | setayesh1866/scratch | /Term 2/6-1.py | 857 | 3.578125 | 4 | import turtle as tr
import random as rnd
shape = input ("Enter witch shape square/traiangle?(s/t)")
if shape == 's':
tr.speed(10000)
for j in range(100):
tr.penup()
x_position = rnd.randint(-400, 300)
y_position = rnd.randint(-200, 200)
tr.goto(x_position, y_position)
t... |
24e1644842df5205bd761387e0b8984d0e936aa6 | setayesh1866/scratch | /Term 2/2-input-test.py | 171 | 3.890625 | 4 | number1 = input ("what is first number?")
number2 = input ("what is second number?")
number1 = int (number1)
number2 = int (number2)
add = number1 + number2
print(add)
|
e2a5190b29f7b3aa54d6aae2586ff12b0c1100e6 | ABROLAB/Basecamp-Technical-Tasks | /Task_6.py | 1,115 | 4.25 | 4 | '''
Write a function that takes two parameters,
an array and some number. The function should
determine whether any three numbers in the array
add up to the number. If it does, the function should
return the numbers as an array. If it doesn’t, the function should return -1.
Example
Input: [1, 2, 3, 4, 5, 6], 6
Outp... |
f383d058de5926eaa00e1d24c65243006a1688df | Mojache1234/projects | /automation/markdown_table.py | 463 | 3.65625 | 4 | import pyperclip
text = pyperclip.paste().split('\n')
for x in text:
row = x.split(',')
print('|', end='')
for y in row:
print(y.center(50, ' '), '|', end='')
print('|')
"""
Good/Service, Market Event(s), D, S, P, Q
Video Cassettes Recorders (VCRs), Technological advances reduce t... |
c58198479030f7bd5ad88b1c23a77d54caa951ad | ProjitB/StoreHouse | /bomberman/Assignment1_20161014/board.py | 2,902 | 3.65625 | 4 | import os
import time
import sys
import colorama
from colorama import Fore, Back, Style
colorama.init()
clear = lambda : os.system('clear')
class Board(object):
def __init__(self):
'''Initializes Board and its dimensions
'''
board = []
a = []
#Size of board is x
... |
69cd1ca1d29619947ff57f4ed1f0f22c1d02cf8f | jeremyimmanuel/leetcode-sols | /21-Merge-Two-Sorted-Lists/solution.py | 1,245 | 4.0625 | 4 | """
Traverse through both list
compare both elements
pick the smallest one,
append smallest to new list
while (h1 and h2 not empty)
# at the end
if h1 empty
move every element in h2
vice versa
"""
class ListNode:
def __init__(self, val=0, next=None):
self.val = x
self.next = None
def merg... |
7cab11825cfa56231dce061e531811e6916b184a | jeremyimmanuel/leetcode-sols | /2-Add-Two-Numbers/test.py | 933 | 3.828125 | 4 | from typing import List, Tuple
import unittest
from solution import addTwoNumbers, ListNode
def init_test_list(l1_vals: List[int], l2_vals: List[int]):
l1, l2 = ListNode(), ListNode()
la, lb = l1, l2
# Preparing test data
for val in l1_vals:
la.next = ListNode(val)
la = la.next
fo... |
e050f7744305de5ebf8fdb13bf0bb759cea983e5 | jeremyimmanuel/leetcode-sols | /1167-Minimum-Cost-to-Connect-Sticks/solution.py | 767 | 4.03125 | 4 | """
the coast of adding a + b = (a+b)
ex:
try doing the smallest possible transaction
[1,2,3,4,5]
1+2 = 3
[3,3,4,5]
3+3 = 6
[4,5,6]
4+6=10
[5,10]
6+9 = 15
[15]
total = 33
The greedy part is to add the two smallest number each time.
We want to minimize a+b
Edge case:
len(sticks) == 1 -> return 0
sort ascendin... |
808406295d9bf72cb40b9d21ddb2979c00a9d007 | jeremyimmanuel/leetcode-sols | /323-Number-of-Connected-Components-in-an-Undirected-Graph/solution.py | 664 | 3.5 | 4 | from collections import defaultdict as dd
from typing import Dict, List
def countComponents(n: int, edges: List[List[int]]) -> int:
def traverse(node: int, visited: List[int], adj: Dict) -> None:
visited[node] = True
for neigh in adj[node]:
if not visited[neigh]:
trave... |
0c37bcd19783489009cc6bbaf0260c1b2802e915 | jeremyimmanuel/leetcode-sols | /210-Course-Scheduler-II/210.py | 1,226 | 3.609375 | 4 | """
Solution from leetcode
"""
from collections import defaultdict as dd
from typing import Dict, List
from enum import Enum
class Graph(Enum):
Unvisited = 0
Visited = 1
Visiting = -1
def findOrder(numCourses: int, prerequisites: List[List[int]]) -> List[int]:
"""
Let G(V, E) -> directed, unweig... |
096bd617d8261fc575e9cb800b8ca8eca924da90 | waynekingcool/FullStackStudy | /基础/类的property.py | 366 | 3.96875 | 4 | class Circle:
def __init__(self,r):
self.__r = r
# 使用property能够将方法变为类的属性
@property
def area(self):
return self.__r**2
# 只有通过property属性修饰后,才能会用setter方法
@area.setter
def area(self,new):
self.__area = new
c = Circle(10)
print(c.area)
c.area = 20
print(c.area) |
1df776b07c476a49d733dfc3e87bce79a2e6b96c | waynekingcool/FullStackStudy | /基础/反射.py | 632 | 4.0625 | 4 | # 反射 通过使用字符串,达到调用函数方法或者获取变量值
#
class A:
def __init__(self,name):
self.name = name
def printName(self):
print(self.name)
a = A('wayne')
# 获取object的变量
if hasattr(a,'name'):
print(getattr(a,'name'))
# 获取函数方法的地址,通过()代用
getattr(a,'printName')()
# setattr设置 delattr删除
# 反射获取类
# import 基础... |
1e3a9b93db4db4c2ffe5ab8eb5bfd719743dd574 | d4n1elchen/machine-learning-study | /vanilla/mlp/1-activation-function.py | 204 | 3.515625 | 4 | import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
X = np.array([-100, -1, 0, 1, 100])
print(sigmoid(X)) # [ 3.72007598e-44 2.68941421e-01 5.00000000e-01 7.31058579e-01 1.00000000e+00 ]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.