blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
de341d1e4d30ed173bab437ba44bc5b8315b3794
yiming1012/MyLeetCode
/LeetCode/动态规划法(dp)/5423. 找两个和为目标值且不重叠的子数组.py
3,197
3.765625
4
""" 给你一个整数数组 arr 和一个整数值 target 。 请你在 arr 中找 两个互不重叠的子数组 且它们的和都等于 target 。可能会有多种方案,请你返回满足要求的两个子数组长度和的 最小值 。 请返回满足要求的最小长度和,如果无法找到这样的两个子数组,请返回 -1 。   示例 1: 输入:arr = [3,2,2,4,3], target = 3 输出:2 解释:只有两个子数组和为 3 ([3] 和 [3])。它们的长度和为 2 。 示例 2: 输入:arr = [7,3,4,7], target = 7 输出:2 解释:尽管我们有 3 个互不重叠的子数组和为 7 ([7], [3,4] 和 [7])...
59da3ebb00d5f0ad223ec65fed6b5c30050eb4aa
yiming1012/MyLeetCode
/LeetCode/动态规划法(dp)/分类讨论dp/801. 使序列递增的最小交换次数.py
2,218
4.09375
4
""" 801. 使序列递增的最小交换次数 我们有两个长度相等且不为空的整型数组 A 和 B 。 我们可以交换 A[i] 和 B[i] 的元素。注意这两个元素在各自的序列中应该处于相同的位置。 在交换过一些元素之后,数组 A 和 B 都应该是严格递增的(数组严格递增的条件仅为A[0] < A[1] < A[2] < ... < A[A.length - 1])。 给定数组 A 和 B ,请返回使得两个数组均保持严格递增状态的最小交换次数。假设给定的输入总是有效的。 示例: 输入: A = [1,3,5,4], B = [1,2,3,7] 输出: 1 解释: 交换 A[3] 和 B[3] 后,两个数组如下: A = [1, 3...
d1294c190f8e519585c7e11b0097b879b3eb4c8c
yiming1012/MyLeetCode
/LeetCode/树(Binary Tree)/513. 找树左下角的值.py
1,880
4.09375
4
""" 给定一个二叉树,在树的最后一行找到最左边的值。 示例 1: 输入: 2 / \ 1 3 输出: 1   示例 2: 输入: 1 / \ 2 3 / / \ 4 5 6 / 7 输出: 7   注意: 您可以假设树(即给定的根节点)不为 NULL。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/find-bottom-left-tree-value 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 """ i...
88e5e3b9eba1079bf4acec5907ae0265fc7dbd78
yiming1012/MyLeetCode
/LeetCode/堆(heap)/630. 课程表 III.py
1,979
3.703125
4
""" 630. 课程表 III 这里有 n 门不同的在线课程,他们按从 1 到 n 编号。每一门课程有一定的持续上课时间(课程时间)t 以及关闭时间第 d 天。一门课要持续学习 t 天直到第 d 天时要完成,你将会从第 1 天开始。 给出 n 个在线课程用 (t, d) 对表示。你的任务是找出最多可以修几门课。   示例: 输入: [[100, 200], [200, 1300], [1000, 1250], [2000, 3200]] 输出: 3 解释: 这里一共有 4 门课程, 但是你最多可以修 3 门: 首先, 修第一门课时, 它要耗费 100 天,你会在第 100 天完成, 在第 101 天准备下门课。 第二, 修...
4864e957ec81f5dcdc53a009280e7488bc7cd681
yiming1012/MyLeetCode
/LeetCode/动态规划法(dp)/区间DP/1780. 剪绳子.py
1,742
3.546875
4
""" 1780. 剪绳子 给你一根长度为 n 的绳子,请把绳子剪成整数长度的 m 段(m、n都是整数,n>1并且m>1),每段绳子的长度记为 k[0],k[1]...k[m - 1] 。请问 k[0]*k[1]*...*k[m - 1] 可能的最大乘积是多少?例如,当绳子的长度是8时,我们把它剪成长度分别为2、3、3的三段,此时得到的最大乘积是18。 答案需要取模 1e9+7(1000000007),如计算初始结果为:1000000008,请返回 1。   示例 1: 输入: 2 输出: 1 解释: 2 = 1 + 1, 1 × 1 = 1 示例 2: 输入: 10 输出: 36 解释: 10 = 3 + 3 + 4, ...
ac742e1e74c22754d7923979570f7846ee15084d
yiming1012/MyLeetCode
/LeetCode/动态规划法(dp)/1301. 最大得分的路径数目.py
2,126
3.734375
4
""" 1301. 最大得分的路径数目 给你一个正方形字符数组 board ,你从数组最右下方的字符 'S' 出发。 你的目标是到达数组最左上角的字符 'E' ,数组剩余的部分为数字字符 1, 2, ..., 9 或者障碍 'X'。在每一步移动中,你可以向上、向左或者左上方移动,可以移动的前提是到达的格子没有障碍。 一条路径的 「得分」 定义为:路径上所有数字的和。 请你返回一个列表,包含两个整数:第一个整数是 「得分」 的最大值,第二个整数是得到最大得分的方案数,请把结果对 10^9 + 7 取余。 如果没有任何路径可以到达终点,请返回 [0, 0] 。 示例 1: 输入:board = ["E23","2X2",...
a6cc334c2e5b8afc2bd6852fce96d6f49730c4ef
yiming1012/MyLeetCode
/LeetCode/最短路径/743. 网络延迟时间.py
5,619
3.8125
4
""" 有 N 个网络节点,标记为 1 到 N。 给定一个列表 times,表示信号经过有向边的传递时间。 times[i] = (u, v, w),其中 u 是源节点,v 是目标节点, w 是一个信号从源节点传递到目标节点的时间。 现在,我们从某个节点 K 发出一个信号。需要多久才能使所有节点都收到信号?如果不能使所有节点收到信号,返回 -1。   示例: 输入:times = [[2,1,1],[2,3,1],[3,4,1]], N = 4, K = 2 输出:2   注意: N 的范围在 [1, 100] 之间。 K 的范围在 [1, N] 之间。 times 的长度在 [1, 6000] 之间。 所有的边 ...
904e86396bb4af0e2571da450a2e42184b4f1d88
yiming1012/MyLeetCode
/LeetCode/999. Available Captures for Rook.py
5,410
3.578125
4
''' On an 8 x 8 chessboard, there is one white rook.  There also may be empty squares, white bishops, and black pawns.  These are given as characters 'R', '.', 'B', and 'p' respectively. Uppercase characters represent white pieces, and lowercase characters represent black pieces. The rook moves as in the rules of Ches...
1996002a1010506103a4db57412e94cab6061629
yiming1012/MyLeetCode
/LeetCode/动态规划法(dp)/线性dp/1218. 最长定差子序列.py
1,507
4.15625
4
""" 1218. 最长定差子序列 给你一个整数数组 arr 和一个整数 difference,请你找出并返回 arr 中最长等差子序列的长度,该子序列中相邻元素之间的差等于 difference 。   示例 1: 输入:arr = [1,2,3,4], difference = 1 输出:4 解释:最长的等差子序列是 [1,2,3,4]。 示例 2: 输入:arr = [1,3,5,7], difference = 1 输出:1 解释:最长的等差子序列是任意单个元素。 示例 3: 输入:arr = [1,5,7,8,5,3,4,2,1], difference = -2 输出:4 解释:最长的等差子序列是 [7,5,3...
7d65edf0d7f56c0db6991b9f0bb7c19f1c5d748f
yiming1012/MyLeetCode
/LeetCode/贪心算法/253. 会议室 II.py
1,265
3.90625
4
""" 253. 会议室 II 给定一个会议时间安排的数组,每个会议时间都会包括开始和结束的时间 [[s1,e1],[s2,e2],...] (si < ei),为避免会议冲突,同时要考虑充分利用会议室资源,请你计算至少需要多少间会议室,才能满足这些会议安排。 示例 1: 输入: [[0, 30],[5, 10],[15, 20]] 输出: 2 示例 2: 输入: [[7,10],[2,4]] 输出: 1 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/meeting-rooms-ii 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 """ fro...
c9977832cf78defd54b8eb52d8fa0215f69db968
yiming1012/MyLeetCode
/LeetCode/位运算/1371. 每个元音包含偶数次的最长子字符串.py
3,885
3.75
4
""" 1371. 每个元音包含偶数次的最长子字符串 给你一个字符串 s ,请你返回满足以下条件的最长子字符串的长度:每个元音字母,即 'a','e','i','o','u' ,在子字符串中都恰好出现了偶数次。   示例 1: 输入:s = "eleetminicoworoep" 输出:13 解释:最长子字符串是 "leetminicowor" ,它包含 e,i,o 各 2 个,以及 0 个 a,u 。 示例 2: 输入:s = "leetcodeisgreat" 输出:5 解释:最长子字符串是 "leetc" ,其中包含 2 个 e 。 示例 3: 输入:s = "bcbcbc" 输出:6 解释:这个示例中,字符串 "b...
a184ffd2b2832ca62dcae35f4022be867e636ae1
yiming1012/MyLeetCode
/LeetCode/数组/448. 找到所有数组中消失的数字.py
2,121
3.75
4
""" 给定一个范围在  1 ≤ a[i] ≤ n ( n = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次。 找到所有在 [1, n] 范围之间没有出现在数组中的数字。 您能在不使用额外空间且时间复杂度为O(n)的情况下完成这个任务吗? 你可以假定返回的数组不算在额外空间内。 示例: 输入: [4,3,2,7,8,2,3,1] 输出: [5,6] 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/find-all-numbers-disappeared-in-an-array 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明...
e022ec1869c9ee05e3fb9f65fc7321bea36ec303
yiming1012/MyLeetCode
/LeetCode/动态规划法(dp)/面试题 01.05. 一次编辑.py
1,167
3.9375
4
""" 面试题 01.05. 一次编辑 字符串有三种编辑操作:插入一个字符、删除一个字符或者替换一个字符。 给定两个字符串,编写一个函数判定它们是否只需要一次(或者零次)编辑。   示例 1: 输入: first = "pale" second = "ple" 输出: True   示例 2: 输入: first = "pales" second = "pal" 输出: False 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/one-away-lcci 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 """ class Solution...
aa7f569185e75e03d665278c44236f0000124e39
yiming1012/MyLeetCode
/LeetCode/回溯法/254. 因子的组合.py
1,334
4.0625
4
""" 254. 因子的组合 整数可以被看作是其因子的乘积。 例如: 8 = 2 x 2 x 2; = 2 x 4. 请实现一个函数,该函数接收一个整数 n 并返回该整数所有的因子组合。 注意: 你可以假定 n 为永远为正数。 因子必须大于 1 并且小于 n。 示例 1: 输入: 1 输出: [] 示例 2: 输入: 37 输出: [] 示例 3: 输入: 12 输出: [ [2, 6], [2, 2, 3], [3, 4] ] 示例 4: 输入: 32 输出: [ [2, 16], [2, 2, 8], [2, 2, 2, 4], [2, 2, 2, 2, 2], [2, 4, ...
a4404c0fdce23d17cce0f71d0276f7a49784df82
yiming1012/MyLeetCode
/LeetCode/树(Binary Tree)/988. 从叶结点开始的最小字符串.py
1,800
4.0625
4
""" 给定一颗根结点为 root 的二叉树,树中的每一个结点都有一个从 0 到 25 的值,分别代表字母 'a' 到 'z':值 0 代表 'a',值 1 代表 'b',依此类推。 找出按字典序最小的字符串,该字符串从这棵树的一个叶结点开始,到根结点结束。 (小贴士:字符串中任何较短的前缀在字典序上都是较小的:例如,在字典序上 "ab" 比 "aba" 要小。叶结点是指没有子结点的结点。)   示例 1: 输入:[0,1,2,3,4,3,4] 输出:"dba" 示例 2: 输入:[25,1,3,1,3,0,2] 输出:"adz" 示例 3: 输入:[2,2,1,null,1,0,null,0] 输出:"a...
aad5bcb74282e488adaf20189a323945a597462b
yiming1012/MyLeetCode
/LeetCode/数学/60. 第k个排列.py
1,380
3.703125
4
""" 给出集合 [1,2,3,…,n],其所有元素共有 n! 种排列。 按大小顺序列出所有排列情况,并一一标记,当 n = 3 时, 所有排列如下: "123" "132" "213" "231" "312" "321" 给定 n 和 k,返回第 k 个排列。 说明: 给定 n 的范围是 [1, 9]。 给定 k 的范围是[1,  n!]。 示例 1: 输入: n = 3, k = 3 输出: "213" 示例 2: 输入: n = 4, k = 9 输出: "2314" 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/permutation-sequence ...
0934c4553a196d6288c3a0d2a90169f40ec0aefd
yiming1012/MyLeetCode
/LeetCode/贪心算法/910. 最小差值 II.py
1,242
3.515625
4
""" 910. 最小差值 II 给定一个整数数组 A,对于每个整数 A[i],我们可以选择 x = -K 或是 x = K,并将 x 加到 A[i] 中。 在此过程之后,我们得到一些数组 B。 返回 B 的最大值和 B 的最小值之间可能存在的最小差值。   示例 1: 输入:A = [1], K = 0 输出:0 解释:B = [1] 示例 2: 输入:A = [0,10], K = 2 输出:6 解释:B = [2,8] 示例 3: 输入:A = [1,3,6], K = 3 输出:3 解释:B = [4,6,3]   提示: 1 <= A.length <= 10000 0 <= A[i] <= 10000 ...
3bd00af43d73452c885fbcd35632c41c4318c303
yiming1012/MyLeetCode
/LeetCode/贪心算法/984. 不含 AAA 或 BBB 的字符串.py
1,547
3.6875
4
""" 984. 不含 AAA 或 BBB 的字符串 给定两个整数 A 和 B,返回任意字符串 S,要求满足: S 的长度为 A + B,且正好包含 A 个 'a' 字母与 B 个 'b' 字母; 子串 'aaa' 没有出现在 S 中; 子串 'bbb' 没有出现在 S 中。   示例 1: 输入:A = 1, B = 2 输出:"abb" 解释:"abb", "bab" 和 "bba" 都是正确答案。 示例 2: 输入:A = 4, B = 1 输出:"aabaa"   提示: 0 <= A <= 100 0 <= B <= 100 对于给定的 A 和 B,保证存在满足要求的 S。 来源:力扣(LeetCode) 链...
a92fddf27b6a19f072e30891ae1d1ef8f5568f40
yiming1012/MyLeetCode
/LeetCode/贪心算法/5712. 你能构造出连续值的最大数目.py
1,353
3.890625
4
""" 5712. 你能构造出连续值的最大数目 给你一个长度为 n 的整数数组 coins ,它代表你拥有的 n 个硬币。第 i 个硬币的值为 coins[i] 。如果你从这些硬币中选出一部分硬币,它们的和为 x ,那么称,你可以 构造 出 x 。 请返回从 0 开始(包括 0 ),你最多能 构造 出多少个连续整数。 你可能有多个相同值的硬币。 示例 1: 输入:coins = [1,3] 输出:2 解释:你可以得到以下这些值: - 0:什么都不取 [] - 1:取 [1] 从 0 开始,你可以构造出 2 个连续整数。 示例 2: 输入:coins = [1,1,1,4] 输出:8 解释:你可以得到以下这些值: - 0...
1f864eb51631cded97db204456ed1ccdb2559072
yiming1012/MyLeetCode
/LeetCode/树(Binary Tree)/1339. 分裂二叉树的最大乘积.py
1,906
4.09375
4
""" 1339. 分裂二叉树的最大乘积 给你一棵二叉树,它的根为 root 。请你删除 1 条边,使二叉树分裂成两棵子树,且它们子树和的乘积尽可能大。 由于答案可能会很大,请你将结果对 10^9 + 7 取模后再返回。   示例 1: 输入:root = [1,2,3,4,5,6] 输出:110 解释:删除红色的边,得到 2 棵子树,和分别为 11 和 10 。它们的乘积是 110 (11*10) 示例 2: 输入:root = [1,null,2,3,4,null,null,5,6] 输出:90 解释:移除红色的边,得到 2 棵子树,和分别是 15 和 6 。它们的乘积为 90 (15*6) 示例 3: 输入...
e6d8175967ca44cb22211fcd549568a7d6793993
yiming1012/MyLeetCode
/LeetCode/动态规划法(dp)/97. 交错字符串.py
2,104
3.59375
4
""" 解题思路 一、采用DFS深度优先遍历算法 用三个下边分别标识s1, s2, s3,然后进行匹配,直到匹配成功。代码清晰易读,注释详细。 二、DP动态规划法 假设dp[i][j]表示s1前i个字符和s2前j个字符,能否和s3的前(i+j)个字符匹配 则转移方程为:dp[i][j]=(dp[i-1][j] and s1[i] == s3[i+1]) or (dp[i][j-1] and s2[j] == s3[i+j]) 初始状态为:dp[0][0] = True """ # DFS缓存 from functools import lru_cache class Solution: def isInterlea...
28e3fc66345dc7b141a2e1659141703a38e8c9b5
yiming1012/MyLeetCode
/LeetCode/树(Binary Tree)/99. 恢复二叉搜索树.py
4,014
4.0625
4
""" 二叉搜索树中的两个节点被错误地交换。 请在不改变其结构的情况下,恢复这棵树。 示例 1: 输入: [1,3,null,null,2]   1   /  3   \   2 输出: [3,1,null,null,2]   3   /  1   \   2 示例 2: 输入: [3,1,4,null,null,2] 3 / \ 1 4   /   2 输出: [2,1,4,null,null,3] 2 / \ 1 4   /  3 进阶: 使用 O(n) 空间复杂度的解法很容易实现。 你能想出一个只使用常数空间的解决方案吗? 来源:力扣(LeetCode) 链接:http...
718ccdaa996dc9c6fe88f4770cbeb86caae191e7
yiming1012/MyLeetCode
/LeetCode/几何/367. Valid Perfect Square.py
1,834
4.125
4
""" Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library function such as sqrt. Example 1: Input: 16 Output: true Example 2: Input: 14 Output: false 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/valid-perfect-square 著作权...
790e6dc775d96d769e50688ce1d6d94669563e3a
SanfordLuo/algorithm
/bus.py
597
3.890625
4
# 要求:输入公交卡当前的余额,只要超过2元,就可以上公交车; # 如果车上有空座位,就可以坐下。 import random # 导入random 模块 money = eval(input("所剩余额:")) # eval用来计算在字符串中的有效Python表达式,并返回一个对象 if money >= 2: print("您可以上车") seat = random.randint(0, 1) # 在0、1中随机产生一个数 if seat == 1: print("有座位,您可以坐下") else: print("...
316a3736b88fc03f1b6d70d7de916067aa1f04aa
ClabEnergyProject/SEM-1
/Cost_Model.py
21,592
3.78125
4
# -*- coding: utf-8 -*- """ Takes output from the simple energy model and produces time series of hourly cost of delivering electricity. Created on Wed Aug 22 17:50:11 2018 @author: kcaldeira """ import numpy as np #%% # Takes a capacity cost (fixed cost) and dispatch cost (variable cost) and # a ti...
99e696447bd5c01ec3637d4e9b69f9a4c7a87f1c
pradhanTejeshwar/Python-Codes
/simple_interest.py
246
3.921875
4
principal = int(input("Enter principal amount:")) time = int(input("Enter duration of loan: ")) interest = int(input("Enter rate of interest: ")) simple_interest = principal*time*(interest/100) print("Total Interest = ", int(simple_interest))
e14834319d4104cb33053370a734d317dac1aaf4
eferrer686/AlgoritmosLaberintos
/tremaux3.py
6,328
3.53125
4
import random #Manejo de direcciones def turnRigh(x): return { 0 : 1, 1: 2, 2: 3, 3: 0 }[x] def turnLeft(x): return { 0 : 3, 1: 0, 2: 1, 3: 2 }[x] def reverse(x): return { 0 : 2, 1: 3, 2: 0, 3: 1 }[x]...
c3830377d49d7899f2cbd60e3f07ab42cd9cc0b8
SennaSemakula/ATM-Locator
/locator.py
922
4
4
"""This class allows users to enter their location""" import requests import json class Locator(): """Class that identifies the nearest ATM for users""" def __init__(self, location): self.location = location self.first_code = '' self.second_code = '' self.post_code = '' def prompt_location(self): self....
12883ff5d0403e31c62ff9bc3e6bc1488ef94e95
shermanbell/CTI110
/M3HW2 sales.py
1,174
4.15625
4
#CTI_110 #M3HW2_Software_Sales #SHERMAN_BELL #9_OCT_2017 # Writ a program that asks the user to enter the number of packages purchased # A software company sells a package that retails for $99 # They offer bulk discounts for volume purchases # Quantity of 10-19 are 10% discount # Quantity of 20-29 are 20% dis...
975bf25075f6f39b482e4f68e3a6ca7ea7a12625
shermanbell/CTI110
/M3T1.py
1,079
4.40625
4
print #Sherman_Bell print #CTI_110 print #M3T1_Areas_of_Rectangles print #24_Sept_2017 # Areas of Rectangles # Write a program that asks for the length and width of two rectangles # The area of a rectangle is length times width # The program should tell the user which rectangle has the greater area or if they ...
8a7809ea9ec482844319052836f13b35309d6c5d
monicamarshall/RestDemo2
/RestDemo/mq/test/test_global_variables.py
718
3.59375
4
total = 100 def test(): # Local variable marks = 19 print('Marks = ', marks) print('Total = ', total) def func1(): total = 15 def func(): # refer to global variable 'total' inside function global total if total > 10: total = 15 def func2(): global total if total >...
a0159e7c9b3f6b83a0aad4105071ca8666706b5f
anujgupta-net/Recommender-System
/Recommender_System.py
2,233
3.734375
4
# Recommender system #import pandas library import pandas as pd #import library for visualization import matplotlib.pyplot as plt import seaborn as sns #get the data column_names = ['user_id', 'item_id', 'rating', 'timestamp'] path = 'file.tsv' df = pd.read_csv(path, sep='\t', names=column_names) # Check out all ...
accbf25de54db0e3caaf1309bd037c5f2ac7cb24
mathiashelseth/MetInstitutt
/Server/calc.py
552
3.8125
4
import math import time R_0 = 100 a = 3.9083 * (10**(-3)) b = -5.775 * (10**(-7)) def space(): print() print() def main(): space() R = float(input("R = ")) space() t = ((((-R_0)*a) + math.sqrt((R_0 ** 2) * (a ** 2) - 4 * R_0 * b * (R_0 - R))) / (2 * R_0 * b)) space() if(t == -0.0): ...
41a7eda5b531fc21a6353811b7f48352c8449bdf
adchizhov/hello-world
/PythonPy6/Python (старье)/money2.py
375
3.90625
4
#Эта программа считает заработок user_input=input('Сколько вы работали на этой неделе часов?: ') user_input2=input('Сколько вы получайте рублей за 1 час работы?: ') pay=int(user_input)* int(user_input2) print ('Ваш заработок составил: ',pay, 'рублей')
ef3bc3fee7e3caa3f97ba21fdca1620c050b09d7
adchizhov/hello-world
/PythonPy6/Фибоначчи_факториал_обзнач.py
942
4.0625
4
def calculate_fibonacci(x): if x==0: return (0) elif x==1: return (1) else: return calculate_fibonacci(x-1)+calculate_fibonacci(x-2) def factorial (x): if x==1: return (1) else: return (x*factorial(x-1)) def calculate_exponent(a, b): if a==0: re...
58671cadfbb83d23254f994b0c1934121dd78e9c
adchizhov/hello-world
/PythonPy6/Фортуна.py
1,479
3.96875
4
from random import * def number_to_fortune (number): if number==0: return "Да, конечно!" elif number==1: return "Я уверен что да" elif number==2: return "Скорее всего" elif number==3: return "Определенно нет, прости" elif number==4: return "М, нет, мне кажетс...
3af49a4dcd47c6fe124f8f251c87ebb274eb19b1
adchizhov/hello-world
/PythonPy6/Python (старье)/Area_Perimeter_Circle.py
524
3.890625
4
while True: try: user=input ("Введите радиус окружности? ") if user=='Прекрати': break r=float (user) #radius of circle p=3.14 area=r*r*p perimeter=r*2*p print ("Площадь окружности", area) print ("Периметр", perimeter) except: print ('Радиу...
8de2dd3561740697589a39b6cb0c96269b393d8c
adchizhov/hello-world
/PythonPy6/Python (старье)/Time (fail).py
353
3.78125
4
number=input('Введите любое число в секундах: ') n=int(number) days=n//(24*60*60) seconds_1=n%(24*60*60) hours=seconds_1//(60*60) seconds_2=n%(60*60) minutes=seconds_2//60 seconds_3=n%60 print ('В днях это будет' ,days, 'дня(ей)' ,hours, 'часа(ов)' ,minutes, 'минут' ,seconds_3, 'секунд')
ba4343ed5386393bdb063a2ebde3d2139aa907bb
adchizhov/hello-world
/PythonPy6/Python (старье)/DICTIONARIES,py.py
1,530
3.96875
4
purse=dict() #Creating a dictionary purse['money']=12 #Adding a new place with value purse['candy']=3 purse['tissues']=75 print (purse) purse['candy']=purse['candy']+2 print (purse) purse['wallet']=15 print(purse) purse=dict() things=['wallet','mirror','mirror','wallet','money','honey','wallet','knife','knife','money'...
c7ecf65c62daf28ab4be537890686af6900e2e2c
iamnidheesh/AI-Lab-Assignments
/ass2/8puzzle.py
2,258
3.6875
4
def hash(board) : c = 1 sum = 0 for i in range(3) : for j in range(3): sum += c*c*board[i][j] c += 1 return sum def ppath(board) : print(board[0]) print(board[1]) print(board[2]) print() def swap(board,x,y,g,h) : temp = board[x][y] board[x][y] = board[g][h] board[g][h] = temp def issolved(bo...
ab52099ea4f54f21d051210e8ac8a5a067e2eaa4
ParthShuklaa/BPIBS_MTA_Python_2020-
/DemoNumpy.py
110
3.828125
4
import numpy as np myArray = np.array([1,2,3,6,8,9]) print(myArray) for i in myArray: print(i)
7cd8303fb8a6063156c4e3b81f52c451444cd9ca
heavenlysouffle/lab_2.2
/task_3.py
4,407
3.96875
4
import math class Group: """Class that contains a sequence of instances of the class STUDENT""" def __init__(self): self.__students = [] def add(self, *students): """Method for adding the student(s) to the group""" if len(self.__students) + len(students) > 20: ...
2aadb79041372bff6b424d5fa3432c33da0f1858
Fivenn/dijkstra_project
/dijkstra.py
2,381
3.921875
4
def dijkstra(graph,startPoint,endPoint,visited=[],distances={},predecessors={}): # Est-ce que le point de départ et le point d'arrivé appartiennent au graphe ? if startPoint not in graph: raise Exception('Le point de départ n\'existe pas.') if endPoint not in graph: raise Exception('Le point...
d22c87f0683a1ae32fd389b5e9828757fce8bbdd
joonalillfors/efficient-heaps
/fibonacci/heap.py
4,845
3.6875
4
from node import Node import sys import math class FibonacciHeap: def __init__(self, node: Node = None): self.minRoot = self.min(node) self.n = 0 if node == None else 1 def min(self, node: Node): if node == None: return None best = node curr = node.next ...
2945c8a5c8bb63e446850d993ad7c2dd9e317e03
ITMO-NSS-team/meteotik
/meteotik/analysis.py
18,131
3.609375
4
import datetime import numpy as np import pandas as pd import seaborn as sns from scipy import stats from sklearn.metrics import mean_absolute_error from matplotlib import pyplot as plt def convert_degrees_to_float(degrees: int = 0, minutes: int = 0, seconds: int = 0) -> float: """ ...
f757c81a87fee117a6c361e5a7ed81a1aa36b28d
brjohnson61/cs8
/cs8/cs8/lab4/functions_lab4.py
522
3.640625
4
#Blake Johnson #Adam Gulliver def stringToPermutation(s): caps="ABCDEFGHIJKLMNOPQRSTUVWXYZ" acc='' for ch in s: a=0 for c in s: if c<ch: a=a+1 acc=acc+str(a+1) return(acc) def printList(myList): for i in range(0, len(myList)): print(i,myL...
18dff4ca372120d848515a5602fd52f73c63c2a0
wegar-2/number_theory_python
/tools/modular_exponentiation.py
1,387
4.1875
4
from tools import base_representations as br def modular_exponentiation_special_case(b, k, m): """ Calculates modular exponent b^e mod m for the special case where e = 2^k, i.e. for the case where e is a power of two :param b: positive integer :param k: :param m: modulus to use in the calculation ...
1ecbe8c7ae0fa2891988c8e3afdfb2f7d9214dd5
afl0w/pythonNotes
/variables.py
516
4.3125
4
# x = int(input('Please enter the first Integer: ')) y = int(input('Please enter the second Integer: ')) #user first name and last name input first_name = input('Enter your First Name: ') last_name = input('Enter your Last Name: ') #user output message display print('The first integer is:',x) print('The second integ...
809c6e3996299e45cca59bc46304b2f2c156394d
omhmichaels/Tkinter_practice
/OOP_Tkinter_v2.py
3,349
3.71875
4
""" # # Author: l33tH@x0rxxGh0u1 # # # # """ # Imports import tkinter as tk # Global Variables Large_Font = ("Verdana", 12) class SeaofBTCapp(tk.Tk): # Initialization of class. (tk.Tk) defines inheritance def __init__(self, *args, **kwargs): # __init__ method initializes with the...
ceab4e61ff3adb44639b287e66c33ea0be0dc4b5
tevulytis/pythontest
/test.py
225
4.1875
4
print "This program multiplies 2 numbers x and y" x = 3 y = 2 print "x equals to "+str(x) print "y equals to "+str(y) res = x * y print "result of x*y is "+str(res) #if y == 2: # print "y is "+str(y) #else: # print(1)
9e46358623907472bfb2ff3b570826913237bd52
joerozo/canal_route_times
/practice.py
4,137
3.59375
4
import math import numpy as np import pandas import sqlite3 import os import os.path def convert_insight_to_fedex(file_name, csv_file): # list the columns in the array below that you would like to keep in the file # list_of_columns = ["V3", "V4", "V10", "V13", "V15", "V16", "V17", "V21", "V26", "V27", "V28"] ...
b161c31c6f5bbd4e6e9cd4034d91950e966249db
Mounika-bs/Mounika
/(m3,ch-2)7.py
105
3.875
4
def convert(string): li=list(string.split(' ')) return li str1= 'geeks for geeks' print(convert(str1))
a717145f7aff80a06f77d9b965dbb0881029cbd1
Mounika-bs/Mounika
/(m3,ch-1)7.py
268
4.21875
4
numbers=(1,2,3,4,5,6,7,8,9,10)#declaring the tuple count_odd = 0 count_even = 0 for x in numbers: if not x % 2: count_even+=1 else: count_odd+=1 print('Number of even numbers :',count_even) print('Number of odd numbers :',count_odd)
349f4ae4133daccb031c0155993d8a3a089e0a3e
Mounika-bs/Mounika
/unit4(7Q).py
240
4.21875
4
# program to read a file line by line and store it into an array def f_read(fname): ar=[] with open(fname) as f: for line in f: ar.append(line) print(ar) fname = input('Enter a file name: ') f_read(fname)
88e55b7932d91498ca9319eae02953491f51492a
San2809/Leet_code
/EASY/add_binary.py
302
3.578125
4
def addBinary(self, a, b): """ :type a: str :type b: str :rtype: str """ if not a and not b: return "0" elif not a: return b elif not b: return a else: return bin(int(a,2) + int(b,2))[2:]
03f98578a24dbd635015e3fde0796ba53d088c39
San2809/Leet_code
/MEDIUM/permutations.py
456
3.53125
4
class Solution(object): def helper(self, nums, path, res): if len(nums)==len(path): res.append(path) return else: for i in nums: if i not in path: self.helper(nums, path+[i], res) def permute(self, nums): """ ...
3ea57b37cae5701d9b06f6e401d5267e1f20b62c
San2809/Leet_code
/EASY/LongestCommonPrefix.py
567
3.703125
4
def Lcp(str1,str2): result = "" j=0 i=0 while(i<len(str1) and j<len(str2)): if(str1[i]!=str2[j]): break result = result+str1[i] i+=1 j+=1 return result def longestCommonPrefix(strs): res="" if(len(strs)==0): res="" elif(len(strs)=...
e86046ba663575eb16ec4d4245fec5911e4aa5bf
rlagusgh0223/Python
/131.py
2,402
3.6875
4
"""#131 names = {'Marry':10999,'Sams':2111,'Aimy':9778,'Tom':20245, 'Michale':27115,'Bob':5887,'Kelly':7855} ret1 = sorted(names) print(ret1) def f1(x): return x[0] def f2(x): return x[1] ret2=sorted(names.items(),key=f1) print(ret2) ret3=sorted(names.items(),key=f2) print(ret3) ret4=sorted(names.items...
84ecfde1b3768330c2e772a51404ddc6604ccd7a
eesawazir/Scrabble
/scrabble.py
5,079
4.03125
4
import sys import random TILES_USED = 0 # records how many tiles have been returned to user SHUFFLE = False # records whether to shuffle the tiles or not # inserts tiles into myTiles def getTiles(myTiles): global TILES_USED while len(myTiles) < 7 and TILES_USED < len(Tiles): myTiles.append(Tiles[TIL...
76528d7c814316626c35182863245b858f823f85
SamwelOpiyo/andelabs
/tests.py
303
3.578125
4
def string_length(s): if type(s)==str: p=[] p.append(len(s)) return p elif type(s)==list: p=[] for i in s: counter=0 while counter<=len(i): k=len(i) counter=counter+1 p.append(k) return p else: return False print string_length("sam")
df28ed63e5a447aa6cc0aa6ef6984287d9c8ed8d
SamwelOpiyo/andelabs
/Min_max_list.py
193
3.671875
4
def find_max_min(list_no): if min(list_no)!=max(list_no): p=[] p.append(min(list_no)) p.append(max(list_no)) return p else: p=[] p.append(len(list_no)) return p
6fffa11294a0acf57117df78075b5f3f9fd45c89
NopMicrowave/Impinj_R700_Indy_Reader_Chip_and_Speedway_Reader_Simulation
/systems_r700/model/src/common/dac.py
897
3.546875
4
import numpy as np class Dac(object): """ DAC Component class. Takes in the following parameters: - r_load: Output load for a current DAC - r_tolerance: Tolerance of r_load - fs_output_I: Full scale output current in Amps for current DAC - bits: Number of input bits - fs_out...
ab4849899ec70a04670a3a1a1c889720df69d369
Kengazi/Learn_AI
/Proj_Int_4.1.py
4,835
3.609375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 14 09:02:06 2020 @author: kendalljohnson """ # One - Hot - encoding print('One - Hot - Encoding') """ Week 4 - A base in using data science with python 4.1 :: Using Scikit-learn (sklearn) for Machine Learning The goal of this assignment is to get...
5236ce2f8c21da8c25829914990a2171b0857839
Kengazi/Learn_AI
/Proj_Int_2.3.py
4,256
3.796875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 12 11:02:27 2020 @author: kendalljohnson """ """ ***** first pip3 install pandas ************** Week 2 - A base in using data science with python 2.3 :: Visual Analysis of Pandas DataFrames The goal of this assignment is to get you comfortable w...
907d02588dcb852542db0a58bd0b7c429b7d22b3
Kengazi/Learn_AI
/Proj_Int_3.2.py
2,896
3.875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 21 11:09:41 2019 @author: kendalljohnson """ """ Week 3 - A base in using data science with python 3.2 :: Using titanic data set for Machine Learning The goal of this assignment is to get you comfortable with real datasets and muilt-linear regr...
d39ce6747cfb829fb6f9cf1eaf9e84638e603249
huwonder/demo
/module1/a1.py
520
3.65625
4
class Parent: parentAttr = 100 def __init__(self): print("call parent struct function") def parentmethod(self): print("parent method") def setAttr(self, attr): Parent.parentAttr = attr def getAttr(self): print("parent attribute", Parent.parentAttr) class Child(Par...
4ae515771b4204f710569cfc668790c524a90989
lihiSabag/numerical-analysis
/ex2/main.py
5,125
3.5625
4
# create Identity matrix def identity_matrix(size): I = list(range(size)) for i in range(size): I[i] = list(range(size)) for j in range(size): if i == j: I[i][j] = 1 else: I[i][j] = 0 return I def machine_epsilon(): ...
7aee527e41d3ac0823287b407787eaf8234f2b66
JunctionChao/python_trick
/MetaClass/2_元类的使用demo1.py
612
3.625
4
# 将创建的类属性字符串改为大写 def upper_attr(class_name, class_parents, class_attr): # 将不是__开头的属性名改为大写 new_attr = {} for name, value in class_attr.items(): if not name.startswith("__"): new_attr[name.upper()] = value # 调用type来创建一个类 return type(class_name, class_parents, new_attr) class Fo...
0c22d90df1a8411550975fb800f69f5bef90f918
JunctionChao/python_trick
/list_trick2.py
2,396
4.5
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # ref: https://www.datacamp.com/community/tutorials/18-most-common-python-list-questions-learn-python # How To Split A Python List Into Evenly Sized Chunks # 将列表分成均匀大小的块 # 这里要注意[iter(x)]*3是浅拷贝,所有iter(x)都指向同一地址 # 不足块长度的舍弃,这是zip的特性 x = [1,2,3,4,5,6,7,8,9,10,11] # Split `x`...
1a44d14f2eae0a7af10f42e083a497b9491cd675
JunctionChao/python_trick
/FileOperator/2_filehandle.py
7,892
3.8125
4
# 流式读取大文件 """ 读取文件有一种“标准做法”:首先使用 withopen(fine_name) 上下文管理器的方式获得一个文件对象, 然后使用 for 循环迭代它,逐行获取文件里的内容 """ # 读取文件中字符9的个数 def count_nine(fname): count = 0 with open(fname) as fp: for line in fp: # 迭代文件对象时,内容一行一行返回 count += line.count('9') return count """ 上述方法的缺点是:如果被读取的文件里,根本就没有任何换行符,所有字符都在...
3e6082f89467c1b1ae8c240a53e8e8106c215862
ChrisArnault/GraphX
/Mountains/mountain_cells.py
1,292
3.578125
4
class CellIterator(object): def __init__(self): self.radius = 0 self.row = 0 self.column = 0 def initialize(self): print("initialize>", self.radius) def iterate(self): print("iterate>", self.radius) def test_stop(self): print("test_stop>", self.radius)...
643035e2a491d92576f17c96b48d08d91f0db836
iremkasikogullari/GlobalAIHubPythonCourse
/HW/HW1.py
309
3.640625
4
import random prime_list = [] def prime_number(num): for i in range (2,num): if num %i ==0 : return False return True for i in range(1,100): if prime_number(1+i): prime_list.append(1+i) for i in range(3): print(random.sample(prime_list,3))
75ef04d4b3880f219799cf87e8fb3243fbefc4d0
W-B-Aguilar/python-assignments
/multi_sum_avg.py
707
4.25
4
for count in range(1,1000): if count%2!=0: print count #loop will count all intergers between 1 and 1000 and only print the interger if it is an odd number for count in range(5,1000000): if count%5==0: print count #loop will count all intergers between 5 and 1,000,000 and only print multiples ...
113591dff1229ae6f492241e4eaa315dfd624642
cuevas1208/ML_Notes_and_Research
/DL_computer_vision/NETS_examples/scripts_inception/augment_image.py
5,237
3.65625
4
import tensorflow as tf def should_distort_images(flip_left_right, random_crop, random_scale, random_brightness): """Whether any distortions are enabled, from the input flags. Args: flip_left_right: Boolean whether to randomly mirror images horizontally. random_crop: Integer perc...
4133c0b098d79b10b61ee424ca7323016964816d
ffalpha/Entropy-Calucalator
/entropyshannon copy/__init__.py
1,211
4.15625
4
import math def shannon_entropy(string): """ Calculates the Shannon entropy for the given string. :param string: String to parse. :type string: str :returns: Shannon entropy (min bits per byte-character). :rtype: float """ "Calculates the Shannon entropy of a string" # get proba...
7c6866f4e24abf4b32bde6250db4650e8682c17e
puven1998/ineurontutorial
/assignment1/question3.py
324
4.28125
4
import math # use this for getting input from user #radius = int((input("Input diameter of sphere : ")))/2 # default value of radius below diameter = 12 radius = diameter/2 volume = (4/3)*math.pi*radius**3 print("Answer rounded off to closest two decimal places: \n") print("\tVolume of sphere is {:.2f} \n".format(volum...
73705e7794529c60c2e1eaa09f6555ebc168931b
nikhilchowdarykanneganti/python_by_example_-NICHOLA-LACEY-
/for loop/c38.py
270
4
4
#Challenge38 '''Change program 037 to also ask for a number. Display their name (one letter at a time on each line) and repeat this for the number of times they entered.''' name=input('Enter name:\n') for i in range(int(input('Enter no:\n'))): for j in name: print(j)
12e458f0ea1ea2b2fb945a5f5453b48f70c621c0
nikhilchowdarykanneganti/python_by_example_-NICHOLA-LACEY-
/maths/c33.py
436
4.40625
4
#Challenge33 '''Ask the user to enter two numbers. Use whole number division to divide the first number by the second and also work out the remainder and display the answer in a user-friendly way (e.g. if they enter 7 and 2 display “7 divided by 2 is 3 with 1 remaining”).''' num1=int(input('Enter a number:\n')) num2=in...
3ae1e34411bfe46afccd5c46633aed18b7233118
nikhilchowdarykanneganti/python_by_example_-NICHOLA-LACEY-
/maths/c31.py
240
4.375
4
#Challenge31 '''Ask the user to enter the radius of a circle (measurement from the centre point to the edge). Work out the area of the circle (π*radius 2 ).''' import math print(float(input('Enter the radius of the circle:\n'))*math.pi**2)
05800c84240887855a566250fbcea34cefbf5de6
nikhilchowdarykanneganti/python_by_example_-NICHOLA-LACEY-
/the basics/c8.py
262
4.09375
4
#Challenge8 '''Ask for the total price of the bill, then ask how many diners there are. Divide the total bill by the number of diners and show how much each person must pay.''' print('Each person must pay',int(input('Total bill\n'))/int(input('No of people\n')))
a2866041bd989e97f76ce2912e0144d965b6aea1
nikhilchowdarykanneganti/python_by_example_-NICHOLA-LACEY-
/while loop/c49.py
585
4.03125
4
#Challenge49 '''Create a variable called compnum and set the value to 50. Ask the user to enter a number. While their guess is not the same as the compnum value, tell them if their guess is too low or too high and ask them to have another guess. If they enter the same value as compnum, display the message “Well done, y...
8d6b829ee195ff29a8b8734eb00c2f645065e0ac
SuyogKhanal5/PythonNotes
/Object Oriented Programming/OOP4.py
819
3.921875
4
mylist = [1,2,3] print(len(mylist)) class Sample(): pass mySample = Sample() # You cannot use built in python functions with user defined objects regularly # In order to do this, you need to use magic methods, also known as dunder methods (double underscore) class Book(): def __init__(self, ti...
e9b2f825533405c89cecc043ba8d813b28df62fe
SuyogKhanal5/PythonNotes
/try_catch.py
1,361
4.09375
4
def add(n1, n2): print(n1+n2) add(10,20) number1 = 10 number2 = input("Please provide a number ") # add(number1, number2) This causes a type error, since you are adding an integer and string # Everything past the error will not get executed, and nothing will happen try: # WANT TO ATTEMPT THIS ...
07592c11c816f5cc76615f839d0b6fc45686b0fe
vhutchinson/Breakthrough
/my_breakthroughgame.py
16,275
3.515625
4
#################################################################################### # CSC 412 - Programming Assignment 1 # # my_breakthroughgame.py holds main and the BreakthroughGame class. # The Breakthrough class includes board and piece information, as well as the steps to run different games of breakthrough. #...
74c8984bb4659dca3f384f5599886b4bd3b6f71e
Simran-kshatriya/Basic
/PythonTuple.py
663
4.4375
4
# Tuple is ordered | indexed | unchangeable and uses () circular bracket my_tuple = ("Mumbai", " Pune", "Nashik") print(my_tuple) print(my_tuple[1]) print(" ") # when we give minus(-) indexed it starts from back print(my_tuple[-1]) print(my_tuple[0:2]) # range print("Printing using for loop") for val in my_tuple: ...
db2e621571a59a03d2918c4316aefce0fb2014a8
Simran-kshatriya/Basic
/Pythonsets.py
1,019
4.25
4
# Set {} : unordered | unindexed |no duplicates my_set = {"Table", "Chair", "Bench"} print(my_set) print(" ") for x in my_set: print(x) print(" ") # It checks whether the particular value is present or not print("Table" in my_set) my_set.add("Bed") print(my_set) my_set.update(["Stool","Sofa set"]) print(my...
039ccc2d5a991ff5e0748a6529729443b90325ef
Simran-kshatriya/Basic
/OopsDemo.py
1,157
4.0625
4
#Classes are nothing but user defined blueprint or prototype # sum, multiplication, addition, constant # Basically class will have methods, variables, instant variables, constructor etc # Self keyword is mandatory for calling variable names into method # instance and class variables have whole different purpose # ...
5dd637b304c5a40e148b374d18406da72e49f873
aksa1/infoshare_2
/func_examples.py
1,271
3.921875
4
def infinitive_arguments(*args): print(args) print((type(args))) infinitive_arguments(1, 2, 3, 4, 5) #musi byc iterowalne tupla, slownik, lista print(sum([1, 2])), #funcja z dowolna liczna arg liczbowych i wyswietli na ekranie ich sume def funkcja(*args): print(sum(args)) print(type(args)) funkcja(1, 2...
be41ea4cd436dd65ea7ba54889e1e1eae2ceb52f
aksa1/infoshare_2
/tuples.py
323
4.21875
4
my_tuple = (1, 2, 3) # ponizsze nie dzial! # my_tuple[1] = 5 + proba przpisania pod element 1 cyfre 5 still_tuple = (4, 5, 6, [7, 8]) still_tuple[-1].append(9) print(still_tuple) #powstawje tupla z tupli - nie mozna zapomniec o przecinku po 4 bo to oznacza tuple jednoelementowa my_tuple = my_tuple + (4,) print(my_tuple...
fb555b561b4b662d6875168a2d7e610fc7882b85
Z1ni/aoc2017
/day_4/part_1.py
246
3.65625
4
#!/usr/bin/env python3 with open("input.txt", "r") as f: passphrases = [l.strip() for l in f.readlines()] valid = 0 for phrase in passphrases: split = phrase.split() if len(set(split)) == len(split): valid += 1 print(valid)
9fe397d0fec3dabf53f9b9f573d34ee14053d56f
saswatsarangi0914/code_repo
/python_classes/demo_class1.py
210
3.765625
4
class Person: def __init__(self): self.firstname = "Saswat" self.lastname = "Sarangi" self.eyecolor = "Black" self.age = -1 person1 = Person() print(person1.age)
eb6a79aafe94d646f4bd8abb5ad5c20e47830207
DeepakSuryaS/Project-Euler
/Largest Palindrome Product/python/solution.py
616
4.21875
4
def reversed(number): reverse = 0 while number > 0: reduced = number % 10 reverse = (reverse * 10) + reduced number = number // 10 return reverse def isPalindrome(number): return bool(reversed(number) == number) def largestPalindrome(a, b): result = 0 largest = 0 fo...
9bf14dbc9e8e8a09643c842f093e636db73d9758
Adi1729/LTFS_TimeSeries
/tools.py
4,248
3.59375
4
import numpy as np def find_day_of_year(year, month, day): ''' Parameters: --------------- year : int month : int day : int Returns: --------------- day_of_year: array of integers ''' days_per_month = np.array( [31, # January 28, # Feb...
5a0c394c96d1965826251b06070e400857c4216d
DarkArmy-ctf/ctf-writeups
/boot2root/crypto/The_Heist/chall.py
1,339
3.78125
4
from Crypto.Cipher import AES from Crypto.Util.Padding import pad,unpad import binascii import sys key = b"****************" iv = key flag = "***********************" def encrypt(str1): obj = AES.new(key, AES.MODE_CBC, iv) str1 = pad(str1,16) ciphertext = obj.encrypt(str1) return binascii.hexlify(ciph...
d38211bb94a48e6e4825cc02a402cfa0800ba111
nihinivi/PyClock
/clock2.py
2,233
3.765625
4
#!/usr/bin/python3 '''Terminal Clock 2.0 The Variables h & m can be treated as a List Use them with a IF statement to display ASCII ART numbers The program will have to refresh with a While Loop clearing the screen to update the Clock. Possibly do Terminal Clock 2.0 with nCurses ''' import os import time #fu...
037802de2382c917f6c6b35abc443a7abcca357e
MrDnp/creativecodinginpython
/Art_triLJB.py
641
3.953125
4
# make a geometric rainbow pattern import turtle # pick order of colors for the hexagon colors = ['red', 'yellow', 'blue', 'orange', \ 'green', 'red'] shelly = turtle.Turtle() turtle.bgcolor('black') # turn background black # make 64 pentagons, each 8 degrees apart for n in range(64): # make pentagon for ...
a5019a6258b17ed0f7964d085806ad709514239d
codingSince9/Advent-of-Code-2015
/day08/day08.py
1,773
3.5625
4
strings = [] hexCheck = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'] codeCounter = 0 charCounter = 0 encodeCounter = 0 f = open("day08.txt", "r") for string in f: strings.append(string.strip()) for string in strings: first = False x = False threeChars = "" for c...
4d79e4bfdd00c03297a9a476e0f5f33dad75669a
JaeGyu/PythonEx_1
/20160101_6.py
371
3.734375
4
#_*_ coding: utf-8 _*_ import math print """ This is multi lines """ a = "Hello workd!" print a[1:3] b = "abcd" print b[::2] c = "123456789" print c[0:9:2] print c[::2] d = [1,2,3] print d[:1] print d[::-1] s= ["a","b","c"] s[1] = "B" print s s = "Hello World" s = "h" + s[1:] print s print len(s) print "Worl...
0c0b7da43db96bf93e878145ecee772d91ac9156
JaeGyu/PythonEx_1
/20160118_1.py
938
3.90625
4
#_*_ coding: utf-8 _*_ L = [1,5,3,9,8,4,2] L.sort() print L print cmp(1,2) print cmp(2,1) print cmp(2,2) def mycmp(a1,a2): return cmp(a2,a1) print mycmp(1,2) L.sort(mycmp) print L def cmp_1(a1,a2): return cmp(a1[1],a2[1]) def cmp_2(a1,a2): return cmp(a1[2],a2[2]) L = [('lee',5,38),('kim',3,28),('jung',10,...
d9d9627116d522b79ed9587a5acd53019c03a99a
JaeGyu/PythonEx_1
/py200_033.py
370
3.640625
4
str1 = "나는 파이썬 프로그래머다" str2 = 'I am python programmer' str3 = '''I love Python.{} You love Python too! ''' str4 = """나는 파이썬을 좋아합니다 """ # " 와 ' 가 섞여 있을 경우 '''을 사용한다 str5 = ''' "나는" i am '입니다' ''' print(str1) print(str2) print(str3.format("이부분은?")) print(str4) print(str5)