blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
813c26726814fce9ce0714de586420abade77c57 | 981377660LMT/algorithm-study | /8_heap/经典题/1942. 最小未被占据椅子的编号.py | 1,664 | 3.515625 | 4 | from typing import List
from heapq import heappush, heappop
# 有 n 个朋友在举办一个派对,这些朋友从 0 到 n - 1 编号。派对里有 无数 张椅子,
# 编号为 0 到 infinity
# 当一个朋友到达派对时,他会占据 编号最小 且未被占据的椅子。
# 总结:排序,模拟sweeping
# 保持pq队头是可供使用的编号最小的椅子
class Solution:
def smallestChair(self, times: List[List[int]], targetFriend: int) -> int:
... |
d155a0951dad711c69405a2e813087897f68330e | 981377660LMT/algorithm-study | /1_stack/单调栈/高频题/42. 接雨水.py | 449 | 3.8125 | 4 | # 每个柱子顶部可以储水的高度为:
# 该柱子的左右两侧最大高度的较小者减去此柱子的高度。
from itertools import accumulate
from typing import List
class Solution:
def trap(self, height: List[int]) -> int:
preMax = list(accumulate(height, max))
sufMax = list(accumulate(height[::-1], max))[::-1]
return sum(min(h1, h2) - h0 f... |
e05a7fa81eae788156bb26b65a85c9ec98d4ad80 | 981377660LMT/algorithm-study | /19_数学/采样/478. 在圆内随机生成点.py | 615 | 3.78125 | 4 | from dataclasses import dataclass
from math import cos, pi, sin, sqrt
from random import random, uniform
from typing import List
@dataclass
class Solution:
radius: float
x_center: float
y_center: float
def randPoint(self) -> List[float]:
# !在单位圆中随机生成一个点,它离圆心的距离小于等于 r 的概率为 F(r) = ... |
b65b5ea3964007c24e8d4735727c64992e5a7964 | 981377660LMT/algorithm-study | /20_杂题/atc競プロ/競プロ典型 90 問/018 - Statue of Chokudai(★3).py | 693 | 3.78125 | 4 | # 平面 x=0 上に、高さ H の T 分で一周する観覧車があります。
# 観覧車の名物である「高橋直大像」は、座標 (X,Y,0) に存在します。
# !求缆车到雕像的俯角
from math import cos, degrees, radians, sin, atan # 转角度、弧度
import sys
sys.setrecursionlimit(int(1e9))
input = sys.stdin.readline
MOD = int(1e9 + 7)
T = int(input())
H, X, Y = map(int, input().split())
Q = int(input... |
b11bb96086bfedeba76cd838a6b9a0528eada6b0 | horada1991/1stSLWEEK | /hello.py | 354 | 3.828125 | 4 | import sys
#funct of Print, with command line arguments
def PrintWithName(name):
print("Hello", end = "")
for i in name:
print(" " + i, end = "")
print("!")
PrintWithName(sys.argv[1:]) if sys.argv[1:] else print("Hello World!")
#It could be solved in one logical line by the .join funct
# but you ... |
b696d8557512109c90c967f7f4bc48c77944ef3d | TroyJDXX/Leetcode_Practise | /Leetcode_Easy/leetcode_easy_day1.py | 4,689 | 3.875 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
若有多解,说明前面是自己做的,后面是更好的答案。
"""
# -------------------------------------------1.两数之和-------------------------------------------
nums = [0, 0, 3, 3]
target = 6
def twoSum(nums, target):
result = []
for i in range(len(nums)):
rest = target - nums[i]
... |
b0e46644c5ffc1b01816c3784bf6a65f8d6f7b11 | TroyJDXX/Leetcode_Practise | /剑指Offer/day4.py | 7,505 | 3.515625 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# ------------------------------------------- 12. 矩阵中的路径 -------------------------------------------
# ---------------------------------------------------
board1 = [["A", "B", "C", "E"], ["S", "F", "C", "S"], ["A", "D", "E", "E"]]
word1 = "ABCCED"
board2 = [["a", "b"], ["c... |
75af241cbd45bb143d78ca7939f6b9c39f719326 | khanalg44/cric-data_webapp | /ipl_page.py | 2,467 | 3.578125 | 4 | #!/usr/bin/env python3
import streamlit as st
import numpy as np
import pandas as pd
import plotly.express as px
from get_profile import get_player_profile
from find_name import find_name
from footer import Footer
def app():
st.title("Welcome to IPL-cric-data!")
st.sidebar.title('Find Player Profile')
us... |
c46dcef6a98217e1627f93d21f70a40631ea231f | jiabin1122/python_practice | /level1/practice_11.py | 549 | 4.0625 | 4 | """
11.数字颠倒
输入一个整数,将这个整数以字符串的形式逆序输出
程序不考虑负数的情况,若数字含有0,则逆序形式也含有0,如输入为100,则输出为001
"""
def reverse_digit(num):
if int(num) < 0:
return -1
else:
result = list(num)
result.reverse()
return ''.join(result)
if __name__ == '__main__':
num = input('please input num...')
flag = r... |
3e33af25150d48a151199e228c2d42336e592176 | jiabin1122/python_practice | /level1/practice_8.py | 597 | 3.6875 | 4 | """
8.合并表记录
数据表记录包含表索引和数值,请对表索引相同的值进行合并,即相同的索引的数值进行求和运算
输出按照key值升序进行输出
"""
list_demo = [('b',2),('a',3),('a',1)]
num0 = list_demo[0][0]
dict_temp = {num0:0}
dict_result = {}
for item in list_demo:
if item[0] in dict_temp:
dict_temp.update({item[0] : dict_temp[item[0]] + item[1]})
else:
dict_t... |
9a13b228d42cfa0188bcd0e1c1439381f1ef280b | aluruiz/ugr-DAI | /P1/ejer/ejer_01_01.py | 562 | 3.859375 | 4 | import random
#Ejercicio 1
print("Juego de Adivinar")
numero = random.randrange(100)
print("Adivina el numero del 1 al 100")
adivina = int(input())
opciones = 10
while adivina != numero and opciones > 0:
if adivina > numero:
print("El numero buscado es menor. In3serta otro:")
adivina =... |
195acffe50e313bc0681f36b891be821d88f8b64 | sapprog/hangman | /hangman.py | 3,172 | 3.78125 | 4 | import random
def hangman(word): # Функция с игрой, параметр - слово, которое нужно отгадать
words = ['idiot', 'retard', 'motherfucker', 'asshole', 'bastard']
random_word = random.randint(0, 4)
word = words[random_word]
wrong = 0 # Кол-во ошибок в отгадывании букв
stages = ['', # Список с рисун... |
6eb1e77461dbcbe03df674bdc8c0887dffa601c9 | emiruzun0/First-Python-Exercises | /whileLoop.py | 203 | 3.734375 | 4 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 17 01:18:07 2020
@author: Emirhan UZUN
Loops (While Loops)
"""
count = 1
sum = 0
while count <= 10:
sum = sum + count
count = count+1
print(sum) |
154d403e9bac5eb3ea9dadbeb61ff6589caf5e86 | emiruzun0/First-Python-Exercises | /classesAndObjects.py | 1,002 | 4 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 2 14:32:28 2020
@author: Emirhan UZUN
Classes and Objects
"""
class Apple:
color = ""
flavor = ""
jonagold = Apple()
jonagold.color = "red"
jonagold.flavor = "sweet"
print(jonagold.color)
print(jonagold.flavor)
print(jonagold.color.upper())
golden = Appl... |
5bfad2734bbe1f361a8a05ef8c40447376618acd | emiruzun0/First-Python-Exercises | /recapDemo3.py | 371 | 4.0625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 17 17:44:05 2020
@author: Emirhan UZUN
Prime Number
"""
primeNumber = int(input("Enter a number : "))
control = True
for x in range(2,primeNumber):
if primeNumber % x == 0:
control = False
break
if control == False :
print("This is not a pr... |
7397fc9b1de1c5d17729a7d55659b6b4e6518d8a | emiruzun0/First-Python-Exercises | /sets.py | 839 | 4 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 15 20:17:08 2020
@author: Emirhan UZUN
"""
mySet = {"Emir","Ali","Elif"}
mySet2 = set(["Aa","Bb","Cc"]) #Other definiton
print(mySet)
for names in mySet:
print(names) #Set elements are not ordered and indexed
print("Ali" in mySet) #Search in set
if "Ali" in... |
74e4f7a233f8e3b5887602db2072ec4b52277138 | Franceshe/Recommendation-System-Best-Practice | /Recommendation_Systems_with_TensorFlow/download_Movelens_data.py | 3,271 | 3.5 | 4 | # @title Load the MovieLens data (run this cell).
# Download MovieLens data.
print("Downloading movielens data...")
from urllib.request import urlretrieve
import zipfile
urlretrieve("http://files.grouplens.org/datasets/movielens/ml-100k.zip", "movielens.zip")
zip_ref = zipfile.ZipFile('movielens.zip', "r")
zip_ref.ex... |
b1523bb9f18d349d8c199d487af40b33ccb0ba8a | BadrChoubai/BookstacksCLI | /Book.py | 673 | 3.5 | 4 | from enum import Enum
class ExtendedEnum(Enum):
@classmethod
def list(cls):
return list(map(lambda c: c.value, cls))
class Shelf(ExtendedEnum):
WANT_TO_READ = "WANT_TO_READ"
READING = "READING"
READ = "READ"
class Book:
def __init__(self, author: str, title: str, shelf: str = "WANT... |
bea7ba5027829daa9bef8151b1017031d8e7a6ed | PenguinDan/Reference | /Python_Flask/Routing.py | 2,308 | 3.890625 | 4 | from flask import Flask
app = Flask(__name__)
# Simple routing
@app.route('/')
def index():
return 'Index Page'
@app.route('/hello')
def hello():
return 'Hello, World'
# Routing using variable rules
# The function will receive the <variable_name> as a keyword argument. Optionally, you can use a converter to ... |
ddcf1d567edc58322dedd8d534772d1199940455 | GabrielMuJi/EjerciciosPython | /01Ejercicio4.py | 566 | 4 | 4 | """
Ejercicio 04
Escribir un programa que use un ciclo definido con rango numérico, que
averigüe a cuántos amigos quieren saludar, les pregunte los nombres de esos
amigos/as, y los salude.
"""
leyendo = True
while leyendo:
numeroAmigos = input("Escribe tu número de amigos")
try:
numeroAmigos = int(num... |
3b0600d125e59325c3f5e1cc8bf56097a7611467 | GabrielMuJi/EjerciciosPython | /01Ejercicio8.py | 449 | 3.78125 | 4 | """
Ejercicio 08
Escribir un programa que imprima todos los números pares entre dos números que
se le pidan al usuario
"""
leyendo = True
while leyendo:
try:
numero1 = int(input("Introduzca el 1er número "))
numero2 = int(input("Introduzca el 2do número "))
leyendo = False
except Value... |
5da60717d45f83e69b7818fd7b113352c8732ab1 | yeijSong/LearningPython | /21.05.13/Python04_01_PrimeNumber_송예지.py | 1,602 | 3.765625 | 4 | '''
[4일차 실습 예제01]
#소수 판별 프로그램 작성#
- 소수란?
1과 자기 자신만으로 나누어 떨어지는 1보다 큰 양의 정수.
이를테면 2,3,5,7,11,13,17,19,23,29,31...등은 모두 소수.
- 조건
1. 사용자로부터 20이상의 수를 입력받는다.
2. n<20이면 '숫자확인하세요'
3. n>=20이면 소수 판별 출력
'''
'''
a=int(input('20이상의 숫자를 입력하세요:'))
if a>=20:
b=0
for i in range(2,a):
if a%i==0:
b=1... |
d5f3a235fd54a86617461fa003d7dc0ecbf00cdb | yeijSong/LearningPython | /21.05.17/Python06_07_DictionaryEx04_송예지.py | 482 | 3.6875 | 4 | #< 딕서녀리 관련 함수들 >
#Key 리스드 만들기(Keys)
a={'name':'pey','phone':'0119993323','birth':'1118'}
print(a.keys())
print('')
'''
dict_keys,dict_values,dic_items 등은 리스트로 변환하지 않더라도
기본적인 반복(iterate)구문(ex_for문)을 실행할 수 있다.
'''
for k in a.keys():
print(k)
print('')
#dict_keys 객체를 리스트로 변환하려면 다음과 같이 하면 된다.
vList=... |
5f1b7faa4326f48018cde4fb556dbedd9bd3de20 | yeijSong/LearningPython | /21.05.11/Python02_06_BreakEx01_송예지.py | 70 | 3.703125 | 4 | no=0
while True:
no=no+1
print("Break Check")
if no>3:
break |
5bae7ca4305de784f088fc5beeaec03b7e002e06 | yeijSong/LearningPython | /21.05.14/Python05_04_CollectionList01_송예지.py | 371 | 3.953125 | 4 | '''
형식:리스트명=[요소1,요소2,요소3,...]
a=[]
b=[1,2,3]
c=['life','is','too','short']
d=[1,2,'life','is']
e=[1,2,['life','is']]
*비어 있는 리스트는 a=list()로 생성할 수도 있다.
'''
print('**리스트의 인덱싱과 슬라이싱**')
a=[1,2,3]
print('a=[1,2,3]')
print(a[0])
print(a[1]+a[2])
print(a[-1])
print('-'*15) |
bbbe632681579624bfe4af8a460e9ce9e84cbd14 | yeijSong/LearningPython | /21.05.11/Python02_07_autoMachine_Step01_송예지.py | 1,462 | 3.71875 | 4 | '''
홍익대학교 과일 판매머신 V01
1.orange:1000원
2.strawberry=2500원
3.peach=1500원
4.mango=2000원
5.grape=2000원
6.판매종료
구매번호를 입력하세요
조건1 해당번호를 입력 -> orange 1000원입니다
조건2
'''
'''
print(*****홍익대학교 과일 판매머신 V01*****)
print("1=Orange=1000원")
print("2=Strawberry=2500원")
print("3=Peach=1500원")
print("4=Mango=2000원")
pri... |
9e31388b50103c1b7f9fb87ea47e8495ab6a9c6c | yeijSong/LearningPython | /21.05.10/Python12_elif_송예지.py | 315 | 3.75 | 4 | #90점 이상이면 A학점
#80점 이상이면 B학점
#70점 이상이면 C학점
#60점 이상이면 D학점
#이외에는 F학점
Score=55
if Score>=90:
print("A학점")
elif Score>=80:
print("B학점")
elif Score>=70:
print("C학점")
elif Score>=60:
print("D학점")
else:
print("F학점") |
35022e796c558de50eae9b0857ce9f68feca0424 | AnsgarKlein/AdventOfCode2020 | /day23.py | 3,089 | 3.734375 | 4 | #!/usr/bin/env python3
from typing import List
import sys
def read_input_file(filename):
with open(filename, 'r') as input_file:
return [int(num) for num in input_file.read() if num != '\n']
def moves(cups: List[int], num_moves: int, verbose = True):
move_id = 1
current_id = 0
len_cups = len... |
f8047524b5d2220fcc6f2b9faec8d72df6817b7b | lzl82891314/AlgorithmDeliberatePractice | /src/geek time/python/week01/70. Climbing Stairs.py | 222 | 3.890625 | 4 | def climbStairs(n: int) -> int :
if n < 3:
return n
f1 = 1
f2 = 2
for i in range(3, n + 1):
f2 += f1
f1 = f2 - f1
return f2
if __name__ == "__main__":
print(climbStairs(10)) |
a20af96d394d6da64fd13ef0e20887c0a6ba5d73 | 3797kaushik/turbo-fortnight | /electronic.py | 598 | 3.75 | 4 | '''
hacker rank
https://www.hackerrank.com/challenges/electronics-shop/problem
'''
def getMoneySpent(keyboards, drives, b):
#
# Write your code here.
#
list_data = []
for data in drives:
for k in keyboards:
total = data + k
if total <= b:
list_data.... |
baf4f3d5c8f6b43e6d31bf60f00996fa9334227f | xbaa/collatz | /collatz.py | 451 | 4 | 4 | """Plain collatz formula which stops after reaching a number lower than its initial input. Outputs the frequency of repetition and the number of separate times divided by a power of two."""
def collatz(n):
x = n
permut = []
poweroftwo = 1
while x >= n:
if x % 2 == 0:
x = x/2
if x % 2 != 0 or x < n:
per... |
9f3251b798875486a9dd24467e1ecf4ca59329ed | androshchyk11/lab8 | /1.3/1.b.py | 646 | 4.09375 | 4 | import numpy as np
array = np.zeros((3,3),dtype=int) #Оголошуємо першу матрицю та заповнюємо її нулями
arrayT = np.zeros((3,3), dtype=int) #Оголошуємо другу матрицю та заповнюємо її нулями
for i in range(3):
for j in range(3):
x = int(input(f"array[{i}][{j}] = ")) #Поелементно заповнюємо першу матрицю
... |
d3b82c2369da330b52ad462d1268ea2101659d7a | bhattsameer/HackerRank_Solutions_Python | /Algorithms and Challanges/Stair-case.py | 280 | 4.0625 | 4 | #!/bin/python
from __future__ import print_function
import os
import sys
#
# Complete the staircase function below.
#
def staircase():
n = int(input())
for i in range(n):
print(" "*(n-i-1)+"#"*(i+1))
if __name__ == '__main__':
staircase()
|
ae0ee943b022a73f8864057c6c12916615c5ca9d | hasanalpzengin/HummingDrone | /Question_1/fibonacci.py | 384 | 4.1875 | 4 | import sys
#recursive
def fibonacci(num):
if num < 2:
return num
else:
return fibonacci(num-1)+fibonacci(num-2)
if __name__ == "__main__":
#first parameter
try:
num = int(sys.argv[1])
output = fibonacci(num)
print("Fibonacci {} = {}".format(num ,output)... |
502c23711779afa7ef3cd4c55ef2266c06933d63 | nastasia18/calculate_economy | /ffff.py | 13,832 | 3.5625 | 4 | from tkinter import *
from tkinter import messagebox
root = Tk()
root.title("Калькулятор ОПФ")
root.geometry("300x400")
main = Frame(root)
main.pack()
def clear():
global main, root
main.destroy()
main = Frame(root)
main.pack()
def cost_opf_end_of_year(position):
clear()
def calc():
... |
1e8ba50a61b4887140232b3a2f937ce26eca4c7c | Cal-0/cs-sprint-challenge-hash-tables | /hashtables/ex3/ex3.py | 608 | 3.734375 | 4 | def intersection(arrays):
cache = {}
intersection = len(arrays)
numbers = []
for nums in arrays:
for i in nums:
if i not in cache:
cache[i] = 1
else:
cache[i] += 1
if cache[i] == intersection:
numbers.app... |
cc1e7dc9589adffef22bfa88861412e16e619c56 | EvaHelloKitty/SummerTech2017 | /Python_by_Phil/for.py | 92 | 3.6875 | 4 | y=0
for x in range (0,100):
print ("Badtz Maru")
print (x)
y=x+y
print (y)
|
033746c7fe8a358006c1d9f51d2d6a496b3e1f15 | EvaHelloKitty/SummerTech2017 | /Python_by_Phil/Rock Paper + Scissors.py | 94 | 3.609375 | 4 | choice=input("Chose rock paper or scissors!")
computer=rock
if= (choice= "scissors")
print |
f904becb2ed7f47133cb64e315ec82bdf1c77a14 | EvaHelloKitty/SummerTech2017 | /Python_by_Phil/times table.py | 126 | 3.953125 | 4 | y=eval(input("Put in a number, I'll give you the multiplication tables for it!"))
for x in range (0,11):
print (x*y)
|
4aab4c8ade5007a777057375b4962178bf35e07d | EvaHelloKitty/SummerTech2017 | /Python_by_Phil/MadLib.py | 710 | 4.03125 | 4 | name1= input ("put in your name")
print (name1)
gender1= input ("put in your gender")
print (gender1)
if ("girl"):
(gender2)=("her")
(gender3)=("she")
if ("boy"):
(gender2)=("his")
(gender3)=("he")
noun1= input("put in a noun")
print (noun1)
verb1= input("put in a verb")
print (verb1)
noun2= input("put ... |
120591140f6cd5e4a638dbfa54b40ad53b436360 | djazzlab/lego-ev3-cube-solver | /Classes/Rubik/Corner.py | 1,598 | 3.671875 | 4 | class Corner:
_SquarePosition1 = 0
_SquarePosition2 = 0
_SquarePosition3 = 0
def __init__(self):
return
######################
# Properties Methods #
######################
#
# SquarePosition1 property
@property
def SquarePosition1(self):
return self._Square... |
5af704a39acb0092f5d7c9849859b8d5e1e8a15b | frankMagoba/Random-problems | /src/Python/Migratory Birds/migratorybirds.py | 599 | 3.5 | 4 | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the migratoryBirds function below.
def migratoryBirds(arr):
typecount = [0 for i in range(5)]
for i in arr:
typecount[i-1] += 1
max_count = max(typecount)
for i in range(5):
if typecount[i] == max_count:... |
725aa2a2b0a1e9844daf52bf78f072cccfebdbea | jburgoon1/python-practice | /34_same_frequency!/same_frequency.py | 428 | 3.609375 | 4 | def same_frequency(num1, num2):
"""Do these nums have same frequencies of digits?
>>> same_frequency(551122, 221515)
True
>>> same_frequency(321142, 3212215)
False
>>> same_frequency(1212, 2211)
True
"""
num1_list = list(num1)
nu... |
98ab1bba3ca9366cc2349a02228db73d63a37c84 | ilove789110/py | /advancedDataStructures/counter.py | 1,283 | 3.515625 | 4 | # -*- coding: utf-8 -*-
import re
from collections import Counter
aList = ["Dog", "Cat", "Mouse", 42, "Dog", 42, "Cat", "Dog"]
a = Counter(aList)
print a
aSet = set(aList)
print len(aSet)
print "{0}:{1}".format(a.values(), a.keys())
print(a.most_common(3))
string = """ Lorem ipsum dolor sit amet, consectetu... |
9cf17dbe3fbd71b2c2f761d3b7c5534a11666cad | pshibu777/Flask | /dictionary.py | 213 | 4 | 4 | print("Dictionary")
#Dictionary is powerfull
ages = {"Alice":22, "Bob":27}
print(ages)
print("Adding a new variable charlie")
ages["Charlie"] = 30
print("increase 1 value for Alice")
ages["Alice"] +=1
print(ages)
|
4556954474760007d306867d344055a8671f576f | dmbernaal/Omega_Dev | /Model_Z/omega_analysis.py | 1,370 | 3.875 | 4 | import os
import pandas as pd
import numpy as np
def return_open_close_change(df_, target_):
"""
This function will return a new pandas series with percentage change between opening price of target time and close of starting price.
ARGS:
df_: <pandas dataframe object>
target_: <int> - ... |
2a33aa27b311ec66c844ee5be8c353f45bd32a0f | C-CCM-TC1028-111-2113/homework-2-EricCaballeroM | /assignments/01IdentificaSigno/src/exercise.py | 315 | 3.890625 | 4 | import math
def main():
#escribe tu código abajo de esta línea
#Identifica signo
a=int(input("give me a number: "))
if (a<0):
print("your number is negative")
elif (a>0):
print("your number is positive")
else:
print("your number is cero")
pass
if __name__ == '__main__':
main()
|
390660e3a2b6e4e809aa668b993ef77e09ec16be | rohanpdesai/mysecondproject | /Fibonacci.py | 120 | 3.75 | 4 | n = int(input("Enter n = "))
a = 0
b = 1
c = a + b
print(a)
print(b)
while c<=n:
print(c)
a = b
b = c
c = a + b
|
d99d4838c4fd18bb716b0aa6f435de40e7e54251 | Yuweiluo1618/Python-Advanced-Project | /interator/06_generator.py | 278 | 3.5625 | 4 | list_data = [ value for value in range(10)]
print(list_data)
#generator
generator1 = (value for value in range(10))
print(next(generator1), '->')
for value in generator1:
print(value)
def generator2():
yield 100
print(next(generator2()))
print(next(generator2())) |
e31498072969f88b1a44a691b6a52d8d0c9ac0c6 | Yuweiluo1618/Python-Advanced-Project | /magic_method/magic_method.py | 585 | 3.5 | 4 | class Goods(object):
color = "white"
def __init__(self):
self.name = "Jack"
self.age = 16
def __call__(self, *args, **kwargs):
print("-------call---------")
def __str__(self):
return "This is Goods object"
def __getitem__(self, item):
print(item)
def _... |
9f5c2a8fbd15cef1cb04acf3b4e3b1557183ddcc | Yuweiluo1618/Python-Advanced-Project | /TCP_WebServer/first_simple_http_server.py | 1,097 | 3.53125 | 4 | import socket
#This is the simple http_server code can handle simple http service will update
def http_handle(new_tcp_client_socket, ip_port):
request_data = new_tcp_client_socket.recv(2048)
if len(request_data.decode()) == 0:
print(f'{str(ip_port)} has disconneted')
new_tcp_client_socket.close(... |
151f6d503f165d847ca1639bb8e8e0d6170d3f9c | FilipVidovic763/vjezba | /sm.py | 496 | 3.59375 | 4 | class Car:
"""definiramo klasu koja predstavlja auto"""
# varijable klase
motor = True
# konstruktor
def __init__(self):
"""funkcija koja se poziva prilikom instancijacije objekta"""
print('stvoren auto!')
self.fuel = 0
self.speed = 0
# metoda
def refuel(self,fuel):
"""postavi količinu goriva"""... |
1d3b9211cd85089fdfdb8fbe4c68028f933fa05e | FilipVidovic763/vjezba | /napad_orkova.py/napadOrkova2.py | 2,438 | 3.515625 | 4 | """
aplikacija: Napad orkova v0.05
autor: Filip Vidović
"""
import random
import textwrap
import sys
def naslov():
ukras='-'
sirina=72
ukras=ukras*sirina
poruka= """
Hrabri vitez Talion vraća se iz boja i želi predahnuti u jednom seocetu.
U seocu se nalazi 5 kućica i želi stupiti ... |
856a125bacefe1f5f9e799a5d229034d8d89a1d1 | FilipVidovic763/vjezba | /vjezbe14.py/test_anjc.py | 2,086 | 3.53125 | 4 | import unittest
from anjc import Anjc
class Anjctestcas(unittest.TestCase):
def test_size_of_deck(self):
game_test=Anjc()
deck= game_test.create_deck()
self.assertEqual(len(deck),52, "Deck ima 52 karte")
def test_shuffle_randomizes_deck(self):
game_test=Anjc()
deck_one=... |
f7acc0514ca7d28ff5f998f6cc05a51567e7d433 | Nerfaith/RandomPasswordGen | /passwordgenerator.py | 383 | 3.609375 | 4 | import random
import string
# Get the random password
def get_random_password_string(length):
password_characters = string.ascii_letters + string.digits + string.punctuation
password = "".join(random.choice(password_characters) for i in range(length))
print("Random string password is:", password)
... |
b1e2341cb884d5a7741952e372f59bc011c8ce95 | AgumaOgwal/cs50x | /pset6/similarities/helpers.py | 2,835 | 3.546875 | 4 | # first action item
# Use sent_tokenize from the Natural Language Toolkit to "tokenize" (i.e., separate) each string into a list of sentences
from nltk.tokenize import sent_tokenize
def lines(a, b):
"""Return lines in both a and b"""
# First, split strings
# a bug with check 50. had to include "\n" inside... |
7ce377f8d3d95a0d895c67e31fc4397e98e855bd | jiangmeilan/python-learning | /sort.py | 5,052 | 3.84375 | 4 | import random
#1sort merge
def merge(a, b):
a_i = 0
b_i = 0
c = []
while a_i < len(a) and b_i < len(b):
if a[a_i] < b[b_i]:
c.append(a[a_i])
a_i += 1
else:
c.append(b[b_i])
b_i += 1
if a_i < len(a):c += a[a_i:]
if b_i < len(b):c += ... |
ade6f9461899f60320e1ee0ceb3356dc1b78861b | jianyuecc/python_learn | /python函数的定义/Lambda形式/make_incrementor.py | 921 | 4.15625 | 4 | 出于实际需要,有几种通常在函数式编程语言例如 Lisp 中出现的功能加入到了
Python。通过 lambda 关键字,可以创建短小的匿名函数。这里有一个函数返回它
的两个参数的和: lambda a, b: a+b 。 Lambda 形式可以用于任何需要的函数对
象。出于语法限制,它们只能有一个单独的表达式。语义上讲,它们只是普通函数
定义中的一个语法技巧。类似于嵌套函数定义,lambda 形式可以从外部作用域引
用变量:
>>> def make_incrementor(n):
... return lambda x: x + n
...
>>> f = make_incrementor(42)
>>> f(0)
42
>>> ... |
7f5f33b40f1a8d3acc72c889bef1accf9432abb7 | rubenvdham/Project-Euler | /euler009/__main__.py | 833 | 4.4375 | 4 | """
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
"""
def find_triplet_with_sum_of(number):
sum = number
number = int(number/2)... |
5710724d0076472f5f53ea51ad4e4f1dc1cc4170 | rubenvdham/Project-Euler | /euler017/__main__.py | 255 | 3.609375 | 4 | from num2words import num2words
def get_result():
result = 0
for i in range(1, 1001):
word = num2words(i).replace(" ", "").replace("-", "")
result += len(word)
return result
if __name__ == "__main__":
print(get_result()) |
03096513cf41a94635528241aee931305c30fbc7 | karmaUdel/practice | /makingChange.py | 1,826 | 3.71875 | 4 | import unittest
def recurse(amount,denomination,size):
if amount == 0 :
return 1
if amount < 0 :
return 0
if size<=0 and amount >=1:
return 0
return recurse(amount,denomination,size-1)+recurse(amount - denomination [size-1], denomination, size)
def iterateWithMemo... |
529f1ab81964a0249a71e17abe827c95a4939521 | karmaUdel/practice | /maxProdct.py | 1,988 | 3.921875 | 4 | import unittest
def highest_product_of_3(list_of_ints):
# Calculate the highest product of three numbers
if len(list_of_ints) <3:
raise Exception
mx1 = -1000000
mx2 = -1000000
mx3 = -1000000
mn2 = 1000000
mn3 = 1000000
for ints in list_of_ints:
if mx1 <ints:
... |
a4b0d44ffdd67605f408b958575afc89268e380e | karmaUdel/practice | /Fibbonacci.py | 1,869 | 3.625 | 4 | import unittest
mem = {}
def fib(n):
# Compute the nth Fibonacci number
if n == 0 or n ==1:
return n
if n < 0:
raise Exception
result = fib(n-1)+ fib (n-2)
mem[n] = result
return result
#return -1
MAX = 1000
# Create an array for memoization
f = [0] * MAX
# ... |
77b256cac7d0b625ab35cf8840678ce3ae33bce4 | sreenikethMadgula/projectEuler | /problem5.py | 1,524 | 3.859375 | 4 | # lcm of 1-10 = 2520
# find lcm of 1-20
lcm = 1
def sieveEratosthenes(n):
array = [] #array of primes
prime = [True for i in range(n+1)]
p = 2
while(p*p <= n):
if prime[p]==True:
for i in range(p*p,n+1,p):
prime[i]=False
p+=1
... |
7b50845812d0781ceb6ad208745ecc4af5db0385 | yeshivsher/auto-downloads-manager | /myserver/server/torrent downloader/povies.py | 2,967 | 3.515625 | 4 | """
Povies class
"""
import os
import sys
import subprocess
import requests
class Povies(object):
"""
This class provides methods for movie requests
"""
def __init__(self):
pass
def movies(self, limit):
"""
- List some movies
- Requires a limit
- Movies ... |
44911c9b43906b58e2f619486889fc97371ed400 | Moustafaali2019/Sudoku-puzzle | /andokuclass.py | 18,678 | 3.71875 | 4 | class Cellclass:
"""each number in the sudoku include cell contains value and probability list"""
def __init__(self):
self.value = 0
self.prob = [False] * 9
def setvalue(self, value):
self.value = value
def setprob(self, position):
self.prob[position] = True
def g... |
6dca447e34a8278890a474edd2e0dd4f8e236030 | lijingchn/MyThreading | /prodcons.py | 845 | 3.828125 | 4 | #!/usr/bin/python
# encoding:utf-8
import random
import time
import datetime
from Queue import Queue
from threading import Thread
queue = Queue(10)
class Producer(Thread):
def run(self):
elem = random.randrange(9)
queue.put(elem)
print "{}厨师{}做了{}碗饭,还剩{}碗饭没卖完~".format(datetime.datetime.n... |
156ce2abce7f089a563208dd1947eb0276c00a20 | romeoalpharomeo/Python | /fundamentals/fundamentals/rock_paper_scissors.py | 1,670 | 4.5 | 4 | """
Build and application when both a user and computer can select either Rock, Paper or Scissors, determine the winner, and display the results
For reference:
Rock beats Scissors
Scissors beats Paper
Paper beats Rock
Part I
Compare user input agains computer choice and determine a winner
Part II
Compare user input ... |
f7675f715c4023b6d01d8e16de459839dd7deb7b | romeoalpharomeo/Python | /fundamentals/extras/diceroller.py | 555 | 3.765625 | 4 | from random import randint
def roll_dice(modifier = 0, number_of_dice = 1, sides_of_dice = 20):
#xdy - x > number of dice, and y > number of sides
#1d20 -> 1 20 sided die
#3d6 -> 3 6 sided die
total = 0
for i in range(0,number_of_dice):
total += randint(1, sides_of_dice)
return total
d... |
828710d56c28619acb5963589129e8d58f2c7072 | romeoalpharomeo/Python | /fundamentals/fundamentals/functions_intermediate_i.py | 3,230 | 3.8125 | 4 | x = [ [5,2,3], [10,8,9] ]
students = [
{'first_name': 'Michael', 'last_name' : 'Jordan'},
{'first_name' : 'John', 'last_name' : 'Rosales'}
]
sports_directory = {
'basketball' : ['Kobe', 'Jordan', 'James', 'Curry'],
'soccer' : ['Messi', 'Ronaldo', 'Rooney']
}
z = [ {'x': 10, 'y': 20} ]
"""
Change the v... |
0e792822cb1faeda92a0c0fec8bb86901c40aa09 | anmolrajaroraa/CorePythonBatch | /largest-among-three.py | 1,385 | 4.46875 | 4 | # num1, num2, num3 = 12, 34, 45
# if (num1 > num2) and (num1 > num3):
# print("The largest between {0}, {1}, {2} is {0}".format(num1, num2, num3))
# elif (num2 > num1) and (num2 > num3):
# print("The largest between {0}, {1}, {2} is {1}".format(num1, num2, num3))
# else:
# print("The largest between {1}, {... |
25886862ce98863e85f8a3bc3b8d5d928c72fa31 | anmolrajaroraa/CorePythonBatch | /armstrong-narcissistic.py | 351 | 3.9375 | 4 | digitCount = len((num:= input("Enter a number to check: ")))
temp = (num: = int(num))
sum = 0
while temp > 0:
digit = temp % 10
sum += digit ** digitCount
temp //= 10
print(num, "is an Armstrong no") if num == sum else print(
num, "is not an Armstrong no")
# num == sum ? true: false // C
# true if c... |
d79955ff44c801c36baa8670543f1cbfe5f71352 | anmolrajaroraa/CorePythonBatch | /exception.py | 758 | 3.84375 | 4 | # print(10/0)
# open("abc.py")
# pin = "1234"
# userPin = input("Enter your PIN: ")
# if userPin == pin[::-1]:
# raise ValueError("Reverse PIN detected..account blocked")
def calc(a, b, operator):
print(eval(a + operator + b))
while True:
choices = {
1: '+',
2: '-',
3: '*',
... |
556e74e4a80e0bc949d77111e7c8e0f3b2f2b187 | ashwin25march/ashwinbasics | /src/python/4 while/hello4.py | 86 | 3.578125 | 4 | count = 1
while count < 100:
count += 1
print("aaassshhhwwwiiinnn")
print(count) |
ac023cd6280e5c864136fa34c2c8cd9bfd65b17d | PythonGirlsGranada/role_game | /game.py | 15,578 | 3.703125 | 4 | #!/usr/bin/env python
import random
# PENDIENTE DEL DIA ANTERIOR:
'''
- documento memories, necesario cambiarlo
'''
#dice
min = 0
max = 99
cla = "none"
name_ = "dummy"
answer = "no"
roll_dice = "no"
action = "none"
lo_tengo = False
#he_ido = False
#text blocks
intro = open("introduction.txt","r")
dice_rule = op... |
aa0bc1725fcdb07bb88285cf2a9795bb211e344a | davixcky/holbertonschool-higher_level_programming | /0x03-python-data_structures/6-print_matrix_integer.py | 254 | 3.984375 | 4 | #!/usr/bin/python3
def print_matrix_integer(matrix=[[]]):
for row in matrix:
for cell in range(len(row)):
end_char = ' ' if cell + 1 != len(row) else ''
print('{:d}'.format(row[cell]), end=end_char)
print()
|
b595effb9993bb7999b7c102566ae79a3f3e6817 | davixcky/holbertonschool-higher_level_programming | /0x07-python-test_driven_development/2-matrix_divided.py | 1,233 | 3.609375 | 4 | #!/usr/bin/python3
''' Module 2 for task 1'''
def matrix_divided(matrix, div):
''' Divide each element of a matrix by dev '''
errors = {
'matrix': 'matrix must be a matrix (list of lists) of integers/floats',
'row': 'Each row of the matrix must have the same size',
'div': 'div must be ... |
782019d56f35c65b24b5f26a682b0fb92ff7478b | davixcky/holbertonschool-higher_level_programming | /0x07-python-test_driven_development/0-add_integer.py | 361 | 4.3125 | 4 | #!/usr/bin/python3
''' Add integer module '''
def add_integer(a, b=98):
''' Function that add to numbers '''
type_a, type_b = type(a), type(b)
if type_a != int and type_a != float:
raise TypeError('a must be an integer')
if type_b != int and type_b != float:
raise TypeError('b must be ... |
84bfb6fc27f52409dda07670e75b83b79b460461 | davixcky/holbertonschool-higher_level_programming | /0x0B-python-input_output/13-student.py | 789 | 3.734375 | 4 | #!/usr/bin/python3
'''Module for task 13'''
class Student:
'''Defines a student'''
def __init__(self, first_name, last_name, age):
'''Constructor'''
self.first_name = first_name
self.last_name = last_name
self.age = age
def to_json(self, attrs=None):
'''JSON repre... |
290b3a1254c3e1378baad2a7ce74aa34a3affc2d | kmalakhova/battleship | /battleship/game.py | 2,386 | 3.828125 | 4 | from .board import Board
import string
from collections import OrderedDict
class Game():
def __init__(self, guesses, quit):
self.guesses = guesses
self.quit = quit
def guesses_left(self):
self.guesses -= 1
while self.guesses != 0:
return True # How to say goodbye?
... |
26e3ddd4f07f64454def7b21df51514cb552db53 | Arpandas93/Hello-World | /Infinite_Loop.py | 173 | 3.84375 | 4 | while (True):
pw = input("Entre the Password :")
if pw == "Myname":
break
else :
print ("Password is Wrong")
print("Access is Granted")
|
4cc5a5142d1dfe950d2ed66be32b316090ec762e | Arpandas93/Hello-World | /String_Summation.py | 138 | 3.59375 | 4 | Str_var="test"
aftersum=Str_var + "Value"
print(Str_var,"+ value =",aftersum)
aftermul=Str_var *3
print(Str_var,"* 3 =", aftermul) |
ca0e4819ccf7c7d888529ecf0bb5192a741b1c74 | KongmingCN/python_intro | /Introductory course for python/lecture 1/ex2.4.py | 325 | 4.0625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 1 20:14:55 2019
@author: u3567723
"""
n = int(input())
for i in range(2, n+1):
if i == 2:
print(i)
continue
isPrime = True
for j in range(2, i):
if i % j == 0:
isPrime = False
break
if isPrime:
pri... |
4449645a1ba505be41735217cae3a2b2ae9f650e | KongmingCN/python_intro | /Introductory course for python/lecture 1/ex2.2.py | 170 | 3.6875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 1 19:57:30 2019
@author: u3567723
"""
n = int(input())
while n > 0:
digit = n % 10
n = n // 10
print(digit) |
5a38d95fe9db58447d65605ddfef48559e6ae689 | angjerden/kattis | /pizza_crust/pizza_crust.py | 845 | 4.1875 | 4 | '''
George has bought a pizza. George loves cheese.
George thinks the pizza does not have enough cheese.
George gets angry.
George’s pizza is round,
and has a radius of R cm. The outermost C cm is crust,
and does not have cheese. What percent of George’s pizza has cheese?
Input
Each test case consists of a single li... |
14fc091ee12c9a6e841096e6e1e8f253863beeb3 | jeffbergcoutts/udacity-compsci | /lesson11.py | 1,373 | 4.53125 | 5 | '''
How to Manage Data
'''
# Quiz: Stooges
stooges = ['Moe', 'Larry', 'Curly']
# Quiz: Days in a Month
days_in_month = [31,28,31,30,31,30,31,31,30,31,30,31]
def how_many_days(month):
return days_in_month[month - 1]
print how_many_days(2)
print how_many_days(9)
# Quiz: Countries
countries = [['China','Beijing',1... |
e161fc2350ea8b2f70bf51ebdb7a96c44e6eaa0d | gogutheglorious/Python-Projects | /sort.py | 504 | 3.625 | 4 | isSorted=False
count=0
def sortList(a):
global count
global isSorted
n=len(a)
if (count%n==0 and isSorted==True):
count=0
return
elif(count%n==0):
isSorted=True
if(a[count%n]>a[(count+1)%n]):
isSorted=False
temp=a[count%n]
a[count%n]=... |
1e0e9f789c65d252092168bbf9d90f89092f0c17 | maryade/Personal-Learning-Python | /Udemy Python Practice programming Module 3.py | 918 | 4.46875 | 4 | # # Addition
# print(5+3)
#
# # Subtraction
# print(11-4)
#
# # multiplication
# print(22*5)
#
# # division
# print(6/3)
#
# # modulo
# print(9%5)
#
# # exponents
# print(2^4)
# print(6**2)
#
# # return integer instead of floating number
# print(11//5)
# print(451//5)
# assignment operation
x = 18
# print(x)
# to i... |
2c5dfa49de5c4c8c63bd991829f29f8c963314c4 | Yuto-M/study-python | /greet.py | 602 | 3.96875 | 4 | # 関数の書き方
def greet(hour):
if 4 < hour < 12:
print('good morning')
elif 12 < hour < 18:
print('good afternoon')
else:
print('good evening')
greet(8)
greet(17)
greet(21)
# 辞書(dict。phpでいうところの連想配列)
jobs = {
"John": "Guitar",
"Paul": "Guitar",
"George": "Bass",
"Ringo": ... |
e9a2d871d22f89b15928748ddf531332f8cf8ad1 | apnisha96/MyProject | /runner.py | 354 | 3.796875 | 4 | runner_scores=list(input("Enter the scores"))
def runneris(scores):
score = scores[0]
for i in range(len(scores)-1):
if(score < scores[i+1]):
runner = score
score = scores[i+1]
else:
score = scores[i]
return runner
runner_score = runneris(runner_scores)
p... |
0cc29ca4535171178e4c1d8a2903ecdc8b040bfa | YoungWoongJoo/CodeUp-Python-basic-100 | /6087/main.py | 433 | 3.8125 | 4 | """
1부터 입력한 정수까지 1씩 증가시켜 출력하는 프로그램을 작성하되,
3의 배수인 경우는 출력하지 않도록 만들어보자.
입력
정수 1개를 입력받는다.
(1 ~ 100)
출력
1부터 입력한 정수보다 작거나 같을 때까지 1씩 증가시켜 출력하되
3의 배수는 출력하지 않는다.
"""
num=int(input())
for i in range(1,num+1):
if i%3==0:
continue
print('%d' %i) |
a927c7e420339c2daf925327697d67ed83bac788 | YoungWoongJoo/CodeUp-Python-basic-100 | /6040/main.py | 283 | 3.515625 | 4 | """
정수 2개(a, b) 를 입력받아 a를 b로 나눈 몫을 출력해보자.
입력
2개의 정수(a, b)가 공백으로 구분되어 입력된다.
출력
a를 b로 나눈 몫을 출력한다.
"""
a, b = input().split()
print(int(int(a)/int(b))) # 또는 print(int(a)//int(b)) |
a60cc3370c04f161e92d0368cf8c8733b9691d0a | YoungWoongJoo/CodeUp-Python-basic-100 | /6070/main.py | 420 | 4.03125 | 4 | """
월이 입력될 때 계절 이름이 출력되도록 해보자.
월 : 계절 이름
12, 1, 2 : winter
3, 4, 5 : spring
6, 7, 8 : summer
9, 10, 11 : fall
입력
월을 의미하는 1개의 정수가 입력된다.(1 ~ 12)
출력
계절 이름을 출력한다.
"""
num=input()
num=int(num)
if num//3==1:
print('spring')
elif num//3==2:
print('summer')
elif num//3==3:
print('fall')
else:
print('winter') |
33c7551c292435f24c4260dacf7f8feb204d7518 | YoungWoongJoo/CodeUp-Python-basic-100 | /6031/main.py | 284 | 3.515625 | 4 | """
10진 정수 1개를 입력받아
유니코드 문자로 출력해보자.
입력
10진 정수 1개(32 ~ 126 범위)가 입력된다.
출력
유니코드 문자로 출력한다.
"""
num = int(input())
print(chr(num)) #chr(num) -> 아스키코드 정수값을 문자로 변환 |
efbb93dfce24a82eedc90d9ae7683a930371ec7d | YoungWoongJoo/CodeUp-Python-basic-100 | /6014/main.py | 145 | 3.625 | 4 | """
실수(real number) 1개를 입력받아 줄을 바꿔 3번 출력해보자.
"""
float1 = input()
print(float1)
print(float1)
print(float1) |
91c64bdadf8a55cdd55d8291590122baf2b0c749 | Yasmin-Core/Python | /Mundo_2(Python)/elif/aula12_desafio44.py | 809 | 4 | 4 | produto= float(input(' O valor do produto: R$ '))
print ('''===== FORMAS DE PAGAMENTOS ======
[1] á vista dinheiro/cheque
[2] á vista no cartão
[3] 2 X no cartão
[4] 3 X ou mais no cartão''')
opção = int(input('Qual é a opção?'))
if opção == 1 :
a= produto - (produto * 10 / 100)
print('Você irá pagar neste pro... |
d7cc97c82263e5dd9fd645c1c010fb8fd36957f9 | Yasmin-Core/Python | /Mundo_2(Python)/funcao_break/aula15_desafio69.py | 894 | 3.890625 | 4 | # Contar :
# A) Quantas pessoas tem mais de 18 anos (i)
# b) Quantos homens cadastrados (h)
# C) Quantas mulheres tem menor de 20 anos (m)
h= m= i= 0
# looping infinito
while True:
print('=-=-=- Dados =-=-=-=')
idade= int(input('Quantos anos você tem: '))
sexo= str(input('Qual é o seu sexo[f/m]: '))
... |
2f6759b79cec00fbb71d0d0e376f2769db1c79d9 | Yasmin-Core/Python | /Mundo_2(Python)/while/aula14_desafio62(PA).py | 396 | 4 | 4 | print('--- PA ---')
termo= int(input('Digite o primeiro termo: '))
razão= int(input('Digite a razão: '))
cont = 1
total= 0
mais= 10
while mais != 0:
total= total + mais
while cont <= total:
print('{} -> '.format(termo), end='')
termo= termo + razão
cont = cont + 1
print(' Pausa ') ... |
f73e4148c3c09b175c154138e78b693fdb0847d2 | Yasmin-Core/Python | /Mundo_1(Python)/condicoes(if...else)/aula10_desafio35.py | 293 | 4.03125 | 4 | a= float(input('Digite o comprimento de uma reta:'))
b= float(input('Digite o comprimento de uma reta:'))
c= float(input('Digite o comprimento de uma reta:'))
if a<b+c and b<a+c and c<a+b:
print('Essas 3 retas formam um TRIANGULO')
else:
print('Essa 3 retas NÃo formam um triangulo') |
ba3d6f7e459acdbf56073a48550d1efce5e36bb9 | Yasmin-Core/Python | /Mundo_2(Python)/funcao_break/aula15_desafio66(break).py | 452 | 3.90625 | 4 | ## Utilizando a função BREAK - interropendo os looping
# s -> soma
s=0
# contador / indice -> coemça a contar do -1 para nao contar o 999( numero de parada )
c= -1
# Enquanto for verdadeiro ( looping infinito)
while True:
n= int(input('Digite um numero: '))
# Conta +1
c += 1
if n == 999:
# Queb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.