blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
80c06bb6aeb90514d45d55fd50a8459630e99056
Arboreus-zg/Unit_converter
/main.py
642
4.53125
5
print("Hello! This is unit converter. It will convert kilometers into miles. Just follow instruction on screen") while True: kilometers = float(input("Enter a number in kilometers: ")) conv_fac = 0.621371 miles = kilometers * conv_fac print("Your kilometers converted into miles are: ",...
6a1738675a831e3526d6602a3978ee90d64c0050
wuxiangjinxing/Leetcode_Python3_Record
/Generator.py
1,162
3.6875
4
# 展开嵌套的列表 # 递归和非递归方法演示 def list_or_tuple(x): return isinstance(x, (list, tuple)) def flatten(sequence, to_expand=list_or_tuple): for item in sequence: if to_expand(item): for subitem in flatten(item, to_expand): yield subitem ...
cb58dd25f9d23770d581c72db9cbb7daffc957bd
noahh142/learn01
/age_challenge.py
197
4
4
name = input("what is your name?") age = int(input("how old are you?")) years_left = 100 - age year100 = 2021 + years_left print("hello ", name) print ("you will be 100 in the year ", year100)
733122d384e0dc2f0fa903ecfc3b2f21cc94f3fd
abrarislam/Diet-Optimization-Model
/Diet Optimization Model.py
6,388
4.3125
4
# The diet problem is one of the first large-scale optimization problems to be studied in practice. # Back in the 1930’s and 40’s, the Army wanted to meet the nutritional requirements of its soldiers # while minimizing the cost.) In this homework you get to solve a diet problem with real data. # 1. The following i...
addeadc0903c094950bdbf96df92842663badaf0
shahakshay11/DP-1
/coin_change.py
2,302
3.546875
4
""" // Time Complexity : O(C * A) -> A -> Amount, C -> size of coins array // Space Complexity : O(1) // Did this code successfully run on Leetcode : Yes // Any problem you faced while coding this : None // Your code here along with comments explaining your approach Algorithm explanation - Recursive approach - We b...
e78ef7ff493875a8789ac1022917b9208ba1aadc
siddeshgr/python-practice
/main.py
1,599
4.21875
4
#1 print("hello world") name = input("enter your name: ") print("hello siddesh") #1 variables in python x = 100 y = 100 z = 200 print(x,y,z) #2 float [float] x1 = 20.20 y1 = 30.30 print(x1,y1) name = "hello" print("single character",name[1]) name = "hello" print("snigle character",name[3]) ...
4d4a379cf67c4f9cfdcbdf9eafbf8d59d41f4655
pchandraprakash/selenium_python3.x
/Advanced_Data_Types/Tuple.py
499
4.03125
4
""" Tuple is very similar to list the only difference is tuples are IMMUTABLE """ my_list = [1, 'a', 'name', 2.0] print(my_list) my_list[1] = 1.1 print(my_list) """ define and declare a tuple """ my_tuple = (1, 'a', 1.1) print(my_tuple) print(my_tuple[1]) print(my_tuple[1:2]) print(my_tuple.index(1.1)...
26d4c9dfda14baf0987a4fcac1eae154528cd0d7
SarahPavlak/Robo_Advisor
/app/robo_advisor.py
5,739
3.546875
4
import csv import json import requests import os from dotenv import load_dotenv import datetime import pandas as pd load_dotenv() def to_usd(my_price): return "${0:,.2f}".format(my_price) #taken from screencast API_KEY = os.environ.get('MY_API_KEY') #Collecting User Information user_input = input ("Plea...
0a1107dce3be216a4a2eb6dfccf10cfbd0a27bfd
marskingx/Learn
/range.py
188
3.765625
4
# range 範圍 # python內建功能:清單 import random range(5) range(3) for i in range(100): r = random.randint(1, 1000) print('這是第', i+1, '次產生隨機數:', r)
5deeaa80c1dbd68aa421637740e2abe664b7e86a
hw-repository/congenial-octo-invention
/Vowels.py
292
4.0625
4
def is_vowel(x): vowels = {'a','e','i','o','u'} return x.lower() in vowels print len('f') while True: letter =raw_input('Input letter: ') if len(letter)==1: print(is_vowel(letter)) break print('This is not a single letter. Please, try again...\n')
275f18428d1aab776fae9a5dbc55319cc9a00025
jfarnerGit/musc-analysis
/acousticFetch.py
5,677
3.578125
4
import spotipy from spotipy.oauth2 import SpotifyClientCredentials import pandas as pd import time import matplotlib.pyplot as plt import numpy as np import os sleep_min = 2 sleep_max = 5 start_time = time.time() request_count = 0 ''' Program to fetch acoustic features from Spotify of all songs in an artists discograp...
652ab15329f9c2dbf8ddc7f2053cbea0fe987617
earamosb8/holbertonschool-web_back_end
/0x00-python_variable_annotations/7-to_kv.py
305
4.125
4
#!/usr/bin/env python3 """ Module - string and int/float to tuple """ from typing import Union, Tuple def to_kv(k: str, v: Union[int, float]) -> Tuple[str, float]: """function to_kv that takes a string k and an int OR float v as arguments and returns a tuple.""" return (k, v * v)
1e7d3ef971b8905b62be1a515dc9b82b24502def
earamosb8/holbertonschool-web_back_end
/0x00-python_variable_annotations/3-to_str.py
224
4.15625
4
#!/usr/bin/env python3 """ Module - to string """ def to_str(n: float) -> str: """function to_str that takes a float n as argument and returns the string representation of the float.""" return str(n)
376de5b21a4d82cd1cc1d957180230ae8d0fc0fe
EMYOU008/KNN_Behaviour
/Q2.py
5,321
3.546875
4
from sklearn import neighbors from NN_plotit import getExamples,accuracy,NN from time import time import matplotlib.pyplot as plt ##############################################Part 2a####################################### def sample(size): mars=NN() kitkat=neighbors.KNeighborsClassifier(5) Run_time=[]...
b216ed91d5b5ced185d3bebe522b298c913f56d4
martin1144/03_Math_Quiz_Game
/asd.py
26,685
3.625
4
from tkinter import * from functools import partial # To prevent unwanted windows import random class Quiz: def __init__(self): # Formatting variables... background_color = "white" self.starting_question = IntVar() self.starting_question.set(0) self.low_amount = IntVar() ...
7b86f14186ab81adca6cbdcf7fcdf5e4cdab7052
zampoC/exebook
/12.6.py
839
3.53125
4
# -*- coding: utf-8 -*- """ Created on Tue Feb 26 21:57:17 2019 @author: zampochung """ class Apple(): def __init__(self, c , w, d, t): self.color = c self.weight = w self.day = d self.temp = t print('creatd') class Circle(): def __init__(self, r): ...
fb98c65e6cc86506506913da628590ef47334410
zampoC/exebook
/14.5.py
461
3.53125
4
# -*- coding: utf-8 -*- """ Created on Mon Mar 4 22:13:38 2019 @author: zampochung """ class Square(): squs = [] def __init__(self, a): self.line = a self.squs.append((self.line)) def print_size(self): print("""{} by {} by {} by {}""".format(self.line, ...
294e5c04b111ba68064bfd5dd6b349e9a35c5c98
zampoC/exebook
/17_exe.py
1,967
3.59375
4
# -*- coding: utf-8 -*- """ Created on Sat Mar 9 17:01:40 2019 @author: zampochung """ import re zen = """Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namesapces are one honking great id...
b108ee953f622dde9a383003c7f7fc0f3fbd61a7
masskonfuzion/falldown_rebirth
/collision.py
21,109
3.578125
4
""" Collision Detection for Falldown Rebirth """ from MKFMath.Vector2D import * from MKFMath.MKFMath2D import * import copy import pygame __author__ = 'Mass KonFuzion' class CollisionGeomAABB: """ The CollisionGeomAABB is simply a rectangle. Collisions will be handled by creating an axis-aligne...
ae94e14039fb7afcec11f6e4bd3814b3231cd5e5
fiona8231/PythonBasic
/String.py
1,401
3.984375
4
var = "This is the sample string" print var numOne = 2 wordOne = "cats" # two way to print string print 'I have {0} {1}'.format(numOne, wordOne) combineStr = "I have " + str(numOne)+ " " + wordOne print combineStr combineStr += " I think? " print combineStr stringVar2 = "Just another string" for i in stringVar2:...
6f0377d0a847c898539aefcfa8c92b7bf4e835e4
lorinmiley/FirstProject
/test_closest_points.py
1,139
3.59375
4
import closest_pair from math import * # content of test_class.py class TestClass: def test_One(self): #creates a 2d array with numerical points test_points = [[1,2],[3,6],[3,3],[1,9],[9,0],[8,10],[99,34]] tester = closest_pair.calculate_closest_pair(test_points) assert isclose(tes...
e41ef20e02710f7c1b02d041d675c4f20015f371
pasky/step
/ndstep_seq.py
5,280
3.515625
4
""" STEP is a scalar optimization algorithm. This module provides an ``ndstep_seq_minimize`` function that tries to apply it to multivariate optimization nevertheless. The approach is to simply keep running independent STEP algorithms along separate dimensions, progressively finding improved solutions. We try to mirr...
46d5d669137de5a13b7188faef9aafc6fccc981c
poponzu/atcoder1
/atcoder/ABC/9/9b.py
174
3.71875
4
N = int(input()) A = [] for _ in range(N): a = int(input()) A.append(a) set_A = set(A) list_A = list(set_A) sort_A = sorted(list_A,reverse=True) print(sort_A[1])
6d25ad43c5350ac562f517979f00857289557bd6
poponzu/atcoder1
/atcoder/ABC/149/149c_rev.py
280
3.953125
4
N= int(input()) import math #素数判定 O(sqrt(N)) def bool_is_prime(x): if x<=1: return False for i in range(2,math.floor(math.sqrt(x))+1): if x%i == 0: return False return True p = N while bool_is_prime(p)==False: p += 1 print(p)
cc562e70ba0e58b91a760720f30d99f42769b5ae
poponzu/atcoder1
/atcoder/ABC/167/167a.py
133
3.71875
4
List = [input() for i in range(2)] S = List[0] T = List[1] # print(S) # print(T) if S==T[:-1]: print('Yes') else: print('No')
256ef0ede44b9edbee321edae3af405c2c680911
poponzu/atcoder1
/atcoder/AOJ/finished/ITP1_9A.py
247
3.8125
4
words=input().upper() text=[] while(True): tmp_text = str(input()) if tmp_text=="END_OF_TEXT": break text += tmp_text.upper().split() # print(words,text) ans = 0 for t in text: if t==words: ans += 1 print(ans)
76b50bb44189acea894a7de8f37dc17732b35097
poponzu/atcoder1
/LeetCode/TwoSum.py
525
3.546875
4
class Solution: def twoSum(self, numbers, target): for left in range(len(numbers) -1): #1 right = len(numbers) - 1 #2 while left < right: #3 temp_sum = numbers[left] + numbers[right] #4 if temp_sum > target: #5 right -= 1 #6 ...
3626cee57e79c1544e3edf1841fd50c97c88bf20
poponzu/atcoder1
/LeetCode/permutations_ans.py
996
3.8125
4
# 天才やdfs # 解説[再帰関数を用いた深さ優先探索(DFS)による全探索アルゴリズム]("https://algo-logic.info/brute-force-dfs/") class Solution: def permute(self, l):#-> List[List[int]]: def dfs(path, used, res): if len(path) == len(l): res.append(path[:]) # note [:] make a deep copy since otherwise we'd be append t...
868f525d4c792a1936420fba2918e3ba446b3faf
poponzu/atcoder1
/LeetCode/permutations.py
260
3.828125
4
# itertoolsなかったらきつい? # import itertools class Solution: def permute(self, nums):# List[List[int]]: per = list(itertools.permutations(nums)) return per num = [1,2,3] per = list(itertools.permutations(num)) print(per)
44deabe4143cddf6b18ec2903c9798b9c48acd91
poponzu/atcoder1
/atcoder/ABC/176/176a.py
1,234
3.65625
4
# N,X,T = map(int, input().split()) # # answer = 0 # # if N%X == 0: # S = int(N/X) # answer = S*T # else: # S = int(N / X) # answer = (S+1) * T # # print(int(answer)) def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lowe...
30d4be243c6e881c887413a6169333585f4880be
poponzu/atcoder1
/atcoder/AOJ/finished/ITP1_9C.py
395
3.5
4
n=int(input()) tarou_point=0 hanako_point=0 for i in range(n): tarou, hanako = input().split() # 1行に空白区切りで与えられた2つの文字列を読み込む if tarou == hanako: tarou_point+=1 hanako_point+=1 elif tarou < hanako: hanako_point +=3 elif tarou > hanako: tarou_point +=3 ans =[tarou_point,h...
ebb862b01050cf3260625def3020eb1cc9e872d3
poponzu/atcoder1
/atcoder/ABC/144/144c.py
538
3.75
4
n = int(input()) #約数列挙O(sqrt(N))リストで返す def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_di...
a93a81689b0e4658287a8fceaa3205b187b4fd89
poponzu/atcoder1
/LeetCode/Longest_Palindromic_Substring_ans.py
980
3.734375
4
class Solution: def isPalindrome(self, s: str) -> bool: return s == s[::-1] def longestPalindrome(self, s: str) -> str: # so I want to create frames of different lengths # that will move along a string # so if string is abba # the first frame is abba # the second...
02967aba698c436f6edf60edf185e90c68bd5271
extremepayne/standard-works-stuff
/test_random_verse.py
1,264
3.515625
4
"""Test scriptures module.""" import random_verse def test_get_random_verse(): """Make sure it returns a verse.""" my_random_verse = random_verse.get_random_verse() assert isinstance(my_random_verse, dict) assert isinstance(my_random_verse["scripture_text"], str) def test_generate_scripture_url(): ...
9326b86d6c0f45152597a6f7128d4df81c2470da
shailja-cyber/tathastu_week_of_code-
/day1/prog4.py
190
3.78125
4
cp=float(input("enter cost price")) sp=float(input("enter selling price")) profit= sp-cp print("profit=",profit) sell=cp+cp*5/100 print("selling price if profit is increased by 5% is",sell)
111a835d30a59f7b9ae66bdebbfcf5813a1c05d3
piaowang/Python003-003
/week07/demo_v2.py
3,058
4.46875
4
'''具体要求: 背景:在使用 Python 进行《我是动物饲养员》这个游戏的开发过程中,有一个代码片段要求定义动物园、动物、猫、狗四个类。 这个类可以使用如下形式为动物园增加一只猫: 定义“动物”、“猫”、“狗”、“动物园”四个类,动物类不允许被实例化。 动物类要求定义“类型”、“体型”、“性格”、“是否属于凶猛动物”四个属性,是否属于凶猛动物的判断标准是:“体型 >= 中等”并且是“食肉类型”同时“性格凶猛”。 猫类要求有“叫声”、“是否适合作为宠物”以及“名字”三个属性,其中“叫声”作为类属性,除凶猛动物外都适合作为宠物,猫类继承自动物类。狗类属性与猫类相同,继承自动物类。 动物园类要求有“名字”属性和“添加动物”的...
e83142901750f1d6072c194491162a82fa51e860
PauliusVaitkevicius/useful-stuff
/dictionaries.py
957
3.78125
4
from collections import defaultdict # create dict from keys dictionary = dict.fromkeys(["one", "two", "three"]) # print(dictionary) # -------- d = {"paulius": "black", "asta": "green", "tomas": "blue", "laura": "red"} print(d) # creatind dict from lists names = ["paulius", "asta", "tomas", "laura"] colors = ["black...
a64e0ebc2e4d156518ffa5f96713b742694d886a
Leporoni/PythonBasic
/src/estrutura_for.py
568
4.125
4
numero = int(input("Digite um número: ")) for i in range(11): print( "{n} x {i} = {resultado}".format(n=numero, i=i, resultado=numero*i)) else: print("**Processo Concluído**") linguagens = ["Python", "Java", "C#", "Node", "Go"] print("Algumas linguagens de programação são: ") for linguagem in linguagens: p...
6e03ee4f113fb1af8854a94fa2d6063381466993
Leporoni/PythonBasic
/src/variaveis.py
268
3.59375
4
word = "samurai" nome = "Alessandro" name = "samurai" a = 2 b = 2 print("Id de word: ") print(id(word)) print("Id de nome: ") print(id(nome)) print("Id de name: ") print(id(name)) print("==============") print("Id de a: ") print(id(a)) print("Id de b: ") print(id(b))
84f1dea358fadc7d49ec0d2e83702f4cef0f701b
Leporoni/PythonBasic
/matematica/funcoes_aritimeticas.py
592
3.875
4
def somar(n1, n2): """Realiza a soma de dois números""" print("{n1} + {n2} = {result}".format(n1=n1, n2=n2, result=n1+n2)) def subtrair(n1, n2): """Realiza a subtração de dois números""" return n1 - n2 def multiplicar(n1, n2): """Realiza a multiplicação de dois números""" return n1 * n2 def d...
30fe43843d6c9cf2ef379ae4174f4a58b3d8e88a
Rodrigocalaca/PythonExercicios1
/ex003.py
124
3.953125
4
n1=float(input('Digite n1: ')) n2=float(input('Digite n2: ')) s=n1+n2 print('A soma entre {} e {} é: {}'.format(n1,n2,s))
fc2918c3967102dc35df29f3de97a2a86c7df345
Rodrigocalaca/PythonExercicios1
/ex022.py
168
3.953125
4
nome = str(input('Digite um nome: ')).strip() print(nome.upper()) print(nome.lower()) print(len(nome) - nome.count(' ')) separado = nome.split() print(len(separado[0]))
9e0061f91cc3d7e8562a4dd836b801bc97a008f2
Rodrigocalaca/PythonExercicios1
/ex030.py
116
4.03125
4
n = int(input('Digite um número: ')) if n%2==0: print('O número é par') else: print('O número é impar')
748c0c5222219981767310d60b26875ef2ef2a8b
ntudavid/Euler_Project
/P14.py
546
3.6875
4
''' Project Euler Problem #14 - Longest Collatz sequence David 06/28/2017 ''' import time def collatz(num): cnt = 1 while(num!=1): cnt += 1 if(num%2==0): num = num/2 else: # odd number num = 3*num+1 return cnt # main tic = time.time() N = 1000000 longestC...
a6a4992a6aea73a3c65c7f9c861cc6ed1530c644
ntudavid/Euler_Project
/P38.py
977
3.53125
4
''' Project Euler Problem #38 - Pandigital multiples David 07/05/2017 ''' import math import time def check_pandigital(s): if(len(s)!= 9): return False else: cnt = [0]*10 for i in range(9): cnt[int(s[i])] += 1 pandigital = True for j in range(1,10): ...
e38d789c50a349b8ca55bfb818f75958423d8c2d
ntudavid/Euler_Project
/P27.py
844
3.703125
4
''' Project Euler Problem #27 - Quadratic primes David 06/30/2017 ''' import math def isPrime(num): if(num<=1): return False elif(num==2): return True elif(num%2==0): return False else: sqrt_num = math.sqrt(num) bound = int(sqrt_num)+1 for i in range(3...
d4ca9e0ac8f3883daff5a11e6afb859e68d4870e
ntudavid/Euler_Project
/P2.py
283
3.546875
4
''' Project Euler Problem #2 - Even Fibonacci numbers David 06/27/2017 ''' noExceed = 4000000 fab1 = 1 fab2 = 2 fab = fab1 + fab2 summation = 2 while(fab<=noExceed): if(fab%2==0): summation += fab fab1 = fab2 fab2 = fab fab = fab1 + fab2 print(summation)
ca1e0cc071337bc4aa2c07cce33f54563877a139
nickstellato/draw_shapes
/spiral.py
257
3.890625
4
import turtle def draw_Spiral(turtle, length): if length > 0: turtle.forward(length) turtle.right(90) draw_Spiral(turtle, length-5) brad = turtle.Turtle() window = turtle.Screen() draw_Spiral(brad, 100) window.exitonclick()
489cc35697b705dd1d3dfb63d0a2a671bd395efc
danila7777/pumpskill_1
/module1/lesson2_2.py
414
4.09375
4
# Ctrl + K+С закомментить выделенные строки # i = 0 # while i < 10: # if i == 3: # i = i + 1 # continue # print(i) # if i == 5: # break # i += 1 i = 0 while i < 10: if i == 0 or i == 5: i = i + 1 continue if i < 5: print('Часть 1:', i) i...
a3ad9b1f4baa15b0a6f72f9d007fecad4b88035b
sojunhwi/Python
/알파벳 찾기.py
236
3.75
4
alphabet=input() List=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] index=0 for i in range(len(List)): index=alphabet.find(List[i]) print(index,end=" ")
dc2e67e23ca6252330559ce29fd096d1e156f3b0
sojunhwi/Python
/단어의 갯수.py
106
3.546875
4
Sentence=input() cnt=(Sentence.strip()).count(' ') if Sentence==' ': print(cnt) else:print(cnt+1)
001778fe50baa891d1527f859510a3855db1993a
tonyveliz/python-challenge
/PyBank/main.py
1,482
4.0625
4
#import csv data import csv #File location Budget_file = ("/Users/tonyv/python-challenge/Pybank/budget_data.csv") #Variables total_months = [] total_profits = [] average_change = [] #Open csv file in read mode with open(input_file,newline="", encoding="utf-8") as budget: #store the contents of the .csv file in the ...
99ebb2beb633a60c57297a7decde0970711e1723
bklimko/phys416-code
/Chapter 1 Work/chap1_problem3.py
2,481
3.515625
4
import numpy as np import matplotlib.pyplot as plt # import statements for plotting purposes """ Benjamin Klimko, PHYS 416 Spring 2018 The program takes no inputs This program recreates a series of plots from the textbook as an exercise to become comfortable with Python Running the program will produce four subplots ...
8e54af6c36cc83ba18c1abd3ab44c5b2eaea268e
ZKDeep/Naive-Bayes-Classifier
/main.py
735
3.625
4
# -*- coding: utf-8 -*- """ Created on Sat Jun 27 12:54:06 2020 @author: zubair """ import numpy as np import pandas as pd import model ### call your classification dataset here data = pd.read_csv("vertebrate.csv") ## call the attribute indexes here cols_x = [1,2,3,4,5,6,7] x = data[data.columns...
acc866bf2ca51675be5d66dca2c1c724b96ce443
linqiuyu/Data-Structure-and-Algorithms
/08_shell_sort.py
480
3.515625
4
def shell_sort(a): """ 希尔排序 :param a: :return: """ length = len(a) gap = length // 2 while gap: for i in range(gap, length): while i > 0: if a[i] < a[i-gap]: a[i], a[i-gap] = a[i-gap], a[i] i -= gap ...
a390436ffd051f352cc6ed38f64e8961f0f36f83
MarcosRigal/Master-en-Python-Udemy
/07-ejercicios/Ejercicio5.py
392
4.03125
4
print("Este programa imprime el intervalo entre los dos números introducidos") inferior = int(input("Introduce el extremo inferior del intervalo: ")) superior = int(input("Introduce el extremo superior del intervalo: ")) if inferior > superior or inferior == superior: print("Error el intervalo no está bien definido...
df29cb4575c299b3a6efb1bc4245ccb77b568998
MarcosRigal/Master-en-Python-Udemy
/15-manejo-errores/main.py
1,258
4.53125
5
""" # Capturar excepciones y manejar errores en código # susceptible a fallos/errores try:#Comprueba el funcionamiento nombre = input("¿Cual es tu nombre?") if len(nombre) > 1: nombre_usuario = "El nombre es: " + nombre print(nombre_usuario) except:#Si va mal print("Ha ocurrido un error, introduzca un nom...
42217516308d09c9b8d9b78a8f3eeac62b0cff31
MarcosRigal/Master-en-Python-Udemy
/16-POO-clases/main.py
1,426
3.921875
4
# Programación orientada a objetos (POO o OOP) # Definir una clase (Es un molde para crear mas objetos de ese tipo con caracteristicas similares) class Coche: # Atributos o propiedades (son publicas) (variables) # Características del coche: color = "Rojo" marca = "Ferrari" modelo = "Aventador" velocida...
b7e9e4dedabccd1f9cadb77bc04148f9a7bdb795
MarcosRigal/Master-en-Python-Udemy
/10-sets-diccionarios/diccionarios.py
730
4.4375
4
""" Un diccionario es un tipo de dato que almacena otros conjuntos de datos en formato: clave > valor (Es como un struct) """ persona = { "nombre": "Marcos", "apellidos": "Rivera", "correo": "riveragavilanmarcos@gmail.com" } print(persona["correo"]) # Lista con diccionarios (Array de Structs) contactos = [ ...
941cb46c7e5475d67fdd5c0e80b864165ff869f9
lucasnuernberg/curso-python-exercices
/ex3.py
145
3.8125
4
n1 = float(input('Digite um número: ')) n2 = float(input('Digite outro número: ')) soma = n1 + n2 print('{} + {} = {}'.format(n1, n2, soma))
74f53cacf0895d8a44b20bd64fe817171611a290
lucasnuernberg/curso-python-exercices
/ex25.py
134
3.765625
4
nome = str(input('\nDigite seu nome completo: ')).strip() N1 = nome.title() print(f'Silva esta contido no seu nome? {"Silva" in N1}')
6f77336a4f3218eec3b0c3d8f53c46da31b283df
lucasnuernberg/curso-python-exercices
/ex54.py
580
3.859375
4
#Lendo idades from datetime import date contador = 0 menor = 0 data = date.today().year#pego o ano atualizado for c in range(0, 7): #faço acontecer 6 VEZES a pergunta dentro do laço n = int(input(('Em que ano você nasceu: '))) if (data - n) >= 18: contador += 1 else: menor += 1 if contador ...
b19ee7e69395469fae5b6f0e559291d8b2ed5b8d
lucasnuernberg/curso-python-exercices
/ex20.py
440
3.5625
4
#sorteando alunos import random alunos = [] aluno1 = str(input('Qual o nome do primeiro aluno? ')) alunos.append(aluno1) aluno2 = str(input('Qual o nome do segundo aluno? ')) alunos.append(aluno2) aluno3 = str(input('Qual o nome do terceiro aluno? ')) alunos.append(aluno3) aluno4 = str(input('Qual o nome do quarto alu...
06be91813ff929516b94619b35542d48c54a4dbe
lucasnuernberg/curso-python-exercices
/ex44.py
588
3.78125
4
print('='*15 + 'LOJAS LUCAS' + '='*15) compras = float(input('Digite o preço das compras: R$')) precoFinal = compras print('FORMAS DE PAGAMENTO:') print('[1] á vista') print('[2] á vista no cartão') print('[3] 2x no cartão') print('[4] 3x ou mais no cartão') metodoPagamento = int(input('Qual o metodo de pagamento? ')) ...
4851e5387a283ddfcc8d4532bb38f406011d5acd
lucasnuernberg/curso-python-exercices
/ex99.py
523
3.921875
4
from time import sleep print('') def maior(*num): if len(num) == 0: print('Analizando os valores passados...') print(f'Foram informados {len(num)} valores') else: print('Analizando os valores passados...') for c in num: print(c, end=' ') sleep(0.3) ...
a69b22e1d0768bd5b3c99dba5a1cb9e13531c37a
lucasnuernberg/curso-python-exercices
/ex13.py
208
3.890625
4
print('-'*60) salario = float(input('Digite o seu saário: R$')) salarioComAumento = salario * 1.15 print('Com um aumento de 15% o seu salário passa a ser R${:.2f}'.format(salarioComAumento)) print('-'*60)
bd81e2f382d80870bb92547ef0ee8ff02957786c
lucasnuernberg/curso-python-exercices
/ex85.py
309
3.890625
4
todos = [[], []] for c in range(1,8): valor = int(input(f'Digite o {c}º numero: ')) if valor % 2 == 0: todos[0].append(valor) else: todos[1].append(valor) todos[0].sort() todos[1].sort() print(f'Os números PARES são: {todos[0]}') print(f'Os números ÍMPARES são: {todos[1]}')
cb6924dc04598245a83bd749307641f1cb2c1683
lucasnuernberg/curso-python-exercices
/ex73.py
386
4.0625
4
#lendo uma tupla lista = ('Criciuma', 'Fluminense', 'Flamengo', 'Vasco', 'Gremio', 'Inter') num = len(lista) print(f'\nO primeiro colocado é {lista[0]}') print(f'Os três primeiros são {lista[0:3]}') print(f'Os times em ordem alfabetica {sorted(lista)}') print(f'Os 2 ultimos colocados são {lista[-2:]}') pos = lista.ind...
77f2e11934fadf6f7ec9231538ffc1447a6bb3a9
lucasnuernberg/curso-python-exercices
/ex106.py
373
3.515625
4
#continuar com as frescuras a mais def ajuda(): while True: n = str('_-' * 15) print(f'\033[1:43:36m{n.center(100)}') print('Sistema de ajuda'.center(100)) print(n.center(100)) h = input('\033[mFunção ou biblioteca-->') if h.lower() == 'fim': break ...
0d177259e36afaaf69a3c08f32a8e0580f0fd0fc
geomeza/simulation
/src/euler_estimator.py
3,386
3.59375
4
import matplotlib.pyplot as plt class EulerEstimator: def __init__(self, derivatives, point): self.derivatives = derivatives self.x_points = [point[0]] self.y_points = [[y for y in point[1]]] self.point = point def calc_derivative_at_point(self): return [self.derivativ...
1ec8d41cc8807acb4cff1bda295d7f0bb9accfd1
aisola/ArcadeGames
/arcadegames/blockslib/ScoreClass.py
1,439
3.96875
4
#-------------------------------------------------------------------------------- # @file : ScoreClass.py # @package: See __init__.py # @author : See __init__.py # @license: See __init__.py #-------------------------------------------------------------------------------- import sys, os, math, random import pygame f...
78a8270c82779b85b69c3395045abf87a2a9b129
HAMDONGHO/USMS_Senior
/python3/python_Practice/helloworld.py
1,640
3.65625
4
print('Hello') #a,b=intput().split() a=1 while a<10: print(a) a+=1 b=3.14 print(b) c='Hello World' print(c) #LIST == Array in C mathList=[37, 93, 59, 87] print(sum(mathList)) print(max(mathList)) print(min(mathList)) print((mathList[1]+mathList[2]+mathList[3]+mathList[0])/4) list1=[1.1, 2.2, 3.3, [4.4, 5.5]]...
7dfc540d930468949f911445e564b712dcf9d136
BorG1985/sabiranje
/calc.py
538
3.703125
4
dct = { "en":{ "n1":"Enter first number", "n2":"Enter second number", "res":"Result is", }, "sr":{ "n1":"Unesite prvi broj", "n2":"Unesite drugi broj", "res":"Rezultat je" } } keys = tuple(dct.keys()) while True: lang = input(f"Enter language {keys...
75083a41a8ce404e1b8ad1b23a06717e617021c1
Roisin-Fallon/Sorting_Algorithms
/Python Code/Algorithm Range 0 - 20000/counting.py
12,101
3.90625
4
from random import * # Import python random module def random_array(n): # Function takes as input a value n array = [] # create an array variable for i in range(0, n, 1): # i start at 0 stop at n an increment by 1 (e.g. if n=4 0...
b61c75377d5bfa38e29131a8dadf9c121ad12a59
andyolivers/lampoon
/testing/testcase-oracle-table.py
418
3.5625
4
# Connects to an Oracle database # Queries the Database and prints the first two columns of a table # Replace username, password, server, port and service # Replace TABLENAME import cx_Oracle conn_str = u'username/password@server:port/service' conn = cx_Oracle.connect(conn_str) c = conn.cursor() SQL="SELECT * FROM...
2bd31ae5cddb27b7749a4a5a34f183af5cd28812
ilse-r/05-02-oop
/loop_playground.py
1,197
3.640625
4
data = [ { 'list': [1,2,3], 'dict': {'a':'aardvark', 'b':'banana'}, "hashtags":[ {"indices":[32,36],"text":"lol"}, {"indices":[32,36],"text":"yummy"} ] }, { 'list': [10,20,30], 'dict': {'a':'apple', 'b':'breakfast'}, "hashtags":[ {"indices":[32,36],"text":"lol"} ...
037a548be82d0320267eb5830baabafd0f9604d1
yuta-inoue/soft2
/3/mon5.py
500
4.125
4
# -*- coding:utf-8 -*- # 再帰関数の線形再帰(フィボナッチ数列の線形再帰) fib = [] # 配列の要素を先に初期化して保持しておく(ループはO(n)) def init(n): fib.append(0) fib.append(1) for i in range(2,n): fib.append(fib[i-1] + fib[i-2]) # 先にO(n)で初期化した配列のn番目の要素を返す def fib_linear(n): return fib[n] def main(): init(10) for i in range(10): print(fib_...
1bc45bd5cec6bf9281c7669d182542304096b233
yuta-inoue/soft2
/6/test-student.py
686
3.71875
4
class Student: name = None grade = None def __init__(self,name): self.name = name self.grade = 0 def set_grade(self,grade): self.grade = grade def get_grade(self): return self.grade def get_name(self): return self.name def promotion(self): self...
33de9bafb8623df3b4d5693151fee8608651f2db
ym0179/bit_seoul
/keras/keras22_LSTM_Return_sequences.py
1,593
3.5
4
#Day4 #2020-11-12 #1. 데이터 import numpy as np x = np.array([[1,2,3], [2,3,4], [3,4,5], [4,5,6], [5,6,7], [6,7,8], [7,8,9], [8,9,10], [9,10,11], [10,11,12], [20,30,40], [30,40,50], [40,50,60]]) #(13,3) y = np.array([4,5,6,7,8,9,10,11,12,13,50,60,70]) x_input = np.array([50,60,...
db60b2b597d017df7cb3a4eea31b13c176137545
JoelsonCRJ/formation_control
/scripts/sigmoid.py
433
3.953125
4
import numpy as np import matplotlib.pyplot as plt def norm(x): # normalise x to range [-1,1] nom = (x - x.min()) * 2.0 denom = x.max() - x.min() return nom/denom - 1.0 def sigmoid(x, k=0.1): # sigmoid function # use k to adjust the slope s = 1 / (1 + np.exp(-x / k)) return s # un-n...
684346291248d951bb3cc435bdb955b1f97c8dae
mwg6/py_sand
/particles.py
1,995
3.75
4
VOID = 0 LIMIT = 1 SAND = 2 WATER = 3 def void_particle(env, position): """The void particle never does nothing, but, if awaken, it goes back to sleep. """ env.sleep(position) def sand_particle(env, position): """The sand particles tries to "fall" into a lower position. """ x, y = posit...
9f1a60930da528c0e10a57543df3cd6ccaa3a38c
i67655685/270201016
/lab11/example1.py
504
3.734375
4
import math # I cant run my code exactly how I want class Cylinder: def __init__(self, radius, height): self.radius = (self, radius) self.height = height def get_surface(self): return 2 * math.pi * self.radius * self.height + 2 * math.pi * self.radius**2 def get_volume(self): ...
d1a8808e0ec97719c4936e9b6b5cf12f5c305f8d
i67655685/270201016
/lab10/example1.py
148
3.578125
4
def mult(n, m): n = 3 if m == 0: return 0 elif m < 0: return - (n - mult(n, m+1)) else: return n + mult(n, m-1) print(mult(3,6))
809c3773e7eca5e135d45483af9912e636d21e3a
i67655685/270201016
/lab10/example3.py
129
3.6875
4
def listsum(numList): theSum = 0 for i in numList: theSum = theSum + i return theSum print(listsum([1,3,5,6,8,14]))
f98bc593d5a6d785c631669f817cab72a8154d5e
i67655685/270201016
/lab2/example4.py
115
3.96875
4
celc = eval(input("Please write the Celcius: ")) equation = (celc*1.8)+32 print("It is ", equation ,"fahrenheit" )
7c6515c6626faabd33508f2b6e3a0788d9dae77b
i67655685/270201016
/lab9/example4.py
148
4
4
def countdown(n): if n == 0 : print("Alert!") else: print(n) countdown(n-1) n = eval(input("How many seconds left ?")) countdown(n)
b2a03099a4d10bc35417e0a5eb88b3df0bb6b08c
shushankettsyan/homework
/1stage/10..py
850
3.671875
4
x = [0, 10, [20, 30], 40, 50, [60, 70, 80], [90, 100, 110, 120]] def list_1(x): list_0 = [] for i in x: if type(i) != list: list_0.append(i) else: list_0 += list_1(i) return list_0 print(list_1(x)) list_1 = [0, 10, [20, 30], [60, 70, 80], [90, 100, 110, 120]]...
0fbe3d9c7f2a8fdbfcca35397e4b751dce5e9fa9
shushankettsyan/homework
/2stage/6lesson.py
1,254
3.734375
4
class Students(object): def __init__(self,grade): self.__grade = grade # def __str__(self): # return "this is an object of Students and it's grade is {}".format(self.__grade) def __repr__(self): return "class Student {}".format(self.__grade) # def __int__(self): # retu...
20abbcb4f03c806fecefa06ee81c535b8a6f0f5f
shushankettsyan/homework
/1stage/9homework.py
845
3.859375
4
#task1 print("duplicate numbers remover") x = [] numbers = [1,1,1,2,3,3,4,4,4,5,6,6] for i in numbers: if i not in x: x.append(i) print("\t",x) #task2 print("\n\ncommon elements between 2 lists") a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] x = [] for i in a...
b4a5f0f1554385659161d0d7937167f38bf2306a
shushankettsyan/homework
/2stage/3homework.py
686
3.890625
4
#task1 class Circle(): def __init__(self, r): self.r = r def area(self): return self.r ** 2 * 3.14 def perimeter(self): return 2 * self.r * 3.14 num = input("enter a number") num_ = Circle(float(num)) print(num_.area()) print(num_.perimeter()) #task2 class Person: def __init_...
9435e9eaab7702b36193506ca77b0d67395edddc
shushankettsyan/homework
/1stage/2homework.py
933
4
4
# #task1 # celsius = float(input('Enter temperature in celsius:')) # fahrenheit = (celsius * 1.8) + 32 # print('\t\t\t\t',fahrenheit) # #Task2 # a = 5 # b = 6 # c = 7 #2.1 # x = (a + b + c) / 3 # print('\n',x) # # #2.2 # y = a ** c + b ** c # print('\n',y) # # #2.33 # z = (a + b) ** c # print('\n',z) #2.4 #print('\n'...
9cf319dbedf8d1dc9c995e7fa496089a0ab181b6
Tsepo-Matheleli/Level0CodingChallenge
/Task 0.9.py
300
4.09375
4
def vowels(word): new_word_list = list(word) vowel_list = ('a', 'e', 'i', 'o', 'u') common_vowels = '' for character in new_word_list: if character in vowel_list: common_vowels += character + ', ' print('Vowels: ' + common_vowels) vowels('Umuzi')
2298c099132339c409386c8371ebd5056d7fb851
celinesf/personal
/2013_py_DNAnexus/DNAnexus1.py
1,516
3.75
4
#!/usr/bin/python ''' Created on Oct 11, 2013 2:36 pm @author: Celine Becquet ''' def getDNA(bit_pair): if bit_pair == '00': return 'A' if bit_pair == '01': return 'C' if bit_pair == '10': return 'G' if bit_pair == '11': return 'T' else: print'I got a prob...
7c9848582f3382359909eb2a1e94e2c1eab258a8
AnanthuPS/ERP_Project
/ERP_system.py
4,911
3.609375
4
#Mini project console ERP system.(With Emp groups) employees = {} groups = {} def add_employee(): employee_id = input("\tEnter Employee id : ") if employee_id not in employees.keys(): name = input("\tEnter name : ") age = int(input("\tEnter age : ")) gender = input("\tEnter the gender : ") place = input("\t...
c4d545269bfe5a8c1382c796198e8c6142164d32
karanthacker/Wrangling-Open-street-Map-xml
/street_types.py
1,950
3.78125
4
# -*- coding: utf-8 -*- ''' intro : this code parses the tag elements with key value "addr:street" to identify diff street types in the street address and to find out most comm street types ''' import xml.etree.cElementTree as ET from collections import defaultdict import re filename = "manhatten.osm" stree...
5fb1e2a5170cd0747953dfc3562b246af764ef8f
Eberty/JogoNIM
/NIM.py
7,684
3.578125
4
import os #Para detectar o sistema from cliente import * clear = lambda: os.system('cls' if os.name == 'nt' else 'clear') opcao = 1; while (opcao >= 1 and opcao <=5): clear() print('***********NIM***********\nSeja bem-vindo ao jogo dos palitos!\n') print("Nim é um jogo matemático de estratégia em que dois jogadores...
2a51b77e77fb26441308f86732a310e8ccfe3a9d
mbrank/optika
/ray.py
606
3.6875
4
from vec3 import Vec3 class Ray(): """Documentation for Ray Inputs: origin: type Vec3 of origin point direction: type Vec3 of direction vector """ def __init__(self, origin, direction): super(Ray, self).__init__() self.origin = origin self.direction = direction ...
5dc37c50c062f713de61c977669225bb566552c3
Matheushfb/CursoPythonUSP
/buzzfizz_parcial.py
127
4.1875
4
n = int(input("Entre com um numero para saber se e divisivel por 3: ")) if (n%3==0): print("Fizz") else: print(n)
5231cc20c3d01eb7c8302dcd1173746ae22e26cd
Matheushfb/CursoPythonUSP
/buzzfizz_parcial3.py
150
4.15625
4
n = int(input("Insira um numero para saber a divisibilidade por 3 e 5: ")) if(n%3 == 0 and n%5 == 0): print("FizzBuzz") else: print(n)
ad75788bae3e9a70643174a3eb4cb4e181f77399
Matheushfb/CursoPythonUSP
/print_while2.py
340
4.0625
4
altura = int(input("digite a altura")) largura = int(input("digite a largura")) y = 0 x = 0 while y < largura: y = y + 1 while x < altura: if y == 1 or y == largura or x == 0 or x == altura - 1: print("#", end ="") else: print (end =" ") x = x + 1 ...