blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
201c93f0bb9b9e7693531b0dc85ca048dd06886d | kkkchch/Homework | /HW6-3.py | 443 | 3.921875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 31 23:01:46 2020
@author: User
"""
print("請輸入三個數字:")
a=input()
b=input()
c=input()
if int(a)>int(b)>int(c):
print (a,b,c)
elif int(a)>int(c)>int(b):
print (a,c,b)
elif int(b)>int(c)>int(a):
print (b,c,a)
elif int(b)>int(a)>int(c):
print (b... |
666d6290263f726dd4e1eeb926b1d736ccd815c1 | andresnino1/turtle_projects | /tortuga1.py | 552 | 4.09375 | 4 | # Step 1: Make all the "turtle" commands available to us.
import turtle
#comentario inicia
# otra linea diferente l
# Step 2: Create a new turtle. We'll call it "bob"
bob = turtle.Turtle()
# Step 3: Move in the direction Bob's facing for 50 pixels
bob.forward(50)
bob.forward(50)
print("esto se debe imprimirbe imprimi... |
3d8eb17f18a799e8c46b58aa3da3d977b3b0023c | aleksnavratil/CarlTheGnarl | /reply.py | 9,305 | 3.703125 | 4 | import os, re, random, string
#----------------------------------------------------------------------
# gReflections, a translation table used to convert things you say
# into things the computer says back, e.g. "I am" --> "you are"
#----------------------------------------------------------------------
gReflections ... |
b34cfa818327bbf58b0f6a18e4158f896c981b0f | muru4a/python | /coding/two_sum1.py | 286 | 3.703125 | 4 | def two_sum(nums,target):
out_dict_seen={}
for i in nums:
if (target-i) in out_dict_seen:
print([nums.index(i)+' , '+nums.index(target-i)])
else:
out_dict_seen[i]=1
return
if __name__ == '__main__':
two_sum([1,1,3,4,5,8,6,9],10)
|
9096c57c8ebb8270eb093c39d1e39c9b5d79ce6e | muru4a/python | /Leetcode/threeSum.py | 1,471 | 3.734375 | 4 | """
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
The solution set must not contain duplicate triplets.
Example:
Given array nums = [-1, 0, 1, 2, -1, -4],
A solution set is: [ [-1, 0, 1], [-1, -1... |
18e67be84982f0834fba0f07607e827623cc7960 | muru4a/python | /Leetcode/isAnagram.py | 438 | 3.875 | 4 | def isAnagram(nums1,nums2):
if len(nums1) != len(nums2):
return "Not valid"
dict1={}
for i in nums1:
if i in dict1:
dict1[i]+=1
else:
dict1[i]=1
dict2={}
for i in nums2:
if i in dict2:
dict2[i]+=1
else:
dict2[i]=... |
15b9cbc77cb766e907315b36381609b9fcb32161 | muru4a/python | /Leetcode/sumofunique.py | 430 | 3.71875 | 4 | def sumOfUnique(nums):
"""
:type nums: List[int]
:rtype: int
"""
dict ={}
result =0
for row in nums:
if row in dict:
dict[row] +=1
else:
dict[row]=1
for k , v in dict.items():
if v == 1:
... |
59d89811809d4bc3d1002d9a3cbef12ec68b9184 | muru4a/python | /Leetcode/removeDuplicates1.py | 349 | 3.515625 | 4 | def removeDuplicates(nums):
i=0
j=1
n =len(nums)-1
while n>0:
if nums[i] == nums [j]:
del nums[i]
else:
i+=1
j+=1
n-=1
return len(nums)
if __name__ == "__main__":
print(removeDuplica... |
d820a983710f2488deabc2413f90dfd49d83259f | muru4a/python | /coding/rooks_are_safe.py | 544 | 3.90625 | 4 | def rooks_are_safe(chessboard):
n = len(chessboard)
print(n)
for row in range(n):
row_count = 0
for col in range(n):
row_count += chessboard[row][col]
if row_count > 1:
return False
for col in range(n):
col_count = 0
for row in range(n):
... |
420f1ca50e7c9f031673083b61c91bda706aa0b3 | muru4a/python | /Leetcode/removeDuplicates.py | 475 | 4.0625 | 4 | def removeDuplicates(s: str) -> str:
"""
use the stack
check the element equal to last element in stack and pop the element
current string character not equal to last element in stack and add the element in stack
"""
result = []
for row in s:
if result and row == result[-1]:
... |
5b2580e47356f65eff373b42a57d30fe333dba1e | muru4a/python | /Leetcode/twosum.py | 941 | 3.671875 | 4 | '''
# Give sorted array identify pair of elements add up to K
# Input : {1,1,2,3,4,5,6} k=10
# Output : {6,4}
# BF : Going through the array for differences O(n+mn) Time O(1)
# For sorted Array : Two pointer approach i,j go through the array left and right and break the loop after it cross O(n) Time O(1) Space
# Unsort... |
8346d0cc664167e6d311b8fc792d679d0eb06573 | muru4a/python | /Leetcode/singleNumber.py | 727 | 3.84375 | 4 | '''
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Input: [2,2,1]
Output: 1
Input: [4,1,2,1,2]
Output: 4
Hashtable approach Time O(n) space O(n)
XOR approach : Time O(n) space O(1)
'''
def singleNumber(nums):
"""
:type nums: List[int]
:rtype: int
... |
c83e4839a5f3ed56ab10f9d0a7cc5b7ccc0b82e8 | muru4a/python | /wordpaths.py | 2,346 | 3.875 | 4 | """
Author : Murugesan Alagusundaram
Python version : python 3.7
Usage of command line arguments: python3 /usr/share/dict/words cat dog
Solution : Read the file and build the graph with dictionary of words as vertex
Breadth first search (BFS) algorithm to traverse the vertex and search the path
"""
fro... |
52ca98f6337245166fabcc2bb9efb54a874dc702 | zhang0123456789/python_study | /lesson/class_1119_object/class_01.py | 6,714 | 3.546875 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time :2018/11/20 21:14
'''对象==实例'''
'''写一个机器人 类 具有的属性 制造年月 名字'''
'''第一代机器人 简单的交流 直线行走遇到障碍物 就会报警 停止行走'''
'''听歌名到音乐库里面找音乐 黑你播放'''
'''对象方法'''
# class Robotone:
# #属性
# birthday='20181119'
# name='小麦'
#
# def talk(self): #对象方法
# print("可以跟... |
60dc37f2d6551fc982a05f556be8b69e30b054dc | zhang0123456789/python_study | /study/python3/字符串.py | 10,364 | 3.78125 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time :2018/11/10 21:43
'''字符串是 Python 中最常用的数据类型。我们可以使用引号("或")来创建字符串。'''
'''Python 不支持单字符类型,单字符在 Python 中也是作为一个字符串使用。
Python 访问子字符串,可以使用方括号来截取字符串,如下实例:'''
# var1 = 'Hello World!'
# var2 = "Runoob"
# print("var1[0]: ", var1[0])
# print("var2[1:5]: ", var2[1:5])
'''你可以截取字... |
b03eb9120d56de47a13c306daf5ee3aac507b155 | zhang0123456789/python_study | /study/python3/数字.py | 3,155 | 3.65625 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time :2018/11/10 21:24
'''Python 数字数据类型用于存储数值。
数据类型是不允许改变的,这就意味着如果改变数字数据类型的值,
将重新分配内存空间。'''
# 以下实例在变量赋值时 Number 对象将被创建:
# var1 = 1
# var2 = 10
'''您也可以使用del语句删除一些数字对象的引用。
del语句的语法是:del var1[,var2[,var3[....,varN]]]]'''
'''我们可以使用十六进制和八进制来代表整数:'''
# number = 0xA0F # 十六进制
... |
6b77baa05b4575db4eb1dec98e93ad04e8c9220c | zhang0123456789/python_study | /lesson/class_1029_base/class_02.py | 2,217 | 3.59375 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time :2018/11/24 20:13
'''标识符 我们命名的名字,都是标识符
#规范
#1由数字、字母、下划线组成
#2不能以数字开头 不能用关键字
#3见名知意'''
# import keyword
# print(keyword.kwlist)
#变量 x=1 y=2 x+y=3 y=x+6 y=10
#变量 都是小写字母 不能数字开头
# x=1#赋值运算 把符号右边的值赋值给等号左边的值
# y=1
# x,y都是1的引用名
# print (id(x)) #查询内存地址
# print(id(y)... |
0a61b981124fb6de6f608c370b3633fb1f06d033 | elizarafee/python-codes | /problems.py | 421 | 4.09375 | 4 | # write a program that returns the letter of two given numbers if both numbers are even, but return the greater if one and both numbers are odd
# problem 1:
def numbersss(a, b):
if(a%2 == 0 and b%2 == 0):
return (a, b)
else:
return max(a, b)
print(numbersss(4, 8))
# problem 2:
def words(a, b):... |
f1b83c69dc1788b225af9cec166cde6f4a339ba7 | elizarafee/python-codes | /functions.py | 896 | 4.4375 | 4 | # Functions allows us to create blocks of code that can be easily executed many time without needing of writing the same code repeatedly
# function writing stars with 'def' and the function name should be all lower case letters
# 'return' allows us to assign the output of the funtion to a new variable
# For future be... |
7776639d513fee6cf22ddb9041115ba21c4a478d | elizarafee/python-codes | /comparisonOperators.py | 198 | 4.125 | 4 | # Comparison operators are: '==' / '!=' / '>' / '<' / '>=' / '<='
a = 100
b = 80
c = 60
d = 40
e = 20
f = 10
g = 5
print(a == b)
print(b != c)
print(c > d)
print(d < e)
print(e >= f)
print(f <= g) |
cbb18e8ff64338f053e8b264022cd8ee88a01a15 | elizarafee/python-codes | /generators.py | 842 | 3.875 | 4 | # generator functions allows us to write a function that can send back a value and then later resume to pick up where it left off
# generator allows us to generate sequence of values over time
# the main difference in syntex will be the use of a yeild statement
# when na generator function is explained they become an O... |
f21e1bb3dcba3dd70c355e172c01bb4d71a34c2e | aggrandize9965/mycampstuff | /snake.py | 6,354 | 3.84375 | 4 |
# -*- coding: utf-8 -*-
#import modules
import pygame
import random
import time
from uagame import *
def collision_with_boundaries(snake_head):
# if snake is outside of boundaries return 1
if snake_head[0]>=display_width or snake_head[0]<0 or snake_head[1]>=display_height or ... |
03f3141fe31ede91c07e336204e6148e71bcc30a | MarkMoretto/codility | /lessons/lesson_1.py | 3,343 | 4 | 4 |
"""
Purpose: Codility lessons
Date created: 2020-05-16
Lesson 1: BinaryGap
URL: https://app.codility.com/programmers/lessons/1-iterations/binary_gap/
Contributor(s):
Mark M.
Challenge:
A binary gap within a positive integer N is any maximal sequence of consecutive
zeros that is surrounded by ones at bo... |
bdf2b51debf8d74f1b51b509bd516cfcdbfc7136 | zhouxiaofeng12/PythonDemo | /dict/fromkeyuse.py | 797 | 3.90625 | 4 | #!/user/bin/python
#-*- coding:UTF-8 -*-
#题目1:请写代码实现字典的fromkeys函数方法
dict={}
def fromkeys(key,values=None):
if isinstance(key,str):
for i in key:
dict[i]=values
elif isinstance(key,list):
for f in key:
dict[f]=values
elif isinstance(key,tuple):
for w in key:... |
01f71c01a23d58787f8b933b1e744079e248e335 | StevenLovell/uni-assignments | /y2b4a2/venn.py | 2,144 | 3.609375 | 4 | # Imports venn diagrams and pyplot from the matplot library
from matplotlib_venn import venn2, venn2_circles
from matplotlib import pyplot as plt
# Creates the venn diagram figures using array global variable
figure, (figure1, figure2) = plt.subplots(1, 2, figsize=(10, 10))
class setTheory(): # Creates the set ... |
2361ea3438c338aceaf2712744eb59f513490355 | StevenLovell/uni-assignments | /y2b4a2/trees.py | 306 | 3.9375 | 4 | from binarytree import tree,bst,heap
# Generates a random tree, binary tree and a random heap.
randomTree = tree(height=3, is_perfect=False)
randomBst = bst(height=3, is_perfect=True)
randomHeap = heap(height=3, is_max=True, is_perfect=False)
print(randomTree)
print(randomBst)
print(randomHeap)
|
9330886b958b6ac51f61d2434f0efdc1b2b6e0ed | lopeztaelisa/CS2302 | /Main.py | 2,768 | 3.9375 | 4 | #Author: Elisabet Lopez
#CS 2302 10:30AM
#Instructor: Diego Aguiree
#T.A.: Manoj Pravaka Saha
#Lab Assignment 1 Option A
#Last modified: September 11, 2018
#Purpose: This program traverses a messy directory tree containing images of cats or dogs. It classifies the images as images of cats or dogs using a
#deep learni... |
5b37dbc8d2b6a1fa9060a267a5cdbbcf04ccaa06 | NesteinHanol/Q-learning-mini-Game | /QLearning.py | 7,351 | 3.578125 | 4 | import pygame
import math
from math import sqrt
import random
# Renkleri tanimlama
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
BLUE=(0,134,250)
PINK=(255,0,198)
# Gridlerin yükseklik ve genisliklerini ayarlama
WIDTH = 50
HEIGHT = 50
# Gridler arasi bosluk ayarlanma
MARGIN = 5
#... |
8f29d45116dee0b87a50d51bafe189402a7de617 | NishatSultana3538/pythonMay2020 | /dictionary/quiz.py | 1,094 | 4.15625 | 4 | # create a dictionary and take input from the user and return the meaning of the word from the dictionary
# l1={"pranti": "burger", "priyana": "lemonhead", "tofael": "cars",
# "Jimmy": "perfume", "Eva": "home", "jenifer":{"A": "kids",
# "B":"Burger","C":"chic... |
add1d3476283d7789e4b527f4aa2ef036cab1eba | NishatSultana3538/pythonMay2020 | /app/Appdemo1.py | 468 | 3.78125 | 4 | # print("enter your number")
# inpum = input()
# print("input("hi")")
print(input("enter your name: "))
print(input('Use of single quotation'))
print("enter your name")
inpum = input()
print("enter your number")
print("you entered", int(inpum)+100)
inpum = input()
print("you entered", inpum)
print(input("enter your ... |
7f2e16cb1f4200782c1c4c8fa4aeaace0b80fa2f | NishatSultana3538/pythonMay2020 | /set/SET.py | 230 | 3.53125 | 4 | s = set()
# print(type(s))
s_from_list = set([1, 2, 3, 4])
print(s_from_list)
print(type(s_from_list))
s.add(1)
print(s)
s.add(2)
s1 = s.union({1, 2, 3})
# s.remove("2")
s.remove(2)
print(s)
print(s.s1)
s1 = s.union({1, 2, 3}) |
42abaedcd1f3b218f0f3a2b0e9e666b5db38a22b | marcelaldecoa/DLND-Labs | /NeuralNetwork/add-and-multi.py | 459 | 3.640625 | 4 | # set some inputs
x = -2; y = 5; z = -4
# perform the forward pass
q = x + y # q becomes 3
f = q * z # f becomes -12
# perform the backward pass (backpropagation) in reverse order:
# first backprop through f = q * z
dfdz = q # df/dz = q, so gradient on z becomes 3
dfdq = z # df/dq = z, so gradient on q becomes -4
# n... |
b9f1365b128e342e01b39bfc2189f2961f4ed7d5 | Brunswick-Khorasan/NumberTheoryHelp | /chinese_remainder_theorem.py | 818 | 3.796875 | 4 | import math
def inv(x,m): #Returns an inverse of x mod m
for i in range(m):
if x*i % m == 1:
return i
def product(X): #Product of an array
p = 1
for x in X:
p = p*x
return p
def crt(r,m): #Residues and modulos, as arrays - Chinese Remainder Theorem
#Follows the proof o... |
6ca732fda5ee036fab13aba6eadadc3a79182628 | aokiga/spring-2019-paradigms-tasks | /task01/list_task.py | 467 | 3.984375 | 4 | def remove_adjacent(lst):
"""
Removes equal adjacent elements.
Does not modify the input list.
>>> remove_adjacent([1, 2, 2, 3])
[1, 2, 3]
"""
return []
def linear_merge(lst1, lst2):
"""
Merges two sorted lists in one sorted list in linear time.
Does not modify input lists.
... |
7cdf704bb9414bb4023195bfb3c698ff33ba30d7 | bendikjohansen/adventofcode | /aoc/aoc2020/days/day22/part_1.py | 1,386 | 3.515625 | 4 | from collections import deque
from typing import Deque, Tuple
from aoc.utils import get_input
Deck = Deque[str]
Decks = Tuple[Deck, Deck]
def parse_deck(deck_raw: str) -> Deck:
return deque([int(value) for value in deck_raw.splitlines()[1:]])
def parse_decks(decks_raw: str) -> Decks:
[first_deck, second_d... |
703731fa26b1e35b64a983220d0f3545c3415be8 | RahulRj09/Python | /solvedPythonProblems/1_Multiples_of_3_and_5.py | 347 | 4.0625 | 4 | # Multiples of 3 and 5
# Problem 1
# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
# Find the sum of all the multiples of 3 or 5 below 1000.
a = []
for i in range(1,1000):
if (i % 5 == 0) or (i % 3 == 0):
a.append(i)
print(s... |
6d00a1faa188815d12c1231c54b54d2f82a1a2a8 | RahulRj09/Python | /solvedPythonProblems/int_to_roman.py | 709 | 4.21875 | 4 | #program to convert integer to roman numerals using classes
class IntToRoman():
'''A python class to convert integers to roman numerals'''
def convert(self, integer):
''' This fucntion will to the conversion process '''
values = [1000,900,500,400,100,90,50,40,10,9,5,4,1]
romans = ["M","C... |
a49e4d3467a4d625ca477abb6806b7c3f2bd7323 | RahulRj09/Python | /hangman/hangman.py | 3,705 | 3.953125 | 4 | import string
from words import get_secret_word
from images import IMAGES
import random
# End of helper code
# -----------------------------------
def is_word_guessed(secret_word, guessed_word):
if str(secret_word) == guessed_word:
return True
return False
def get_guessed_word(secret_word, letters_gu... |
4662f203df4f944a099f410f4c33f9cb4734142e | RahulRj09/Python | /solvedPythonProblems/classes.py | 368 | 3.515625 | 4 | # class MyNewClass():
# """This is my new class"""
# pass
# print(MyNewClass.__doc__)
class MyClass():
"This is my second class"
a = 10
def func(self):
return 'Hello'
# print(MyClass.a)
# print(MyClass.func)
# print(MyClass.__doc__)
# creating a new object
ob = MyClass()
#this is a function of MyClass
print(... |
0097368ae7b009e2b2e67ef0eae3f3efe4dd8fc6 | Xh4H/ManyTimePad | /Logic Scripts/ManyTimePad.py | 4,824 | 3.546875 | 4 | import sys
import string
import collections
import sets
# XOR two strings of different lengths
def stringXOR(a, b):
if len(a) > len(b):
return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a[:len(b)], b)])
else:
return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b[:len(a)])])
# All the ... |
d0085ad7f78f99544f5ea5ab24fed4b145f33e9e | zendpen/command_line_contacts_list | /contacts_list.py | 2,392 | 3.8125 | 4 | import sqlite3
import subprocess
conn = sqlite3.connect('contacts.db')
def sql_fetch(con):
cursorObj = con.cursor()
cursorObj.execute('SELECT * FROM people ORDER BY name')
rows = cursorObj.fetchall()
for row in rows:
print(row)
def sql_add(name, number, email):
cursor = conn.cursor()
curso... |
763c01c17afb5cbf7ec49b925ae3788f3e5f3aed | Elisabeth-A/Alien-Invasion-Game | /alien_invasion/alien_invasion.py | 2,367 | 4.34375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Alien Invasion Game
In this game the player controls a ship that appears at the bottom center of the screen.
The player can move the ship right and left using the arrow keys and shoot bullets using the spacebar.
When the game begins, a fleet of aliens fills the sky a... |
5d31094fae09d091df62d4aff4184f6cb22359cb | matthew-erdman/week11 | /lab11/findfiles.py | 2,400 | 4.3125 | 4 | """
Description: This program allows the user to search for filenames containing a
given pattern in a given directory. A user provides a directory and a pattern, and
the program recursively finds all occurrences of the pattern in filenames from the directory.
Author: Matthew Erdman
Date: 9/20/21
"""... |
eec9b1ebb421fddf10fd52149daabf8810a83912 | matthew-erdman/week11 | /lab11/sillytext.py | 1,548 | 4.46875 | 4 | """
Description: This program creates a silly text effect. A user provides a string
and an integer, and each letter of the original text is printed repeated n times.
Author: Matthew Erdman
Date: 9/20/21
"""
def getInteger():
"""
Purpose: Gets input from the user and validates that it is a non-n... |
4d5216737430fbcd1790ab609ec990f8b5c629eb | vicwuht/pl-hd | /stringFunc/stringfunc.py | 8,103 | 3.71875 | 4 | import unicodedata
s = 'banana'
ss = 'it is my banana'
#首字母大写 capitalize()
s1 = s.capitalize()
print(s1)
#字符串内所有单词首字母大写 title()
print(ss.title())
#都小写 casefolde和lower的区别在于lower只支持ASCII 也就是 'A-Z'有效。
# 汉语 & 英语环境下面,继续用 lower()没问题;要处理其它语言且存在大小写情况的时候再用casefold()
s2 = s1.casefold()
s3 = s1.lower()
print(s2)
print(s3)
... |
a109a5edc155408149d12229e6e4fd16b4c2ad71 | vicwuht/pl-hd | /python_programing/exceptiontest/print_files.py | 428 | 3.640625 | 4 | filenames = ["dogs.txt","cats.txt"]
for filename in filenames:
filename = "txt_files\\" + filename
print(filename)
try:
with open(filename) as getfile:
lines = getfile.readlines()
print(lines)
except FileNotFoundError:
# print("文件读取失败,请确认文件位置")
# break
... |
604426ba624ddf328153070b4b7f893cc85b1d1e | vicwuht/pl-hd | /python_programing/ClassTest/user.py | 1,211 | 3.8125 | 4 | class User():
"""定义一个用户类"""
def __init__(self,first_name,last_name,gender,age,phone_number):
"""初始化,姓名,性别,年龄,电话"""
self.first_name = first_name
self.last_name = last_name
self.gender = gender
self.age = age
self.phone_number = phone_number
self.login_attem... |
cc60faa82025f40bb4a9eab3215cd880d39caf80 | vicwuht/pl-hd | /python_programing/list/name_list.py | 1,040 | 4.1875 | 4 | #邀请人吃饭的小例子
names = ['candy', 'rodger' ,'cavin' ,'sean']
for i in names:
message = 'Hello '+ i.title() + '! Please have a dinner with me !'
print(message)
print(names[-1].title()+ " can not have a dinner with me ")
names[-1] = 'jack'
for i in names:
message = 'Hello '+ i.title() + '! Please have a dinner ... |
3537c4d77e1213c1f2d2e0809f499392aa74c5cb | aakarsh0/Optimization-techniques | /main_bracket_penalty.py | 7,719 | 3.640625 | 4 | import math
import numpy as np
import matplotlib.pyplot as plt
from Problem import info
#from Penalty import penalty, set_prob
import matplotlib.pyplot as plt
#from input import starts
## WRITE THE PROBLEM NO. HERE FOR VARIABLE NAME, 'prob'
## Default problem is Hammelblau function otherwise.
prob = 0
obj... |
966a0eed3f1d78cea5d309568fee8bae6bfa0e49 | binarioGH/criptopython | /poc/cifrararchivo.py | 721 | 3.65625 | 4 | #-*-coding: utf-8-*-
from cryptography.fernet import Fernet
from sys import argv
from random import randint
def cifrararchivo(file, clave):
with open(file, "r") as f2c:
with open("file-{}.{}".format(randint(0, 1000),file[len(file)-3:]), "w") as cf:
for line in f2c.readlines():
cf.write(c.encrypt(line.encode(... |
31bee301b7e7250d18ae3469af864973a6babd2d | WorldPierce/Automate_the_Boring_Stuff_With_Python | /python_concept_references/autoGui.py | 647 | 3.8125 | 4 | import pyautogui # install pyautogui
width, height = pyautogui.size() # returns screen res
pyautogui.position() # returns mouse position
pyautogui.moveTo(10,10)
pyautogui.moveTo(10,10, duration=1.5) # drags mouse to position
pyautogui.moveRel(200, 0) # move 200 pixels to the right
pyautogui.moveRel(0, -100) # move ... |
deda1d8f5de0a627dad5d7c370cad9a69f603b1d | WorldPierce/Automate_the_Boring_Stuff_With_Python | /python_concept_references/regexDotStar.py | 894 | 3.625 | 4 | import re
beginsWithHelloRegex = re.compile(r'^Hello')
print(beginsWithHelloRegex.search('Hello there!'))
endsWithRegex = re.compile(r'world!?')
allDigitsRegex = re.compile(r'^\d+$') # must begin and end with this pattern (one or more digits)
# . wildcard character any character except newline
atRegex = re.compi... |
2d6a26cdb338cc1995b6854528f907ec8f7a3e64 | ana-mariatambur/Fisiere-in-Python | /problema 5.py | 825 | 3.8125 | 4 | """Afişaţi tabla înmulţirii cu numărul n. Exemplu: pentru n=5, se va afişa pe verticală 1x5=5 2x5=10 3x5=15 4x5=20 5x5=25 6x5=30 7x5=35 8x5=40 9x5=45 10x5=50.
Din fişierul « numar.txt » se citeşte un număr, în fişierul « inmultire.txt » - se înscrie tabla înmulţirii cu acest număr."""
with open('numar.txt','r')as... |
0987aff468f4f2d35e41f95feebd7aaec10bfa93 | linyue2000/review | /alg/CLRS/5_1_2.py | 653 | 3.609375 | 4 | # coding=utf-8
import random
import time
import math
def random_0_1():
return random.randint(0, 1)
def random_a_b(a, b):
if a > b:
return 0
elif a == b:
return a
c = b - a
num_digits = 0 if c == 0 else int(math.log(c, 2)) + 1
while True:
result = 0
for i in xr... |
c78a69ed27b5396034700dc354f5dceab99397b5 | linyue2000/review | /leetcode/p25.py | 945 | 3.65625 | 4 | #coding=utf-8
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def reverseKGroup(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
"""
p... |
569670d722211d71e18026e48cd2f761e07070af | fady-michel/passkey | /translate.py | 1,599 | 3.859375 | 4 | from sys import argv
from itertools import cycle
import os
class Key(object):
def __init__(self, operation: str, user_input: str) -> None:
super().__init__()
self.OFFSET = 33
self.operation = operation
self.key = os.environ.get('PASS_KEY') or 'My_SECRET'
self.user_input = u... |
c0c31d2538f021bfbf8bd2cdf64b0f7e17e8664d | Tomtao626/python-note | /py_tools/tools/magic/m01/main.py | 2,357 | 3.671875 | 4 | # 冷知识
# 1 ...语法糖
print(...) # Ellipsis
print(id(...)) # 4551344512
print(id(Ellipsis)) # 4551344512
print(bool(Ellipsis)) # True
"""
你会发现这是个单例,作用类似于pass bool转换是真 而且是Numpy的一个语法糖🍬
"""
# 2 end结束代码块
__builtins__.end = None
def my_abs(x):
if x > 0:
return x
return -x
end
end
print(my_abs(10)) # 10
print(... |
841f41acb6ca2de95725f27917c8e0665ce95555 | Tomtao626/python-note | /py_tools/example/tools/10-copy_demo.py | 654 | 3.65625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/4/13 20:08
# @Author : Tom_tao
# @Site :
# @File : 拷贝.py
# @Software: PyCharm
# a = [1,[2,3],4]
# b = a[::]
#
# a[0] = 5
# print("----1----")
# print(id(a))
# print(id(b))
#
# a[1][1] = 10
# print("----2----")
# print(id(a))
# print(id(b))
# import copy
#
... |
a93a8c5254ed2adee85027e0cf884f3ca078366f | Tomtao626/python-note | /py_tools/study/类与对象/属性方法.py | 788 | 3.8125 | 4 | class Dog(object):
'''这个类用于描述Dog这个对象'''
def __init__(self,name):
self.name = name
self.__food = None
# @staticmethod
@property
def eat(self):
# print("%s is eatting %s"% (self.name,food))
print("%s is eatting %s" % (self.name,self.__food))
@eat.setter #修改
de... |
3f7516984adc0e33a2256806d645a1a24fa3446d | Tomtao626/python-note | /py_interview/pythonic-code/4.使用合适的数据结构.py | 649 | 3.65625 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:tom_tao626
@license: Apache Licence
@file: 4.使用合适的数据结构.py
@time: 2020/12/07
@contact: tp320670258@gmail.com
@site: xxxx.suizhu.net
@software: PyCharm
"""
# 使用set()做成员测试和去重
million_numbers = list()
def check_number(number):
for item in million_number... |
36c27b934fa6dd2e9e720af51d6743f18719d4d7 | Tomtao626/python-note | /py_interview/pythonic-code/1.内置函数.py | 466 | 3.59375 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:tom_tao626
@license: Apache Licence
@file: 1.内置函数.py
@time: 2020/12/07
@contact: tp320670258@gmail.com
@site: xxxx.suizhu.net
@software: PyCharm
"""
# 1.多使用内置函数
# 计算列表长度
# 新手写法
how_many = 0
one_million_elements = [1, 2, 3, 4, 5, 6, 7]
for element in one_mi... |
5214d0276eb945ad9e81bb3b03ce4ef41567041d | Tomtao626/python-note | /py_interview/pythonic-code/23.展开列表清单.py | 690 | 3.65625 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:tom_tao626
@license: Apache Licence
@file: 23.展开列表清单.py
@time: 2020/12/10
@contact: tp320670258@gmail.com
@site: xxxx.suizhu.net
@software: PyCharm
"""
# 有时不知道列表的嵌套深度,并且只想把所有元素放在一个普通列表中。可以通下面的方法得到数据:
from iteration_utilities import deepflatten
# 如果嵌套列表的深度只有1层
... |
e17f5b64308d8b45efd04d75550889875d41f439 | Tomtao626/python-note | /py_tools/study/类与对象/继承.py | 1,408 | 4.125 | 4 |
# class Person: 经典类
class Person(object): # 新式类
def __init__(self,name,age):
self.name = name
self.age = age
self.friends = []
def eat(self):
print("%s is eatting ...." %self.name)
def sleep(self):
print("%s is sleeping...." %self.name)
def play(self):
... |
aacf8382d22fd3a93bd68e21e9c5d98d70dbab70 | Tomtao626/python-note | /py_tools/example/face_object/codes/01-面向对象基础/hm07_内置方法__del__( ).py | 823 | 3.8125 | 4 | class Cat:
def __init__(self,new_name):
self.name = new_name
print("%s is coming" % self.name)
def __del__(self):
#会在对象调用完毕后,销毁对象
print("%s was died" % self.name)
'''
__init__改造初始化方法,可以让创建对象更加灵活
__del__如果希望在对象被销毁前,在做一些事情,可以考虑使用__del__方法
生命周期
一个对象从调用类名(... |
ac7e4d3164afea55ab33abe2e0ba4f4f8ee6f525 | Tomtao626/python-note | /py_tools/example/逻辑运算符取反.py | 151 | 3.65625 | 4 | sex = True
if not not sex:
print("boy")
else:
print("girl")
#not true=false
# not false = true
#not 结合性 从右往左
|
96428a5ee7d6a0b281704be6842d913c7bc26360 | Tomtao626/python-note | /py_tools/basic/moneytest.py | 311 | 3.796875 | 4 | year = eval(input("请输入贷款年限:"))
money= eval(input("请输入贷款金额:"))
monthrate=eval(input("请输入贷款利率:"))
monthmoney = (money*monthrate)/(1-1/(1+monthrate)**(year*12))
allmoney = monthrate*12*year
print("你每月月供为:",monthmoney)
print("全部还款:",allmoney) |
f3168c16c0cb8c1c3541d61c8ffa62406b132db0 | Tomtao626/python-note | /py_tools/example/英尺转米.py | 217 | 3.671875 | 4 | miles = eval(input("请输入英尺数:"))
mi = 0.305*miles
print("转换后的米数为:",mi)
#千克与磅的转换
Bg = eval(input("请输入磅数:"))
Kg = 0.454*Bg
print("转换后的千克数为:",Kg) |
677a2a6f32eaa21974ae0b7f8163dd7bd5b3e594 | Tomtao626/python-note | /py_tools/subprocess/async_demo/12-通过send使用生成器.py | 571 | 3.65625 | 4 | def create_num(all_num):
a, b = 0, 1
current_num = 0
while current_num < all_num:
ret = yield a
print("---ret---", ret)
a, b = b, a+b
current_num += 1
obj = create_num(10)
# obj.send(None) # send一般不会放到第一次启动生成器,如果非要这么做,那么传递None
ret = next(obj)
print(ret)
ret = obj.send("hahahah")
print(ret)
# send里面的数... |
f2c592a0ea38d800510323a1001c646cdbecefff | Tomtao626/python-note | /py_interview/pythonic-code/17.列表中的元素统计.py | 599 | 3.578125 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:tom_tao626
@license: Apache Licence
@file: 17.列表中的元素统计.py
@time: 2020/12/09
@contact: tp320670258@gmail.com
@site: xxxx.suizhu.net
@software: PyCharm
"""
# collections.Counter()
from collections import Counter
list1 = ['a', 'b', 'b', 'c', 'd', 'e', 'a', ... |
e859489f042fcee10cea7240e3c23f10e47eba10 | Tomtao626/python-note | /py_tools/study/file_open.py | 1,662 | 3.828125 | 4 | # -*- coding:utf-8 -*-
# Ayuthor:Tom_Tao
#data = open("yesterday",encoding = "utf-8").read()#打开文件并读取
#'w'创建一个新文件
#f = open("yesterday2",'r+',encoding="utf-8")#文件句柄 读写
#f = open("yesterday2",'w+',encoding="utf-8")#文件句柄 写读 先创建一个新文件,再写
#f = open("yesterday2",'a+',encoding="utf-8")#文件句柄a+追加读
f = open("yesterday2",'wb')#文... |
64f90b31126ad1952223aa77f64c1ede284db9e5 | Tomtao626/python-note | /py_tools/example/直线坐标.py | 504 | 3.6875 | 4 | # /usr/bin/env python
# -*- coding=UTF-8 -*-
import turtle
x1,y1 = eval(input("请输入x1,y1的坐标:"))
x2,y2 = eval(input("请输入x2,y2的坐标:"))
print(x1,y1)
print(x2,y2)
turtle.penup()
turtle.goto(x1,y1)
turtle.pendown()
turtle.write('('+str(x1)+','+(str(y1))+')')
turtle.goto(x2,y2)
turtle.write('('+str(x2)+','+(str(y2))+')')
t... |
5ebb81be1f50caf40943aafb679203e90fd63337 | HudsonStreet/hs-scheduler | /utilities/tradeDateValidator.py | 379 | 3.609375 | 4 | from datetime import datetime
def is_holiday(date):
holidays = set(line.strip() for line in open('../2019nonTradeDate.date'))
is_holiday = date in holidays
return is_holiday
def is_tradeday(date):
weekday = datetime.strptime(date, '%Y-%m-%d').isoweekday()
if weekday <=5 and not is_holida... |
0dea65febe0222d5c10dea587c01d921c4e23c86 | rlee32/daily-coding-solutions | /465-easy/solve.py | 1,048 | 3.9375 | 4 | #!/usr/bin/env python3
class Node:
def __init__(self, index):
self.index = index
self.next = None
def append_new(self):
new_tail = Node(self.index + 1)
self.next = new_tail
return new_tail
def create_list(size):
head = Node(0)
tail = head
for i in range(1, ... |
5d71451f64339d9fa8f7971cfd241a91933b733d | RobsonFulaneti/python-learning | /cursoemvideo/cursoemvideo/Palindromo.py | 187 | 3.796875 | 4 | for c in range(1, 4):
a = str(input("Digite uma palavra: "))
b = a[::-1]
if a == b:
print("é Palindromo ")
else:
print("Não é Palindromo ")
print("Fim") |
d9743201211084d9485d51d36367e5e682cd7cfc | RobsonFulaneti/python-learning | /cursoemvideo/EstruturaDeDecisao/Ex07.py | 665 | 4.03125 | 4 | produto = str(input("Informe o produto que voce deseja comprar: "))
preco1 = float(input("Digite o preço do produto: "))
loja1 = str(input("Digite o nome da loja: "))
preco2 = float(input("Digite o preço do produto: "))
loja2 = str(input("Digite o nome da loja: "))
preco3 = float(input("Digite o preço do produto: "))
l... |
0cadbbb85891a7c0e8cac17c4129dad7e222c273 | RobsonFulaneti/python-learning | /cursoemvideo/FuncoesEx01.py | 237 | 3.65625 | 4 | def área(larg, comp):
a = larg * comp
print(f'A área de um terreno {larg} * {comp} é de {a} metros')
print('Controle de terrenos')
print('-' * 30)
l = float(input('Largura: '))
c = float(input('Comp: '))
área(l, c) |
eeadb66730147552848c952b11b27d7b959f2cf5 | RobsonFulaneti/python-learning | /cursoemvideo/cursoemvideo/ifelse10.py | 301 | 4.09375 | 4 | a = int(input("Digite o primeiro lado do triângulo: "))
b = int(input("Digite o segundo lado do triângulo: "))
c = int(input("Digite o terceiro lado do triângulo: "))
if a < b + c and b < c + a and c < a + b:
print("Triângulo formado")
else:
print("Não é possível formar um triângulo") |
4fa0b1887c71a2bbfb5282434c990fa735b1b542 | RobsonFulaneti/python-learning | /cursoemvideo/EstruturaDeDecisao/Ex03.py | 444 | 4.0625 | 4 | #Faça um Programa que verifique se uma letra digitada é "F" ou "M".
#Conforme a letra escrever: F - Feminino, M - Masculino, Sexo Inválido.
while True:
letra = str(input('Digite a primeira letra do sexo: '))
if letra in "Ff":
print("Sexo Feminino")
elif letra in "Mm":
print("Sexo Masculino")... |
8e1d0a3f185619e896496dffc45e09e3e0438fa4 | RobsonFulaneti/python-learning | /cursoemvideo/cursoemvideo/Hipotenusa.py | 589 | 3.90625 | 4 | co = float(input("O valor do cateto oposto é: "))
ca = float(input('O valor do cateto adjacente é: '))
hi = (co**2 + ca**2) ** (1/2)
print("O valor da Hipotenusa é de {:.2f}".format(hi))
import math
co = float(input("O valor do cateto oposto é: "))
ca = float(input('O valor do cateto adjacente é: '))
hi = math.hypot(c... |
cd22f050d7f5bf880e5f1c6237b3037984bb8e51 | RobsonFulaneti/python-learning | /cursoemvideo/cursoemvideo/Forex001.py | 90 | 3.8125 | 4 | total = 0
for c in range(0, 10, 3):
if total % 3 == 0:
total += c
print(total) |
40d44063a335cab62480bfc0ecdd6f36b3eea8cb | RobsonFulaneti/python-learning | /cursoemvideo/EstruturaDeDecisao/Ex05.py | 274 | 4 | 4 | nota1 = float(input("Digite a primeira nota: "))
nota2 = float(input("Digite a segunda nota: "))
media = nota1 + nota2 / 2
if media < 5:
print(f"Reprovado com nota {media}")
elif media < 10:
print(f"Aprovado {media}")
else:
print("Parabéns foi aprovado com 10") |
655b66de74c51bfe577684c234435eb4d2ef5d35 | RobsonFulaneti/python-learning | /cursoemvideo/cursoemvideo/Listaex001.py | 630 | 3.8125 | 4 | num = []
mai = 0
men = 0
for cont in range(0, 5):
num.append(int(input("Digite um numero: ")))
if cont == 0:
mai = men = num[cont]
else:
if num[cont] > mai:
mai = num[cont]
if cont == 0:
mai = men = num[cont]
else:
if num[cont] < men:
men = num... |
dced334605cdbc355bfc19ac7c3e0f4ce01725f1 | RobsonFulaneti/python-learning | /cursoemvideo/EstruturaDeDecisao/Ex02.py | 402 | 4.15625 | 4 | #Faça um Programa que peça um valor e mostre na tela se o valor é positivo ou negativo.
while True:
numero = int(input("Digite um numero: "))
if numero > 0:
print("Esse número é positivo")
elif numero < 0:
print("Esse número é negativo")
else:
print("Esse número é 0")
cont = ... |
abe2740014cae09541bea580db92c7b339c87c48 | jledux/write_lines | /create_file.py | 1,174 | 3.9375 | 4 | """Entrer les des phrases itératives dans un fichier."""
import os
def main():
"""Fonction principale."""
while True:
print("Le repertoire contient les éléments suivants :")
print(os.listdir())
phrase = input("Entrez la phrase voulue : ")
numero = input("Entrez le nombre d'itér... |
e5156929d6eff4b23ac03e8e5a8cbe43077248c6 | ghmulti/adventofcode2020 | /day15/day15.py | 984 | 3.609375 | 4 | from itertools import islice
numbers = [0,13,1,16,6,17]
def get_next_number(spoken, previous_number):
if previous_number not in spoken or len(spoken[previous_number]) == 1:
return 0
else:
return spoken[previous_number][-1] - spoken[previous_number][-2]
def counter(numbers):
yield from num... |
0a4ee8a3030d08b70ce164c8f417b89006ce5425 | DenSssobol/mope_lab1 | /Лаб2/Lab2.py | 4,632 | 3.515625 | 4 | #прошу вибачення за незручності, виникла якась технічна помилка і надіслався не тей код, але в протоколі
#засвідченно цей код та показані результати цієї програми, тому я надіслав пустий файл не для того, щоб встигнути в дедлайн.
from math import *
from random import *
while True:
m = 5
max_y = (30 - ... |
5ef3177ceca683b8db68fadfdf3855b3e12f8380 | dtbinh/courses | /distributed-computing/lab-2.py | 7,272 | 3.671875 | 4 | def task1(directory):
directory = "D:\SEECS\Lectures\Distributed Computing\Assignment/python_ass_afroze_310.txt"
import string
f=open(directory,"r")
text=f.read()
text=text.lower()
for punc in string.punctuation:
text=text.replace(punc,' ') ##might make some extra words like "s" which... |
34efec5bba84eb3d1e04b975e7e06459e7af22be | robstraker/quantum-computing-d-wave | /D-Wave Examples - Beginner/Constrained_Scheduling.py | 3,432 | 3.734375 | 4 | # Constrained Scheduling - D-Wave Beginner Example
# This example solves a binary constraint satisfaction problem (CSP). CSPs require that
# all a problem’s variables be assigned values that result in the satisfying of all
# constraints. Here, the constraints are a company’s policy for scheduling meetings:
# - Constra... |
c7938aa1283221a37ab5800bf3754e79a1ca9eb7 | nexus85/webformyself_python | /webFormyselft/lesson10.py | 261 | 3.640625 | 4 | # s = 'hello, world'
# print(len(s))
# print(s.capitalize())
# print(s.upper())
# print(s.lower())
#
# print(s.center(20, '%'))
# print(s.count('l', 0, 4))
# print(s.index('a§'))
# print(s.replace('l', 't
# '))
# print(s.split(sep='o'))
s = 111
s.isdigit()
|
d30ade056e79beb77b12ee0e17541dc0a615a517 | nexus85/webformyself_python | /spec/demo8.py | 346 | 3.84375 | 4 | # статическая типизация
from typing import List, Dict, Tuple
s: str # это подсказка, какой тип будет использоваться
n: int = 1 #
def is_equal(n1: int,n2: int)->bool:
return n1 == n2
print(is_equal('2',3))
lst: List[int]
lst = [2,3,4]
d: Dict[str,int]
t: List[Tuple[int, int]]
|
cf3340219c6eeb0ae0a504d4076e0d17e7859b58 | nexus85/webformyself_python | /webFormyselft/lesson22.py | 689 | 3.65625 | 4 | # s = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
# print(type(s))
#
# print(s)
# s2 = set('hello')
# s3 = {i for i in range(1,11)}
# s4 = {1,3,4,5,1,3,4}
# print(s2)
# print(s3)
# print(s4)
#
#
# s4 = set()
# print(type(s4))
#
# nums = [1,2,3,4,1,1,2,3,5,5,3,3,4]
# nums2 = list(set(nums))
# print(nums)
# ... |
0eefd196b9b45a63c29f81446d47ef62bccc2d64 | frankwrk/code_challenges | /project_euler/python/085.py | 1,917 | 3.625 | 4 | """http://projecteuler.net/problem=085
Counting rectangles
By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles:
- 6 1x1
- 4 1x2
- 2 1x3
- 3 2x1
- 2 2x2
- 1 3x2
Although there exists no rectangular grid that contains exactly two million rectangles, find the area... |
7e58727004d03c92e07e4b3ae7b10369268d2f05 | Artur-Grigoryev/ICS3U-Unit3-07-Python-Dating | /Dating.py | 776 | 4.15625 | 4 | #!/usr/bin/env python3
# Created by Malcolm Tompkins
# Created on May 25, 2021
# Determines if a person fits grandma's dating criteria
import constants
def main():
# User input
user_input = (input("Enter your age: "))
# Process
try:
user_age = int(user_input)
if (user_age >= consta... |
8d03b5ad4ca2fe62c2b74def3709ab4f2fa3bb96 | cnsnaya/SmartSTT | /Python/light_module.py | 351 | 3.625 | 4 | from tkinter import *
def change_color():
current_color = box.cget("background")
next_color = "orange" if current_color == "sky blue" else "sky blue"
box.config(background=next_color)
root.after(1000, change_color)
root = Tk(className="Light")
root.geometry("200x200")
box = Text(root, background="oran... |
616c626d3295ce6e5188bd9b29e04d404e1ad968 | hyeonggeun2/filterdesigner | /filterdesigner/FIRDesign/_fir2.py | 2,264 | 3.953125 | 4 | import numpy as np
import scipy.signal as signal
import scipy.interpolate as ip
from typing import List, Tuple
def fir2(n : int, f, m, npt : int =512, window='hamming') -> Tuple:
"""
FIR filter design using the window method.
From the given frequencies `f` and corresponding gains `m`,
this f... |
4d245050e2a138c93186b5db542c6a0a17d8b1eb | hyeonggeun2/filterdesigner | /filterdesigner/IIRDesign/_polyscale.py | 615 | 3.5625 | 4 | import scipy.signal as signal
from typing import List, Tuple
import numpy as np
def polyscale(a, alpha:float):
"""
Scale roots of polynomial
b = polyscale(a,alpha) scales the roots of a polynomial in the z-plane,
where a is a vector containing the polynomial coefficients and alpha is
... |
c2ad8f956b6ea6dfa1c699475ead18edd5cb9225 | hyeonggeun2/filterdesigner | /filterdesigner/IIRDesign/_butter.py | 4,182 | 3.921875 | 4 | import scipy.signal as signal
from typing import List, Tuple
import numpy as np
def butter(n : int, Wn, ftype :str='default', zs :str= 'z') -> Tuple:
"""
Butterworth digital and analog filter design.
Design an Nth-order digital or analog Butterworth filter and return the
filter coefficients.... |
ed8e926f6447596de2ebe93fa34df1caf967a1b8 | hyeonggeun2/filterdesigner | /filterdesigner/IO/_whosmat.py | 1,782 | 3.53125 | 4 | import scipy.io as io
import numpy as np
from typing import List, Tuple
def whosmat(filename:str, byte_order:str=None, matlab_compatible:bool=False)->list:
"""
List variables inside a MATLAB file.
Parameters
----------
filename : str
Name of the mat file.
Can also ... |
363a9a266418637548b470b85bfc261d8b113aa8 | sophusen/Codeacademy | /Conditional and control flow.py | 344 | 3.796875 | 4 | # Make sure that the_flying_circus(something) returns True
def the_flying_circus():
if 3<4 and 4<5: # Start coding here!
return True==True
# the code inside this block!
elif 4>3:
return "yes again"
# Keep going here.
# You'll want to add the else statement, too!
el... |
e22a6cf72ba11a4e28ca0c1a87ec02b3e91f4d96 | gonchigor/ormedia | /ht3_3.py | 301 | 3.78125 | 4 | '''
Посчитать сумму числового ряда от 0 до 14 включительно. Например, 0+1+2+3+…+14;
'''
def sum_r(n):
s = 0
for i in range(n+1):
s += i
return s
# sum = 0
# for i in range(0,15):
# sum += i
# print(sum)
print(sum_r(14))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.