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 |
|---|---|---|---|---|---|---|
880aab07fcba2c1465c4ed990ed22f21cdc6cae2 | seemoo-lab/csicloak | /Device_Free_Indoor_Localization/plottingUtils.py | 3,365 | 3.90625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Felix Kosterhon
Provides a class to visualize the results using plotting methods and libraries (e.g. input data or cdf)
"""
################################################# IMPORTS #############################################################
from colour ... |
bbd58ab6982dfad39fe56cfca044aaeea866bee5 | Baes14/Python-work | /buffet.py | 209 | 3.703125 | 4 | foods=('lamb','fish', 'pork', 'beef', 'chicken')
for food in foods:
print(food)
foods=('Cheese','fish', 'bacon', 'beef', 'chicken')
print("\nThere's been changes to the menu")
for food in foods:
print(food)
|
9da610d83d64333d494899b32167e6423de09752 | nfarrell36/DrawDaveMatthews | /src/drawDaveMatthews.py | 110,626 | 3.78125 | 4 | import turtle
import math
"""
Name: Nathan Farrell
Class: CSAPX
description:
Draws Dave Matthews.
Recursion is included in the making of the background.
"""
def main():
turtle.bgcolor("lightblue3")
turtle.speed(0)
draw_background()
draw_first_layer()
draw_second_layer()
draw_third_layer()
... |
cdaff7909bb7501769f16f0cd3a6a144650b0f43 | Mukesh656165/basics | /mycalculator.py | 520 | 4.03125 | 4 | def add(x,y):
return x+y
def sub(x,y):
return x-y
def multi(x,y):
return x*y
def div(x,y):
return x/y
print('select operation')
print('1. add')
print('2. sub')
print('3. multiply')
print('1. devide')
choice = input('enter your choice 1/2/3/4:')
num1 = int(input('Enter your 1st number:'))
num2 = int(in... |
a4fa0cd3e5993a8819095a7a8753878ce1efe428 | josephok/ProjectEuler | /p80/solve.py | 637 | 3.515625 | 4 | from decimal import Decimal, getcontext
import unittest
getcontext().prec = 105
def sum_of_100_digits(n):
sq_root = str(Decimal(n).sqrt())
if sq_root.find('.') != -1:
temp = sq_root.replace('.', '')[0:100]
return sum(map(int, [i for i in temp]))
return 0
def one_hundred_natural_numbers(n=100):
return sum([su... |
e5b266f0d848fc1bac004110066782db4e006bb6 | josephok/ProjectEuler | /p50/solve.py | 391 | 3.53125 | 4 | import prime
MAX = 5000
prime.prime(MAX)
def check_length(n, below):
maxprime = 0
for x in xrange(0, below):
total = sum(prime.prime_list[x:x+n])
if total > below: break
if prime.isprime(total): maxprime = total
return maxprime
for n in xrange(1000, 0, -1):
maxprime = check_le... |
62a0d43acbea2f8ba461929ac8b61ee594dc61d1 | saikumarbt/machineLearningBasics | /Part 1 - Data Preprocessing/data_preprocessing_template.py | 893 | 3.625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 9 17:39:57 2018
@author: Sai Kumar
"""
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Data.csv')
# Create matrix of features
X=dataset.iloc[:, :-1].values # Matrix of featur... |
f8518d96eb3f63b4cd2d6929ae45b2245a2f6ebc | lujamaharjan/pythonAssignment2 | /question20.py | 769 | 3.984375 | 4 | '''
Write a python class to find the three elements that
sum to zero from a list of n real numbers.
Input array: [-25, -10, -7, -3, 2, 4, 8, 10]
Output : [[-10, 2, 8], [-7, -3, 10]]
'''
def sums_zero(arr):
result = []
# finding numbers that sum zero
for i in range(0, len(arr)):
for... |
258decfc38f5f05740389356d78bcdfaf780bfc8 | lujamaharjan/pythonAssignment2 | /question5.py | 791 | 4.75 | 5 | """
5. Create a tuple with your first name, last name, and age. Create a list,
people, and append your tuple to it. Make more tuples with the
corresponding information from your friends and append them to the
list. Sort the list. When you learn about sort method, you can use the
key parameter to sort by any field in th... |
6065ac1867f7dafea2872a50162e1b8f4f2a2527 | lujamaharjan/pythonAssignment2 | /question15.py | 700 | 4.3125 | 4 | """
Imagine you are designing a bank application.
what would a customer look like? What attributes
would she have? What methods would she have?
"""
class Customer():
def __init__(self, account_no, name, address, email, balance):
self.account_no = account_no
self.name = name
self.add... |
b498c2f376e29e304b717a6b3f32dfebdb70d00c | gamingpigeon/Vara_story | /timesTHREE.py | 95 | 4.1875 | 4 |
x=float(input("please enter number:"))
print("your number, " + str(x) + " * 3 = " + str(3*x)) |
83a89b06cfd79446d9d2994839888afbfb2d79b2 | gamingpigeon/Vara_story | /popquiz.py | 183 | 3.859375 | 4 | import time
ask = int(input("give me a whole number and i will count down from it: "))
for i in range(ask + 1):
print(ask)
ask = ask - 1
time.sleep(1)
#i did it :)
|
babb9a73a1cdc74028e5421db4873bffed03a1be | TheFlash205/AI-PRACTICAL- | /AI_practical_programs/NUMPY/(np)question2.py | 377 | 3.734375 | 4 | """
Write a NumPy program to test whether each element of a 1-D array is also present in a second array.
Expected Output:
Array1: [ 0 10 20 40 60]
Array2: [0, 40]
Compare each element of array1 and array2
[ True False False True False]
"""
import numpy as np
arr1 = np.array([0, 10, 20, 40, 60])
arr2 = np.... |
68e729a3561408a445a4e92f895b4123993e0349 | tomcur/enactive-agents | /enactiveagents/model/world.py | 12,904 | 3.546875 | 4 | """
Module that holds classes that represent the world.
"""
import abc
import collections
from random import shuffle
import pygame
import appstate
import events
import interaction
import agent
from entity import Position
class World(events.EventListener):
"""
Class that represents the world.
"""
def... |
668b295a143bd66b28c44b0f4c0f7b96053304e3 | Ha-Young/algorithm_programmers | /Python/Lv2/최솟값만들기/solution.py | 157 | 3.609375 | 4 | def solution(A, B):
answer = 0
A.sort()
B.sort(reverse=True)
for num1, num2 in zip(A, B):
answer += num1 * num2
return answer
|
babc61a4695d0afb93ce2a7ca03c35b188298620 | marumuji/python | /checkio/three_words.py | 678 | 4 | 4 |
def checkio(text):
temp = text.split()
if (len(temp) < 3): return False
for i in range(len(temp)):
if not temp[i].isdigit() and not temp[i+1].isdigit() and not temp[i+2].isdigit():
return True
elif i == len(temp) - 2:
return False
# print(checkio("Hello World hello... |
159b9930a4ecca871774d94d4b6e9249f66edbce | ValentinLaurent62/NeuralNetwork | /linear_regression.py | 1,124 | 4.03125 | 4 | '''Linear regression: find the relationship between the dependant variable (y) and the independant variable (x)'''
# f(x) = 2x + 5
training_set = [[1, 7], [5, 15], [11, 27], [20, 45], [29, 63], [34, 73], [1000, 2005]]
# Parameters that need to be optimized (weight and bias)
a = 0
b = 0
# Value used for partial deriv... |
3a5c680575c2108cd6830e87f79c2741779a08de | dthieu/Python | /DesignPattern/Singleton.py | 912 | 4.0625 | 4 | # hasattr() detects that an obj already exists
class Singleton(object):
def __new__(cls):
if not hasattr(cls, 'instance'): # If an instance exists => serve the same obj again
cls.instance = super(Singleton, cls).__new__(cls)
return cls.instance
s = Singleton()
print("Object cr... |
17b98be80e5156259b3b176037ce4a197053dc88 | FelixWeichselgartner/DFTMusicVisualization | /mylib/DiscreteFourierTransformation/python/plot.py | 1,214 | 3.59375 | 4 | import numpy as np
import matplotlib.pyplot as plt
def singlePlot(function):
maximum = max(function)
plt.figure(1)
s = plt.subplot(211)
s.set_ylim([-maximum, maximum])
s.set_xlabel('time [s]')
s.set_ylabel('signal')
x = np.arange(len(function))
plt.plot(x, function)
plt.show(... |
486e32e5d6eebb018f06474e79b5e5fdd07547f3 | brigondaud/BentleyOttmann | /solution.py | 2,997 | 3.71875 | 4 | """
Solution module for the Bentley Ottmann algorithm
"""
from itertools import combinations
from geo.tycat import tycat
class Solution:
"""
solution: associates to all the segment their intersection
"""
def __init__(self, segments):
"""
initializes a hastable that associates to all the... |
591cfbad8fa445296a3928c56bb2f3b0e04098d8 | ashersebban/DB-Design-and-Mgmnt | /DB_Site/Coursework/HW5/files/data.py | 9,345 | 3.953125 | 4 | #!/usr/bin/python3
import cgi
import sqlite3
import cgitb
cgitb.enable()
#1 set up and open an HTML page
print("Content-Type: text/html\r\n\r\n")
print( "<html>\n<head>")
print( "<title>Homework 5</title>")
print( '''<link href="custom.css" rel="stylesheet" type="text/css" />''')
print(" </head>")
print( "<body>")... |
114177c0a8c2213c5515b09d0973051713f4ccbf | Yusadolat/pyorglib2 | /pyorg.py | 1,076 | 3.796875 | 4 | import os
import shutil
class organize: #class
def organizer(self,newpath,folder_name,choice): #organizes the files
if not os.path.exists(folder_name):
print "Folder Does Not Exist"
return
if os.listdir(folder_name)==[]:
print "Folder is Empty"
return
files=os.listdir(folder_name) #select all files f... |
51fc6b4356a70695f4bc9f31386ca2c8dd1059cc | zhangjk4859/python-stuff | /codes/forChar.py | 104 | 3.59375 | 4 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
for num in range(0,100000):
char = chr(num)
print(num,char) |
62a4265cee87cca2eaf1304fe5cfdb6d24f392e5 | jordiclariana/terrawrap | /terrawrap/utils/collection_utils.py | 1,554 | 3.6875 | 4 | """Utilities for working with collections"""
from typing import List, Iterable, Mapping, TypeVar, Dict
Type = TypeVar('Type')
def flatten_collection(lists: Iterable[Iterable[Type]]) -> List[Type]:
"""
Flatten a collection of collections into a list
:param lists:
:return:
"""
return [
... |
a1600386ec77dacea74872b18c5279411c732128 | lesterlaitw/BMI | /BMI.py | 806 | 4 | 4 | height = input('請輸入身高(單位cm):' )
height = float( height )
weight = input('請輸入體重(單位kg):' )
weight = float( weight )
height2 = height / 100
bmi = weight / ( height2 * height2 )
print('您的BMI值為:' , bmi )
if bmi < 18.5:
print('BMI<18.5,體重過輕' )
elif bmi >=18.5 and bmi < 24:
print('18.5≦BMI<24,正常範圍' )
elif bmi >=24 and bmi <... |
d8a624db26589a208a1b6856fe2a7c89b4be287d | ElkinAaron/Parser | /Parser.py | 5,196 | 3.6875 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# see http://stackoverflow.com/questions/3170211/why-declare-unicode-by-string-in-python
import unicodedata
def Parser(file):
Hash = {}
Hashnumber = 1
#loops until the parsing is done.
with open(file) as file:
for line in file:
#Tur... |
14569d9e12b63f29b2002c014fe8fdb79d990bcf | babbgoud/maven-project | /guess-numapp/guessnum.py | 765 | 4.15625 | 4 | #! /usr/bin/python3
import random
print('Hello, whats your name ?')
myname = input()
print('Hello, ' + myname + ', I am thinking of a number between 1 and 20.')
secretNumber = random.randint(1,20)
for guesses in range(1,7):
print('Take a guess.?')
guessNumber = int(input())
if int(guessNumber) > se... |
b1d72b44b456a488b80bf50c321080a7fd79d6fc | Aymane11/BasicAlgos | /Python/Math/binomialcoefficient.py | 598 | 3.828125 | 4 | '''
Summary:
Evaluating the binomial coefficient, C(n,k), with n>=k using recursion C(n,k)=n!/(k!*(n-k)!)
Arguments:
[int] -- [n]
Returns:
[double] -- [n!]
'''
def binomialcoefficient(n, k):
if k > n:
print("Invalid Inputs, ensure that n >= k")
return -1
if ... |
c30beff4dd3b4098d1516cc19d79feae3e1845cc | rajpatel2619/cg-solve | /py/2/main.py | 2,514 | 3.796875 | 4 | import turtle
import math
# setting screen
screen = turtle.Screen()
screen.mode('world')
screen.bgcolor("lightblue")
# setting the world coordinates
# case 1: coordinate mentioned as in question
# turtle.setworldcoordinates(-1, -(math.pi)/2, 1, (math.pi))
# case 2: coordinates for clear view
turtle.setworldcoordina... |
0e48fc0c64c061fe9afc421767357a1a78592e7c | noahgift/azure-devops | /hello.py | 506 | 3.625 | 4 | import click
@click.command(help="This is just a hello app. It does nothing")
@click.option("--name", prompt="I need your name", help="Need name")
@click.option("--color", prompt="I need your color", help="This is your color")
def hello(name, color):
if name == "Thor":
click.echo("Thor your are always red"... |
de8a9d01321db8de5a25387c5d2f5aafacb2819a | RayFFH/SQLite_v1 | /databasescoding.py | 1,447 | 3.84375 | 4 | import sqlite3
# connection = sqlite3.connect('students.db')
# c = connection.cursor()
# c.execute("""CREATE TABLE students (
# first_name text,
# last_name text,
# age text
# )""")
# connection.commit()
# connection.close()
def show_record():
connection = sqlite3.connect('students.db')
... |
0ba7e782993022d05d12ff034a8620d4b9bed263 | darbaga/mg | /mg/player.py | 1,455 | 3.578125 | 4 | from pyglet.window import key
class Player(object):
"""The player class
Represents the player. Has bunch of functions to do bunch of stuff.
"""
def __init__(self, Map):
self.Map = Map
self.position = (0, 0)
self.has_moved=False
self.move_counter=20
def move(self, ... |
7d821075795e357fc2de1bac8ad4769270b38b95 | loyalbuddha/HW_Python_GitHub | /HW4/HW4.3.py | 377 | 3.71875 | 4 | '''
Для чисел в пределах от 20 до 240 найти числа, кратные 20 или 21. Необходимо решить
задание в одну строку.
Подсказка: использовать функцию range() и генератор.
'''
my_list_20_21 = [el for el in range(20, 241) if (el % 20 == 0) or (el % 21 == 0)] |
ef16d8643a56197f3305e1a3731b3a8f67c99cf0 | loyalbuddha/HW_Python_GitHub | /HW_5_all_tasks/HW5.5.py | 887 | 4.09375 | 4 | ''' Задача 5.5. Условие:
Создать (программно) текстовый файл, записать в него программно набор чисел,
разделенных пробелами. Программа должна подсчитывать сумму чисел в файле и выводить
ее на экран.
'''
from random import randint
num = int(input('Введите, сколько чисел запишется в файл:\n'))
with open('new... |
8a77c620af720a29e8f0a2bd3cdb2dd321d56049 | botaserban/tirehouse | /TireHouse/db.py | 2,302 | 3.65625 | 4 | import sqlite3
class Database:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cur = self.conn.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS anvelope (id INTEGER PRIMARY KEY, serieSasiu text, nrInmatriculare text, client text, dimFata text, dimSpate text, profil text, ... |
329e8620665deceacc603f107bcec131811d8714 | sumithrasenthil/Hackerrank-Implementation | /seperate_the_numbers.py | 426 | 3.5625 | 4 |
def separateNumbers(s):
n=len(s)
for i in range(len(s)//2):
a=''
k=0
r=int(s[0:i+1])
f=r
while(len(a)<n):
a+=str(r)
r=int(r)
r+=1
if(a==s):
return 'YES'+' '+str(f)
return 'NO'
if __name__ == '__main__':... |
3b1ca0a17c5873d94673b9b290919f900b6793c5 | egroeg92/BattleShips | /reefGeneration.py | 2,177 | 3.84375 | 4 | import random
class reefGeneration(object):
def __init__(self):
self.reef = "Reef"
def random(self):
tuple = ()
x = random.randint(10,13)
y = random.randint(3,26)
tuple = (x,y)
return tuple
def randommid(self):
tuple = ()
x = random.randint(14,14)
y = random.randint(3,26)
tuple = (x,y)
return t... |
0dcc567b62cb6e81893fd99471a32737388d04b2 | ramyanaga/MIT6.00.1x | /Pset2.py | 2,332 | 4.3125 | 4 | """
required math:
monthly interest rate = annual interest rate/12
minimum monthly payment = min monthly payment rate X previous balance
monthly unpaid balance = previous balance - min monthly payment
updated balance each month = monthly unpaid balance + (monthly interest rate X monthly unpaid balance)
NEED TO PRINT:... |
a39e195a3021aec471b1a64515d3ca6f60543d15 | benjifc/python_exercises | /loteria.py | 2,815 | 3.8125 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, random
menu_estado = True
numero_ganador = random.sample(range(0,10), 5)
def menu():
os.system('clear') # Limpio pantalla haciendo una llamada al sistema operativo
msg = """
**************************************************... |
b9d9b1be2ef6597a7bfde0c9fb4ba6cdd41885a7 | molendzik/AdventOfCode2020Python | /Day 2/Solution 4/main.py | 903 | 3.875 | 4 | #read file and convert content to a list of lines
with open("input.txt", "r") as file:
data = file.readlines()
for index, line in enumerate(data):
line = line.rstrip("\n")
data[index] = line
#split strings into useable data, convert numbers to int, check if password is correct and (if it is) add it to the... |
b3a894ddde6b8f8370237373af1a0babbc856af5 | molendzik/AdventOfCode2020Python | /Day 3/Solution 6/main.py | 1,008 | 3.71875 | 4 | #read file and convert content to a list of lines
with open("input.txt", "r") as file:
data = file.readlines()
for index, line in enumerate(data):
line = line.rstrip("\n")
data[index] = line
#1 line has 31 characters with indexes 0-30; data has 323 lines with indexes 0-322
def tree_counter(right_movemen... |
8e90357a4ad5e9a5ee35de20cc8f878da873e08c | Praveenkumar789/Mission_RND | /unit7_assignment_01.py | 2,711 | 4.03125 | 4 | __author__ = 'Kalyan'
problem = """
We are going to revisit unit6 assignment3 for this problem.
Given an input file of words (mixed case). Group those words into anagram groups and write them
into the destination file so that words in larger anagram groups come before words in smaller anagram sets.
With ... |
97a6915d9a1e55a82b4a15cd2773bda74e17cf94 | LukaVieira1/Exercicios-Python | /Seção 6/EX_5.py | 177 | 4.0625 | 4 | numero = 1
valor = 0
while numero <= 10:
soma = int(input('Insira um valor: '))
valor = valor + soma
numero = numero +1
print(f'A soma de todos numeros é: {valor}') |
4c20c59ced618bbf23b23ed543f4f1192ab81433 | LukaVieira1/Exercicios-Python | /Seção 4/EX_3.py | 305 | 3.890625 | 4 | # v1, v2, v3 = [int(x) for x in input('Insira 3 valores: ').split()] Insere os 3 na mesma linha com espaço
v1, v2, v3 = int(input('Digite primeiro valor ')), int(input('Digite o segundo valor: ')), int(input('Digite o terceiro valor: '))
soma = v1 + v2 + v3
print(f'A soma dos 3 numeros é: {soma}')
|
72acf6c2db01441998d1c0d2ac7d1e1876177f8e | LukaVieira1/Exercicios-Python | /Seção 8/EX_14.py | 446 | 3.65625 | 4 | n = ''
while n.lower() != 'nao':
n = input( 'Deseja saber o consumo de algum veiculo? (sim) ou (nao) ')
if n == 'nao':
break
km, litros = float(input('Quantos km você andou? ')), float(input('Quantos litros foram gastos? '))
consumo = km / litros
if consumo < 8:
print('Gastador')
... |
721cbf42f2ad6754dbe05a6b9cf35589bc755d02 | LukaVieira1/Exercicios-Python | /Seção 7/Parte 1/EX_17.py | 160 | 3.796875 | 4 | lista = []
for _ in range(11):
x = int(input('Insira o valor: '))
if x < 0:
lista.append(0)
else:
lista.append(x)
print(f'{lista}') |
651f4b881297a0ded35ff3c7815d581f980d4997 | DylanGuidry/python101 | /conditionals.py | 383 | 3.9375 | 4 | #Ask for name
user_name = input("Hi there! Let's start off if your name.")
#Greet user
print("Nice to meet you " + user_name + "! ")
#Check if name is longer than 10 or not as long as 10
if len(user_name) > 10:
print("How that's is one long name!" )
elif len(user_name) == 5:
print("You are an amazing person."... |
83f54cd5c6d6398d2a188179ea94a4f3538133f2 | trishahanlon/RecipePlanner-Python | /view.py | 1,179 | 3.59375 | 4 | # Huge shoutout to youtube user: sentdex at https://www.youtube.com/watch?v=jBUpjijYtCk which
# helped me figure out how to do multiple pages with tkinter
# Trisha Moyer
# Version 3.5
from tkinter import *
from addRecipe import AddARecipe
from mealPlan import MakeMealPlan
from landingpage import LandingPage
LARGE_FO... |
3aa1983ba92e05f47c693d5e5aabc37f41167346 | aminami1127/checkio | /science/stack.py | 786 | 4.03125 | 4 | def digit_stack(commands):
stack, result = [], 0
for c in commands:
if c.startswith('PUSH'):
stack.append(int(c[-1]))
elif c.startswith('POP'):
result += stack.pop() if stack else 0
elif c.startswith('PEEK'):
result += stack[-1] if stack else 0
ret... |
5925b3ab74cc4502a50457cf1d09938c051761a9 | aminami1127/checkio | /home/max_min.py | 978 | 3.640625 | 4 | def min(*args, **kwargs):
key = kwargs.get("key", lambda x: x)
values = iter(args[0]) if len(args) == 1 else iter(args)
min_value = next(values)
for i in values:
if key(i) < key(min_value):
min_value = i
return min_value
def max(*args, **kwargs):
key = kwargs.get("key", lam... |
63219cd9a3cd828dd12195495a706e4d59ded15a | aminami1127/checkio | /elementary/base.py | 631 | 4.0625 | 4 | from string import digits, ascii_uppercase
def checkio(str_number, radix):
numbers = digits + ascii_uppercase
if any(x for x in str_number if numbers.index(x) >= radix):
return -1
else:
return sum(radix ** i * numbers.index(x) for i, x in enumerate(str_number[::-1]))
#These "asserts" us... |
d7d020410c436a4d045f4a805a8d2e67c7df3d07 | aminami1127/checkio | /practice/generator/ex7.py | 444 | 3.921875 | 4 | # -*- coding:utf-8 -*-
class EvenOddIterator(object):
def __init__(self):
self.i = 0
def __iter__(self):
return self
# python3 => __next__(self):
def next(self):
self.i += 1
while True:
if self.i % 2:
return 'odd'
else:
... |
f7758b29863173b1159c31b7eb0d77dc29d37523 | AbuSheikh/Python-Course | /Week 1/Practise1-A.py | 564 | 4.09375 | 4 | #!/usr/bin/env python
# coding: utf-8
# In[3]:
name = input ("Enter your Name:")
num1 = int (input ("Enter the first Number: "))
num2 = int (input ("Enter the second Number: "))
print ("Hi Mr/Mrs" + name)
print (f"The Sum of {num1} and {num2} is:",str(num1+num2))
print (f"The Sub of {num1} and {num2} is:",str(num1-n... |
9cf1858af3cbb52a132667e9b6edd1fe9086a5e3 | AlexDT/Playgarden | /random/fizzbuzz.py | 406 | 3.828125 | 4 | number1 = int(raw_input("Vanaf welk getal wil je beginnen?"))
number2 = int(raw_input("Waar wil je eindigen?"))
def fizzBuzz(x):
if x % 3 == 0 and x % 5 == 0:
print str(x) + ": FizzBuzz"
elif x % 3 == 0:
print str(x) + ": Fizz"
elif x % 5 == 0:
print str(x) + ": Buzz"
else:
... |
3eb482c7861a7a2ea0e293cacce0d75d2f41de77 | AlexDT/Playgarden | /Project_Euler/Python/001_sum.py | 542 | 4.1875 | 4 | # coding: utf-8
#
# ONLY READ THIS IF YOU HAVE ALREADY SOLVED THIS PROBLEM!
# File created for http://projecteuler.net/
#
# Created by: Alex Dias Teixeira
# Name: 001_sum.py
# Date: 06 Sept 2013
#
# Problem: [1] - Multiples of 3 and 5
# If we list all the natural numbers below 10 that are multiples of
... |
310d37a65726f9eaf377b7348e9d9b3ecc1cc06e | dsgon/python_class | /class08.py | 332 | 3.609375 | 4 | # Listas Avanzadas I
# #Split
# paises = 'Mexico, Venezuela, Argentina, Brasil, Colombia, Panama'
# lista_paises = paises.split(', ')
# #Join
# paises = '_'.join(lista_paises)
# print(paises)
# Tuplas
my_list = [1,2,3,4]
my_tuple = (1,2,3,4)
my_list[0] = 7
my_list.append(6)
print(my_list)
estados = list()
estad... |
7fa7aadc1606f706cda2bc5e7882fa586fa7d5f2 | CptnReef/Bank_Account | /BankAccount.py | 1,995 | 3.84375 | 4 | import random
class BankAccount:
def __init__(self,full_name,account_number,routing_number,balance):
self.full_name = full_name
self._account_number = ": " + str(account_number)
self.__routing_number = ": " + str(routing_number)
self.balance = balance
... |
f6e11e1126b4ff75710bb3df868b8c2555485fe8 | shubham3211/python-practice | /Module1.py | 1,100 | 3.765625 | 4 | #Activity 1
#Question 4
# def printHello():
# print("hello")
#Question 5
string = "All work and no play make Jack a dull boy"
strList = string.split(" ")
print(" ".join(strList))
#Activity 2
#Question 1
print(5%2)
print(9%5)
print(15%12)
print(12%15)
print(0%7)
# print(7%0)
x = int(input("Enter x"))
y = int(input(... |
059b1b036fd32d0df3d23ef4fed084586b92202a | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/Day02-集合遍历/day02/11-拆包.py | 481 | 4.21875 | 4 | #拆包通俗理解:把容器类型(字符串,列表,元组,字典,结合)
#每一个数据使用不同的变量保存一下
#字符串
my_str = "abc"
a,b,c = my_str
print(a,b,c)
#列表
my_list = [1,5]
num1,num2 = my_list
print(num1,num2)
#元组
my_tuple = (1,5)
num1,num2 = my_tuple
print(num1,num2)
#拆字典(默认拆取的是key)
my_dict = {"name":"胡亮","age":"20"}.values()
key1,key2 = my_dict
print(key1,key2)
#集合
my_set... |
ec97c964601cfb0e8f6b37dbaa0b14b96d0728f0 | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/Day02-集合遍历/day02/03-元组.py | 1,236 | 4.28125 | 4 | #元组:以小括号形式的数据集合,比如(1,2,"abc")
#可以存储任意数据类型
#注意,元组可以根据下标获取数据,但是不能对元组进行数据修改
my_tuple = (1,4,"abc",True,1.2)
print(my_tuple)
#根据下标取值
value = my_tuple[-1]
print(value)
# #元组不能根据下标删除数据
# del my_tuple[2]
# print(my_tuple)
#修改也是不可以
# my_tuple[0] = 3
# # print(my_tuple)
# #直接根据下标修改数据是不可以的,不论元组里面装的是什么数据类型
# my_tuple = (1,[3,5... |
77b977b3f31c609b93873d18e9b74ff0b2972b45 | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/Day02-集合遍历/练习.py | 804 | 3.84375 | 4 | 练习1
创建两个列表,列表1含有字符串'life','is','short',列表2含有字符串'you','need','python'。并输出'need'
练习2
截取列表['a','b','c','d']中的前三个元素。
练习3
对已给字典dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'},
增加 Age=8 与 School= DPS School 两键值对,并输出。
向字典添加新内容的方法是增加新的键/值对,修改或删除已有键/值对如下:
输出结果样例为:
dict['Age']: 8
dict['School']: DPS School
练习4
用... |
f9cb101f1631a29181cd618df67314983cfc19e4 | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/day10/12-进程之间可以使用消息队列通信.py | 959 | 3.53125 | 4 | import multiprocessing
import time
def add_data(queue):
for i in range(3):
print(i)
queue.put(i)
time.sleep(0.3)
def read_data(queue):
while True:
# 判断队列是否为空
if queue.empty():
break
value =queue.get()
print(value)
if __name__ == '__main__'... |
cec2ffe298df0e238f6a2633469437b27a8b3a42 | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/day07-类/08-动态添加对象的属性,获取属性的值.py | 385 | 4.03125 | 4 | #类名一般情况大写(约定俗成)
#class + 类名
class Teacher(object):
def show(self):
print("今天天气不错")
#创建对象
teacher = Teacher()
#动态的添加属性
teacher.name = "李四"
teacher.age = 18
#获取数据对应的属性
print(teacher.name,teacher.age)
#修改属性
teacher.name = "王五"
print(teacher.name,teacher.age)
teacher.show() |
ea71747d629f1bc44e5e205f03fda81fb134cec6 | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/day10/08-进程.py | 661 | 3.5 | 4 | #进程:每次创建一个进程操作系统会给这个进程分配对应的资源
#一个进程里面默认有一个线程(主线程)
#真正干活的是线程,进程只提供资源
#但多进程也可以完成多任务
import multiprocessing
import time
def show():
for i in range(10):
time.sleep(1)
print("show")
def info():
for i in range(10):
time.sleep(1)
print("info")
if __name__ == '__main__':
#创建子进程
... |
dad73ea4d4400f60927c07b8c16a74c5815b91a4 | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/Day03-函数/代码/12-必须参数使用关键字传参.py | 440 | 3.796875 | 4 |
# 定义必须参数使用关键字传参的函数, 注意点: *后面的参数必须使用关键字方式传参
def show(address, sex,*, name, age):
print(address, sex)
print("我叫:%s 年龄:%d" % (name, age))
# 使用位置参数传参
# show("刘八女", 38)
# 使用关键字参数传参
# show(name="曹操", age=66)
show("上海", '男', name="刘墉", age=92)
show(address="北京", sex="男", name="和珅", age=49) |
71856300434cde12fa7ecf800d283dba9c8f75ea | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/005ListFormula.py | 787 | 3.890625 | 4 |
"""
列表生成式
即List Comprehensions
Python内置的非常简单却强大的可以用来创建list的生成式。
L = []
for x in range(1, 11):
L.append(x * x)
转换为:
[x * x for x in range(1, 11)]
for循环后面还可以加上if判断
[x * x for x in range(1, 11) if x % 2 == 0]
运用列表生成式,可以快速生成list,
可以通过一个list推导出另一个list,而代码却十分简洁。
"""
from collections import Iterable
L = ... |
8b342f9279fd4a380434b2f01d874f0fd3171894 | softwarefaith/PythonFullStack | /PythonFullStack/004Exception/000exception.py | 1,357 | 4.1875 | 4 | # 异常处理
""""""
"""
内置了一套try...except...finally...的错误处理机制
"""
try:
print('try...')
r = 10 / int('a')
print('result:', r)
except ValueError as e:
print('ValueError:', e)
except ZeroDivisionError as e:
print('ZeroDivisionError:', e)
else:
print('no error!')
finally:
print('finally...')
print(... |
e69c10620674ce54416070ef1b8c2fdc08cdd452 | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/day04/10-切片.py | 701 | 4.40625 | 4 | #切片:根据下标的范围获取一部分数据:字符串,列表可以使用切片
#正数下标的切片
my_str = "hello"
result = my_str[0]
print(result)
#[起始下标,结束下标,步长](下标从0开始)
#切片结束下标不取
result = my_str[0:4:1]
print(result)
#前三个数据(默认步长为0)
result = my_str[0:3]
print(result)
#前两个可以省略
result = my_str[::3]
print(result)
#快速获取整个字符串
result = my_str[:]
print(result)
#使用负数下标切片的方式获取数据
my_... |
ed7166755867c16366a6aa0ab3dc23278e51720b | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/day10/01-json序列化.py | 726 | 3.53125 | 4 | import json
#微信:即时通信(xml)
#只支持部分数据类型:(语言障碍,CC++java)
#1.列表,字典,int ,自定义类型不可以,需要额外指定
my_list = [{"name":"张三","age":"20"}]
file = open("mylist.txt","w",encoding="utf-8")
#序列化
json.dump(my_list,file)
file.close()
file = open("mylist.txt","r",encoding="utf-8")
#反序列化
my_list = json.load(file)
print(my_list)
#自定义类型
class ... |
fbe7386c2a4425dc87bf76982cf9dc23c54f938b | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/day07-类/06-类的定义.py | 654 | 4.21875 | 4 | #类的定义需要使用class关键字 人有特征和行为(动作)
#类有属性(特征)和方法(行为)
#定义一个老师类(继承父类)
#创建类的方式,是旧式类方式创建
#python3默认继承object
#python2中里面就没有父类
class Teacher():
#国籍(属性)
country = "中国"
#方法
def show(self):
print("大家好,我是大家的授课老师")
#通过类来创建对象,类好比是一个图纸,根据图纸创建对象
teacher = Teacher()
#通过对象调用方法
teacher.show()
#通过对象查看方法
print(teache... |
8cb228a94781948c76f546d9670c4e887610fc4f | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/day08/01-init方法使用super.py | 754 | 4 | 4 | #提示一下:创建py文件的时候,命名规则尽量和变量和函数的命名规则一样
class AA(object):
def __init__(self,name):
print("A")
self.name = name
class B(AA):
#提示一下:如果子类提供了调用的方法,那么,不会主动调用父类的方法
def __init__(self,subject):
#调用父类的init方法(错误)
# self.__init__("zhangsan")
#使用类名调用父类的init方法(注意点,用类名调用方法,需要传入对象)
... |
0adc3d68701d28d0094280378b9cb2e068a4ae3b | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/day07-类/10-__str_魔法方法.py | 397 | 4.125 | 4 | #__str_:当使用print打印对象的时候回自动调用
class Person(object):
def __init__(self,name,age):
self.name = name
self.age = age
def __str__(self):
#返回一个字符串信息
return "我叫:%s 年龄:%d" %(self.name,self.age)
#创建对象
person = Person("张三",18)
#打印对象的属性值
print(person.name,person.age)
print(person) |
e3d703041d36a6d58c081c2bd1dc586d216ad566 | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/day04/03-函数的注意事项.py | 285 | 3.875 | 4 | #函数的注意事项:1.函数不能相同(注意,第二个函数会把第一个函数覆盖掉)
#2.变量名不能和函数名一样
def show():
print("好累啊")
def show():
print("一点都不累")
#
# show()
show = 10
print(show)
#拿着变量名去调用函数
show()
|
7c5b76802332fb94e70ec68d50802985901cc80a | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/day07-类/13-多继承.py | 391 | 3.546875 | 4 | #多继承:相当于继承多个父亲
class A(object):
def show(self):
print("我是A类")
class B(object):
def show(self):
print("我是B类")
class C(A,B):
pass
c = C()
#调用父类A的方法
c.show()
#调用父类B的方法
# c.show_info()
#python里面方法调用hi尊村mro
#累的继承顺序,决定方法调用的时候查找的顺序
print(C.mro()) |
dfb51c4118736ffd4a3c32a59fe2f2230860ce38 | dyarnall/python_immersive | /text_files.py | 655 | 3.71875 | 4 | dic = {}
fakelist = ["wonder.", "help!", ".nope"]
def split_char(word):
my_string = ["?", ".", ",", "!"]
for f in word:
if f in my_string:
#print("f", f)
#print("word", word)
word = word.strip(f)
#print("final",word)
return word
def unpacking(tup):
return tup[1]
def counter(data):
for word in dat... |
8cb741e0a0b55808bb0fee27e092898eafb69180 | dyarnall/python_immersive | /class_one_ex_3.py | 95 | 3.765625 | 4 | word_list = ["python", "star", "green", "yellow"]
for word in word_list:
print(word[-1::-1]) |
6f005d2bc97e716107c50bcfd4d8e99a475cf687 | dyarnall/python_immersive | /pig_latin.py | 571 | 3.96875 | 4 | def is_a_vowel(letter):
my_string = "aeiou"
if letter in my_string:
return True
else:
return False
def assess(word):
if is_a_vowel(word[0]):
pig_word = word + "yay"
# return new_word
else:
for i in word:
if is_a_vowel(i):
log = word.index(i)
new_word1 = word[log:]
new_word2 = word[0:log]... |
a5f80cc1fcd31a5dc1c765c7d03ddcc5ef17b98d | dyarnall/python_immersive | /even_or_odd.py | 156 | 4.28125 | 4 | number = int(input("Please enter an integer: "))
if number % 2 == 0:
print("The number", number, "is even.")
else:
print("The number", number, "is odd.") |
0f9b783d05b37f0b59aab5c5f08a15976d31bd0e | dyarnall/python_immersive | /dictionaries.py | 136 | 3.515625 | 4 | d = {}
word = "applleeee"
cnt = 0
for i in word:
d[i] = d.get(i,1) + 1
# if i in d:
# d[i] += 1
# else:
# d[i] = 1
print(d)
|
9add5ccb3c569bbaabf6553333f9c09708eaee94 | husenzhang/reinvent_the_wheel | /personClass.py | 889 | 3.921875 | 4 | class Person(object):
def __init__(self, name, phone, email):
self.name = name
self.phone = phone
self.email = email
def get_name(self):
return self.name
def get_phone(self):
return self.phone
def get_email(self):
return self.email
def set_ema... |
52eb41a5f47ae22a09e6a8ec85d53ae90c82e89e | tviniciusilva/exercicios_curso_python | /curso_python/modulos.py | 459 | 3.640625 | 4 | #import doce
#from doce import pudim
#import math
#ceil é um arredondamento para cima
#floor é um arredondamento para baixc
#trunc truncar um numero
#pow potencia substitui **
#sqrt calcular raiz quadrada
#factorial numero fatorial
#from math import sqrt
#num = int(input('Digite um número: '))
#raiz = sqrt(num)
#print... |
793c0e8ad577d4a69022472e6a976548a1f3ca71 | tviniciusilva/exercicios_curso_python | /curso_python/ex002.py | 365 | 3.984375 | 4 | #nome = input('Digite seu nome: ')
#print('Olá {} seja muito bem-vindo!'.format(nome))
#n1 = int(input('Digite um número: '))
#print(type(n1))
#n1 = int(input('Digite o primeiro número: '))
#n2 = int(input('Digite o segundo número: '))
#s = (n1+n2)
#rint('A soma entre {} mais {} é igual a: {}'.format(n1,n2,s))
n = i... |
bc4eaf88ad6a934545f7649438789c1b4bd99011 | tviniciusilva/exercicios_curso_python | /curso_python/ex008.py | 220 | 3.734375 | 4 | #Conversão de metros para centímetros e milímetros
m = float(input('Meu amigo, digite a metragem: '))
cm = m*100
mm = m*1000
print('{} metro(s) é equivalente a {} centímetros e a {} milímetros'.format(m, cm, mm)) |
eda93e8d8697f4262feb5a357df639af7fa89455 | thequinn/Coding_Problems | /Codewars/Unique_In_Order.py | 405 | 3.84375 | 4 |
def unique_in_order(iterable):
res = []
prev = None
for curr in iterable:
if curr != prev:
res.append(curr)
prev = curr
return res
print(unique_in_order('AAABBCCD')) # ['A', 'B', 'C', 'D']
print(unique_in_order('AAABBCCDD')) # ['A', 'B', 'C', 'D']
print(unique_in_order('ABBCcAD')) ... |
5428a470fe235738542957fdd98077f53d816189 | thequinn/Coding_Problems | /Codewars/Are_they_the_same.py | 379 | 3.515625 | 4 |
def comp(array1, array2):
if None in (array1, array2):
return False
return sorted(a ** 2 for a in array1) == sorted(array2)
a = [121, 144, 19, 161, 19, 144, 19, 11]
b = [121, 14641, 20736, 361, 25921, 361, 20736, 361]
print(comp(a, b)) # T
a2 = [121, 144, 19, 161, 19, 144, 19, 11]
b2 = [132, 14641, 20... |
2b6cb2b7fe787d95f4430888981ede38d1fb61cc | thequinn/Coding_Problems | /Codewars/Moving_Zeros_To_The_End.py | 358 | 3.53125 | 4 |
def move_zeros(arr):
l = [i for i in arr if isinstance(i, bool) or i!=0]
return l+[0]*(len(arr)-len(l))
print(move_zeros([False,1,0,2])) # [False,1,2,0]
print(move_zeros([False,1,0,1,2,0,1,3,"a"])) # [False,1,1,2,1,3,"a",0,0]
print(move_zeros([9, 0, 9, 0, 0, 9, 0, 0.0, 0, 0.0, 0, 0, 0]))
# [9... |
7bf49dc7c06bfa74c2847b7154630da9b434d3ab | thequinn/Coding_Problems | /Codewars/Complementary_DNA.py | 243 | 3.609375 | 4 |
def DNA_strand(dna):
complements = {
'A': 'T',
'T': 'A',
'C': 'G',
'G': 'C'
}
return "".join([ complements[c] for c in dna ])
print(DNA_strand ("ATTGC")) # return "TAACG"
print(DNA_strand ("GTAT")) # return "CATA"
|
1fc9ce667ce22cd265679aca046acdb70c341f27 | weronika313/eariliest_date_algorithm | /eariliest_date_creator.py | 4,021 | 3.59375 | 4 | from calendar import monthrange
import datetime
class EarliestDateCreator:
def __init__(self, string):
self.numbers = string
self.min = 0
self.mid = 0
self.max = 0
def convert_str_to_list(self):
self.numbers = self.numbers.split("/")
def change_strings_to_numbers(... |
8510292ddf13a8c4e1429c0cf5fa6af90be72b7b | SharanSMenon/Programming-Folder | /AlgorithmsCoursera/week4_divide_and_conquer/1_binary_search/binary_search.py | 1,013 | 3.90625 | 4 | # Uses python3
import sys
def binary_search(list_: list, key: int, low=0, high=0):
"""
:param list_: list
:param key: int
:param low: int
:param high: ubt
:return:
"""
if high < low:
return -1
if high == 0:
high = len(list_)
mid = low + int(((high - low) / 2))
... |
c1bb5e660efb94775fb40e6393d2c5e78bd8ba61 | BartoszSlesar/PythonSmallerProjects | /the_magical_adder/the_magical_adder.py | 466 | 4.09375 | 4 | number = input("Please enter three numbers separated by comma: ")
data = number.split(",")
if len(data) == 3:
# simple program to calculate a+b-c from user input using map
numbers = map(int, data)
a, b, c = numbers
print(a + b - c)
# simple program to calculate a+b-c from user using list comprehens... |
636df5d58f0b9729b01718e81dfa0da1d17a46f1 | nikrasiya/DP-6 | /264_ugly_number_II.py | 1,196 | 3.59375 | 4 | import heapq
class Solution:
def nthUglyNumber(self, n: int) -> int:
"""
Time Complexity - O(nlogn)
Space Complexity - O(n)
"""
pq = [1]
visited = set([1])
i = 1
while i < n:
cur_num = heapq.heappop(pq)
for num in [2, ... |
caa473a30bcfab1f491e58b5f017ab4eb4eb99e2 | SamNel2000/FreshmenProjects | /Fibonacci and Lucas Sequences.py | 773 | 4.15625 | 4 | name = input("Enter 'A' for Fibonacci Sequence and 'B' for Lucas Sequence: ")
def fib(a, b):
n = int(input("Enter the ordinal value of the term you want: ")) - 1
for x in range(n):
a = a + b
b = a - b
print("The " + str(n + 2) + "th term of the fibonacci sequence is:", a, "\nThe appr... |
6fe2ff23af41c94928705d8fa0cdbde97a0b230c | rasithasreeraj/python | /Logging Basics/Logging.py | 549 | 3.671875 | 4 | # This program says that 'debug' information wont be getting displayed in console
import logging
# logging levels - 5 std - debug, info, warning, critical, error
# default logging level is warning, ie vll capture warning, critical & error
def add(x,y):
#add function
return x + y
num_1 = 10
num_2 = 2
add1... |
d39efff57ef84c7a7526c95cb206793a0ed426da | sasathornt/Python-3-Programming-Specialization | /Python Basics/Week 4/assess_ac4_1_1_8.py | 253 | 4.0625 | 4 |
##Write code to switch the order of the winners list so that it is now Z to A. Assign this list to the variable z_winners.
winners = ['Alice Munro', 'Alvin E. Roth', 'Kazuo Ishiguro', 'Malala Yousafzai', 'Rainer Weiss', 'Youyou Tu']
z_winners = winners
z_winners.reverse()
print(z_winners) |
34534abc70987c7c05910c3436868db6b0a97148 | sasathornt/Python-3-Programming-Specialization | /Python Basics/Week 4/assess_week5_01.py | 331 | 4.34375 | 4 | ##Currently there is a string called str1. Write code to create a list called chars which should contain the characters from str1. Each character in str1 should be its own element in the list chars
str1 = "I love python"
# HINT: what's the accumulator? That should go here.
chars = []
for letter in str1:
chars.app... |
33732221ea863dd5699c8b4184b3aa24f786b296 | sasathornt/Python-3-Programming-Specialization | /Python Basics/Week 4/asign_c01_01.py | 395 | 3.875 | 4 | ##Below are a set of scores that students have received in the past semester. Write code to determine how many are 90 or above and assign that result to the value a_scores.
scores = "67 80 90 78 93 20 79 89 96 97 92 88 79 68 58 90 98 100 79 74 83 88 80 86 85 70 90 100"
a_scores = 0
sclst = scores.split()
for sc in s... |
59b85b9ab4a741aa88d6e7801bf3f9e8ab2017a8 | teomdn01/Lava-Checkers | /src/strategy/strategy.py | 2,761 | 3.765625 | 4 | from copy import deepcopy
import pygame
from checkers.tools.constants import YELLOW, PURPLE
class Strategy:
def __init__(self):
pass
@staticmethod
def minimax(position, depth, max_player):
"""
:param position: the current position we are in (a board object)
:param depth:... |
479199ac895a2d5e5d349296eed58621f6d9c038 | Neves-Roberto/python-course | /aula07.py | 136 | 3.78125 | 4 | n1 = int(input('numero 1'))
n2 = int(input('numero 2'))
print('a soma \n é {}'.format(n1+n2), end='>>>')
print('teste de outra linha')
|
aff493107f2fe0b300cb3c222480c48161ae51f0 | Neves-Roberto/python-course | /soma_hipotenusas.py | 1,771 | 4.125 | 4 | '''
Exercício 2 - (Difícil) Soma das hipotenusas
Escreva uma função soma_hipotenusas que receba como parâmetro um número
inteiro positivo n e devolva a soma de todos os inteiros entre 1 e n que
são comprimento da hipotenusa de algum triângulo retângulo com catetos
inteiros.
DIca1: um mesmo número pode ser hipotenusa ... |
ef76640f6cfa0646e65bd1d79cf04d5c5f931100 | Neves-Roberto/python-course | /lista_numeros_invertido.py | 357 | 3.828125 | 4 | lista_numeros = []
cont = 1
while cont != 0:
lista_numeros.append(int(input('Digite um numero inteiro: ')))
if lista_numeros[-1] == 0:
cont = 0
tamanho = len(lista_numeros)
lista_numeros_invertida = []
while cont < tamanho:
lista_numeros_invertida.append(lista_numeros[(tamanho - 1) - cont])
cont... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.