blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
2bee1d643f2555712c9d31604f28939cb9b306f1 | erik-dunteman/orbital | /db_utils.py | 1,396 | 4 | 4 | import sqlite3
'''
NOTES ON SCHEMA:
There is one table, "log", which has fields:
episode, v_x, v_y, radius, wall_dist, mass, fuel, reward
'''
def write(episode, observation, reward):
#Connect to database
connection = sqlite3.connect("warehouse.db")
cursor = connection.cursor()
add_start = "INSER... |
c2faa9ed79e7a81e9d3e9fa3e0381aa07bfbf1ef | westonb/python-3d-printing | /src/functions_3d.py | 2,050 | 3.640625 | 4 | import math
#test functions
def circle_grid(point):
[x,y,z] = point
if bounds(point) == 0:
return 0
def square_grid(point):
[x,y,z] = point
if bounds(point) == 0:
return 0
dist = min((x%2), (y%2))
if dist <0.4:
return 1
else:
return 0
def cube_grid(point):
[x,y,z] = point
x = round(x,8)
y = round(y... |
e563063d757ca33ad30bfad8e59abf14085d88f5 | phaidorr/python-morsels | /earliest.py | 490 | 3.6875 | 4 | def get_earliest(*args):
earliest_date = args[0]
earliest_date_int = convert_date_to_int(earliest_date)
for date in args:
current_date_int = convert_date_to_int(date)
if current_date_int < earliest_date_int:
earliest_date = date
earliest_date_int = current_date_int
... |
9bcaa72b193d3b5ce12db67faffd751c3f1cc7c5 | girisagar46/KodoMathOps | /kodomath/mathops/quiz_service.py | 1,377 | 4.15625 | 4 | from decimal import Decimal
from asteval import Interpreter
class SubmissionEvaluator:
"""A helper class to evaluate if submission if correct or not.
"""
def __init__(self, expression, submitted_result):
self.expression = expression
self.submitted_result = submitted_result
# https:... |
fef35a8efdfce8bd81030271203281e5dbb0e914 | aloaberasturi/Probabilistic-Models-of-Competency-Assessment | /pyPAAS/assessment.py | 1,988 | 3.921875 | 4 | """
Python implementation of Assessment class
@author aloaberasturi
"""
class Assessment:
"""
A class used to represent an assessment
...
Attributes
----------
referee : Peer
submission : Submission
mark : double
assessment_type : str
time_stamp : double... |
62fc508e92da25473206d0cdc5373a45bd461130 | Akatsuki217/MD | /Inducción matemática/AlternativaIndMat.py | 200 | 3.5625 | 4 | def IndMat(n: int):
if n >= 0:
resultado = int( (n * (n + 1) * ((2*n)+1)) / 6 )
print(f"({n} * ({n} + 1) * ((2*{n})+1)) / 6", resultado)
return
print("Sin resultado")
|
b576fbdb33a5a04219779f265b7ed4b64405cc1b | Mrpolat/PythonNotes | /deneme2323/datastructures.py | 1,512 | 3.78125 | 4 | # -*- coding: utf-8 -*-
import random
x =[1,2,3,4,5]
#indisle beraber indisde bulunan değeride gösterir
for i in enumerate(x):
print(i)
for indis,eleman in enumerate(x):
print(indis,eleman)
for indis,eleman in enumerate(x):
print("x[{}]={}".format(indis,eleman))
#dizileri kolay... |
c595ac791e571464f4cf4df6eee498b7fc2eb4c5 | victorradael/learning_python | /formatImpress.py | 434 | 4.03125 | 4 | print('This is a String')
teste = 'VARIAVEL'
print('Temos uma %s auxiliar.' %(teste))
print('Printando pontos fluantes: %1.2f' %(13.144))
teste = '123456'
print('Temos uma %r auxiliar.' %(teste))
varA = 'STRING'
varB = 123456
print('Temos uma string aqui: %s. Temos um inteiro aqui: %r.' %(varA, varB))
a1 = 'On... |
f2b4a0c7cf9d59694d91a42115753a674c53309d | idane19-meet/meet2017y1lab3 | /specialcharcters.py | 292 | 3.953125 | 4 | print(" \Hi!\" ")
(" \'Hi!\' ")
print(" \\Hi!\\ ")
print("Hello \n friend!")
print("Hi\t friend")
print(" \Instructor Alex asks, “what are you learning today?”\n
"The students reply, ‘We are learning how to print!’ "
"We can type print(“\\Day1\\”) to print out \Day1\.\" ")
|
493cc5ee3132d01c05cca6495738e3e4f6ab1436 | rbodduluru/PythonCodes | /Duplicatenumsinlist.py | 448 | 4.25 | 4 | # #!/usr/bin/python
# Python program to find the duplicate numbers in the list of numbers
def finddup(myList):
for i in set(myList):
if myList.count(i) > 1:
print "Duplicate number(s) in the list : %i"%i
if __name__ == '__main__':
myList = []
maxNumbers = 10
while len(myList)... |
7482040764573a3ae727ecc44debb48c46ad3c4f | PionDas/introToWebScraping | /webScrap.py | 2,730 | 3.828125 | 4 | #Purpose: to collect data from a website
#idea: use image recognition for parsing instead of html
# tuturial: https://www.youtube.com/watch?v=XQgXKtPSzUI&t=24s
# stoped @: 22:10
#object name is 'eReq' which calls a method 'urlopen' from module called 'request' from a package called 'urllib'
from urllib.request import ... |
d5a7a54db0d477fd6ea153062b7d0b88ec9ab964 | JancisWang/leetcode_python | /575.分糖果.py | 1,194 | 3.984375 | 4 | '''
给定一个偶数长度的数组,其中不同的数字代表着不同种类的糖果,每一个数字代表一个糖果。你需要把这些糖果平均分给一个弟弟和一个妹妹。返回妹妹可以获得的最大糖果的种类数。
示例 1:
输入: candies = [1,1,2,2,3,3]
输出: 3
解析: 一共有三种种类的糖果,每一种都有两个。
最优分配方案:妹妹获得[1,2,3],弟弟也获得[1,2,3]。这样使妹妹获得糖果的种类数最多。
示例 2 :
输入: candies = [1,1,2,3]
输出: 2
解析: 妹妹获得糖果[2,3],弟弟获得糖果[1,1],妹妹有两种不同的糖果,弟弟只有一种。这样使得妹妹可以获得的糖果种类数最多。
注意:
数组的长... |
26efa3bb90e323f34e37b382b90df6a20838ddf3 | JancisWang/leetcode_python | /1027.最长等差数列.py | 1,258 | 3.578125 | 4 | '''
给定一个整数数组 A,返回 A 中最长等差子序列的长度。
回想一下,A 的子序列是列表 A[i_1], A[i_2], ..., A[i_k] 其中 0 <= i_1 < i_2 < ... < i_k <= A.length - 1。并且如果 B[i+1] - B[i]( 0 <= i < B.length - 1) 的值都相同,那么序列 B 是等差的。
示例 1:
输入:[3,6,9,12]
输出:4
解释:
整个数组是公差为 3 的等差数列。
示例 2:
输入:[9,4,7,2,10]
输出:3
解释:
最长的等差子序列是 [4,7,10]。
示例 3:
输入:[20,1,15,3,10,5,8]
输... |
b8538bb031bafda134a86c6daab91dbaede1ad12 | JancisWang/leetcode_python | /66.加一.py | 1,316 | 3.71875 | 4 | '''
给定一个由整数组成的非空数组所表示的非负整数,在该数的基础上加一。
最高位数字存放在数组的首位, 数组中每个元素只存储单个数字。
你可以假设除了整数 0 之外,这个整数不会以零开头。
示例 1:
输入: [1,2,3]
输出: [1,2,4]
解释: 输入数组表示数字 123。
示例 2:
输入: [4,3,2,1]
输出: [4,3,2,2]
解释: 输入数组表示数字 4321。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/plus-one
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
'''
class Solution:
... |
c467bd4fb9282b97985ea38e52eaa7ee4a920d84 | JancisWang/leetcode_python | /299. 猜数字游戏.py | 1,703 | 3.59375 | 4 | '''
你正在和你的朋友玩 猜数字(Bulls and Cows)游戏:你写下一个数字让你的朋友猜。每次他猜测后,你给他一个提示,告诉他有多少位数字和确切位置都猜对了(称为“Bulls”, 公牛),有多少位数字猜对了但是位置不对(称为“Cows”, 奶牛)。你的朋友将会根据提示继续猜,直到猜出秘密数字。
请写出一个根据秘密数字和朋友的猜测数返回提示的函数,用 A 表示公牛,用 B 表示奶牛。
请注意秘密数字和朋友的猜测数都可能含有重复数字。
示例 1:
输入: secret = "1807", guess = "7810"
输出: "1A3B"
解释: 1 公牛和 3 奶牛。公牛是 8,奶牛是 0, 1 和 7。
示例 ... |
80a5579be2963eaf2907059b6b45e2c8ae939093 | JancisWang/leetcode_python | /118. Pascal's Triangle.py | 510 | 3.9375 | 4 | '''
easy
Given a non-negative integer numRows, generate the first numRows of Pascal's triangle.
In Pascal's triangle, each number is the sum of the two numbers directly above it.
'''
class Solution:
def generate(self, numRows: int) -> List[List[int]]:
def get_k(k):
row = [1]
for i... |
6d843cb1862413c9d475ec5d7c28d6ccde22ddfe | JancisWang/leetcode_python | /984. 不含AAA或BBB的字符串.py | 1,149 | 3.65625 | 4 | '''
给定两个整数 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)
链接:https://leetcode-cn.c... |
9d5f9e1fec068fbf4cdeebc019ae71ec85a73d19 | JancisWang/leetcode_python | /413. 等差数列划分.py | 1,549 | 3.53125 | 4 | '''
如果一个数列至少有三个元素,并且任意两个相邻元素之差相同,则称该数列为等差数列。
例如,以下数列为等差数列:
1, 3, 5, 7, 9
7, 7, 7, 7
3, -1, -5, -9
以下数列不是等差数列。
1, 1, 2, 5, 7
数组 A 包含 N 个数,且索引从0开始。数组 A 的一个子数组划分为数组 (P, Q),P 与 Q 是整数且满足 0<=P<Q<N 。
如果满足以下条件,则称子数组(P, Q)为等差数组:
元素 A[P], A[p + 1], ..., A[Q - 1], A[Q] 是等差的。并且 P + 1 < Q 。
函数要返回数组 A 中所有为等差数组的子数组个数。
示... |
285f282b32ba4233a000dcab3f7131bff31e638e | JancisWang/leetcode_python | /572.另一个树的子树.py | 1,705 | 4.15625 | 4 | '''
给定两个非空二叉树 s 和 t,检验 s 中是否包含和 t 具有相同结构和节点值的子树。s 的一个子树包括 s 的一个节点和这个节点的所有子孙。s 也可以看做它自身的一棵子树。
示例 1:
给定的树 s:
3
/ \
4 5
/ \
1 2
给定的树 t:
4
/ \
1 2
返回 true,因为 t 与 s 的一个子树拥有相同的结构和节点值。
示例 2:
给定的树 s:
3
/ \
4 5
/ \
1 2
/
0
给定的树 t:
4
/ \
1 2
返回 false。
在真实的面试中遇到... |
2e20e00bb00e92ae17c94218d0558c86c96e2bc3 | JancisWang/leetcode_python | /485. 最大连续1的个数.py | 872 | 3.53125 | 4 | '''
给定一个二进制数组, 计算其中最大连续1的个数。
示例 1:
输入: [1,1,0,1,1,1]
输出: 3
解释: 开头的两位和最后的三位都是连续1,所以最大连续1的个数是 3.
注意:
输入的数组只包含 0 和1。
输入数组的长度是正整数,且不超过 10,000。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/max-consecutive-ones
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
'''
class Solution:
def findMaxConsecutiveOnes(self, nums: List[... |
369ddd53044a3f81d73126f3823b95113f1c4f79 | JancisWang/leetcode_python | /1223. 掷骰子模拟.py | 2,171 | 3.6875 | 4 | '''
有一个骰子模拟器会每次投掷的时候生成一个 1 到 6 的随机数。
不过我们在使用它时有个约束,就是使得投掷骰子时,连续 掷出数字 i 的次数不能超过 rollMax[i](i 从 1 开始编号)。
现在,给你一个整数数组 rollMax 和一个整数 n,请你来计算掷 n 次骰子可得到的不同点数序列的数量。
假如两个序列中至少存在一个元素不同,就认为这两个序列是不同的。由于答案可能很大,所以请返回 模 10^9 + 7 之后的结果。
示例 1:
输入:n = 2, rollMax = [1,1,2,2,2,3]
输出:34
解释:我们掷 2 次骰子,如果没有约束的话,共有 6 * 6 = 36 种可能的组合。但... |
46eb3a5b87a939e33dcae3f9151c9a040b97e43d | JancisWang/leetcode_python | /136.只出现一次的数字.py | 773 | 3.890625 | 4 | '''
给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。
说明:
你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?
示例 1:
输入: [2,2,1]
输出: 1
示例 2:
输入: [4,1,2,1,2]
输出: 4
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/single-number
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
'''
class Solution:
def singleNumber(self, nums:List[int]) -> int:... |
c684ac5507512891be8c9a0ef21e4321afc1e541 | JancisWang/leetcode_python | /650. 只有两个键的键盘.py | 1,150 | 3.734375 | 4 | '''
最初在一个记事本上只有一个字符 'A'。你每次可以对这个记事本进行两种操作:
Copy All (复制全部) : 你可以复制这个记事本中的所有字符(部分的复制是不允许的)。
Paste (粘贴) : 你可以粘贴你上一次复制的字符。
给定一个数字 n 。你需要使用最少的操作次数,在记事本中打印出恰好 n 个 'A'。输出能够打印出 n 个 'A' 的最少操作次数。
示例 1:
输入: 3
输出: 3
解释:
最初, 我们只有一个字符 'A'。
第 1 步, 我们使用 Copy All 操作。
第 2 步, 我们使用 Paste 操作来获得 'AA'。
第 3 步, 我们使用 Paste 操作来获得 'AAA'。
说明:
... |
0589e2ebe6371d18bf6497d1310d6606a79628bc | JancisWang/leetcode_python | /665. Non-decreasing Array.py | 711 | 3.859375 | 4 | '''
easy
Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.
We define an array is non-decreasing if array[i] <= array[i + 1] holds for every i (1 <= i < n).
'''
class Solution:
def checkPossibility(self, nums: List[int]) -> bool:
count ... |
999cc49ec8c576d316f211a65f1e4eb902385b02 | JancisWang/leetcode_python | /652. 寻找重复的子树.py | 1,267 | 3.890625 | 4 | '''
给定一棵二叉树,返回所有重复的子树。对于同一类的重复子树,你只需要返回其中任意一棵的根结点即可。
两棵树重复是指它们具有相同的结构以及相同的结点值。
示例 1:
1
/ \
2 3
/ / \
4 2 4
/
4
下面是两个重复的子树:
2
/
4
和
4
因此,你需要以列表的形式返回上述重复子树的根结点。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/find-duplicate-subtrees
著作权归领扣网络... |
f50b8600d5469e418244e31c9aaf8abab9e785b3 | KoulickS/Codechef-Contest-Solutions | /PRACTICE/HOWMANY 21146381.py | 78 | 3.84375 | 4 | N=input()
if len(N)>3:
print("More than 3 digits")
else:
print(len(N)) |
37dfc998c994dc3858eb62b18ec3802b1c28029d | Manaspanigrahi0/Manaspanigrahi0 | /hackerearth/splithouse.py | 143 | 3.65625 | 4 | # Manaspanigrahi0
n= int(input())
s= input()
m=""
if "HH" in s:
print("NO")
else:
m= s.replace(".","B")
print("YES")
print(m)
|
af881cb66b06978a45b199683de3b4b2d7080c68 | brhoades/irps | /lib/node.py | 4,256 | 3.8125 | 4 | #!/usr/bin/env python
#Author: Billy J Rhoades <bjrq48@mst.edu>
#Class: CS348 Assignment 2c
#This is the file for our node class, which contains per node logic.
import util, random
from const import *
class node:
def __init__( self, tree, parent, **args ):
#our tree
self.tree = tree
#our ... |
87d765efb144ec054fb7c8d0eb9bdb9724ca3d7d | fravil/Personal-project-Vilums-2020 | /Fractals/vicsek.py | 1,748 | 3.828125 | 4 | import pyglet #library that allows me to draw
width = 1000
height = 1000
window = pyglet.window.Window(width,height,"vicsek") #Draws the window
centerx = int(round(width/2))
centery = int(round(height/2)) #Calculate the centre of the window
def whitebackground(): #This makes a white background
for i in ... |
bba2b972415af6cebb5721da09fee8555e9dd27a | sumitc29/machine_learning | /Feature_selection/chi.py | 821 | 3.71875 | 4 | """using univariate analysis"""
#this is used only for cat vs cat variable and in encoded form
#more the value of chi2 better the correlation between variables
le = preprocessing.LabelEncoder()
y = le.fit_transform(train['target'])
le = preprocessing.LabelEncoder()
x= le.fit_transform(train['independent'])
x = x.res... |
186af03ae0d73620cd35d4b8089009c886d4e4e0 | rajeshreddychintha/python | /newfile8.py | 166 | 3.984375 | 4 | #swapping of two numbers
a=int(input("enter the number :"))
b=int(input("enter the number :"))
print("print a and b",a,b)
temp=a
a=b
b=temp
print("print a and b",a,b) |
601edaf590c7b92f853fe2f1c88fd153ce7bccef | saurabh626/python-programming | /a32.py | 168 | 4.125 | 4 | def fact(n):
if n==0 or n==1:
return 1
else:
return n*fact(n-1)
a=int(input("Enter a no to find factorial : "))
f=fact(a)
print("Factorial of ",a,"is",f) |
6fac7f877c79bfbbe0d43475ec35615dc0d44a87 | preeti28dec/Dictinary-code- | /ascending_descending(14).py | 323 | 3.59375 | 4 | import operator
d={'bijender':45,'deepak':60,'param':20,'anjili':30,'roshini':50}
print('Original dictionary : ',d)
sorted_d = sorted(d.items(), key=operator.itemgetter(1))
print('ascending order: ',sorted_d)
sorted_d = dict( sorted(d.items(), key=operator.itemgetter(1),reverse=True))
print('descending order: ',sorted_... |
82f292ac4e6d69d0447d13cf47e0da0690666779 | preeti28dec/Dictinary-code- | /print the tbale.py | 319 | 3.59375 | 4 | ## Python program to print the data
d = {1: ["Python", 33.2, 'UP'],
2: ["Java", 23.54, 'DOWN'],
3: ["Ruby", 17.22, 'UP'],
10: ["Lua", 10.55, 'DOWN'],
5: ["Groovy", 9.22, 'DOWN'],
6: ["C", 1.55, 'UP'] }
print ("Pos,Lang,Percent,Change")
for k, v in d.items():
lang, perc, change = v
print (k, lang, perc, change) |
21e475ab0081cf310d212f2abbacf3111126e5ca | preeti28dec/Dictinary-code- | /Debug_code(2).py | 108 | 3.8125 | 4 | dict1={1:2,2:3,3:4,4:5}
Sum=0
i=0
while i<len(dict1):
dict1.values()
Sum+=i+2
i=i+1
print(Sum) |
3592dd73b96b954252e470d6f4b76c37a22aeef5 | AlexanderKari/Forritun | /git_forritun.py | 1,576 | 3.8125 | 4 | #Alexander Kári Ragnarsson
#Kt: 0404002220
#25.1.2017
#Forritun
#Liður 1
tala1=int(input("Slaðu inn tölu eitt "))
tala2=int(input("Slaðu inn tölu tvö "))
#spyr notanda um að sla inn tölur
utk1=tala1+tala2
utk2=tala1*tala2
#læt forritið reikna út tölurnar
print("Tölurnar lagðar saman: ",utk1)
print("Tölurnar margfaldað... |
07353ffd5bfddde5864dd9a42d15a9ab1c32eeb5 | 525642022/leetCodeArithmetic | /testNum198.py | 724 | 3.71875 | 4 | # 作者 ljc
# 你是一个专业的强盗,计划抢劫沿街的房屋。每间房都藏有一定的现金,阻止你抢劫他们的唯一的制约因素就是相邻的房屋有保安系统连接,如果两间相邻的房屋在同一晚上被闯入,它会自动联系警方。
#
# 给定一个代表每个房屋的金额的非负整数列表,确定你可以在没有提醒警方的情况下抢劫的最高金额。
class Solution(object):
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
last, now = 0, 0
for i in num... |
84c952cbf54b2e181cb9b97cae5b858c15c35a2c | 525642022/leetCodeArithmetic | /testNum53.py | 899 | 3.625 | 4 | # 作者 ljc
class Solution:
# @param A, a list of integers
# @return an integer
# 6:57
# 给定一个序列(至少含有
# 1
# 个数),从该序列中寻找一个连续的子序列,使得子序列的和最大。
#
# 例如,给定序列[-2, 1, -3, 4, -1, 2, 1, -5, 4],
# 连续子序列[4, -1, 2, 1]
# 的和最大,为
# 6。
#
#
#
# 扩展练习:
#
# 若你已实现复杂度为
# O(n)... |
6293266ea8a3c93f6b5f6344bc5cc982f86f65a4 | 525642022/leetCodeArithmetic | /testNum326.py | 270 | 3.59375 | 4 | # 作者 ljc
# 给出一个整数,写一个函数来确定这个数是不是3的一个幂。
#
# 后续挑战:
# 你能不使用循环或者递归完成本题吗?
class Solution(object):
def isPowerOfThree(self, n):
return n > 0 and 1162261467 % n == 0 |
648aff5175dce92b5a6efc43e4296bd5a3f1905b | 525642022/leetCodeArithmetic | /testNum88.py | 835 | 3.890625 | 4 | # 作者 ljc
# 给定两个有序整数数组 nums1 和 nums2,将 nums2 合并到 nums1中,使得 num1 成为一个有序数组。
# 注意:
# 你可以假设 nums1有足够的空间(空间大小大于或等于m + n)来保存 nums2 中的元素。
# 在 nums1 和 nums2 中初始化的元素的数量分别是 m 和 n。
class Solution(object):
def merge(self, nums1, m, nums2, n):
"""
:type nums1: List[int]
:type m: int
:type nums2: ... |
d0a2acf109a57ab7841728ccbdfa1909fbe35eb7 | anukanab/DataanalysisPythonCodes | /filtercolumns2.py | 729 | 3.515625 | 4 | ''' this file filetrs columns of a file based on columns from another file'''
import pandas as pd
import csv
import numpy as np
import sys
data=pd.read_csv('/data/salomonis2/NCI-R01/TCGA-BREAST-CANCER/Anukana/UO1analysis/tcga_rsem_gene_tpm.txt', sep='\t', index_col=1)
print data.head()
df=pd.read_csv('/data/salomonis... |
5af225318d489d7132e342ab85087a2c7441557d | tzlilLV97/IDconsole | /newmain.py | 4,470 | 3.8125 | 4 | import sqlite3
conn = sqlite3.connect('id.db')
import tkinter as tk
import ctypes
ctypes.windll.user32.ShowWindow( ctypes.windll.kernel32.GetConsoleWindow(), 0 )
conn = sqlite3.connect('id.db')
conn.execute("CREATE TABLE IF NOT EXISTS idAddress(_id integer PRIMARY KEY, studentName text, ID integer)")
root = ... |
a149a290bc900f8f2bc5428173a44f20db472217 | DEEPAKVETTU/deepakvettu | /exp8.py | 232 | 3.9375 | 4 | days=["Monday","Tuesday","Wednesday","Thursday","Friday"]
day=["Sunday","Saturday"]
p=input("Enter the day:")
for i in range(5):
if(p==days[i]):
print("no")
for i in range(2):
if(p==day[i]):
print("yes")
|
e2c34e2a719a9863944e99bd7dee30bc5b69c91b | DEEPAKVETTU/deepakvettu | /exp131.py | 119 | 3.578125 | 4 | a=input("ENTER THE NUMBERS")
n=0
for i in a:
if int(i)%2!=0:
n=n+int(i)
if(n%2==0):
print("E")
else:
print("O")
|
20c489dd909c4846446ecf15b8169f6a5fe9da13 | dwambia/100daysofhacking | /Tiplator.py | 565 | 4.28125 | 4 | #Simple python code to calculate amount a user is to tip
total_bill = input("What is your total bill? ")
#ignore the $ sign if user inputs
total_bill= total_bill.replace("$","")
#convert users bill to float
total_bill=float(total_bill)
print(total_bill)
#list of possible tips calculation
tip_1= 0.15*total_bill
tip_2... |
1dc8c3d6993dada95cfbd984741a825aecc575fc | kprahman/py_book_exercises | /ch20/alice_words.py | 1,442 | 3.828125 | 4 | import time
def text_to_words(the_text):
""" return a list of words with all punctuation removed,
and all in lowercase.
"""
my_substitutions = the_text.maketrans(
# If you find any of these
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&()*+,-./:;<=>?@[]^_`{|}~'\\",
# Replace them by... |
9f80937ecf7d24889bad09e0df14d205e5bedf33 | kprahman/py_book_exercises | /ch22ch23/Cards.py | 6,987 | 4.09375 | 4 | class Card:
## Class attributes are defined outside methods, and can be accessed
## from any of the methods in the class.
## think of this as 'base data.' generally, i do not want to edit this!
suits = ["Clubs", "Diamonds", "Hearts", "Spades"]
ranks = ["narf", "2", "3", "4", "5", "6", "7", "8", "9",... |
1192e4ddb2f45f010367286caede13b6278d2c7d | kprahman/py_book_exercises | /ch20/frui dictionary.py | 372 | 3.671875 | 4 | def add_fruit(inventory, fruit, quantity=0):
inventory[fruit] = inventory.get(fruit,0) + quantity
return
from unit_test import test
new_inventory = {}
add_fruit(new_inventory, "strawberries", 10)
test("strawberries" in new_inventory)
test(new_inventory["strawberries"] == 10)
add_fruit(new_inventory, "strawber... |
ac184bff8002aa36d80a6a239bc8939df695b7f8 | kprahman/py_book_exercises | /ch12/cleanword.py | 205 | 3.84375 | 4 | import string
set = ["a", "apple", "pear", "grape"]
def longestword(set):
length = []
for (i,v) in enumerate(set):
x = len(v)
length.append(x)
return max(length)
|
43d8fc3e4354ba83f704482afaab4ca502d9a29b | kprahman/py_book_exercises | /ch16/rectangles class.py | 2,001 | 4.03125 | 4 | class Point:
def __init__(self, x=0, y=0):
"""Create new point at x,y"""
self.x = x
self.y = y
def __str__(self):
return "({0},{1})".format(self.x, self.y)
class Rectangle:
"""A class to manufacture rectangle objects"""
def __init__(self, posn, w, h):
"""initi... |
d2798b6f9988f924b4bbfebcf5b2ac78b61558de | kprahman/py_book_exercises | /ch12/replace_breaks.py | 782 | 3.515625 | 4 | def myreplace(old,new,s):
w = s.split(old)
list_of_words = []
for (i,v) in enumerate(w):
if len(v) >= 1:
if i < (len(w) - 1):
split_word = list(v)
split_word.append(new)
complete_word = "".join(split_word)
list_of_words.appe... |
e9015ab249f5445c321914c683eb9453c6d948be | valeriybercha/py-test-exercises | /pythonWorldRu.py | 9,302 | 4.5 | 4 | # https://pythonworld.ru/osnovy/tasks.html
import math
import string
# ЗАДАЧА 1 - Простейшие арифметические операции. Написать функцию arithmetic, принимающую 3 аргумента: первые 2 - числа,
# третий - операция, которая должна быть произведена над ними. Если третий аргумент +, сложить их; если —, то вычесть;
# * — умн... |
08dd9bacc1f9134f1135c8fee02da58b13c74e44 | valeriybercha/py-test-exercises | /it-academy/workshop12.py | 3,432 | 3.75 | 4 | # class Door:
# def __init__(self, number, status, color):
# self.number = number
# self.status = status
# self.color = color
# def open(self):
# self.status = 'opened'
# def close(self):
# self.status = 'closed'
### Door1 ######
# door1 = Door(1, 'closed')
# print(t... |
692cef22cd3d8a97e75cc8c7d3670e935ac0371a | valeriybercha/py-test-exercises | /msft-learn/msft_learn.py | 3,018 | 4.125 | 4 | # Introduction to Python
x = int(input('Enter the first number: '))
y = int(input('Enter the second number : '))
print(str(x) + ' + ' + str(y) + ' = ' + str(x+y))
# Add numbers
print('First number')
first_number = int(input())
print('Second number')
second_number = int(input())
sum = first_number + second_number
pr... |
28d0368ee2905421a4d527041f2baec2569fbe39 | valeriybercha/py-test-exercises | /it-academy/hometask9_bercha.py | 3,397 | 4.125 | 4 | # TASK 1 - ARITHMETIC FUNCTION
print("# TASK 1 - ARITHMETIC FUNCTION")
def arithmetic(var_1_a, var_1_b, var_1_op):
if var_1_op == "+":
var_1_result = var_1_a + var_1_b
return var_1_result
elif var_1_op == "-":
var_1_result = var_1_a - var_1_b
return var_1_result
elif var_1_o... |
510b74f5f3e5281d47106469eceecdef3c2e9150 | RazvanBerbece/MultiLayerPerceptronFNN | /functions/activation/linear.py | 253 | 3.671875 | 4 | import numpy as np
# Linear function with added derivative functionality through param if true
def linear(x, derivative):
if derivative == True:
"""
Return derivative of function linear(x)
"""
return 1
return x |
c0fdead62f65239be6c75836c9cc8ed867707105 | bri-shin/OS_Paging | /a.py | 504 | 3.859375 | 4 | import os
def min_and_max(iterable):
iterator = iter(iterable)
# Assumes at least two items in iterator
minim, maxim = sorted((next(iterator), next(iterator)))
for item in iterator:
if item < minim:
minim = item
elif item > maxim:
maxim = item
return (mini... |
471a1424a01f3d9f8422aa9c520fe0feb18e6139 | onceuponpython/A-Lot-of-Stickers | /turtle_art.py | 994 | 3.796875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 26 07:47:13 2019
@author: Owner
"""
import turtle
import random
t=turtle.Turtle()
#speed choices "slowest", "slow", "normal", "fast" & "fastest"
t.speed("fastest")
#t.color("blue")
t.width(2)
num_sides=3
turn_amount=360/num_sides
repeats=5
col... |
3d25d863f804edf0e8940d1e0ac4b2c0c41d7b88 | FAdy-200/Data_Structures_Project_1 | /BFT.py | 1,125 | 3.78125 | 4 | from AVL_Tree import AVLTree
from Circular_Queue import CircularDeque
def printLevelOrder(root):
"""
Given root node, print the root tree level by level
"""
if root == None: # Empty Tree
print("Tree is empty")
return
last_level = 2 ** root.height # Maximum number ... |
b1ee55ef4a7da499b3b47fa99a3ad63e7c1524c0 | AlexDuo/DuoPython | /2Day02/circulation.py | 394 | 4.0625 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Duo
name = ["one","two","three","four","five","six"]
# List traversal
# for i in name:
# print(i)
# [start index: end index : step length]
print(name[0:-1:2])
# we can omit the first and the last index which means 0 and -1
# Therefore, to traversal the list is... |
a15efb4ceef88d5b19dc8b77fd5f0a1f022de7ed | AlexDuo/DuoPython | /Exception Handling/exceptionDEMO.py | 652 | 3.953125 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Duo
# 异常处理就是虽然程序出错了,但是我不想让用户看到,而且不想让程序崩溃
name = ['Duo Zhang','Yang chen']
dictionary = {}
try:
# dictionary["name"]
name[3]
except KeyError as error:
print("there is no %s in the dictionary"%error)
except IndexError as error:
print(error)
exce... |
d81c54e439f2b51fed285fc9754b205d0a7f50f0 | AlexDuo/DuoPython | /1Day_01/loop3.py | 386 | 3.890625 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Duo
# 值得注意的是continue的特点是跳出本次循环,继续下一次循环
# 在下面的循环中 pin 只打印了5次(i=0,1,2,3,4) 因为在 i=5的时候,
# 循环进行到else便从新进入到了下一次循环当中
for i in range(10):
if i < 5:
print(i)
else:
continue
print("pin") |
c48ae9d514b516831db37fb3efbe033cdd007c90 | AlexDuo/DuoPython | /OOP/inherit.py | 1,369 | 4.46875 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Duo
# 使用人类做继承的例子
class relation(object):
def make_friends(self,obj):
print("%s is making friends with %s"%(self.name,obj.name))
self.friendlist.append(obj)
class humanbeings:
def __init__(self,name,age):
self.name = name
... |
217b8afebd0327046b0d5d02bfe3c1541fe7082a | AlexDuo/DuoPython | /5Function/paramater_tuple.py | 812 | 3.53125 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Duo
# 参数组
# 单独使用位置参数赋值,或者关键字赋值的时候,如果定义了函数需要两个参数,那么不能多也不能少
# 当使用默认参数赋值的时候默认参数可以不用赋值。
# 用参数组给函数赋值
def test(*papamters):
print(papamters)
# 这里都是tuple的形式
test(1,3,4,5,6,7,7,8,98,9)
test(*[2,3,4,5,6,7,8,9])
def test2(x,*par):
print(x)
print(par)
# 对于混合... |
b58bf7fc7acb93feb179be20ead83922d45f20dd | Lucas-Moura-Da-Silva/Python-Estudo | /Exercícios de Python/atv039.py | 518 | 3.875 | 4 | massa = float(input('Qual é sua massa corporal?(Kg) '))
altura = float(input('Qual é sua altura?(m) '))
IMC = (massa)/altura**2
print('O IMC dessa pessoa é de {:.2f}.'.format(IMC))
if IMC <= 18.5:
print('Você está ABAIXO DO PESO ideal!')
elif 25 >= IMC > 18.5:
print('PARABÉNS, você está na faixa de PESO IDE... |
d4a9ed184f65c46f619a8c21f7129f47ed6c629a | Lucas-Moura-Da-Silva/Python-Estudo | /Exercícios de Python/atv029.py | 469 | 3.71875 | 4 | a = int(input('\033[35mPrimeiro valor: '))
b = int(input('\033[36mSegundo valor: '))
c = int(input('\033[37mTerceiro valor: '))
print('\033[1;34m-\033[m'*25)
#menor valor
menor = a
if b<a and b<c:
menor = b
if c<a and c<b:
menor = c
#maior valor
maior = a
if b>a and b>c:
maior = b
if c>a and c>b:
mai... |
ac46c16285a58de3379dc4f7970965303a6d465d | Lucas-Moura-Da-Silva/Python-Estudo | /Exercícios de Python/atv041.py | 1,703 | 3.546875 | 4 | from random import randint
import emoji
import time
#cores
cores = {'limpa':'\033[m',
'branco':'\033[1;30m',
'vermelho':'\033[1;31m',
'verde':'\033[1;32m',
'amarelo':'\033[4;33m',
'azul':'\033[1;34m',
'roxo':'\033[1;35m',
'ciano':'\033[1;36m'}
#itens
iten... |
d66c5c22c7fe4902aa03e1c814f941ca35eee03f | Lucas-Moura-Da-Silva/Python-Estudo | /Exercícios de Python/atv026.py | 226 | 3.6875 | 4 | num = int(input('\033[4;31mDigite um número qualquer:\033[m '))
nu = num % 2
if nu == 0 :
print('\033[1;34;40mO número {} é par\033[m'.format(num))
else:
print('\033[1;30;44mO número {} é impar\033[m'.format(num)) |
132dc1e43e631ef82360a7db5d30d47ac419510b | Lucas-Moura-Da-Silva/Python-Estudo | /Exercícios de Python/atv058.py | 488 | 3.921875 | 4 | print('-='*20)
print('{:^40}'.format('Geradora de PA'))
print('-='*20)
p = int(input('Primeiro termo: '))
r = int(input('Razão da PA: '))
c = 0
total = 0
mais = 10
while mais != 0:
total += mais
print('-='*20)
while c <= total:
print('{}'.format(p), end='→')
p += r
c += 1
print... |
392b85976a5b9490d804a8f80d0787b4e9c0b01c | Lucas-Moura-Da-Silva/Python-Estudo | /Exercícios de Python/atv075.py | 581 | 4.09375 | 4 | ficha = []
while True:
num = float(input('Digite um número: '))
while num in ficha:
print('Valor duplicado! Não vou adicionar')
num = float(input('Digite um número: '))
ficha.append(num)
print('Valor adicionado com sucesso...')
son = str(input('Quer continuar? [S/N]')).strip().up... |
eba64e506452c497641bdaae7c05cedcc88527ad | Lucas-Moura-Da-Silva/Python-Estudo | /Exercícios de Python/atv064.py | 852 | 3.6875 | 4 | from random import randint
vitorias = 0
print('=-'*15)
print('{:^30}'.format('Jogo do Par e Impar'))
print('=-'*15)
while True:
jogador = int(input('Digite um número: '))
computador = randint(0, 10)
resposta = (jogador + computador)/2
escolha = ' '
while escolha not in 'PI':
escolha = str... |
7d8d3527c5881021195b3426fb2db5263a8dc157 | Lucas-Moura-Da-Silva/Python-Estudo | /Exercícios de Python/atv057.py | 232 | 3.8125 | 4 | print('-='*10)
print('Geradora de PA')
print('-='*10)
p = int(input('Primeiro termo: '))
r = int(input('Razão da PA: '))
c = 0
print('-='*10)
while c != 10:
print('{}'.format(p), end='→')
p += r
c += 1
print('FIM') |
4a67f714e118924dbdcbd6e2679ff12a27d00fd8 | Zovengrogg/ProjectEuler | /Euler34_DigitFactorials.py | 351 | 3.71875 | 4 | # Digit Factorials https://projecteuler.net/problem=34
from math import factorial
def factorialSum(n):
sum = 0
digits = [int(i) for i in str(n)]
for digit in digits:
sum += factorial(digit)
return sum
total = 0
for n in range(3, 1000000):
if n == factorialSum(n):
tot... |
4ea534095f8c0e581e70c8ceca80223102229dfa | Zovengrogg/ProjectEuler | /Euler51_PrimeDigitReplacement.py | 3,978 | 4.03125 | 4 | # Prime Digit Replacement https://projecteuler.net/problem=51
import time
from math import sqrt
from itertools import *
# The replacable digit cannot be the last digit (It would not be prime 5/10 times)
# Ones place must be 1, 3, 7 or 9 otherwise it will not be prime
# The number of digits that are replaced m... |
cf2acdea769cb7db59040c2048d6ed63d2988362 | vishwa1995/VPDemo | /7.py | 239 | 4 | 4 | a=raw_input("enter the temperature:")
a=int(a)
while True:
if a>31 and a<35:
print("sunny day")
break
elif a>35 and a<40:
print("warm day")
break
elif a>40 and a<50:
print("high temperature")
break
else:
print("invalid")
|
0f63ea05c73e248f9657f159521cb02be4db5a77 | keremakdemir/ISONE_UCED | /Time_series_data/Synthetic_wind_power/Wind_Energy_Production.py | 7,391 | 3.6875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 4 15:38:18 2020
@author: kakdemi
"""
import pandas as pd
import matplotlib.pyplot as plt
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
#importing all hourly data for different heights from CSV file
All_Hourly_Data = pd.rea... |
b29f7c3cb6f218c570c90c8d20c4ed6c3c24f718 | muskan1802/Python-Mini-Projects | /RockPaperScissor/RockPaperScissor.py | 2,442 | 3.9375 | 4 | import tkinter
from tkinter import *
import random
rps = Tk()
rps.geometry("300x300")
rps.title("Rock Paper Scissor")
user_score= 0
comp_score = 0
user_choice = ""
comp_choice=""
def rock():
global user_choice
global comp_choice
user_choice="rock"
comp_choice = random_computer_choice()... |
053b97a235fd39a28fcc08cbb5c08f5776d6b1a4 | kai-dat18/advanced_scripting_github | /Exercise03/Python/Task06/kai.py | 415 | 3.546875 | 4 | import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 500)
y = np.sin(x)
plt.plot(x, y, color = 'green', linestyle='dashed')
#line.set_dashes([10, 5, 20, 5])
plt.show()
#print(plt.style.available)
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = (30 * np.rando... |
d2cfbac64efd564de57f163406892fe94db8697a | olotintemitope/Algo-Practice | /valid_palindrome_2.py | 533 | 3.796875 | 4 | import re
def valid_palindrome_2(s: str):
regex_pattern = r"[a-z]+"
words_matched = re.findall(regex_pattern, s)
s = "".join(words_matched)
if s == s[::-1]:
return True
low = 0
high = len(s) - 1
while low < high:
if s[low] != s[high]:
check1 = s[low + 1:high + 1... |
830417fdaa2109a007d516b6e3a8804fbf79775d | olotintemitope/Algo-Practice | /add_two_binary_numbers.py | 515 | 3.640625 | 4 | def add_binary(num1, num2):
n = max(len(num1), len(num2))
num1, num2 = num1.zfill(n), num2.zfill(n)
carry = 0
sum_string = ''
for i in range(n - 1, -1, -1):
if num1[i] == '1':
carry += 1
if num2[i] == '1':
carry += 1
if carry % 2 == 1:
sum... |
b7a4c138b9106c64d6db33f53e6cd0b5b35e5648 | olotintemitope/Algo-Practice | /quick_sort.py | 1,732 | 4.125 | 4 | def quick_sort(lists):
lists_length = len(lists)
if lists_length > 2:
current_position = 0
""" Partition the lists """
for index in range(1, lists_length):
pivot = lists[0]
if lists[index] <= pivot:
current_position += 1
swap = lis... |
72ffe1d623af0591a4073828857c327801bd97c1 | tirloniRS/100DaysOfPythonCode | /ex011.py | 332 | 3.796875 | 4 | l = float(input('Quantos metros de largura tem sua parede?'))
a = float(input('Quantos metros de altura tem sua parede?'))
area = l * a
tinta = area / 2
print('Sua parede tem a dimensão de {}x{}, e sua área é de {:.2f}m²'.format(l, a, area))
print('Para pintar essa parede, você precisará de {:.2f}l de tinta'.format(ti... |
7da91af49db0fd2aba183e1ab7fefba42d049b68 | Mcps4/ifpi-ads-algoritmos2020 | /EXERCICIOS_CAP_7_ADS/F3_Q7_SOMA_NUMEROS_1_A_N_FOR.PY | 184 | 3.921875 | 4 | def main():
n = int(input('digite um numero: '))
i = 1
ac = n
for i in range (1,n,1):
ac = ac + (n - 1)
print(f'>>> {ac}')
main() |
9df4930a4bc4f4f6dc2794be9be84ffb23ed2f01 | Mcps4/ifpi-ads-algoritmos2020 | /LISTA_4_FABIO/F4_Q2_ELEMENTOS_IGUAIS.PY | 665 | 3.90625 | 4 | def main():
print(elemento_igual())
def elemento_igual():
a = []
n = int(input('digite a quantidade de elementos: '))
for i in range(n):
a.append(int(input('Digite o valor que você quer adicionar no vetor: ')))
if len(a) == 1:
return 'Tamanho do vetor é insuficinete pa... |
0c7525a7cb1825269cf3bc12a757d54a95c3f657 | Mcps4/ifpi-ads-algoritmos2020 | /EXERCICIOS_CAP_7_ADS/F3_Q4_PROGRESSAO_GEOMETRICA.PY | 372 | 3.640625 | 4 | def main():
a0 = int(input('digite o valor de inicio da PG: '))
l = int(input('digite o valor limite da PG: '))
r = int(input('digite o valor da razão da PG: '))
cont = 1
alvo = 0
while l >= alvo:
alvo = a0 * r ** (cont - 1)
if l > alvo:
print(f'... |
7f30bf02deefcfbb9b4cff7398e51bb92d328082 | Mcps4/ifpi-ads-algoritmos2020 | /LISTA_2_FABIO_PARTE_1/F2_P1_Q24_DELTA.PY | 600 | 3.75 | 4 | import math
def main():
letra_a = int(input('digite o valor de a: '))
letra_b = int(input('digite o valor de b: '))
letra_c = int(input('digite o valor de c: '))
raizes(letra_a, letra_b, letra_c)
def raizes(letra_a, letra_b, letra_c):
delta = letra_b ** 2 - 4 * letra_a * letra_c
ra... |
4bf44feeecfb77e67913be9001c9c299cc36a99e | Mcps4/ifpi-ads-algoritmos2020 | /EXERCICIOS_CAP_7_ADS/F3_Q2_INTEIROS_PARES_1_A_N_FOR.PY | 222 | 3.796875 | 4 | def main():
n = int(input('digite um numero: '))
contador = 0
alvo = n
for contador in range(n):
if contador % 2 == 0:
print(f'>>> {contador}')
main() |
e7744c76027f6ffd53a91f58b33c7db84e1c6537 | Mcps4/ifpi-ads-algoritmos2020 | /EXERCICIOS_CAP_4/CAP_4_Q1.py | 840 | 3.78125 | 4 | import turtle
import math
def square(t,length):
for i in range(4):
t.forward(length)
t.lt(90)
def polyline(t, n, length, angle):
for i in range(n):
t.fd(length)
t.lt(angle)
def polygon(t,length,n):
angle = 360.0 / n
polyline(t,n,lenght,angle)
def arc(t,... |
73526f53aa0031af32bf1d3f0c563476b51097d5 | Mcps4/ifpi-ads-algoritmos2020 | /EXERCICIOS_CAP_7_ADS/F3_Q10_LIMITE_IMPARES_FOR.PY | 294 | 3.78125 | 4 | def main():
n = int(input('digite um numero: '))
inicio = int(input('Limite inferior: '))
fim = int(input('Limite superior: '))
atual = inicio
for atual in range(inicio,fim + 1,1):
if atual % 2 != 0:
print(f'>>> {atual}')
main() |
6205abaef06a88537dafc33234e1725c6942e1ca | Mcps4/ifpi-ads-algoritmos2020 | /LISTA_2_FABIO_PARTE_1/F2_P1_Q6_ANGULOS.PY | 712 | 4.03125 | 4 | def main():
alg_1 = int(input('digite o primeiro angulo: '))
alg_2 = int(input('digite o segundo angulo: '))
alg_3 = int(input('digite o terceiro angulo: '))
angulos(alg_1, alg_2, alg_3)
def angulos(alg_1, alg_2, alg_3):
if alg_1 + alg_2 + alg_3 < 180 or alg_1 + alg_2 + alg_3 > 180:
... |
a90da0ac4e5c9994b9689498f0c5f76b1d844321 | Mcps4/ifpi-ads-algoritmos2020 | /LISTA_2_FABIO_PARTE_2/F2_P2_Q14_COMBUSTIVEL.PY | 1,113 | 3.578125 | 4 | def main():
tp_combustivel = str(input('digite o tipo de combustível: '))
litros = float(input('digite o quantidade de litros: '))
valor_combustivel(tp_combustivel, litros)
def valor_combustivel(tp_combustivel, litros):
G = 'gasolina'
A = 'álcool'
preco_G = 2.5 * litros
p... |
326aa90db503a36ee76c999842089ea710c8dd97 | Mcps4/ifpi-ads-algoritmos2020 | /LISTA_2_FABIO_PARTE_2/F2_P2_Q5_PRODUTOS.PY | 1,041 | 4.125 | 4 | def main():
produto_1 = float(input('Digite o preço primeiro produto:'))
produto_2 = float(input('Digite o preço segundo produto:'))
produto_3 = float(input('Digite o preço terceiro produto:'))
precos(produto_1, produto_2, produto_3)
def precos(produto_1, produto_2, produto_3):
if ... |
f2bf5f5ff0dd70383322dcf80fbb9a5e32839431 | Mcps4/ifpi-ads-algoritmos2020 | /EXERCICIOS_CAP_7_ADS/F3_Q14_RAIZ_QUADRADA_MENOR.PY | 452 | 4.0625 | 4 | def main():
import math
n = int(input('digite quantos numeros são: '))
cont = 1
atual = 0
antes = 0
while cont <= n:
atual = int(input('digite o numero: '))
atual = int(math.sqrt(atual))
if atual > antes:
maior = atual
antes = atua... |
36b47b83057b9df45ac0df30a99c54dc7ba604e6 | Dex4n/exercicios-python | /exercicio_03.py | 875 | 4.46875 | 4 | #3 - Crie uma classe calculadora com as quatro operações básicas (soma, subtração, multiplicação e divisão).
# usuário deve informar dois números e o programa deve fazer as quatro operações.
class Calculadora:
def soma (self, numero1, numero2):
return numero1 + numero2
def subtracao(self, numero1, num... |
992d4bc3d6a25c326885d0637d189646d1b01575 | Dex4n/exercicios-python | /exercicio_09.py | 489 | 4.0625 | 4 | #9 - faça um método que receba um número X e uma palavra no console e repita x vezes a essa frase.
class Manipulacao:
def mostrar_x_vezes(self, p_tamanho, p_texto):
for i in range(p_tamanho):
print(p_texto)
tamanho = int(input("Digite a quantidade de vezes que deseja repetir uma palavra: "))
t... |
9d863ae76bad0770b25b102e6ddd41bd7f0f6d30 | 321mimi/MPG-to-KM-conversion-Python | /lab4-2.py | 480 | 3.953125 | 4 | # convertGas
# By Michelle Cantin
import math
# The function
def convertGas(conversionType, convert):
conversion = float((100 * 3.785411784) / (1.609344 * convert))
conversion = round(conversion,2)
return conversion
# Prompts
convert = float(input("What is the number to convert? "))
conversionType = int(... |
f308010ca764d75e70bfe801e705b5e05bed0052 | mehulk-5245/exsp | /cc fctrl improved.py | 148 | 3.640625 | 4 |
tc = int(input())
for i in range(tc):
n = int(input())
sum = 0
while(n>=5):
n = n//5
sum = sum+n
print(sum) |
9c8faa887aae3be0f542185a273b2bcfd312e311 | jikukjs/pytet | /pytet.py | 6,230 | 3.609375 | 4 | from matrix import *
import random
def draw_matrix(m):
array = m.get_array()
for y in range(m.get_dy()):
for x in range(m.get_dx()):
if array[y][x] == 0:
print("□", end='')
elif array[y][x] == 1:
print("■", end='')
else:
... |
7e288d4a72a09595f76ef9f40ebdc5b4fd5d9820 | kdehaan/291project1 | /main.py | 1,352 | 3.625 | 4 | import sqlite3
from sqlite3 import OperationalError, IntegrityError
import interface
conn = sqlite3.connect('./data.db')
sql = conn.cursor()
i = interface.Interface(conn, sql)
def sql_from_file(filename):
"""
Adapted from https://stackoverflow.com/a/19473206
Runs sql queries from a .sql or .txt file
... |
ebbb04505c73a2597a52ebfff30d4a6faf942fb9 | Alm3ida/resolucaoPythonCursoEmVideo | /desafio09.py | 952 | 3.921875 | 4 | #Faça um programa que leia um número Inteiro qualquer e mostre na tela a sua tabuada.
n1 = int(input('Digite um número: '))
m0 = n1 * 0
m1 = n1 * 1
m2 = n1 * 2
m3 = n1 * 3
m4 = n1 * 4
m5 = n1 * 5
m6 = n1 * 6
m7 = n1 * 7
m8 = n1 * 8
m9 = n1 * 9
m10 = n1 * 10
print('-'*24)
print('O valor de {} x 0 é igual à {}' .format... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.