blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
53c9253b441e4e9e45ad4f72c8ccd8f8cbd4a27a | LiliGuimaraes/100-days-of-code | /CURSO-EM-VIDEO-PYTHON3/ESTRUTURAS-ANINHADAS/guanabara_exerc_37.py | 228 | 4.03125 | 4 | numero = int(input("Digite um número inteiro qualquer \n"))
print(f"Este número em binário é: {bin(numero)}")
print(f"Este número em formato octal é: {oct(numero)}")
print(f"Este número em hexadecimal é: {hex(numero)}") |
97fa0a9c0d74e713b9e5bcd8ae48d78a0101d642 | LiliGuimaraes/100-days-of-code | /logical-exercises/URI-JUDGE/EXERCISES-SUGGESTIONS/seis_numeros_impares_1070.py | 319 | 4 | 4 | # Leia um valor inteiro X.
# Em seguida apresente os 6 valores ímpares consecutivos a partir de X,
# um valor por linha, inclusive o X ser for o caso.
x = int(input("Digite um número inteiro qualquer:\n"))
for i in range(1, 13):
if x % 2 != 0:
print("O próximo número ímpar é: ", x)
x = x + 1
|
8fd759548250e80dbf3826f1b2c90f7a767955f8 | LiliGuimaraes/100-days-of-code | /CURSO-EM-VIDEO-PYTHON3/LISTAS/guanabara_exerc_79.py | 703 | 4.15625 | 4 | values = []
tempValues = []
digit = True
while digit:
userDigit = int(input("Digite um número: "))
if digit not in values:
values.append(userDigit)
prossegue = str(input("Novo número cadastrado. Deseja adicionar um novo número? [S/N]\n")).upper()
if prossegue == 'S':
userDigi... |
822b02abd511b9ab48a3632930a078214ba31130 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 1 - O Shell do Python/Programas/Roteiro 1 Questão 6 e).py | 620 | 3.5625 | 4 | #6. Observe qual a saída de cada um dos comandos abaixo:
#e) print("--\n--\n--")
print ( "--\n--\n--" )
# O comando print é utilizado para imprimir algo na saída do interpretador (tela)
# O comando deve ser utilizado seguido de parêntesis que indica o ínicio e o fim do comando
# O comando deve ser utilizado com aspa... |
1cc9928212e690f751e19c1c8236b8f20a9c0dbc | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 6 - For/Programas/Roteiro 6 Questão 2 b).py | 759 | 3.984375 | 4 | #2. Analise o algoritmo abaixo e informe quais resultados serão exibidos na saída padrão (para cada
#algoritmo acompanhe os valores das variáveis usando uma tabela tal como no exemplo abaixo):
#soma = 3
#cont = 1
#forx in range(0,10,2):
#soma = soma + 2
#cont = cont + 1
#print(x)
#print(soma)
#print(cont)
#iteração ... |
7ddcc7e851489e28cc196e98ba4f782086f474bc | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 10 - Mais sobre listas/Programas/Roteiro 10 Questão 1.py | 858 | 4.15625 | 4 | '''
1. Escreva um programa que leia e armazene em um vetor de 8 posições um conjunto de
números reais. O programa deve somar os valores de todas as posições e exibir o resultado
na saída padrão.
'''
vetor = []
for i in range(8) :
valores = float(input("Digite os números para a lista (pertencentes ao conjunto dos ... |
5d26690c130f15042c167be739fc9fb616a248e3 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 14 - Funções/Programas/Roteiro 14 Questão 9.py | 1,011 | 4.4375 | 4 | '''
9. Escreva um programa que contenha uma função que receba uma palavra e um número inteiro
e imprima esse na saída padrão a palavra a quantidade de vezes igual ao numero recebido.
'''
def imprimir_palavra(palvra, vezes):
for vez in range(vezes):
print(palvra)
nome = input("Digite a palavra que deseja i... |
794d40bbd2ccbc1fc1e7857c38eea4a8fcdeb0d9 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 5 - While/Programas/Roteiro 5 Questão 1 c).py | 709 | 3.90625 | 4 | #1. Analise o algoritmo abaixo e informe quais resultados serão exibidos na saída padrão (para cada
#algoritmo acompanhe os valores das variáveis usando umatabela tal como no exemplo abaixo):
# c)
#cont = 0
#soma = 0
#while (cont <= 6) or (soma < 12):
#soma = soma + 2
#cont = cont + 2
#print(“Valor de soma é:\n ”, so... |
3a3bcba52b3820792c41882b331ecefa860aa636 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 1 - O Shell do Python/Programas/Roteiro 1 Questão 1 i).py | 611 | 3.6875 | 4 | #1. Utilizando o prompt do interpretador do Python (>>>), digite as seguintes operações abaixo e observe o valor produzido.
#i) ((2*3-1) / ((4+14/2))
( ( 2 * 3 - 1 ) ) / ( ( 4 + 14 / 2 ) )
# Foi apresentado o valor 0.454545... na saída do interpretador do Python
# Inferindo-se que o interpretador realiza as operações... |
2440a0c896633bd616db2564b9ec58b86540b66a | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 5 - While/Programas/Roteiro 5 Questão 13.py | 2,506 | 4.0625 | 4 | #13. Escreva um programa que leia o sexo e o salário de 10 pessoas e calcule:
#- a quantidade de homens;
#- a quantidade de mulheres;
#- a média do salário de homens e de mulheres;
#- o sexo da pessoa com o maior salário;
#- a média de salário dos homens;
MAX = 10
cont = 0
homens = 0
mulheres = 0
maior = 0
sexo_maior ... |
de05d58d902b78872564e6adc640296b7cc17bd8 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 9 - Matrizes/Programas/Roteiro 9 Completo (Jardel Brandon).py | 5,184 | 4.4375 | 4 | '''
Engenharia de Computação
Disciplina: Algoritmos e Computação
Semestre Letivo: 2016
Professor: Marcelo Siqueira / Henrique Cunha
Assunto:
Listas e Matrizes
Objetivos:
1. Analisar a sintaxe de códigos escritos em Python
2. Observar o comportamento da estrutura de dados conhecida como lista e sua aplicação na resoluç... |
80b103574271fbe88d0d1f051c7d04eeeb2afaf7 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 5 - While/Programas exemplos/media_notas_2.py | 273 | 3.828125 | 4 | MAX_NOTAS = 3
qtde_notas = 1
soma = 0
while True:
nota = int(input("Nota " + str(qtde_notas) + ": "))
soma += nota
qtde_notas += 1 # Mesma coisa que qtde_notas = qtde_notas + 1
if qtde_notas > MAX_NOTAS:
break
media = soma/MAX_NOTAS
print(media) |
bfc52879286ff50451ea1e8ee73240eb5d29836b | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 8 - Listas/Programas/Roteiro 8 Questão 7.py | 1,206 | 4.28125 | 4 | '''
7. Escreva um programa que recebe um número arbitrário de valores do usuário. Em seguida, o
usuário deve digitar um valor para que seja procurado dentro da lista passada anteriormente.
O programa retorna True se o valor foi encontrado ou False, caso contrário.
'''
lista = []
maximo = int(input("Digite a quantidade... |
d6159b54ca186ae27f3c3bd2773bcc0851c02072 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 5 - While/Programas/Roteiro 5 Questão 1 a).py | 711 | 3.9375 | 4 | #1. Analise o algoritmo abaixo e informe quais resultados serão exibidos na saída padrão (para cada
#algoritmo acompanhe os valores das variáveis usando umatabela tal como no exemplo abaixo):
# a)
#cont = 0
#soma = 0
#while (cont < 10):
#soma = soma + 2
#cont = cont + 1
#print(“Valor de soma é:\n ”, soma)
#iteração... |
1be17b46aacb1bba7371c521d08dd15e5594f93a | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 4 - Exercícios/Programas/Roteiro 4 Questão 6.py | 1,594 | 4.375 | 4 | '''
6. Fazer um programa que solicita o total gasto pelo cliente de uma loja,
imprime as opções de pagamento, solicita a opção desejada e imprime o
valor total das prestações (se houverem).
1) Opção: a vista com 10% de desconto
2) Opção: em duas vezes (preço da etiqueta)
3) Opção: de 3 até 10 vezes com 3% de juros ao m... |
c6cfe16943eeab04596d464f090321f900332a0c | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 3 - Comando condicional/Programas/Roteiro 3 Questão 1 a).py | 1,069 | 4.03125 | 4 | #1°. Analise o algoritmo abaixo e informe quais resultados serão exibidos na saída padrão:
# a)
# a = 10
# b = 4
# c = 32
# d = 2
# if (a/4) > (b*4):
# print(“Alternativa 1”)
# else:
# print(“Alternativa 2”)
# if c > d:
# print(“Alternativa 3”)
# else:
# print(“Alternativa 4”)
a = 10
b = 4
c = 32
d = 2
if ( a /... |
18af412cf1d1351aee06848877e20e7d3c6e7170 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 4 - Exercícios/Programas/Roteiro 4 Questão 10.py | 2,874 | 3.75 | 4 | '''
10.As tarifas de certo parque de estacionamento são as seguintes:
a. 1 a e 2 a hora : R$ 1,00 cada
b. 3 a e 4 a hora : R$ 1,40 cada
c. 5 a hora e seguintes : R$ 2,00 cada
O número de horas a pagar é sempre inteiro e arredondado por excesso.
Deste modo, quem estacionar durante 61 minutos pagará por duas horas,
que é... |
87f04db35055463b4a0b1a132d105edeb2cbdefa | JardelBrandon/Algoritmos_e_Programacao | /Provas/3º Prova/Prova original/Prova 3 2016.2/Programas/Prova 3 2016.2 Completa (Jardel Brandon).py | 4,914 | 4.09375 | 4 | '''
Questão 1: Sequência bitônica
Descrição:
Uma sequência é dita bitônica quando ela é crescente até atingir um ápice (chamado o
ponto bitônico), e a partir do ponto bitônico ela é decrescente.
Escreva um algoritmo que recebe x números informados pelo usuário, sendo que x deve
ser pedido no início do algoritmo. O algo... |
ad840328cc5a6b2aeb6dccc243e68fe6de5ff3a6 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 14 - Funções/Programas/Roteiro 14 Questão 14.py | 1,216 | 4.46875 | 4 | '''
14. Faça um programa com uma função chamada calculaImposto. A função tem dois parâmetros:
imposto, que é a quantidade de imposto sobre vendas expressa em porcentagem e custo, que é
o valor do produto antes do imposto.
'''
def calcula_imposto(imposto, custo):
total = imposto / 100 * custo + custo
print("Cus... |
c25de183db1424cf1db963161e7383d09b5109e8 | JardelBrandon/Algoritmos_e_Programacao | /Provas/4º Prova/Prova 4 2016.2/Programas/Prova 2016.2 Questão 1.py | 4,046 | 4.09375 | 4 | '''
Questão 1:
Leet é uma maneira de escrever palavras na qual algumas letras, sílabas ou palavras são
substituídas por números ou símbolos. Isso é muito usado no contexto da informática para
confundir leitores "não iniciados” ou escrever de forma resumida (por exemplo, na escrita
de tweets).
Dentro desse contexto, voc... |
00ebfec5ba592bb21c05227f4c2369384afb72bf | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 10 - Mais sobre listas/Programas/Roteiro 10 Questão 6.py | 4,292 | 3.875 | 4 | '''
6. Escreva um programa que leia e e armazene em um vetor de 10 posições um conjunto de
caracteres (V_BASE). Em seguida, o programa deve ler um outro conjunto de caracteres e
armazenar em um vetor de 4 posições (V_PROC). O procgrama deve verificar se a
sequência armazenada em V_PROC se encontra dentro de V_BASE.
Ex... |
006f02195fb5f3412809f41ad8a5b3d708ce8263 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 6 - For/Programas/Roteiro 6 Questão 4.py | 736 | 3.9375 | 4 | #4. Escreva um programa que exiba na saída padrão os 100 primeiros números ímpares.
for i in range(1,200,2) :
print(i, end=" ")
#O comando end=" " define a forma de saída no interpretador
#Por exemplo, end="\n" Linha abaixo de linha
#end=" " na mesma linha com 1 espaço
#end="" na mesma linha sem espaço, etc...
... |
c94c79a1b787e74529e9fb2780acf6d4c207600b | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 4 - Exercícios/Programas/Roteiro 4 Completo ( Jardel Brandon ).py | 24,132 | 4.03125 | 4 | #IFPB - Engenharia de Computação
#Disciplina: Algoritmos e Programação
#Semestre Letivo: 2016
#Professor : Marcelo Siqueira / Henrique Cunha
#ROTEIRO DE AULA 4 – 31/05/2016
# 1. Escreva um programa que receba do usuário a quantidade de linhas (QUANTL) de
# um programa e o tamanho da equipe (TAMEQ) encontrados e calcu... |
c34d724274a9df85e0423ec64de4fa8a4aa02d63 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 5 - While/Programas exemplos/media_notas.py | 247 | 3.796875 | 4 | MAX_NOTAS = 3
qtde_notas = 1
soma = 0
while qtde_notas <= MAX_NOTAS:
nota = int(input("Nota " + str(qtde_notas) + ": "))
soma += nota
qtde_notas += 1 # Mesma coisa que qtde_notas = qtde_notas + 1
media = soma/MAX_NOTAS
print(media) |
e96f41dd10fd27a1e7cfc03ee20e1d3c74d99620 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 8 - Listas/Programas/Roteiro 8 Completo (Jardel Brandon).py | 14,643 | 4.46875 | 4 | '''
Engenharia deComputação
Disciplina: AlgoritmoseComputação
SemestreLetivo: 2016
Professor:Marcelo Siqueira/HenriqueCunha
Assunto: Listas
Objetivos: 1. Analisar asintaxedecódigosescritosemPython
2. Observar o comportamento da estrutura de dados
conhecidacomo lista
3. Resolver problemas usando estruturas de repetição... |
f803e9e3c3564eed6674f4d1452c76ba7257983a | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 6 - For/Programas/Roteiro 6 Questão 5.py | 695 | 4.03125 | 4 | #5. Escreva um programa que exiba na saída padrão os 100 primeiros números em ordem
#descrescente.
for i in range(99,-1,-1) :
print(i, end=" ")
#O comando end=" " define a forma de saída no interpretador
#Por exemplo, end="\n" Linha abaixo de linha
#end=" " na mesma linha com 1 espaço
#end="" na mesma linha sem e... |
3ae4fe8136d7cb57f7e76be8bd68a3661420abf7 | ddevost/PYTHON | /TkinterGUI4.py | 2,250 | 4.3125 | 4 | import tkinter
from tkinter import filedialog
from tkinter import tix
pic = None
file = None
class MyGUI:
def __init__(self):
# Create main window
self.main_window = tkinter.Tk()
# Create label
self.label1 = tkinter.Label(self.main_wind... |
cb75ee3b18e1d9bfdf5b5d20fd69f3bccf197816 | prithwishmisra1/HangmanWithPythonAndSql | /Game.py | 4,641 | 3.53125 | 4 | __author__ = 'Prithwish Misra'
from random import *
from pymysql import *
from os import system
#class of game
class Game:
__score = 0
__player_name = ""
__topic = ""
__hint = ""
__blanks = ""
__answer= ""
#print a new screen
def print_screen(self):
for i in range(20):
... |
12402c49ffa6bf79ef48c386e2f75ad681631318 | sshan0509/day3 | /loopcontrol.py | 356 | 4 | 4 | message = ''
# while message != 'quit':
# message = input("typing you messge: ")
# print(">" + message)
# while True:
# message = input("typing you message: ")
# print(">" + message)
# if message == 'quit':
# break
number = 0
while number < 10:
number = number + 1
if(number%2 == 0)... |
c3e3199016604049897de9258ba6aaf738f123bc | javierea/Conversordebase | /Conversor.py | 2,008 | 3.734375 | 4 | __author__: "Javier E. Aguirre"
__Version__: "2021.06.21"
def decimal(num, a):
"Convierte un número (primer parámetro 'num') de sistema en base 2 a 16 (segundo parámetro 'a')."
global dec
num = list(num)
num = list(reversed(num))
for i in range(len(num)):
if num[i] == "A":
... |
2c73d27384fee46a0f52f4ba8be5779d0d90483a | leegakyeong/dsalgo | /array/python/codeup_1403.py | 121 | 3.546875 | 4 | def f(k, nums):
num_str = '\n'.join(nums.split())
for i in range(2):
print(num_str)
f(input(), input())
|
b10f37b66016997dda78eb3becdb57404335b0ee | areebbeigh/CompetitiveProgramming | /Project Euler/problem_4.py | 385 | 3.625 | 4 | a = range(100, 1000)
b = range(100, 1000)
largest_palindrome = 0
for el_a in a:
for el_b in b:
prod = str(el_a * el_b)
prod_reversed = list(prod)
prod_reversed.reverse()
prod_reversed = "".join(prod_reversed)
if prod == prod_reversed and int(prod) > largest_palindrome:
... |
aa62468c0ecdf8fdea2eddf9470d4758711598e7 | sophiawisdom/class_chat | /wyr/interpret.py | 1,215 | 3.734375 | 4 | import string
import random
categories = ["Family","Friends","Discussion"]
def load_database():
with open("questions.txt") as file:
questions = file.read().split("\n")
questions = [q for q in questions if (not q.startswith("#")) and q]
n = [data.index(i + ":") for i in categories]
n.append(len(d... |
7d636aea76ab41c3f38499ed745137d007d1daaf | chaimae-mnwr/Projets_BPI | /fractales.py | 1,848 | 3.625 | 4 | import random
import svg
import sys
from math import cos
from math import sin
from math import pi
def dessine_segment(point, angle, distance):
x = point[0]
y = point[1]
nx = distance*cos((pi*angle)/180)
ny = distance*sin((pi*angle)/180)
print(svg.genere_segment((x,y), (x+nx,y+ny)))
return 0
... |
86c0c927a7bb21c1965ae0fabac2b76766b6000d | vektorelpython/Python11TemelOrnekler | /Ornek3.py | 2,100 | 4.25 | 4 | """
Write a program which accepts a one-digit integer from the user.
The program should calculate the square of the given number. If the calculated square’s last digit is equal to the given input, the program should stop and print out the square. If not, program should continue by calculating the square of the squar... |
a51702386edc09b3d2bb95b72c4371b445821077 | vektorelpython/Python11TemelOrnekler | /OOP/OOP1.py | 2,853 | 3.703125 | 4 | """
Encapsulation
Polymorphism
Abstraction
Inheritance
"""
# 1.Aşama
# sesli_harfler = "aeıioöuü"
# sayac = 0
# kelime = input("Bir Kelime Girin")
# for harf in kelime:
# if harf.lower() in sesli_harfler:
# sayac += 1
# mesaj = "{} kelimesinde {} sesli harf var."
# print(mesaj.format(kelime... |
52f20a1b269f131f86ad6e76ea2a058ca8ea68df | OnlinePseudonym/mit_intro_to_cs | /pset2/problem3.py | 606 | 3.625 | 4 | balance = 999999
annualInterestRate = 0.18
monthlyInterestRate = annualInterestRate / 12.0
newBalance = balance
lowerBound = balance / 12.0
higherBound = (balance * (1 + monthlyInterestRate)**12) / 12.0
while True:
payment = (lowerBound + higherBound) / 2.0
for i in range(12):
newBalance = newBalance -... |
7cb5a0a2a2832ab69fa72c13c47f995d1d5d076e | OnlinePseudonym/mit_intro_to_cs | /pset2/problem1.py | 253 | 3.703125 | 4 | balance = 484
annualInterestRate = 0.2
monthlyPaymentRate = 0.04
for i in range(12):
balance = balance - (balance * monthlyPaymentRate)
balance = balance + (balance * (annualInterestRate / 12.0))
print('Remaining balance:', round(balance, 2))
|
83ecd1018953cbf0b95c05b81557b39e1d94e9a8 | abhiyanbeta/rock_paper_scissors | /program.py | 3,575 | 4.53125 | 5 | # Very basic rock paper scissors game using python.
# Made by @abhiyanbeta.
#
# Instructions: run the script and enter "R" for rock, "P" for paper or "S" for scissors.
# The computer will randomly select a choice and determine the winner. The winner is awarded
# one point and the scoreboard is displayed. The game then ... |
eefd992712f9a730c9dbef56eafcc85d3eda8f63 | hectorsvill/Hash-Tables | /src/hashtable.py | 4,360 | 3.96875 | 4 | # '''
# Linked List hash table key/value pair
# '''
class LinkedPair:
def __init__(self, key, value):
self.key = key
self.value = value
self.next = None
class HashTable:
'''
A hash table that with `capacity` buckets
that accepts string keys
'''
def __init__(self, capaci... |
b589966f1cc98cf6a7f9e47b2fbecb467a05dd7a | Edgar2001Grigoryan/group-2 | /Python/Range.py | 118 | 3.609375 | 4 | #!/usr/bin/env python3
print("Hello")
for i in range(1500,2700):
if i%5==0 and i%7==0:
print(i,end = " ")
|
3f0d2e3f08e3a2d72758c9bdb230537750c36cfc | Edgar2001Grigoryan/group-2 | /Python/IsPrime.py | 402 | 3.78125 | 4 | #!/usr/bin/env python3
import unittest
def is_prime(n):
''' Is prime number, or no'''
for i in range(2, n):
if n % i == 0:
return False
return True
class MyTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test(self):
se... |
f7cba958cbf429766660a7a7a430b7842075edae | Edgar2001Grigoryan/group-2 | /Python/BazmAxyusak.py | 104 | 3.75 | 4 | #!/usr/bin/env python3
n = input("Type a number")
for i in range(1,11):
print(n,"x",i,"=",int(n)*i)
|
a730fd4cb76aadcfce4e9f4a1520bcb94e49120f | mateusangeli/lista-de-exercicio | /c.py | 224 | 3.796875 | 4 | par = 0
for num in range (1,501):
if (num%2 == 0):
print(num)
par += num
print("O resultado foi: ", par)
par = 0
cont = 1
while(cont <=500):
if(cont % 2 ==0):
par += cont
cont += 1
print("Soma: ", par)
|
6320f3e8b8a03a4a744bc3f4331147f825d11474 | tmlewin/Guessing-Game | /guess.py | 4,153 | 4.21875 | 4 |
import random
def query_user():
while True:
query = input("Enter a number that falls between 1 and 10 ")
# Cast the type to integer to support numeric data type
try:
guesser = int(query)
if guesser < 1 or guesser > 10:
raise ValueErro... |
4cbc75a26cee586935fd2dd6c950b80a769fe5cd | addkap92/Python-Crash-Course | /6-11 Cities.py | 816 | 3.921875 | 4 | cities = {
'new york': {
'country': 'usa',
'population': '20,320,876',
'fact': "New York City is made up of five boroughs: Manhattan, The Bronx, Queens, Brooklyn, and Staten Island.",
},
'los angeles': {
'country': 'usa',
'population': '3,990,456',
'fact': "L.... |
d1a3b1b46e334ecb594c6bb2c0557c1519af47fc | addkap92/Python-Crash-Course | /8-9 Magicians.py | 173 | 3.515625 | 4 | magician_names = ['jim', 'danny', 'guy', 'pal']
def show_magicians(magicians):
for magician in magicians:
print(magician.title())
show_magicians(magician_names) |
69c21e5b6a540640e7715ac6104c198459de9c3f | addkap92/Python-Crash-Course | /7-1 Rental Car.py | 206 | 4.09375 | 4 | car = input("What kind of car would you like to rent? ")
if car.capitalize() == 'subaru' or car == 'subaru':
print("Excellent! We have that in stock")
else:
print("Sorry, that car is not available") |
f21c5d73d0988ee1894feeca1aa185946ca0245d | addkap92/Python-Crash-Course | /7-10 Dream Vacation.py | 359 | 3.8125 | 4 | responses = {}
while True:
name = input("What is your name?\n")
place = input("What is your dream vacation?\n")
responses[name] = place
response = input("Does anyone else want to answer?\n")
if response == 'no':
break
for name, place in responses.items():
print(name.title() + "'s dream ... |
2cc6a895316dde8399127eb1387ff6e20abe55f4 | addkap92/Python-Crash-Course | /8-7 Album.py | 358 | 3.640625 | 4 | def make_album(name, title, tracks=''):
album = {'Artist Name': name.title(),
'Album Title': title.title(),
}
if tracks:
album['tracks'] = tracks
return album
album = make_album('jake jonah', 'bees')
print(album)
album = make_album('james jameson', 'birds')
print(album)
a... |
77504d2520d21dd3ec0951151b5917d99fc6159e | temidayo/p4e | /functions.py | 269 | 3.796875 | 4 | def computepay(h,r):
if h > 40:
extraHours = h - 40
return (1.5 * extraHours * r) + (r * 40)
else:
return(r * h)
hrs = input("Enter Hours:")
rate = input("Enter Rate:")
p = computepay(float(hrs),float(rate))
print(p) |
f3e4245fbb0097446ac6c184c7376795c051e204 | AnkitaDeshmukh/Cleaning-data-in-Python | /frequency count for categorical data.py | 701 | 3.6875 | 4 | #In this exercise, you're going to look at the 'Borough', 'State', and 'Site Fill' columns to make sure all the values in there are valid.
#When looking at the output, do a sanity check: Are all values in the 'State' column from NY, for example? Since the dataset consists
#of applications filed in NY, you would expect... |
3d9e0424273d0b3b4568b01bade7b991f2933467 | rohan300557/git_workshop | /calculator.py | 696 | 4.09375 | 4 | def again():
x = input('''To continue press Y/y, To exit press N/n
Choice :: ''')
if x.lower() == 'y':
calc()
elif x.lower() == 'n':
quit()
else:
print("Input error, Enter the choice again ")
again()
def calc():
a = float(input("Enter first no. : "))
b = flo... |
c0e38f8afe510e23727ddce6b1b7c2f157adaca8 | paldenlhamo21/Calculator | /calc.py | 7,888 | 4.28125 | 4 | # Palden Lhamo
# Introduction to Computer Science: The Way of the Program
# Calculator Final Semester Project
from graphics import *
class Button:
def __init__(self, win, center, width, height, label):
# initialize a new button on a window with a center point and dimensions
# w and h are half the ... |
2581117829ffe279779f78035864276f17622918 | Husniya-Sanoqulova/python_2 | /9-dasturcha.py | 490 | 3.796875 | 4 | print('Kvadrat tenglamani yechish: ')
a = float(input('a ning qiymatini kiriting: '))
b = float(input('b ning qiymatini kiriting: '))
c = float(input('c ning qiymatini kiriting: '))
d= b**2 - 4*a*c
print('Diskriminant= ' + str(d))
if d < 0:
print('Ildizda manfiy son yuzaga keldi')
elif d == 0:
x = -b... |
170e0418e864eb6cdff3a85399fb2265073ec280 | mhyeagle/programming-language | /python/test/list_test.py | 599 | 4.03125 | 4 | #!/usr/bin/python
# -*- coding=UTF-8 -*-
list1 = [1, 2, 3]
list2 = ["hello " + str(ele) + " right" for ele in list1]
print list2
print "***1***"
list3 = ['sequence %d\n' %i for i in range(10)]
print list3
for i in range(len(list3)):
print list3[i]
""""---illustration---
为了便于理解它,让我们从右向左看。li 是一个将要映射的 list。Python... |
43c50eeec1151da8b4771d04f93a9937d6f31206 | myllenaalves/Algoritmos-e-estruturas-de-dados | /exercicio-1.2-2.py | 527 | 3.953125 | 4 | # Vamos supor que estamos comparando implementações de ordenação por inserção e ordenação por intercalação na mesma máquina.
# Para entradas de tamanho n, a ordenação por inserção é executada em 8n2 etapas, enquanto a ordenação por intercalação é executada em 64n Ig n etapas.
# Para que valores de n a ordenação por i... |
ba1219004722e8da6ab56e90ac2eeba4dcebe4e7 | myllenaalves/Algoritmos-e-estruturas-de-dados | /filaImpressao.py | 1,493 | 3.6875 | 4 | class Arquivo():
def __init__(self, id,t,d,p):
self.id = id
self.t = t
self.d = d
self.p = p
class listaImpressão():
def __init__(self, lista):
self.__listaImpressao = []
self.__primeiro = self.__ultimo = None
def imprimindo(self):
if self.__primeiro =... |
eb39f28095196a5f7e744503f2d3847ba27381bd | eddiethedean/CodeWar | /Unique.py | 358 | 3.859375 | 4 | def unique_in_order(iterable):
#start with iterable[0] in new list
if len(iterable)==0:return []
new_list = [iterable[0]]
#loop through iterable
#check if last new_list item matches iterable item
#if not, add to new_list
for i in iterable:
if i!=new_list[-1]:
new... |
f84b9969c81bf7d7b42e023a7b78df0ed7455b70 | pkueecslibo/amw-python-study | /PyMOTW/headq/heapq_heapreplace.py | 317 | 3.546875 | 4 | #!/usr/bin/python
#!-*- coding:utf-8 -*-
import heapq
from heapq_showtree import show_tree
from heapq_heapdata import data
heapq.heapify(data)
print 'start:'
show_tree(data)
for n in [0, 7, 13, 9, 5]:
smallest = heapq.heapreplace(data, n)
print 'replace %2d with %2d:' % (smallest, n)
show_tree(data)
|
4582586253febfa071d2f05e4c246ab57db72dc6 | pkueecslibo/amw-python-study | /PyMOTW/fileinput/fileinput_grep.py | 444 | 3.5625 | 4 | #!/usr/bin/python
import fileinput
import re
import sys
pattern = re.compile(sys.argv[1])
for line in fileinput.input(sys.argv[2:]):
if pattern.search(line):
if fileinput.isstdin():
fmt = '{lineno}:{line}'
else:
fmt = '{filename:<20}:{lineno:02}:{line}'
print fmt.f... |
7e6dd27bd7c3a878c71f902034537bd79ac0f059 | pkueecslibo/amw-python-study | /PyMOTW/decimal/decimal_create.py | 332 | 3.734375 | 4 | #!/usr/bin/python
#!-*- coding:utf-8 -*-
import decimal
fmt = '{0:<20} {1:<20}'
print fmt.format('Input', 'Output')
print fmt.format('-' * 20, '-' * 20)
# Integer
print fmt.format(5, decimal.Decimal(5))
# String
print fmt.format('3.14', decimal.Decimal('3.14'))
# Float
print fmt.format(repr(0.1), decimal.Decimal(... |
fd14711c1692f8e4429307f736a9027bf5dbb608 | Vedarth/calcualtor | /calculator.py | 252 | 4.03125 | 4 | #!/usr/bin/python
a = raw_input("Enter your first number:")
b = raw_input("Enter your second number:")
c = int(a) + int(b)
d = int(a) * int(b)
e = float(a) / float(b)
print("The sum is %d"%c)
print("The product is %d"%d)
print("The division is %f"%e)
|
c889b029bd8dc5983b0ea9570f5e529675c3a95e | abdulmm/Python_files | /W3D2Q1.py | 392 | 3.953125 | 4 | # Mohammed Abdul Mohi
hours = int(input('Please enter the number of hours:'))
RPH = int(input('Please enter the rate per hour:'))
Otime_rate = RPH * 1.5
Otime_hours = hours-40
if hours > 40:
over_pay = Otime_rate * Otime_hours
pay = 40 * RPH
total_pay = over_pay + pay
print('Total Gross Pay:')
... |
d957b60c53df398c4a8a1e6829df10797d649d7e | DamienGygi/BotProject | /HammerPaperScissorsLocalVersion.py | 579 | 3.875 | 4 | from random import choice
textFromBot = input("Want play with me ?")
if textFromBot=='Yes':
coup = ("HAMMER", "PAPER", "SCISSORS")
print("\n------------------------------------")
print("Hammer - Paper - Scissors")
print("------------------------------------\n")
a = int(input("Make your choice:\n0: Ha... |
4ff4780d82ce8f57ebd1d3c9e7f1f7b84ac60f73 | TBailez/Sistema-RPG | /class/teste.py | 824 | 3.609375 | 4 | class arma():
def __init__(self, nome, tipo):
self.__nome = nome
self.__tipo = tipo
def description(self):
print(f"{self.__nome}, {self.__tipo}")
class Piercing(arma):
def __init__(self, nome, tipo):
super().__init__(nome, tipo)
class Blunt(arma):
def __init_... |
3f1ab928bb20d5e63b30b362ab15bafd7d58cdd4 | TBailez/Sistema-RPG | /GameRPG/scripts/text.py | 808 | 3.640625 | 4 | import pygame
from scripts.inputbox import main
# printa os textos na tela
def texto(txt,textos,D,window_size,font,tat):
# adiciona o texto dado a lista de textos
textos.insert(0,txt)
# draw area de texto
pygame.draw.rect(D,(0,0,0),(window_size[0],0,tat,window_size[1]))
n=0
# print all texts... |
ee976b26eef0c60d05aa237f237a0b7efd60ea1a | CypherING/python_work | /favorite_places.py | 257 | 4 | 4 | favorite_places = {
'Mary': ['Budapest', 'Frankfurt', 'Los Angeles'],
'Andy': ['Moscow', 'Toronto', 'Rome'],
'Trevor': ['London', 'Seattle', 'Paris']
}
for name, places in favorite_places.items():
print(name + ": ")
for place in places:
print(place) |
bf49753e2d1891b52c4fb279d91d1f1c0304cbad | CypherING/python_work | /cities.py | 409 | 3.984375 | 4 | cities = {
'London': {
'country': 'England',
'population': '8.5 million',
'fact': 'Big Ben is the bell, not the clock tower.'
},
'Frankfurt': {
'country': 'Germany',
'population': '687,775',
'fact': 'You can go anywhere across Europe from here.'
},
}
for city, features in cities.items():
print(city + ... |
27148bfdf4db6dbe728abcddd94d04e32232bb09 | CypherING/python_work | /read_learning_python.py | 330 | 4.125 | 4 | filename = 'learning_python.txt'
with open(filename) as file_object:
# Reading the entire file
#contents = file_object.read()
#print(contents)
# Looping the file_object
#for line in file_object:
# print(line.strip())
# Storing the lines in a list
lines = file_object.readlines()
for line in lines:
print(lin... |
147aaf88639a74ec937efc126ea73e8bfc4eebf2 | riemannzeta1191/PyDev | /Stack.py | 574 | 3.765625 | 4 | # Enter your code here. Read input from STDIN. Print output to STDOUT
class Stack:
def __init__(self):
self.data = []
self.size = 0
def push(self, item):
self.data.append(item)
self.size += 1
def pop(self):
return self.data.pop(0)
def max(self):
max = s... |
3f5d73332becb9999fa334dc524e9116c39fa5c5 | YukiKis/deepage | /index.py | 1,537 | 3.515625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 7 23:07:35 2020
@author: s1430
"""
import pandas as pd
a = pd.DataFrame([[1, 1, 1], [2, 1, 2], [3, 2, 3]], index=["one", "two", "three"], columns=["a", "b", "c"])
print(a)
print(a.index, a.columns)
a.rename(index={"two": "eight"}, columns={"b": "BB"}, inplace=True)
p... |
009bee73f1f833b2226dd3a17364f353e71a20b5 | YukiKis/deepage | /union.py | 374 | 3.65625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 7 23:41:42 2020
@author: s1430
"""
import pandas as pd
import numpy as np
a = pd.DataFrame(np.arange(25).reshape(5, 5), columns=["a", "b", "c", "f", "g"])
print(a)
print(a.index.union([-1, -2, 3, 8]))
print(a.index.union(["a", "b"]))
print(a.reindex(a.index.union([4,... |
9679ed37c0358902a09b800e750abb417489c450 | VictoriaHaievska/w3 | /18.py | 252 | 4.21875 | 4 | #Write a Python program to calculate the sum of three given numbers, if the values are equal then return three times of their sum.
num1 = 4
num2 = 4
num3 = 4
if num1 ==num2 == num3:
print(3*(num1+num2+num3))
else:
print(num1+num2+num3) |
50d145b22f29da072b6fefa1e56d1aa19b79279b | VictoriaHaievska/w3 | /16.py | 394 | 4.34375 | 4 | # Write a Python program to get the difference between a given number and 17,
# if the number is greater than 17 return double the absolute difference.
given_number = int(input("give a number: "))
existing_number = 17
print (existing_number-given_number)
if given_number > existing_number:
print(2*abs(given_nu... |
9098892ba3ecfbc982b571d3b5fba797485bf1fa | srishtishukla-20/logical_questions | /capitaliseParticular;etter.py | 155 | 4 | 4 |
s="mamatha"
new_str=""
for i in range (len(s)):
if s[i]=="m":
new_str+=s[i].upper()
else:
new_str+=s[i].lower()
print(new_str)
|
edd684e84ee03abb5845f2a5efb08076e376814d | srishtishukla-20/logical_questions | /operators2.py | 662 | 4 | 4 | x = 5.2
if (type(x) is not float):
print("true")
else:
print("false")
x = 24
y = 20
list = [10, 20, 30, 40, 50 ];
if ( x not in list ):
print("x is NOT present in given list")
else:
print("x is present in given list")
if ( y in list ):
print("y is present in given list")
else:
print("y... |
883bf269251ec41f9b4e763c0d4e86e8abe96428 | srishtishukla-20/logical_questions | /arr.py | 439 | 3.65625 | 4 | arr=[]
value=int(input("enter value"))
i=0
while i<value:
a=int(input("enter number"))
arr.append(a)
i+=1
print(sum(arr))
# list=["bangalore","telangana","telangana","andrapradesh","bangalore","up","maharashtra"]
# list1=[]
# i=0
# while i<len(list):
# j=0
# count=0
# while j<len(list):
# ... |
fd098c80ba6e8cf7823f6e26117f448f9929eae9 | srishtishukla-20/logical_questions | /power_sum.py | 157 | 3.71875 | 4 | a=int(input("enter power"))
b=int(input("enter number"))
mul=b**a
x=str(mul)
print(x)
i=0
sum=0
while i<len(x):
sum=sum+(int(x[i]))
i+=1
print(sum)
|
5d37f77caf15e8188bfdfd527130786f411d1e0b | srishtishukla-20/logical_questions | /ifelse3.py | 162 | 4.03125 | 4 | a=input("enter word")
print(a[::3])
if len(a)>2:
if a[:-3]=="ing":
a+="ly"
print(a)
else:
a+="ing"
print(a)
else:
pass
|
d55a4e1f3bf6f8bf7f1b11f654c59c6d6b7e3ce5 | jasrusable/InventoryCalculator | /IFixStoreCalculator.py | 1,957 | 3.625 | 4 | '''
Created on 24 Jan 2016
@author: Craig
'''
class IFixStoreCalculator(object):
'''
This class is used as a calculator for iFix for various order, sales and inventory related calculations.
'''
def __init__(self, sales = {} , orders = {} , stock = {}):
'''
... |
af0bb8981fb04ef2ae90730cf78e4b1b59d2bd62 | jforrester670/Python-Core-and-Advanced | /controlstatements/assignment4.py | 128 | 3.90625 | 4 | x = int(input("Enter a number: "))
y = 0
while y < x and y < 100:
y += 1
if y % 10 == 0:
continue
print(y)
|
5ccb3b4cbfc02c4e512e4921aa33e2e825ecaf71 | radduri/PythonLearning | /Second.py | 3,062 | 4.03125 | 4 | '''While loop'''
# learn comments
from typing import Any, Union
'''magicNumber =5
i=0
while i<10:
if i is magicNumber:
print(i)
break
i=i+1'''
# continue
'''numbersTaken =[2,5,12,33,17]
print('Here are the numbers that are still available:')
for n in range(1,20):
if n in numbersTaken:
... |
cea8399313cf728c4ec533d1a635bdf555da9fe9 | suhanishukla/introductoryproblems | /permutations.py | 689 | 4.3125 | 4 | #Permutations
#A permutation of numbers 1,2,...,n is called beautiful if there are no adjacent elements with a difference of 1.
#Given n, print a possible beautiful permutation or NO SOLUTIONS if one does not exist.
#put all even numbers in ascending order in front of odds in ascending order, does not work for 1,2,an... |
be797dbcc53fecc7397c1f12f8a9f9ba876def34 | letaniaferreira/methods-to-remember | /ATM/account.py | 577 | 3.65625 | 4 | class Account:
def __init__(self, user, pin, account_number):
self.user = user
self.pin = pin
self.account_number = account_number
self.balance = 0
def check_balance(self):
return self.balance
def make_a_deposit(self, deposit_amount):
self.balance += deposi... |
e3505c89d74bec757dd94118f2ff86a011c38dc6 | letaniaferreira/methods-to-remember | /hash_map.py | 2,244 | 3.71875 | 4 | class MyHashMap(object):
def __init__(self):
self.length = 11
self.hash_map = [None] * self.length
self.occupancy = 0
def insert(self, key, val):
my_hash = self.hash_key(key)
if self.hash_map[my_hash] is None:
self.hash_map[my_hash] = [(key, val)]
... |
2e5fb506286cc9f16d108d280bc5b64264e2c042 | asdgkuo/pythonlab | /1_basics/test.py | 676 | 4.4375 | 4 | print("hello world")
print("hello","world")
print("hello","world",sep="-")
#sep可在字與字的中間加東西
#end可在字串後加東西 不會換行 例題如下
print("hello",end="@")
print("abc")
#運算
#整數除法
print(9//2)
#餘數
print(9%5)
#次方
print(3**3)
#變數宣告
a = 1
b = 2
print(a + b)
str="the color of apple is red"
print(str)
print(len(str))
print(str[::-1])
print... |
cfbc2bcbd428a3d440bcbee3d8533af9ec9ea216 | wenjunz/kaggle | /walmart_trip/walmart.py | 222 | 3.5 | 4 | import pandas as pd
import numpy as np
df = pd.read_csv('train.csv')
for day in ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']:
df[day] = df.Weekday==day
df.drop('Weekday',1,inplace=True)
|
85d771232883e02c2db9c7f0c2d4f99cafa86dd0 | Samar97/CS-386-Artificial-Intelligence-Lab | /LAB 7/dataClassifier.py | 12,295 | 3.5625 | 4 | # dataClassifier.py
# -----------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berk... |
b35bf8ca7d083316ec955e698649471a5cb960f7 | thanhsonng/algo-exercises | /chapter_1/1-1.py | 121 | 3.78125 | 4 | def is_multiple(n: int, m: int):
return n % m == 0
print(is_multiple(5, 2)) # False
print(is_multiple(6, 2)) # True
|
949bd10f314cdc77843ac3b9f45bb2466bc0b43b | thanhsonng/algo-exercises | /chapter_6/queue.py | 1,677 | 3.75 | 4 | class EmptyException(Exception):
pass
class ArrayQueue:
DEFAULT_CAPACITY = 10
def __init__(self):
self._data = [None] * ArrayQueue.DEFAULT_CAPACITY
self._size = 0
self._front = 0
def enqueue(self, item):
if (self._size == len(self._data)):
self._resize()
... |
bea6abeda01a393d0b10bfda7fd1827a424f2f74 | thanhsonng/algo-exercises | /chapter_1/1-20.py | 300 | 3.75 | 4 | from random import randint
def my_shuffle(data):
length = len(data)
ret = [None] * length
for item in data:
index = randint(0, length - 1)
while ret[index]:
index = randint(0, length - 1)
ret[index] = item
return ret
print(my_shuffle([1, 2, 3]))
|
b6f8f252132d32d96f247c5ee4a56a9841143c2a | thanhsonng/algo-exercises | /chapter_1/1-12.py | 259 | 3.546875 | 4 | from random import randrange
def my_choice(data):
maximum = max(data)
minimum = min(data)
i = randrange(minimum, maximum + 1)
while (i not in data):
i = randrange(minimum, maximum + 1)
return i
print(my_choice([5, 90, 25, 50]))
|
0f0c6de8cbc6096cc044779e2f14cc9194015b08 | sunyujun16/python_tulingxueyuan | /CookBook_and_code-master/00 贪吃蛇/0_queue_test.py | 363 | 3.515625 | 4 | import queue
q = queue.Queue()
q.put({'one': 1})
q.put({'two': 2})
q.put({'three': 3})
# 下面的写法, 内存占用急剧增加
# while True:
# try:
# q_list = q.get(block=False)
# except queue.Empty:
# continue
q_list = q.get(block=False)
if q_list.get('one'):
print('yes')
q_list = q.get(block=False)
print... |
225454339937c301b5bc84b6b13a4114c32fb498 | bivkarki/Soft-Computing-Techniques | /Maculloch_model.py | 465 | 3.625 | 4 | import matplotlib.pyplot as plt
from math import *
import numpy as np
def threshold(x):
if x>0:
return 1
else:
return 0
x=[]
neti=0
w=[]
n=int(input("enter size of inputs "))
for i in range(n):
x.append(float(input("Enter Inputs ")))
w.append(float(input("Enter Weights "... |
cb411ad7cdabbd228689cdadcae51c5bc5973907 | martinbudden/epub | /test/test_mwb.py | 1,177 | 3.515625 | 4 | """
Test the mediawiki book contents parsing.
"""
import epub.mediawikibook
def test_space():
"""Test the wikibook at test/data/Book_Space.txt"""
print "Testing wikibook Space"
filename = "test/data/Book_Space.txt"
FILE = open(filename, "r")
text = FILE.read()
FILE.close()
info = epub.med... |
e91eacde86071267f01c61d2e7022e0565138ae7 | Sprinkle-Cookie/CoconutButt | /vocabbot/bot.py | 1,200 | 4.3125 | 4 | """
TODO:
1. Read in the file
2. Split the sentences up.
3. Pick a sentence.
4. Split the sentence into words
5. Filter out stopwords
6. Choose a word
7. Replace the word with underscores
8. Print to stdout
9. Prompt for the answer.
10. Respond with the correct
"""
import nltk
f... |
a8f9c10f671a01afaa83d9e1f4afa8e0ccac5834 | etraskyoung/HPM573S18_Trask-Young_HW8 | /P2.py | 2,076 | 3.71875 | 4 | import Classes as Cls
import scr.FormatFunctions as Format
import scr.StatisticalClasses as Stat
# Present to the gambler's change in their reward if they use an unfair coin for which the probability of head is 45%.
#settings for steady state
fair_prob = 0.5
unfair_prob = 0.45
n_sim_cohort = 1000
n_games_in_a_set = ... |
387fde128291d1badd85afc4903a9a6762e24f1c | alamin1x0/PythonProgramming | /Factorial n.py | 275 | 4.21875 | 4 | n= int(input("Give the value of n:"))
fact=1
if n<0:
print("Negative number is not Allow")
elif(n==0 or n==1):
print("Value of factorial 0 or 1 is", fact)
else:
for i in range(2,(n+1)):
fact=fact*i
print("factorial value of n is", fact)
|
071746a283317b102d429875b15db745a080b600 | alamin1x0/PythonProgramming | /1^2+2^2+3^3+4^5+5^6+.py | 181 | 4.03125 | 4 | n=int(input("Give the value of n:"))
sum=0
for i in range (2,(n+1)):
sum=sum+i*i
print("summation of 1^+2^2+...+", n, "=", sum)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.