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 |
|---|---|---|---|---|---|---|
f9bb9ba4696b2e12a6085f993ff5f479f14a0fab | erben22/fib | /fibonacci.py | 1,206 | 3.984375 | 4 | """Class that provides function(s) related to calcuations of
Fibonacci numbers.
TODO: Add some additional error handling:
- How do I handle desiredSequence and ensuring it is an integer.
TODO: Overflow handling?
TODO: Can I cleanup the calculation
"""
class Fibonacci:
"""This class provides Fibonacci... |
4af2f35beec4452f5c5d77e52c6634083022bc94 | esmullen21/OO-ModuleProject | /Route.py | 6,617 | 3.828125 | 4 | import math
from Lookup import *
from itertools import permutations
class Route:
"""This class finds all the permutations of the list of airports, calculates the cost of each leg then finds the best cost for the entire journey"""
def __init__(self, look):
self.look=look # assigns the object look as a... |
bac9eeaeb959e1c48e5d9ff34b056a2c78839db9 | mxochicale/my-cortex | /tex/figures/pretty_function.py | 532 | 3.578125 | 4 | """Plot the function sin(1 / XY)."""
import matplotlib.pyplot as plt
import numpy as np
# Compute sin(1 / xy)
sz = 5000
X = np.linspace(-1, 1, sz)
Y = np.linspace(-1, 1, sz)
X, Y = np.meshgrid(X, Y)
Z = np.sin(1 / (X * Y))
# Plot it
fig, ax = plt.subplots(1)
im = ax.imshow(Z, cmap=plt.get_cmap("plasma"),
... |
e68ebd9fb2eca7f826bfad34e254f2cad33ea6e7 | naim2206/Complex-Numbers-Calculator | /operaciones_complejos.py | 2,621 | 3.703125 | 4 | import math
def suma(a1, b1, a2, b2):
return f"Result: {a1 + a2} + {b1 + b2}i"
def resta(a1, b1, a2, b2):
return f"Result: {a1 - a2} + {b1 - b2}i"
def multi(a1, b1, a2, b2):
return f"{a1*a2 - b1*b2} + {a1*b2 + a2*b1}i"
def div(a1, b1, a2, b2):
return f"{(a1*a2 + b1*b2)/(a2**2 + b2**2)} +... |
223127abf6808a49397784324016e389604d46ee | afrinh/CompetitiveProgramming | /Week3/Day3/FindDuplicateBEASTMODE.py | 1,097 | 3.796875 | 4 | import unittest
def find_duplicate(int_list):
# print(int_list)
# Find a number that appears more than once ... in O(n) time
list2=[]
length=len(int_list)
for i in range(0,length):
index = int_list[i]%length
int_list[index] = int_list[index]+length
# print(int_list)
... |
df635eeac89b0a77af043544d73e74da636c3e54 | afrinh/CompetitiveProgramming | /Week2/Day6/InPlaceShuffle.py | 379 | 3.96875 | 4 | import random
def shuffle(the_list):
length=len(the_list)
for i in range(length-1,0,-1):
j = random.randint(0,i)
the_list[i],the_list[j] = the_list[j], the_list[i]
# Shuffle the input in place
sample_list = [1, 2, 3, 4, 5]
print 'Sample list:', sample_list
print 'Shuff... |
55ba7fe0d292373dc01bd2619720dd8792092827 | ldrunner100/fizz_buzz | /fizzbuzz.py | 365 | 4.0625 | 4 | try:
n = range(int(raw_input("Fizz buzz counting up to ")))
except ValueError:
print("Please only input integers.")
n = range(int(raw_input("Fizz buzz counting up to ")))
for i in n:
if i % 3 == 0 and i % 5 == 0:
print("fizz buzz")
elif i % 5 == 0:
print("buzz")
elif i % 3 == 0:
... |
ebd7d39e55aa5a0200a680629a31442a9795ba72 | suman9868/Python-Code | /class.py | 863 | 4.125 | 4 | """
this is simple program in python for oops implementation
submitted by : suman kumar
date : 1 january 2017
time : 9 pm
"""
class Employee:
emp_count = 0
def __init__(self, name, salary):
self.name = name
self.salary = salary
Employee.emp_count = Employee.em... |
a655c9a58ccbe8679fbd3271eb312a6894e62520 | Jun-Lizst/ProbeDesign | /maskprobes/fasta.py | 14,122 | 4 | 4 | import os
import re
import string
class Fasta:
""" Stores contents of a FASTA file with useful retreival methods
Usage:
>> fa = fasta.Fasta('/path/to/yourfavgene.fasta')
or
>> seq = 'ACTATCTACTACTTTCATACTTATACTCTATC'
>> fa = fasta.Fasta(s,True)
Author:
Marshall J. Le... |
ffd768bd21bbfd25c208500da8e35241210ae820 | SabinaBeisembayeva/WEB-dev | /lab_python_django/python_informatics/5-g.py | 126 | 3.8125 | 4 | a = int(input())
arr = []
for i in range(a):
x = int(input())
arr.append(x)
for i in arr:
arr.reverse()
print(arr) |
77f27e01be7161901f28d68801d67c3d1e1e8c83 | Nikola011s/portfolio | /work_with_menus.py | 2,539 | 4.6875 | 5 |
#User enters n, and then n elements of the list
#After entering elements of the list, show him options
#1) Print the entire list
#2) Add a new one to the list
#3) Average odd from the whole list
#4) The product of all elements that is divisible by 3 or by 4
#5) The largest element in the list
#6) The sum... |
08abab6476720aee96923352443d6f7d127c17ae | faustoandrade/METODOS_TALLER | /metodosOrd.py | 3,295 | 3.875 | 4 | def insercionDirecta (lista,tam):
for i in range(1, tam):
v = lista[i]
j = i - 1
while j >= 0 and lista[j] > v:
lista[j + 1] = lista[j]
j = j - 1
lista[j + 1] = v
def mergeSort(lista):
#("Desordenado ",alist)
if len(lista)>1:
mid = len(lista)/... |
2e3920524acf1c91f5f71a479b56402f59e76cd3 | SethCerca/UNCC-Fall-2020 | /Intro-to-AI/Local_Search.py | 5,505 | 4.03125 | 4 | import random
import math
class Board():
def __init__(self, numRowsCols):
self.cells = [[0] * numRowsCols for i in range(numRowsCols)]
self.numRows = numRowsCols
self.numCols = numRowsCols
# negative value for initial h...easy to check if it's been set or not
... |
731d24bb396d7af45d3601da31c9773ca2f6e055 | fatterZhang/leetcodeComments | /128_elegant_subarray.py | 1,389 | 3.75 | 4 | # -*- coding: utf-8 -*-#
# Name: 128_eligent_subarray
# Author: ARCHI
# Date: 2020/4/21
# Description:
# -------------------------------------------------------------------------------
from typing import List
def numberOfSubarrays(nums: List[int], k: int) -> int:
if len(nums) < k:
... |
ba564bd38231baac9bec825f4eaac669c00ff6a5 | desingh9/PythonForBeginnersIntoCoding | /Day6_Only_Answers/Answer_Q2_If_Else.py | 353 | 4.21875 | 4 | #1.) Write a program to check whether a entered character is lowercase ( a to z ) or uppercase ( A to Z ).
chr=(input("Enter Charactor:"))
#A=chr(65,90)
#for i in range(65,90)
if (ord(chr) >=65) and (ord(chr)<=90):
print("its a CAPITAL Letter")
elif (ord(chr>=97) and ord(chr<=122)):
print ("its a Small charect... |
24b053c54c9e1de72aac7df28d284805f78802fa | desingh9/PythonForBeginnersIntoCoding | /Day2/asciiExplain.py | 286 | 3.828125 | 4 | print(chr(65))
print(ord("B"))
# loops will be clear later on but to clarify
# here we are CREATING (new list of characterS) FROM (list of number).
listOfNo= [1,2,3,4,5,6,7,8,9,10]
listOfCharacters=[]
for no in listOfNo:
listOfCharacters.append(chr(no+64))
print(listOfCharacters) |
e21b670ea1df1c62ec1c25b0959e221e49bb9f7a | desingh9/PythonForBeginnersIntoCoding | /Day6_Only_Answers/Answer10 July 19_percentage.py | 344 | 3.609375 | 4 | A=int(input("enter your percentage in \"A\"")) #Variable
B=int(input("enter your percantage in \"B\"")) #Variable
if (A>=55) and (B>=45):
print("Pass [Grade 1] ")
elif(A>=45) and (A<=55) and (B>=55):
print ("pass [Grade]2")
elif(B<45) and (A>=65):
print ("you are allwed to reappear")
else:
print("fail ... |
7be2d577af8b2c87f844ec785a742e44167fa306 | desingh9/PythonForBeginnersIntoCoding | /Day6_Only_Answers/Answer9_def.py | 1,016 | 3.9375 | 4 | hardness = int (input("Enter the hardness:" ))
carbonContent = float (input("Enter the carbon content:" ))
tensileStrength = int (input("Enter the tensile strength:" ))
def IsCondition1Passed():
if hardness>50:
return True
else:
return False
def IsCondition2Passed():
if carbonContent<0.7:
... |
4fd4a832d17bd36622e15261490d868f6cd40076 | desingh9/PythonForBeginnersIntoCoding | /Day4_loops/For_loop_table.py | 184 | 4.3125 | 4 | #Print a table using for loop
t=int(input("enter the number : "))
for table in range (1,10+1): # this will print from 1- 10 number as given
print (t, "x",table, "=", t * table ) |
dea948a20c0c3e4ad252eb28988f2ae935e79046 | desingh9/PythonForBeginnersIntoCoding | /Q4Mix_A1.py | 776 | 4.28125 | 4 | #1) Write a program to find All the missing numbers in a given integer array ?
arr = [1, 2,5,,9,3,11,15]
occurranceOfDigit=[]
# finding max no so that , will create list will index till max no .
max=arr[0]
for no in arr:
if no>max:
max=no
# adding all zeros [0] at all indexes till the maximum no in arra... |
d58778a994c202c98ff855a5845c6218200d72ce | desingh9/PythonForBeginnersIntoCoding | /Day6_Only_Answers/answer Q6 Day6.py | 441 | 4.09375 | 4 | #Q=7 Given a point (x, y), write a program to find out if it lies on the x-axis,
# y-axis or at the origin, viz. (0, 0).
x=int(input("enter the point in \"x\"")) #Variable
y=int(input("enter the point in \"y\"")) #Variable
#int(input("Enter the point{x.y}"))
if (x==0 and y==0):
print("Point lies on the Origin\n")... |
f7b15de5e73135519571b13d16a80f061fd962c5 | sifatmahmud/snake-water-gun-game-1.0-using-Python | /main.py | 2,849 | 3.796875 | 4 | try:
pc_point = 0
player_point = 0
roundn = 0
while roundn < 10:
roundn = roundn + 1
import random
list2 = ["snake", "water", "gun"]
list1 = random.choice(list2)
print("\n snake , water , gun")
inp1 = input("choose one of this : ") # user input
... |
0ce43db33d529e28974bdbfff6bfb6b7a53aa0f7 | kdmgs110/NP-Automation | /ex50/bin/never-be-a-pm/autoTweet.py | 9,936 | 3.71875 | 4 | # -*- coding: utf-8 -*-
import tweepy
import random # ランダムでツイートを選ぶときに使う
"""
Procedure
* Sign in Twitter Accout
* Make list object that contains tweet content
* Randomly select one tweet content, and tweet
* automate tweeting
"""
# First, sign in to Twitter API
# 各種キーをセット
CONSUMER_KEY = 'psWut2vFh9e1dX0gCV5ICj5rk'
C... |
2b99e0c3f6ba81f5c8a8226a47036f4bc59f4a0b | EvertonAlvesGomes/Curso-Python | /pesoPessoas.py | 1,755 | 3.90625 | 4 | ### pesoPessoas.py
## Cadastre pessoas pelo nome e peso em kg. Ao final,
## Retorne a quantidade de pessoas cadatradas, as mais pesadas e as mais leves
pessoas = list()
dado = list() # lista temporária para armazenar dados de uma única pessoa
mais_leves = list() # lista das pessoas mais leves
mais_pesad... |
f00c15c9471ecefdbbee77caf4015416c1710938 | EvertonAlvesGomes/Curso-Python | /jogador_futebol.py | 886 | 3.703125 | 4 | ### jogador_futebol.py
jogador = dict()
gols = list()
jogador = {'nome': '', 'gols': gols, 'n_partidas': 0}
jogador['nome'] = str(input("Nome do jogador: "))
jogador['n_partidas'] = int(input(f"Quantas partidas {jogador['nome']} jogou? "))
for n in range(0,jogador['n_partidas']):
gols.append(int(input(... |
152920d0c317bb528f19c39d56dfead8bc0d9952 | EvertonAlvesGomes/Curso-Python | /listas.py | 1,525 | 4.5625 | 5 | ### listas.py
## Estudando listas em Python
moto = ['Rodas','Motor','Relação','Freios'] # lista inicial
moto.append('Embreagem') # adicona elemento ao final da lista
moto.insert(2, 'Transmissão') # insere o elemento 'Transmissão' na posição 2,
# sem substituir o ele... |
b97fe6ef13c9e35f1ea45aa71198d80a21aefd93 | hanylovescode/ezgame | /src/helpers/vector.py | 5,290 | 3.671875 | 4 | import logging
from random import randint
import math
# TODO: try to make class Vector inherit from a Sequence (list, tuple, ...)
# TODO: check the difference between this and the Verlet method:
# https://gamedev.stackexchange.com/a/41917
class Vector:
"""
Implementation of a 2D Euclidean Vector and its m... |
6d1b6eee9d586df27b6a18d83341a911ccb285cd | veetarag/Data-Structures-and-Algorithms-in-Python | /LeetCode/friend_cricles_UnionFind.py | 951 | 3.671875 | 4 | class DisjointSet:
def __init__(self, matrix):
self.matrix = matrix
self.nodesCount = len(matrix)
self.parent = [i for i in range(self.nodesCount)]
def find(self, x):
if self.parent[x] == x:
return x
self.parent[x] = self.find(self.parent[x])
return ... |
be06a70e1eef93540bb5837ae43220ae29d7d7fa | veetarag/Data-Structures-and-Algorithms-in-Python | /Interview Questions/Rotate Image.py | 592 | 4.125 | 4 | def rotate(matrix):
l = len(matrix)
for row in matrix:
print(row)
print()
# Transpose the Matrix
for i in range(l):
for j in range(i, l):
matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]
for row in matrix:
print(row)
print()
# Row Reverse
... |
432c2ef039a742686610f06640afc7e2a064e64d | veetarag/Data-Structures-and-Algorithms-in-Python | /Interview Questions/Maximum Chair at a Party.py | 2,255 | 3.671875 | 4 | """
arr[] = {1, 2, 10, 5, 5}
dep[] = {4, 5, 12, 9, 12}
Below are all events sorted by time. Note that in sorting, if two
events have same time, then arrival is preferred over exit.
Time Event Type Total Number of Guests Present
------------------------------------------------------------
1 Ar... |
0e7ed5d0d93126fa87651d01591db594b85a2c0c | veetarag/Data-Structures-and-Algorithms-in-Python | /DataStructure/bfs.py | 892 | 3.578125 | 4 | def bfs(n, m, edges, s):
# initializing graph
graph = {i: [] for i in range(1, n + 1)}
# taking the edges input
visited, queue, level = [False] * (n + 1), [], [0] * (n + 1)
# push start node
queue.append(s)
visited[s] = True
level[s] = 0
# iterate until queue is empty
while queue... |
cdea0cb65d41a67aa98441438a387efa5069f3a9 | veetarag/Data-Structures-and-Algorithms-in-Python | /Interview Questions/Check Linked List Palindrome.py | 513 | 3.6875 | 4 | # Singly-linked lists are already defined with this interface:
# class ListNode(object):
# def __init__(self, x):
# self.value = x
# self.next = None
#
def isListPalindrome(l):
# Use a stack to move from left to right. Then pop from right and check again with traversing
stck = []
head = l
whil... |
17c6813b90aea51bf990a8d3b0973038fe152d27 | veetarag/Data-Structures-and-Algorithms-in-Python | /Dynamic Programming/longest_palindrome_length.py | 552 | 3.578125 | 4 | def longest_palindrome_length(string):
N = len(string)
cache = [[None]*N for _ in range(N)]
left, right = 0, 0
def find_length(i, j):
if(cache[i][j]!=None):
return cache[i][j]
if(i>j):
return 0
if(i==j):
return 1
if(string[i]==strin... |
059cd17df17100c619386fb61793efa4efd6e18a | veetarag/Data-Structures-and-Algorithms-in-Python | /Interview Questions/First Duplicate in Array.py | 291 | 3.890625 | 4 | def firstDuplicate(array):
l = len(array)
for i in range(l):
if array[abs(array[i])-1] < 0:
return abs(array[i])
# Make the found value index negative
array[abs(array[i])-1] = -array[abs(array[i])-1]
print(firstDuplicate([2,1,1]))
# [2, -1, 1] |
97cb2080244ceb7295c891736cfdd4ff6675e547 | veetarag/Data-Structures-and-Algorithms-in-Python | /graph/detect_cycle_directed_dfs.py | 798 | 3.515625 | 4 | from collections import defaultdict
def dfs_visit(node, graph, color, time, d, f):
time+=1
color[node] = 'Gray'
d[node] = time
for neighbour in graph[node]:
if(color[neighbour]=='Black'):
continue
elif(color[neighbour]=='Gray'):
return True
elif(dfs_visit... |
52e733fa1990f4d8815d6560a7150da78874ae17 | veetarag/Data-Structures-and-Algorithms-in-Python | /Dynamic Programming/longest_increasing_sequence_LIS.py | 812 | 3.671875 | 4 | def LIS(array):
l = len(array)
cache = [None]*(l+1)
dir = [-1]*(l+1)
def longest(i):
if cache[i]!=None:
return cache[i]
maxi = 0
for j in range(i+1, l):
if(array[j]> array[i]):
if longest(j) > maxi:
maxi = longest(j)
... |
9077f94ae39d9dd034cb95db552b714d2ecc540d | veetarag/Data-Structures-and-Algorithms-in-Python | /Interview Questions/Unique Email Addresses.py | 484 | 3.5 | 4 | def uniqueEmails(emails):
uniq_mails = set()
for email in emails:
formatted_email = ''
splits = email.split('@')
flag = True
for c in splits[0]:
if c=='+':
flag=False
if c=='.':
continue
if flag:
... |
97880a186f59ee58b83e9487e2d5c9c4e3366788 | mnazimy/blocks-world | /bw.py | 2,650 | 3.59375 | 4 | """
The Blocks World AI problem implemented and sovled with Python.
Creator: Apostolos Anastasios Kouzoukos, dai17038
Email: kouzoukos97@gmail.com
Github: https://github.com/kouzapo
"""
import time
import sys
import os
from state import State
from searching import breadth_first_search, depth_first_searc... |
4312eb44292879e0a6ad3b8b7582a1e6b677883f | J0ul/main | /12.2-8.py | 4,218 | 3.90625 | 4 | # 12.2 Напишите программу, которая для целочисленного списка из 1000 случайных
# элементов определяет, сколько отрицательных элементов располагается между его
# максимальным и минимальным элементами.
import random
import statistics
s = []
for i in range(20):
s.append(random.randint(-10, 100))
print(s)
a = s.index... |
3e46644256108dd4af3ceed69e96ed4e2df5637c | J0ul/main | /13.1-2.py | 1,877 | 4.0625 | 4 | # 13.1
# Напишите программу, проверяющую четность числа, вводимого с клавиатуры.
# Выполните обработку возможных исключений
try:
x = int(input("Введите целое число: "))
if x % 2 > 0:
print(x, " - нечетное число")
else:
print(x, " - четное число")
except ValueError:
print("Ошибка, это не... |
219d0100864e2e8b1777cb935a9b5e61ca52ef8a | osalpekar/RSA-Encrypter | /rsa.py | 620 | 4.15625 | 4 | '''
Main function instantiates the Receiver class
Calls encrypt and decrypt on user-inputted message
'''
from receiver import Receiver
def main():
message = raw_input("Enter a message you would like to encrypt/decrypt: ")
receiver = Receiver()
encrypted_message = receiver.encrypt(message)
decrypted_me... |
cef0c8680f1f374708d3029d5e6e4d60616310b6 | KJCook/sedov-solution | /VH1/output/10sm/animate_hydro.py | 1,628 | 3.546875 | 4 | #Base animation code written by Nathan Parzuchowski
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
# First set up the figure, the axis, and the plot element we want to animate
fig = plt.figure()
ax = plt.axes(xlim=(0.0, 0.4), ylim=(0, 3.0e5)) # change the axis limits here
li... |
3d29b57b143e7d20205b780c22d7e4a4e82dd5b2 | XARXALINUX/myfipypro | /calc.py | 723 | 3.90625 | 4 | print("IF IT DOESN'T WORKING READ README")
print("To learn the commands type hlp()")
def calc():
a = input()
b = input()
print("The sum is:", a + b)
def mu():
c = input()
d = input()
print("The sum is:", c * d)
def ext():
print("CLOSING")
exit()
def hlp():
print("To s... |
8858083bbd2a1ff2bd63cdde91462bc1efbeb4c7 | HenriqueSilva29/infosatc-lp-avaliativo-06 | /atividade 1.py | 624 | 4.1875 | 4 | #O método abs () retorna o valor absoluto do número fornecido.
# Exemplo :
# integer = -20
#print('Absolute value of -20 is:', abs(integer))
numero=0
lista = [2,4,6,8]
def rotacionar(lista, numero):
numero=int(input("Algum número positivo ou negativo :"))
if numero >= 0:
for i in range(n... |
792a5e835c06afadcad8f0957227331042a61fd4 | nnguyen150468/newGitTest | /hangman2.py | 1,033 | 3.703125 | 4 | x=100
#declare variables
word='dog'
letter_left=list(word)
score_board=['_']*len(word)
stages=['','________ ','| | ','| O ','| | ','| /|\ ','| / \ ','| ']
wrong_guesses=0
win=False
#welcome
print('Welcome to Hang Man!')
print('It\'s a ',len(word),'-letter word:')
print(''.join(score_board))
#loop
while wrong_gues... |
990c1a77124dff17c594ffcce78b9af9be483226 | sherbold/Python-Programmierkurs | /examples/sample_package/sqrt.py | 161 | 3.84375 | 4 | def my_sqrt(x):
"""Returns the square root of x"""
guess = 1
while(abs(guess*guess-x)>0.0001):
guess = (1/2)*(guess+x/guess)
return guess |
29bd5a30f30e9d05bd61a34967ee1eb92fad4731 | dallangoldblatt/befunge-interpreter | /interpreter.py | 8,112 | 3.578125 | 4 | import random
import numpy as np
import matplotlib.pyplot as plt
class Interpreter():
def __init__(self, lines, visualize):
self.visualize = visualize
# Set pointer bounds
self.rows = len(lines)
self.cols = len(max(lines, key=len))
# Covert program source into a two dimen... |
9847616b6403b437507d2fc7c3414ca32b571b61 | nogicoder/sorting-algorithm | /test1.py | 729 | 3.84375 | 4 | import pyglet
a = [0, 1, -3, 6, 2, 10]
numbers = [[str(item) for item in a]]
def bubble_sort_algo(lst):
move = []
for t in range(len(lst)):
swap = False
for i in range(len(lst) - 1):
move.append(('n', lst[i], lst[i + 1]))
if lst[i + 1] < lst[i]:
lst[i], ... |
b297fbeb7560eae165bcb27592832253562d8f00 | AnnieJeez/Pythons | /class_cd.py | 215 | 3.515625 | 4 | class Potato():
def __init__(self):
self.name = "Jim Bob, Chubbbbby Donkey & Choompa"
def displayChubsters(self):
print(self.name)
print(self.name)
p1 = Potato()
p1.displayChubsters() |
2a1558cef42d9302cb114202c9eb2586aa4a46d3 | AnnieJeez/Pythons | /testing.py | 228 | 4.03125 | 4 | message = input("Enter message")
charCount=0
wordCount =1
for i in message:
charCount=charCount+1
print(i+str(charCount))
if(i==" "):
wordCount=wordCount+1
print("Word count" + str(wordCount))
|
395e1f0a23abb1d2e6bc2c08310d44f4171b438b | AnnieJeez/Pythons | /mode.py | 243 | 3.671875 | 4 | from collections import Counter
numbers = [1,2,3,4,5,6,7,8,4,5,6,7,8,6]
print(Counter(numbers))
z = Counter(numbers)
max = 0
for p in z:
if z[p]> max:
max = z[p]
for p in z:
if z[p]== max:
print(p)
|
69da6775487c8b27702302afdc60c7ceef53f148 | NoroffNIS/Code-2019-Week-5 | /16 - Documenting_Practical.py | 2,826 | 4.1875 | 4 | class Car:
def __init__(self):
self.type = ""
self.model = ""
self.wheels = 4
self.doors = 3
self.seets = 5
def print_model(self):
print("This car is a {model}: {type}, Wow!".format(model=self.model,type= self.type))
def print_space(self):
print("The... |
bd42b81d7d008bab809a365e99c4d410876b453c | rocky-recon/mycode | /farm_challange.py | 704 | 4.5 | 4 | #!/usr/bin/env python3
# Old Macdonald had a farm. Farm.
farms = [{"name": "NE Farm", "agriculture": ["sheep", "cows", "pigs", "chickens", "llamas", "cats"]},
{"name": "W Farm", "agriculture": ["pigs", "chickens", "llamas"]},
{"name": "SE Farm", "agriculture": ["chickens", "carrots", "celery"]}]
#... |
b985436c5371ffcbd94fa1f53fde8d83b06b95f2 | rocky-recon/mycode | /projects/losdice.py | 660 | 3.5625 | 4 | #!/usr/bin/env python3
# always add shebang on top of page
# standard library first!
from random import randint
class Player:
def __init__(self):
self.dice = []
def roll(self):
# Clear current dice
self.dice = []
for i in range(6):
self.dice.append(randint(1,6))
... |
7806dc4a7767918fd48cecd05dfb0eb586da0ee9 | rocky-recon/mycode | /projects/hw2.py | 1,987 | 4.03125 | 4 | #!/usr/bin/env python3
# always add shebang on top of page
"""The puropose of this program is to display every NFL players data. By: Damian Mercado"""
# standard library first!
import random
#import os
#import shutil
import csv
# This will print every line in a csv file
#def print_csv(data):
# for row in data:
#... |
6c3c75fc6f5c9dd7a74f02fb29c2a69975f2a541 | HelenaSILS/geo_computer | /tester.py | 823 | 4.03125 | 4 | class tester:
"""
tester class verifies the input
"""
def __init__(self):
pass
def test_string(self,address):
"""
Function to test if the type is a string
:param address: string
:return: assert
"""
t=type(address) == str
assert t, "not... |
8e9b5073b1ee0d0c77522913d27bb22ecb237047 | ewinge2/WebApp | /CarlStats.py (stop updating this one?) | 5,806 | 3.734375 | 4 | #!/usr/bin/python
'''
File:webapp.py
Authors: Anne Grosse and Jialun "Julian" Luo
Last edited: 2013/10/10
This program will generate a html to the browser to display. It will print a summary or results
when user inputs are detected.
'''
import cgi
import DataSource
import cgitb
cgitb.enable()
class CarlStats:
'''
... |
c758366a22e1ab6095ada44d366394395b6797bf | MieMieSheep/Learn-Python-By-Example | /python3/2 - 数据类型与变量/1.py | 1,684 | 4.375 | 4 | #encoding:utf-8
#!/user/bin/python
'''
前面两行#encoding:utf-8
#!/user/bin/python
的作用:
第一行:#encoding:utf-8
用于声明当前文件编码,防止程序乱码出现
第二行: #!/user/bin/python
用于声明python文件
养成良好编码习惯,敲代码时习惯添加这两行注释。
'''
'''
变量:仅仅使用字面意义上的常量很快就会引发烦恼——
我们需要一种既可以储存信息 又可以对它们进行操作的方法。
这是为什么要引入 变量 。
变量就是我们想要的东西——它们的值可以变化,
即你... |
c66cf6ba9742afaabdc349c8d4631018d611ddf3 | krnorris65/python-exercises | /sets/cars.py | 1,408 | 4.0625 | 4 | # Create an empty set named showroom.
showroom = set()
# Add four of your favorite car model names to the set.
showroom.add('Honda')
showroom.add('Ford')
showroom.add('Dodge')
showroom.add('RAM')
# Print the length of your set.
print(len(showroom))
# Pick one of the items in your show room and add it to the set agai... |
2d5360aca816845779d66f742760757ae60d4aef | krnorris65/python-exercises | /dictionaries/stocks.py | 1,089 | 3.578125 | 4 | stockDict = {
"GM": "General Motors",
"CAT":"Caterpillar",
"EK":"Eastman Kodak",
"GE": "General Electric"
}
purchases = [
( 'GE', 100, '10-sep-2001', 48 ),
( 'CAT', 100, '1-apr-1999', 24 ),
( 'GE', 200, '1-jul-1998', 56 )
]
for purchase in purchases:
stock_abrv = purchase[0]
stock_... |
f92fa5880c9022d5ef4b3a69f23c98681d62b5b5 | A284Philipi/1008_Salario_Python | /1008 - Salário.py | 178 | 3.65625 | 4 | numero = int(input())
horas = int(input())
salario = float(input())
salario = float(salario * horas)
print("NUMBER = {}".format(numero))
print("SALARY = U$ %.2f" %(salario)) |
a85ee24b796906873366ac5c0e57671d3eb067cd | tinysheepyang/python_scripts | /leetcode/字符串/9求解回文数.py | 481 | 3.5625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/8/13 23:27
# @Author : chenshiyang
# @Site :
# @File : 9求解回文数.py 判断一个数是否是回文数
# @Software: PyCharm
def isPalindrome(n):
if n < 0:
return False
sum = 0
origin = n
while n:
num = n % 10
sum = sum*10 + num
... |
bad2a831f59ceeabcc4c103259b183393ce2da0d | tinysheepyang/python_scripts | /leetcode/数组/121买卖股票最佳时机.py | 675 | 3.71875 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/10/26 23:01
# @Author : chenshiyang
# @Site :
# @File : 121买卖股票最佳时机.py
# @Software: PyCharm
class Solution:
def maxProfit(self, prices):
if prices is None:
return 0
minPrices = prices[0]
maxProfit = 0
... |
c9b7dc854359b2d3eaa583b90407006a3b956fb1 | tinysheepyang/python_scripts | /leetcode/树/04.04检查平衡性.py | 1,221 | 3.625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/7/11 17:18
# @Author : chenshiyang
# @Site :
# @File : 04.04检查平衡性.py
# @Software: PyCharm
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def... |
9abd57de2effe8b69393b790a582ef1b3817c761 | tinysheepyang/python_scripts | /leetcode/数组/167两数之和2.py | 1,054 | 3.859375 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/7/28 23:43
# @Author : chenshiyang
# @Site :
# @File : 167两数之和2.py
# @Software: PyCharm
def twoSum(nums, target):
"""
双指针实现
两数之和
"""
assert len(nums) >= 2
l, r = 0, len(nums)-1
while l < r:
if nums[l] + nums... |
1e3d0b63fc565980a5625233263241cfd31b8847 | coblax/Python-Exploit | /reverse_convert_to_utf-8.py | 102 | 3.546875 | 4 | #!/usr/bin/python
with open ('reversed.txt') as text_reversed:
print(text_reversed.read()[::-1])
|
1913960882c3ca12dbdbe23ff406b8ca14b919dc | zxq8132/learning | /iteration/moudule_01.py | 1,256 | 3.578125 | 4 | #by zxq
# 模块的分类:
# 一、标准库
# 1、时间模块
# time和datetime
# a、格式化表示的时间
# '2017-10-26-16:48:01'
# b、时间戳
# 本质就是秒数
# 从1970年01月01日0分0时0秒开始到当前的秒数
# ex1:
# import time
# x=time.time()#单位是秒
# print(x/3600/24/365)#1970+47=2017
# #c、 元组的表示方式
# print(time.localtime())
# print(time.timezone/3600)#和utc时间的差值
# print(help(time.gmtime()))
# ... |
762006b4118526ee432aa561f348f2b444e1b7a4 | zxq8132/learning | /iteration/generator.py | 547 | 3.8125 | 4 | #by zxq
#斐波拉契数列的实现,用函数实现
# def fib(max):
# n,a,b=0,0,1
# while n<max:
# print(b)
# a,b=b,a+b
# n=n+1
# return 'end'
# fib(10)
#斐波拉契数列的生成器,关键字是yield
#函数值能连续输出,就可以用生成器的方式定义?
def fib(max):
n,a,b=0,0,1
while n<max:
yield b
a,b=b,a+b
n=n+1
return 'end'
... |
14e68af4c1a647adfbec43a817d0118aee73055a | zxq8132/learning | /function_operation/fun_recursion.py | 326 | 3.5625 | 4 | #by zxq
#函数内部调用函数本身叫递归(recursion)
# python最多内部调用997次数
#1、必须有一个明确结束条件
#2、递归效率不高
#3、每次递归,问题规模要比上次递归有所减少
def calc(i):
print(i)
if int(i/2)>0:
return calc(i/2)
print("--->>",i)
calc(5)
|
a658fec2fdfc867fb137a756a100cee78d5fa69e | WangXu1997s/store | /小跳蛙.py | 264 | 3.75 | 4 | a=20
b=0
num=0
while True :
if b<a:
b+=3
num+=1
if b<a:
b-=2
else:
print("第",num,'天能跳出来')
break
else:
print("第", num, '天能跳出来')
break
|
db852fa295bed837efa39df3ca81e77006f7c894 | WangXu1997s/store | /统计列表中每个数出现的次数.py | 196 | 3.671875 | 4 |
List = [1,4,7,5,8,2,1,3,4,5,9,7,6,1,10]
setL = set(List)
#print(setL.pop())
for i in range(len(setL)):
view = setL.pop()
print("{0}出现了{1}次。".format(view,List.count(view))) |
eda075a19350e70fd5bc3c2e04c87ff998993948 | tt-n-walters/saturday-python | /first-class-example-2.py | 269 | 3.703125 | 4 |
def add(amount):
def func(value):
return value + amount
return func
adds_5 = add(5)
adds_10 = add(10)
adds_1000 = add(1000)
print(adds_5(60))
print(adds_5(15))
print(adds_5(995))
print(adds_1000(60))
print(adds_1000(15))
print(adds_1000(995)) |
89cc6b02e44f2c8c22cb68601e93de4facc18fd8 | tt-n-walters/saturday-python | /data-model-example.py | 805 | 4.03125 | 4 |
class Polynomial:
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def __repr__(self):
return "Polynomial({}x^2 + {}x + {})".format(self.a, self.b, self.c)
def __add__(self, other):
return Polynomial(self.a + other.a, self.b + other.b, self.c + o... |
6dce087cb7a81d81dfb4bec0f50bc8e10413cf44 | amitdivekar30/Clustering_by_python | /Hierarchial_Clustering_CrimeData.py | 2,078 | 3.578125 | 4 | #Hierarchail Clustering
#Perform Clustering for the crime data and identify the number of clusters formed and draw inferences.
#
#Data Description:
#Murder -- Muder rates in different places of United States
#Assualt- Assualt rate in different places of United States
#UrbanPop - urban population in different pl... |
7dae7b15c23415aa639d273a19152762da9a0f5c | ua-ants/webacad_python | /lesson02_old/hw/script7.py | 550 | 3.796875 | 4 | import random as r
# generate array:
arr=[]
n = r.randint(2, 20)
while(n):
arr.append(r.randint(100, 999))
n -= 1
print(arr)
# task 7. Дан список из целых чисел длинной в три числа. Вернуть
# список отсортированный в обратном порядке, не используя метод .reverse()
def reverse_array(arr):
i = 1
res = ... |
db6b22e0d6c051b508dbdff4cab4babcbd867c6e | ua-ants/webacad_python | /lesson01_old/hw/script3.py | 485 | 4.15625 | 4 | while True:
print('To quit program enter "q"')
val1 = input('Enter a first number: ')
if val1 == 'q':
break
val2 = input('Enter a second number: ')
if val2 == 'q':
break
try:
val1 = int(val1)
val2 = int(val2)
except ValueError:
print('one of entere... |
265a3d593c820ebc354bcd04b15da5489ba51f6d | ua-ants/webacad_python | /lesson02_old/hw/script3.py | 336 | 4.3125 | 4 | # given array:
arr = [1, 3, 'a', 5, 5, 3, 'a', 5, 3, 'str01', 6, 3, 'str01', 1]
# task 3. Удалить в массиве первый и последний элементы.
def remove_last_and_first(arr):
del arr[0]
del arr[-1]
return arr
print("Array before: ", arr)
print("Array after: ", remove_last_and_first(arr)) |
6af244e2bbc7d8935d7cc4abbdee85481d61f5c9 | yoonjeewoo/DataScience | /matrix.py | 669 | 3.515625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 27 16:24:54 2016
@author: JEEWOOYOON
"""
A = [[1, 2, 3],
[4, 5, 6]]
B = [[1, 2],
[3, 4],
[5, 6]]
def shape(A):
num_rows = len(A)
num_cols = len(A[0]) if A else 0
return num_rows, num_cols
def get_row(A, i):
return A[i]
def get_... |
12794f17cffae439d9b0f9faaac24cca73be2857 | wescleytorres/Python-Introducao | /Introducao/Func01.py | 658 | 3.625 | 4 | from time import sleep
def lin():
print('-=' * 20)
def contador(i, f, p):
if p < 0:
p *= -1
if p == 0:
p = 1
print(f'Contagem de {i} até {f} de {p} em {p}')
sleep(2.5)
if i < f:
cont = i
while cont <= f:
print(cont, end=' ')
sleep(0.4)
... |
3a26d1912702f2074d97e3ea8f7610d7ba367c6e | wescleytorres/Python-Introducao | /Introducao/DicCadast94.py | 1,071 | 3.71875 | 4 | dados = dict()
lista = list()
somaidade = 0
while True:
dados['nome'] = input('Nome: ')
while True:
dados['sexo'] = str(input('Sexo [M/F]: ')).upper()
if dados['sexo'] == 'M' or dados['sexo'] == 'F':
break
print('Erro. favor informar M ou F.')
dados['idade'] = int(input(... |
c6086e5149ac1602aa1c7f79d190e7975671532f | sujonict07/Python | /decorator/decorating_functions_with_arguments.py | 317 | 3.734375 | 4 | from decorator.decorators import do_twice
"""
Returning Values From Decorated Functions
"""
@do_twice
def greet(name):
print(f"Hello {name}")
print(greet("sujon"))
@do_twice
def return_greating(name):
print("Creating greading")
return f"Hi {name}"
hi_emon = return_greating("Emon")
print(hi_emon) |
5f638c2f50487b667f8e4847f98f51626df9acbd | sujonict07/Python | /decorator/inner_functions.py | 541 | 3.984375 | 4 | """
It’s possible to define functions inside other functions.
Such functions are called inner functions
"""
def parent():
print("printing from the parent() function")
def first_child():
print("printing from the first_child() function")
def second_child():
print("printing from the second... |
7917204479189e2db870651438617faaa40b610d | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex072.py | 1,165 | 4.0625 | 4 | # Ex: 072 - Crie um programa que tenha uma tupla totalmente preenchida com uma
# contagem por extenso, de zero até vinte.
# Seu programa deverá ler um número pelo teclado (entre 0 e 20) e mostrá-lo por
# extenso.
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 072
-=-=-=-=-=-=-=-=... |
3bcdcbc338e89c239b62ee743e13ccc0c27a640b | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex002.py | 340 | 3.984375 | 4 | print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 002
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
''')
nome = input('Digite seu Nome: ')
print(f'Seja bem vindo {nome}!')
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Obrigado pelo uso!
--Desenvolvido por Thalles Torres
-=-=-=-=-=-=-=... |
23b0bf7288672ad81c27e25daec3a6afe4ca707f | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex096.py | 654 | 4.25 | 4 | # Ex: 096 - Faça um programa que tenha uma função chamada área(), que receba
# as dimensões de um terreno retangular(largura e comprimento) e mostre a
# área do terreno.
def area(a, b):
print("\n--Dados finais:")
print(f"Área de um terreno {a}x{b} é de {a * b}m².")
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-... |
b3a51cbf148e888c3b6671002af0076741cc768e | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex027.py | 655 | 4.03125 | 4 | # Ex: 027 - Faça um programa que leia o nome completo de uma pessoa mostrando em
# seguida o primeiro e o último nome separadamente.
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 027
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
''')
n = input('Digite seu nome completo: ').split()
pri... |
fff59cf15424d077cdecd2f1212e40ca1f6ec1c0 | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex005.py | 426 | 4 | 4 | print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 005
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
''')
n = int(input('Digite um Número: '))
print(f'\nAnalisando o valor {n} \n'
f'\nSeu sucessor é: {n + 1} '
f'\nSeu antecessor é: {n - 1}')
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-... |
f6be53d05eb1b961a31026c54fb7e7098f0835c5 | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex044.py | 2,749 | 3.890625 | 4 | # Ex: 044 - Elaborar um programa que calcule o valor a ser pago por um
# produto, considerando o seu preço normal e condeção de pagamento:
# À vista dinheiro/cheque - 10% de desconto; À vista no cartão - 5% de
# desconto; Em até 2x no cartão - preço normal; 3x ou mais no cartão -
# 20% de juros.
print('''
-=-=-... |
762da45f442ce9137535d13f7d776e59f6bfbebe | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex108/ex108.py | 765 | 4.0625 | 4 | # Ex: 108 - Adapte o código do desafio 107, criando uma função adicional
# chamada moeda() que consiga mostrar os valores como um valor monetário
# formatado.
import moeda as m
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 108
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
''')
m.escreva("Anál... |
20c58b946dbd60868c57fc25f42b53898a0cd8f0 | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex057.py | 761 | 3.96875 | 4 | # Ex: 057 - Faça um programa que leia o sexo de uma pessoa, mas só aceite os
# valores 'M' ou 'F'. Caso esteja errado, peça a digitação novamente até ter
# um valor correto.
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 057
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
''')
print('--Ve... |
aed12fae37f7d357e59bd77f622ee3d8397dafbb | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex015.py | 528 | 3.828125 | 4 | print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 015
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
''')
d = int(input('Quantidade de Dias alugado: '))
km = float(input('Quantidade de Km percorridos: '))
precod = d * 60
precokm = km * 0.15
print('-' * 5, 'Preços', '-' * 5, f'\nDia: R${preco... |
34033ea6ed96aad27da2eaa7e407b52f81ad1759 | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex109/ex109.py | 825 | 4.0625 | 4 | # Ex: 109 - Modifique as funções que foram criadas no desafio 107 para que
# elas aceitem um parãmetro a mais, informando se o valor retornado por elas
# vai ser ou não formatado pela função moeda(), desenvolvida no desafio 108.
import moeda as m
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--E... |
0d3ed7021b6e129475af59523ffb2b4bb71a6af2 | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex085.py | 767 | 4.0625 | 4 | # Ex: 085 - Crie um programa onde o usuário possa digitar sete valores numéricos e
# cadastre-os em uma lista única que mantenha separados os valores pares e ímpares.
# No final, mostre os valores pares e ímpares em ordem crescente.
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 085
-=-... |
18a98ca174b9c50a8d1d3a2bf84cabe8e968c39a | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex045.py | 1,738 | 3.96875 | 4 | # Ex: 045 - Crie um programa que faça o computador jogar JOKENPÔ com você.
from random import randint
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 045
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
''')
print('--Jogo: Pedra, Papel ou tesoura')
print('''--Você acha que consegue ganhar... |
0b164f76b93c57eb2e187d1a664cbfe463c58ae1 | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex112/ex112.py | 677 | 3.546875 | 4 | # Ex: 112 - Dentro do pacote utilidadesCeV que criamos no desafio 111,
# temos um módulo chamado dado. Crie uma função chamada leiaDinheiro()
# que seja capaz de funcionar como uma validação de dados para aceitar
# apenas valores que sejam monetários.
from utilidadescev import moeda, dados
print('''
-=-=-=-=-=-=-... |
7640d24a194f8c478d40869a1b13a2d84422c0b2 | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex110/ex110.py | 579 | 4.0625 | 4 | # Ex: 110 - Adicione ao módulo moeda.py criado nos desafios anteriores, uma
# função chamada resumo(), que mostre na tela algumas informações que já
# temos no módulo criado até aqui.
import moeda
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 110
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
... |
1814f6fbdbf5a3c28a73efa51323d42a0a3e2fe9 | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex095.py | 2,045 | 4.1875 | 4 | # Ex: 095 - Aprimore o DESAFIO 093 para que ele funcione com vários jogadores,
# incluindo um sistema de visualização de detalhes do aproveitamento de cada jogador.
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercício 095
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
''')
jogadores = list()
resp = 's'... |
f4b83fb8b66baabe97524968fa0dabf401a98b33 | ThallesTorres/Curso_Em_Video_Python | /Curso_Em_Video_Python/ex068.py | 1,320 | 4 | 4 | # Ex: 068 - Faça um programa que jogue par ou ímpar com o computador. O jogo só
# será interrompido quando o jogador PERDER, mostrando o total de vitórias
# consecutivas que ele conquistou no final do jogo.
from random import randint
print('''
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--Seja bem-vindo!
--Exercíci... |
927c3152f1b8d4cbc0e9a0ce8ef753cd8d80d1cd | sangarfield/WebScrapingWithPython | /Chapter9/139_SubmitForm.py | 258 | 3.609375 | 4 | '''
填写一个提交表单
http://pythonscraping.com/pages/files/form.html
'''
import requests
url = 'http://pythonscraping.com/files/processing.php'
params = {'firstname' : 'Kevin', 'lastname' : 'Liu'}
r = requests.post(url, params)
print(r.text) |
940ee3ad025a05f9a10a2330c81ddbc22c353813 | milknsoda/start_camp | /day4/day4-1.py | 4,070 | 3.71875 | 4 | """
Python dictionary 연습 문제
"""
# 1. 평균을 구하시오.
score = {
'수학': 80,
'국어': 90,
'음악': 100
}
# 아래에 코드를 작성해 주세요.
print('==== Q1 ====')
sume = 0
for s in score.values():
sume = sume + s
average = sume / len(score)
print(f'평균: {average}')
# 풀이 : 반복문
result = 0
count = 0
for score_value in score.values():
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.