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 |
|---|---|---|---|---|---|---|
748d03635387c9a23cf71a5e9970d29ea94cc36b | rogeriosilva-ifpi/teaching-tds-course | /programacao_estruturada/20192_186/Bimestral1_186_20192/ANTONIO_FRANCISCO_OLIVEIRA___EDRAS/base_triangulo.py | 280 | 3.65625 | 4 | def programa():
base = float(input('Digite a base do triângulo: '))
altura = float(input('Digite a altura do triângulo: '))
print('A área do triângulo é: ', area(base, altura))
def area(arroz, fejao):
area = (arroz * fejao) / 2
return area
programa()
|
e2c304d5ec7da25ff76e6b84f3dd1ceed672703d | rogeriosilva-ifpi/teaching-tds-course | /programacao_estruturada/20192_186/Bimestral2_186_20192/Parte 2/Luciano Oliveira/2questao2parte.py | 846 | 3.734375 | 4 | def senha():
senha = str(input("Digite uma senha: "))
tamanho = len(senha)
a = b = c = 0
for l in senha:
if chr(65) <= l <= chr(90):
a = a + 1
if chr(97) <= l <= chr(122):
b = b + 1
if "123456789":
c = c + 1
if tamanho >= 8 :
if a ... |
f5f4ae98f4461ea578682973cfd8708e409e822a | rogeriosilva-ifpi/teaching-tds-course | /programacao_estruturada/20192_166/cap7_iteracoes/escrever_primos.py | 575 | 3.75 | 4 | def programa():
limite_inferior = int(input('Inferior: '))
limite_superior = int(input('Superior: '))
while limite_inferior <= limite_superior:
if eh_primo(limite_inferior):
print(limite_inferior)
limite_inferior = limite_inferior + 1
def eh_primo(numero):
inicio = 1
c... |
c6d94761d588165768ce6cda96a2e6e7c04d12f6 | rogeriosilva-ifpi/teaching-tds-course | /programacao_estruturada/20192_166/Bimestral2_166_20192/Parte_1/willian moraes luis prova/questao3.py | 531 | 3.8125 | 4 | def main():
preco_carro = int(input('digite o valor do carro:'))
ano = int(input('digite o ano do carro:'))
if ano >= 15:
print(preco_carro)
elif ano > 5 and ano < 10:
soma = preco_carro - (preco_carro * 0.15)
print(soma)
desconto = preco_carro - soma
print('seu d... |
e0a449a5c193d1cd1860672cec0b9791350f7ad6 | rogeriosilva-ifpi/teaching-tds-course | /programacao_estruturada/20192_186/Bimestral2_186_20192/Parte 2/adailton dia 2 rogerio/q5.py | 605 | 3.5625 | 4 | def programa():
veiculo = float(input('Digite o valor do veiculo: '))
taxa = float(input('Digite o valor da taxa: '))
valor_mensal = float(input('Digite o valor mensal de deposito: '))
taxa_mensal = (taxa / 12) / 100
contador_acumulo = 0
contador_tempo = 0
while contador_acumulo > veic... |
e1e0b860d1d6817bb4eb94a0d0d511d3069c85a1 | rogeriosilva-ifpi/teaching-tds-course | /programacao_estruturada/20192_166/cap5_condicionais/hello0.py | 283 | 3.8125 | 4 | def programa():
# entrada
nome = input('Digite seu nome: ')
idade = int(input('Digite a idade: '))
if idade >= 18:
print('Parabens', nome, 'voce ja e de maior')
else:
print('Infelizmente voce ainda e um bebezinho')
print('fim')
programa()
|
a36a3ee87b97121407b54a8e815f5e55841dd6ac | cdedmondson/project-3 | /Program2.py | 4,142 | 3.796875 | 4 | import re
# Checks if user exists in database if not add user to database
def addUser(user, password):
# If user name is not in database and the password is valid and the user id is valid then add new user
if (not inDatabase(user)) and isValidPassword(password) and isValidUserID(user):
database... |
f36666c605117ed5873078de0dd1ce6b783a2417 | CebucBogdan/GraphicalUserInterface | /Turtle.py | 654 | 3.921875 | 4 | import turtle
from math import pi
bob = turtle.Turtle()
def square(t, length):
for i in range(4):
t.fd(length)
t.lt(90)
def polygon(t, n ,length):
degrees = 360/n
for i in range(n):
t.fd(length)
t.lt(degrees)
def circle(t, r):
circumference = 2 * ... |
6341ccb7964ce49866e79ff209db627e98399186 | jdjkelly/genomics | /ads1-algorithims-for-dna-sequencing/04/shortest_common_superstring.py | 1,692 | 3.59375 | 4 | import itertools
def overlap(a, b, min_length=3):
""" Return length of longest suffix of 'a' matching
a prefix of 'b' that is at least 'min_length'
characters long. If no such overlap exists,
return 0. """
start = 0 # start all the way at the left
while True:
start = a.find... |
8828cb507d53a4cf69b953c7e01839bf6af16fc1 | yuq-1s/homework | /sorting/count_sort.py | 590 | 3.578125 | 4 | #! /usr/bin/env python
from pdb import set_trace
def count_sort(Arr):
min_value = min(Arr)
max_value = max(Arr)
# HACK: zeros(max.....)
B = ([0]*(max_value - min_value + 1))[:]
for num in Arr:
B[num-min_value]+=1
last_num = 0
for i in range(len(B)):
B[i] += last_num
... |
d3dfec0f977e2993527b264236f4fe70c49d657d | yuhouzhou/sml | /HW02_2019_09_16/p5.py | 1,743 | 3.84375 | 4 | import matplotlib.pyplot as plt
import numpy as np
"""
GTM: Due to wrong formulation -0.5
given points 2.5
"""
def volatility(c, y, n, m, f=1):
"""
:param c: annual coupon rate
:param y: yield to maturity
:param n: years to maturity
:param m: number of payments per year
:param f: par value
... |
7002c84202396bb1e5a44faefab90e49487584bc | Delvio/Volcanoes-in-the-world | /volcanoes-map.py | 2,194 | 3.75 | 4 | import folium
import pandas
# Reading the data from the txt file using pandas
data = pandas.read_csv("volcanoes.txt")
name = list(data["Name"])
lat = list(data["Latitude"])
lon = list(data["Longitude"])
elev = list(data["Elevation"])
volcano_type = list(data["Type"])
last_known_eruption = list(data["Last Known Erupti... |
c5caf6646bf4834c59ff21b005a751aca4380a45 | claudinemahoro/Password-locker | /credentials.py | 2,040 | 3.890625 | 4 | import random
import string
from user import User
class Credential:
'''
Class to help saving user's different accounts'credentials or create new ones.
'''
list_of_credentials =[]
user_credentials_list = []
def __init__ (self,username,platform_name,account_name,password):
'''
Method to define the prop... |
8a27f2d1f5980ceaf9826b015f0727917eb303a2 | msuriar/parsing | /python/parsing.py | 870 | 3.578125 | 4 | """Module parsing contains classes used to implement a basic parser."""
class Character(object):
"""Class Character is a data object for a single character."""
# pylint: disable-msg=too-few-public-methods
def __init__(self, index, line, column, text):
self.payload = text[index]
self.index ... |
82abd4ca17f00f895586e14ba285743e695506aa | agalar2002/hackerrank | /python/print-function/solution.py | 91 | 3.515625 | 4 | n = int(input())
a = 0
v = ""
while n > 0:
n -= 1
a += 1
v += str(a)
print (v)
|
50d79d8e47fe808a5e84382a0d46af8dddc0ab83 | ChristofferArnlund/Applied-Artificial-Intelligence-Python- | /reversi.py | 11,449 | 3.640625 | 4 |
#Reversi imports
import random
import sys
import os
from threading import Timer
import time
def drawBoard(board):
#Prints out board that is passed. Return None.
HLINE = ' +---+---+---+---+---+---+---+---+'
VLINE = ' | | | | | | | | |'
print (' 1 2 3 4 5 6 7 8')
p... |
4b320cbfa5c387375c7eb2939c3f83e3eaed0995 | houbin/recipes | /python/day05/narcissistic_number.py | 282 | 3.5 | 4 | """
narcissistic number
"""
loop = 0
for i in range(100, 999):
hundred_digit = i // 100
tens_digit = (i % 100) // 10
single_digit = i % 10
if hundred_digit ** 3 + tens_digit ** 3 + single_digit ** 3 == i:
print('%d: %d' % (loop, i))
loop += 1
|
15ad7c2c4e4eb8680b8407497ee448e8c679d329 | houbin/recipes | /python/day01/radius.py | 218 | 3.953125 | 4 | """
输入圆的半径,计算周长和面积
l = 2πr
s = πr*r
"""
import math
r=float(input('input r:'))
perimeter = 2 * math.pi * r
area = math.pi * r * r
print('周长: %.2f, 面积: %.2f' % (perimeter, area))
|
7afa2a2f42b00963e1fec475bff39a91d19925df | justinyates887/p4e-wordFinders | /main.py | 1,111 | 3.5625 | 4 | from tkinter import *
from tkinter import filedialog
def init():
file_opener()
base = Tk()
base.geometry('300x150')
def match(words, fhand):
count = 0
for word in words:
for line in fhand:
count += 1
if any(word in line for word in words):
print('Line ' + s... |
2caa6b70bf4ab117f5c2aa4f0fa74a9b336c509a | coreyacl/InteractiveProgramming | /Asteroid.py | 20,428 | 3.96875 | 4 | import pygame
from pygame.locals import *
import time
import math
import random
class Asteroid():
"""
Asteroid Class:
x - position
y - position
speed - speed of asteroid
direction - direction of asteroid
image - surface containing picture of asteroid
gameDisplay - the display to put th... |
75b165d0a815a9e3edf7e3847f35336e342e77da | EvaldasStremas/CGoL | /flight-exercise-2-main/flights_tests_3.py | 1,636 | 3.75 | 4 | '''
Run tests with: python -m unittest flights_tests
Run 2nd class: python -m unittest flights_tests.FlightsTestCase2
https://docs.python.org/3/library/unittest.html
'''
import unittest
import flights
# import os
class FlightsTestCase(unittest.TestCase):
def setUp(self):
print('executing setUp')
... |
5ceaca20092251297bf2cdca80cf4970bc5d3fc4 | madjaqk/encryption_for_josh | /encryption_for_josh.py | 3,564 | 4.09375 | 4 | import datetime
import itertools
def numberfy(string):
# Returns a list with the unicode values of the letters in a string
return [ord(c) for c in string]
def letterfy(num_list):
# Converts a list of unicode values (such as produced by numberfy) into a
# string
return "".join([chr(i) for i in num_... |
9e8ec86987e2ef90fc89b59f1497c285dbd7355c | Zahar23/python-snippets | /persons_alive.py | 1,047 | 3.53125 | 4 | """
Given a list of people with their birth and death years (all between 1900 and 2000),
find the year with the most number of people alive.
"""
from pprint import pprint
persons = [(1900, 1910), (1905, 1920), (1907, 1918), (1920, 1925)]
years_slices = []
for p in persons:
years_slices.append((p[0], '+1'))
y... |
1f527d83890651daeebb1874a70225fa013d07e4 | louisbranch/hello-py | /ProblemSet3/ps3_newton.py | 1,757 | 4.21875 | 4 | # 6.00x Problem Set 3
#
# Successive Approximation: Newton's Method
#
# Problem 1: Polynomials
def evaluatePoly(poly, x):
'''
Computes the value of a polynomial function at given value x. Returns that
value as a float.
poly: list of numbers, length > 0
x: number
returns: float
'''
s =... |
f525328d7f0accb742b1c5c068109c35404be1ef | Itamar-Farias/TST_P1_UFCG | /unidade1/area_circulo/area.py | 96 | 3.515625 | 4 | #coding: utf-8
import math
r = float(raw_input())
area = math.pi * (r**2)
print "%.2f" % (area)
|
bd2b8e740042e472b54269eb862e606b7715d6d2 | Itamar-Farias/TST_P1_UFCG | /unidade3/gratificacao_natalina/gratificacao_natalina.py | 1,182 | 3.546875 | 4 | # coding: utf-8
# Itamar da Silva Farias 115210021
# Programação I
cargo = int(raw_input())
if cargo == 1:
print "Deverá receber em dezembro R$ 25000.00."
elif cargo == 2:
print "Deverá receber em dezembro R$ 15000.00."
elif cargo == 3:
faltas = int(raw_input())
if faltas == 0:
print "Valor da gratificação R$ %.... |
bb3e312a072b4aecbdfb46673d630b8aa7d01ea9 | Itamar-Farias/TST_P1_UFCG | /unidade8/expressao_regular_simples/expressao_regular_simples.py | 511 | 3.609375 | 4 | # coding: utf-8
# Itamar da Silva Farias 115210021
# Programação I
def is_substring_expr(str1,str2):
str_separada = [""]
indice = 0
for letra in str2:
if not letra == "*":
str_separada[indice] = str_separada[indice]+letra
else:
str_separada.append("")
indice += 1
for i in range(len(str_separada[0]... |
a64eda3c72c6bffbf88fb5a8501b83e5a5050576 | Itamar-Farias/TST_P1_UFCG | /unidade4/nova_palavra.py | 227 | 3.59375 | 4 | # coding: utf-8
# Itamar da Silva Farias 115210021
# Programção I
nome = raw_input()
numero = raw_input()
nova_palavra = ""
n = 1
for x in range(len(nome)):
nova_palavra += (nome[x] * (int(numero[-1]) + n))
n += -1
print nova_palavra
|
c4715bccc551d5fb4a3b1fde47cf9037abac8c17 | Itamar-Farias/TST_P1_UFCG | /unidade4/menor_extremo/menor_extremo.py | 1,052 | 3.875 | 4 | # coding: utf -8
quantidade_numeros = int(raw_input())
lista_numero = []
quant_menor_superior0 = 0
quant_maior_superior0 = 0
quant_menor_superior1 = 0
quant_maior_superior1 = 0
for n in range(quantidade_numeros):
numero = int(raw_input())
lista_numero.append(numero)
if lista_numero[0] < lista_numero[-1]:
print "M... |
db370190bb8dc4f83a9cc87e4de2ab4d75003d2b | Itamar-Farias/TST_P1_UFCG | /unidade7/obfuscation/ofuscation.py | 1,630 | 3.671875 | 4 | # coding: utf-8
# Itamar da Silva Farias 115210021
# Programação I
def func():
while True:
nova_palavra = ""
palavra = raw_input().split()
if palavra[0] == "fim":
break
for i in range(len(palavra)):
if i > 0:
nova_palavra += len(palavra[i - 1]) * "*"
for j in range(len(palavra[i])):
if palavr... |
66449534be79e3db289fa647ffc73d336e192ee4 | Itamar-Farias/TST_P1_UFCG | /unidade3/defensivos/defensivos.py | 800 | 3.578125 | 4 | # coding: utf-8
# Itamar da Silva Farias 115210021
# programação I
"""Defensivo volume preço
Fungicida 1.0L/ha 50 320
Herbicida 0.3L/ha 1 100
Inseticida 2.5L/ha 30 400"""
defensivo = raw_input()
area = float(raw_input())
if defensivo == "Fungicida":
quantidade = ... |
f3cc7b1639cf40a7d8ac44526ba4cea248b59087 | Itamar-Farias/TST_P1_UFCG | /unidade4/criptografia_senha/criptografia_senha.py | 512 | 3.578125 | 4 | # coding: utf-8
# Itamar da Silva Farias 115210021
# Programação I
palavra = raw_input()
senha = ""
troca = 0
for x in range(1, len(palavra)):
if palavra[x] == "a" or palavra[x] == "A":
senha += "4"
troca += 1
elif palavra[x] == "e" or palavra[x] == "E":
senha += "3"
troca += 1
elif palavra[x] == "i" or pa... |
c85ab01cba0e60fbd4143f029922dd637e606c38 | Itamar-Farias/TST_P1_UFCG | /unidade3/limpeze/limpeza.py | 457 | 3.53125 | 4 | # coding: utf-8
# Itamar da Silva Farias 115210021
# Programação I
servico = int(raw_input())
if servico == 1:
volume = float(raw_input())
if volume * 80 >= 200:
print "R$ %.f,00" % (volume * 80)
print "Brinde!"
else:
print "R$ %.f,00" % (volume * 80)
elif servico == 2:
volume = float(raw_input())
if volu... |
419d50a04563565f7238f70091d1c0b1695ed4f2 | Itamar-Farias/TST_P1_UFCG | /unidade6/cpf.py | 767 | 3.546875 | 4 | # coding: utf-8
# Itamar da Silva Farias 115210021
# Programação I
def calcula_digitos_verificacao(digit):
invertida = []
soma = 0
soma2 = 0
for i in range(len(digit)-1,-1,-1):
invertida.append(digit[i])
for j in range(len(invertida)):
d = int(j) + 2
soma += d... |
ae069876ea6409ad4a9ff29f1fb23a915d707e01 | priyankagoma/learningpython | /src/python_scripts/print_examples/printexamples.py | 290 | 4.15625 | 4 | #below are few examples that how we can print numbers.
print(2 + 8)
print(3 * 5)
print(6 - 3)
#Example of a string.
print("The end", "it should be nice", "we will able to make it")
#Exapme of integers.
print(1, 2, 3, 4, 5)
#Example of words.
print("one two three four five cat dog") |
80d37ebeedc1dc329cc95558504b125319d7654e | francomasu/ET21de10 | /Granja Franco Masucco.py | 9,211 | 3.734375 | 4 |
class Animal():
def init(self, nombre, peso):
self.nombre = nombre
self.peso = peso
self.sed = 100
self.hambre = 100
self.vacunado = "no"
self.comio = 0
self.auxc = 0
self.auxc2 = 0
self.auxc3 = 0
def verificar(self):
verif =... |
9ce8e85defc8e4af03f38fd4ce660fbf82ec95c8 | lenafabr/fiberModel | /scripts/genutils.py | 3,032 | 3.6875 | 4 | """ generic utilities for python scripts """
from numpy import *
from math import *
class Quaternion:
def __init__(self,coords):
self.coords = array(coords)
def getRotMat(self):
"""get rotation matrix for this quaternion"""
w = self.coords[0]
x = self.coords[1]
y = ... |
0cdc3c136c8532d63a52d8005184c2e9b2ed603c | snymanc/tictactoe | /player.py | 3,319 | 3.78125 | 4 | import math
import random
class Player:
def __init__(self, letter):
# letter is x or o
self.letter = letter
# we want all players too get their next move
def get_move(self, game):
pass
class RandomComputerPlayer(Player):
def __init__(self, letter):
super().__init__(l... |
74df60ce51b49bd982b555b0598dbcaf9af18cca | abdullahharuntahtali/my_codes_of_python_data_structures | /Stack-Queue/Queue.py | 694 | 3.71875 | 4 | import appendinsertvepopfonksiyonu
class Queue: #FIFO İLK GİREN İLK ÇIKAR
def __init__(self):
self.dizi=list()
def isEmpty(self):
return self.dizi==[]
def enqueue(self,eleman) :#elemanı başa ekler
self.dizi=appendinsertvepopfonksiyonu.insert(self.dizi,0,eleman)
print(... |
d36390c8f81c15c6dbddc3660a7763ef585fcbdf | abdullahharuntahtali/my_codes_of_python_data_structures | /Recursive/listetoplama.py | 226 | 3.765625 | 4 | syc=0
def addition(array,syc):
#print(syc)
if syc==0 :
return 0
else:
print(array[syc-1])
return array[syc-1]+addition(array,syc-1)
x=[1,2,2,2]
print(addition(x,len(x)))
|
151a7065a5c689f6ec62334bd0ddf68bb307cd76 | abdullahharuntahtali/my_codes_of_python_data_structures | /Stack-Queue/Stack.py | 1,013 | 3.84375 | 4 | import temp #Bu Kütüphanemde append ve pop fonksiyonlarını kendim yazdım.Koduda aşağıda ;
"""def append(dizi,y):
i=len(dizi)
i+=1
x=[None]*i
for j in range (0,len(dizi)):
x[j]=dizi[j]
x[i-1]=y
dizi=x
return x
def pop(dizi):
i=len(dizi)-1
x=[None]*i
for... |
a19fda8f5221baa8186d7233f95d797f4c4976fc | abdullahharuntahtali/my_codes_of_python_data_structures | /Searching Algorithms/Lineer Search/unorderedlist.py | 314 | 3.8125 | 4 | def lineer_search_unordered_list(liste,value):
index=0
found=False
while(len(liste)>index and not found):
if(liste[index]==value):
found=True
else:
index+=1
return (found,index)
x=[1,5,9,6,99,-8,100,0,5,1,6]
print(lineer_search_unordered_list(x,8)) |
df53ec293bedda6a6954334daca394536dc0e02b | Junhee-Kim1/RandomNumber | /RandomNumberGuesser.py | 442 | 4.15625 | 4 | import random
print("number Guessing Game!")
number=random.randint(1,9)
chance=0
print("guess number")
while chance<5:
guess=int(input("enter your guess!: "))
if guess == number:
print("you win!")
break
elif guess<number:
print("your number is too low")
else:
... |
b2987c015572bf332869d9022027f509a029445a | jayzym/project-euler-solutions | /p9.py | 377 | 3.78125 | 4 | import math
def get_triplets():
a = 0
b = 1
while True:
product = 0
a += 1
b = a + 1
while product <= 1000:
c = math.sqrt((a**2) + (b**2))
product = a + b + c
if product == 1000:
print(str(a*b*c))
return
... |
a202d4dcb98377701d8579f40b6cc2007688fed1 | ma-ath/tensorflow-studies | /2 - FashionMNIST Convolucional/network_architectures.py | 1,919 | 3.625 | 4 | # Neste arquivo, estaremos definindo qual o modelo de rede que usaremos para o treinamento
# Eu acho interessante deixar o modelo em um arquivo separado, pois ajuda a modularizar o nosso codigo
import tensorflow as tf
from tensorflow import keras
# Essa funcao simplesmente retorna o modelo que iremos treinar
de... |
19be1ebc2be21867b2161517c1c8ac7377b900f8 | Parkjju/likelion_TIL | /likelion_session/python/var/input.py | 389 | 3.875 | 4 | print(1+2)
number = 5
print(number)
banjang = "박경준"
print("우리반 반장 이름은 : ",banjang)
bubanjang = input("부반장의 이름을 입력하세요: ")
print("부반장의 이름은 : ",bubanjang)
number1 = int(input("첫 번째 숫자를 입력하세요: "))
number2 = int(input("두 번째 숫자를 입력하세요: "))
print("number1 + number2 = ", number1+number2) |
2ec0e2ba5761d0e6dd2d7fb5ce38debb9d588f74 | Parkjju/likelion_TIL | /likelion_session/python/loop/loop-work.py | 149 | 3.8125 | 4 | count = 0
while True:
print(count)
count+=1
if count == 10:
break
print("무한루프 탈출!")
for a in [1,2,3]:
print(a)
|
0a70620cbfbd548a8ebc7134c2cf385c44e8d8f0 | tswsxk/CodeBook | /Leetcode/84_Largest Rectangle in Histogram.py | 766 | 3.65625 | 4 | # coding: utf-8
# create by tongshiwei on 2018/4/20
class Solution:
def largestRectangleArea(self, heights):
"""
:type heights: List[int]
:rtype: int
"""
if len(heights) == 0:
return 0
max_area = 0
for i in range(len(heights)):
l = len... |
28752254b08bbabd52adcad36061c025b350ebd4 | tswsxk/CodeBook | /Leetcode/TwoSum.py | 372 | 3.609375 | 4 | class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
for i, n1 in enumerate(nums):
for j, n2 in enumerate(nums):
if n1 + n2 == target and i != j:
return [i, j]
if __name__ == "__main__":
sol = Solut... |
e2e381810423c77491c476f57ff42537fb401529 | tswsxk/CodeBook | /Leetcode/RemoveDuplicatesfromSortedArrayII.py | 562 | 3.75 | 4 | class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
ind = 0
res = []
twice_tag = False
while ind < len(nums):
if res and nums[ind] == res[-1]:
if twice_tag:
pass
else:
res.append(nums[ind])
... |
5cc21ba77cd7fb6f6373f589d93e6e04c7cfce58 | tswsxk/CodeBook | /Leetcode/SimplifyPath.py | 784 | 3.5625 | 4 | class Solution(object):
def simplifyPath(self, path):
"""
:type path: str
:rtype: str
"""
path_stack = ["/"]
ind = 0
while ind < len(path):
if path[ind] != "/":
break
ind += 1
record = ""
new_path = path[ind:]
for c in new_path:
if c == "/":
if... |
2df10d0d5ee8a795173c0242666588ea6463ca65 | tswsxk/CodeBook | /Leetcode/Search_for_a_Range.py | 1,686 | 3.6875 | 4 | class Solution(object):
def searchRange(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
head = 0
tail = len(nums) - 1
if nums[head] > target or nums[tail] < target:
return [-1, -1]
def par_search(head, tail, target):
if nums[head] ... |
628001a277e82ccab21bfbee582c4bfac5f2eac2 | tswsxk/CodeBook | /Leetcode/14_LongestCommonPrefix.py | 606 | 3.625 | 4 | class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if len(strs) == 0:
return ""
elif len(strs) == 1:
return strs[0]
ls = [len(s) for s in strs]
cp = ""
for ind in range(min(ls)):
check = strs[0][ind]
for s ... |
121ff596f3e23e4536cc90b6e7f940e94a86c0d4 | julipasserini/prueba | /ejercio3.py | 167 | 3.71875 | 4 | peso=float(input("Cual es tu peso en kg?"))
altura=float(input("Cual es tu altura?"))
imc=(peso/altura)
imc= round(imc,2)
print("Tu Indice de masa corporal es", imc)
|
81f92a04728d40ce4f1f2b8d55cc95ebc2a25f5d | ollybritton/algorithms | /sorting/bubble.py | 402 | 3.96875 | 4 | def bubble(xs):
# Perform a bubble sort on list xs and return the sorted list.
while True:
unsorted = False
print(xs)
for i in range(len(xs) - 1):
i += 1
if xs[i] < xs[i-1]:
xs[i], xs[i-1] = xs[i-1], xs[i]
unsorted = True
... |
2c4da32e1420daae3f9401ca78d4be75b6af5f9d | prathmesh2606/DSA_LU | /a1q1.py | 344 | 4.4375 | 4 | # Assignment 1 - Q1
# Write a python program that takes two numbers as the input such as X and Y and print the result
# of X^Y(X to the power of Y).
# Taking input
x,y = [int(i) for i in input("Enter base value and then power value by giving space between them (eg: 2 3 ans: 8): ").split()]
print(f"{x} to the pow... |
b1b7f0de711f5d40447d83553dc3e8c4bbe3209f | charliettaylor/CSA231 | /Projects/4/project4.py | 2,286 | 4.28125 | 4 | # Turtle Project by Charlie Taylor
from turtle import *
import random as rand
SCALE = "Enter the size of the spiral (recommend 1-10): "
LOW = "Enter low bound of shake (rec. negative or 0): "
HIGH = "Enter high bound of shake (rec. positive or 0): "
def draw_c(t) -> None:
'''
draws letter C
'''
t.do... |
4c2563aa491bcd7ead0ff56495b71f5e741a4468 | charliettaylor/CSA231 | /Classes/Locator.py | 2,905 | 3.5 | 4 | import re
class Locator():
'''
takes an SRL(str) as a parameter
'''
def __init__(self, SRL: str) -> None:
try:
if type(SRL) == str:
self.SRL = SRL
else:
raise ValueError
except ValueError:
print("SRL must be a string... |
0ff56879b6c3ce36475dc0eb4125a27d4c523906 | charliettaylor/CSA231 | /Classes/Mailbox/main.py | 5,122 | 3.546875 | 4 | from mail import Message, Mailbox
running = True
def user_interface(mail) -> None:
'''
main running of ui
'''
while running:
print_menu()
selection = int(input('Enter a number between 1 and 7: '))
if selection == 1:
compose(mail)
elif selection == 2:
... |
070fc3ff17f9e17439b8f6ee398f901375646375 | LoicPonchaux/Simulation_Tennis | /Score/score.py | 2,161 | 3.625 | 4 | import Score.game as game
import Score.set as set
import Player.player as player
class Score():
def __init__(self, J1, J2):
# self.gameJ1 = game.Game()
# self.gameJ2 = game.Game()
self.set1 = set.Set(1)
self.set2 = set.Set(2)
self.set3 = set.Set(3)
self.J1 = J1
... |
9af092a8e0f2967335c0a25e6cfb1194e741fba2 | jakemcannon/Data-Structures | /LinkedList/LinkedList.py | 1,461 | 3.984375 | 4 | #https://medium.freecodecamp.org/python-interview-question-guide-how-to-code-a-linked-list-fd77cbbd367d
#https://medium.com/@kojinoshiba/data-structures-in-python-series-1-linked-lists-d9f848537b4d
class linked_list():
def __init__(self):
self.head = node()
def append(self, data):
new_node = node(data)
cur =... |
6a5d10ca9b4a66b45fd7030a079ecae3665d2f24 | rehankarol09/EndSemPython | /Q8.py | 467 | 4.03125 | 4 | def createlist(list1):
count=int(input("Enter number of elements you want"))
for i in range(count):
data=int(input("Enter element"))
list1.append(data)
def display(list1):
print("Element in list are:")
for i in range(len(list1)):
print(list1[i], " ", end='')
print(... |
33670a82109ba7ef84a17ac20f5313edd182b476 | nikhilbharadwaj0110/python-turtle | /FirstNumbers.py | 828 | 3.71875 | 4 | import turtle
import random
window = turtle.Screen()
tom = turtle.Turtle()
tom.speed(1)
tom.hideturtle()
tom.penup()
tom.goto(-200, 200)
tom.pendown()
for _ in range(4):
tom.write(tom.pos())
tom.forward(400)
tom.right(90)
oneTurtle = turtle.Turtle()
oneTurtle.speed(10)
oneTurtle.color("red")
oneTurtle... |
425c3446e5c7f37e7eb6d52a4fba1ce18e5da43d | nikhilbharadwaj0110/python-turtle | /DrawPattern.py | 821 | 3.9375 | 4 | import turtle
import random
window = turtle.Screen()
tom = turtle.Turtle()
tom.speed(200)
tom.pensize(5)
size = 20
tom.screen.colormode(255)
for i in range(150):
tom.forward(size)
tom.right(135)
tom.forward(10)
tom.backward(10)
tom.right(90)
tom.forward(10)
tom.backward(10)
size = si... |
75f1f106470ace06b5af459e3db246e9eaf33fc9 | bernazsg/LP | /DZ01/dz01.py | 415 | 3.9375 | 4 | # per1 = 200
# per2 = "Переменная"
# print(per1)
# print(per2)
username = input("Введите своё имя >>> ")
height_username = int(input("Введите свой рост в см >>> "))
Year_born = int(input("Введите свой год рождения >>> "))
print(f"{username}, ваш рост - {height_username} см")
print("Вы родились в {} году".format(Year_... |
3ce5b0c40b315834b2c7cd0fa0c0e17d271a31d9 | sherwinvarkiani/Programming-Practice | /OpenCV/PixelManipulationAndFiltering.py | 513 | 3.71875 | 4 | import numpy as np
import cv2
color = cv2.imread("butterfly.jpg", 1)
# Convert image to grayscale
gray = cv2.cvtColor(color, cv2.COLOR_RGB2GRAY)
cv2.imwrite("gray.jpg", gray)
# Split channels
b = color[:,:,0]
g = color[:,:,1]
r = color[:,:,2]
# Set up alpha layer (transparency layer)
# setting the last input as g m... |
e58fc02e65b590d376432ad40b4fc9984ebac759 | NankuF/PythonKnowledge | /SOLVES/dz_course_python_sobes/Lesson2/4.py | 1,179 | 3.796875 | 4 | # Реализовать возможность переустановки значения цены товара.
# Необходимо, чтобы и родительский, и дочерний классы получили новое значение цены.
# Следует проверить это, вызвав соответствующий метод родительского класса и функцию дочернего
# (функция, отвечающая за отображение информации о товаре в одной строке).
... |
d6e0008fbabd8e0c6450f7945ff730f070a1dfb3 | NankuF/PythonKnowledge | /SOLVES/strings/7.py | 714 | 3.71875 | 4 | # 7. Дана строка.
# Определите общее количество символов '+' и '-' в ней.
# А так же сколько таких символов, после которых следует цифра ноль.
s = '+7 (911) 90-50-72'
def check_plus_minus_zero_in_string(s: str):
storage_plus_minus = []
storage_before_zero = []
for i in range(len(s)):
if s[i] == '... |
0aa736149880d32257380a30c7aec91029fd233d | NankuF/PythonKnowledge | /SOLVES/dz_course_python_sobes/Lesson2/3.py | 709 | 3.859375 | 4 | # Усовершенствовать родительский класс таким образом,
# чтобы получить доступ к защищенным переменным.
# Результат выполнения заданий 1 и 2 должен быть идентичным.
class ItemDiscount:
_name = 'A'
_price = 10
class ItemDiscountReport(ItemDiscount):
def get_parent_data(self):
print(ItemDiscount._na... |
c375d422785b223ec527afda67d87f6e69e0115b | NankuF/PythonKnowledge | /SOLVES/strings/12.py | 1,358 | 4.03125 | 4 | # 12. Дана строка.
# Разделить строку на фрагменты по три подряд идущих символа.
# В каждом фрагменте средний символ заменить на случайный символ,
# не совпадающий ни с одним из символов этого фрагмента.
# Показать фрагменты, упорядоченные по алфавиту.
import random
s = 'impossible'
alphabet = 'impossibleZ'
def part... |
7446475f5a503615bc1bd315cdacd3c2193ac78c | NankuF/PythonKnowledge | /SOLVES/arrays/3.py | 377 | 4 | 4 | # 3. Заполнить массив последовательными нечетными числами, начиная с единицы.
from array import array
start_even = 1
def array_odd(start_even: int) -> array:
arr = array('i')
for i in range(start_even, 10):
if i % 2 != 0:
arr.append(i)
return arr
print(array_odd(start_even))
|
e307eb42c7b796d5e927e7f03720a4b3abfca74b | NankuF/PythonKnowledge | /classes/1.py | 596 | 4.125 | 4 | # Определите класс car с двумя атрибутами: color и speed.
# Затем создайте экземпляр и верните speed
"""
class Car:
color = 'red'
speed = 20
car_ex = Car()
print(car_ex.speed)
"""
class Car:
def __init__(self, color, speed):
self.color = color
self.speed = speed
def __str__(self):
... |
c2b4f4115f03c6cc1372232d42d50ad4f2398d13 | koshalsingh/numpy | /numpy5_FancyIndexing.py | 737 | 3.65625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 20 00:02:57 2019
@author: koshal
Fancy Indexing """
a1=np.random.randint(0,20,15)
print('Random matrix A : ', a1)
#filter even nums
mask = (a1%2==0)
#mask contains only boolean values
... |
b05de2457b3e6f8c01b74cb8f2c03670aa5c5e4b | 60rzvvbj/pythonExperiment | /pythonExperiment/experiment5/py5.py | 497 | 3.5 | 4 | import openpyxl
excel = openpyxl.load_workbook('resources/成绩.xlsx')
sheet1 = excel['Sheet1']
m = {}
lst = []
for row in range(2, sheet1.max_row + 1):
key = sheet1.cell(row=row, column=1).value
m[key] = sum([int(sheet1.cell(row=row, column=x).value)
for x in range(2, 5)])
lst.append(key)
... |
d93a306c3e15832d4b0badc2bcf76cacb3f2aa3f | 60rzvvbj/pythonExperiment | /pythonExperiment/experiment4/py4.py | 219 | 3.640625 | 4 | # 4.编写一个lambda表达式,对给定的列表[1, 2, 3, 4, 5]
# 把它的每个元素值分别加上10,生成一个新列表。
lst = [1, 2, 3, 4, 5]
def fun(l): return [x + 10 for x in l]
print(fun(lst))
|
973dd77e69c1aadc14399e409b4bbe368ed8a687 | pierpaolo28/Hackerrank-Challenges | /Miscellaneus/Flipping Bits/flippingbits.py | 265 | 3.6875 | 4 | # Complete the flippingBits function below.
def flippingBits(n):
n = "{0:32b}".format(n)
ib_string = ""
for bit in n:
if bit == "1":
ib_string += "0"
else:
ib_string += "1"
n = int(ib_string, 2)
return n
|
feadda5535fdc46adaff3b01794db2e5d954c285 | pierpaolo28/Hackerrank-Challenges | /10 Days of Statistics/quartiles.py | 406 | 3.546875 | 4 | n = int(input())
arr = sorted([int(i) for i in input().split()])
def median(a, le):
if le%2 == 0:
q = (a[le//2-1]+a[le//2])//2
l = arr[:le//2]
r = arr[le//2:]
else:
q = a[le//2]
l = arr[:le//2]
r = arr[le//2+1:]
return q, l, r
q2, l, r = median(arr, n)
q1, l... |
2de1a1afa31e369f67faccd6f6d78bb7a6702d33 | coldnegative/CSC-Python-2021 | /CSC-Python-2021-1/B/B.py | 732 | 3.71875 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from re import sub
def writer(line):
with open("output.txt", "a") as f:
f.write(line)
def main():
"""Замените в тексте знаки дюйма на парные кавычки-елочки.
Кавычки в тексте всегда парные, вложенных кавычек нет."""
# Code goes over here.
with... |
14b989ac5d250dbbfda318980215ca273b18f261 | coldnegative/CSC-Python-2021 | /CSC-Python-2021-1/J/J.py | 987 | 3.625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from re import sub
def writer(line):
with open("output.txt", "a") as f:
f.write(line)
def main():
"""Дан текст с меню, котором указана цена в долларах (всегда целое число).
Перевести его по курсу $1 = 75р в рубли.
Воспользуйтесь предыдущим кодом:... |
68a43299999babbff039fcac174abbd9b190bdd6 | yingl910/MongoDB | /Aggregation Framework/mdb_aggregation_example5.py | 1,236 | 3.8125 | 4 |
'''This is an example of MongoDB aggregation framework and $unwind operator'''
'''This code uses Tweets data and answers question: Who included the most user mentions?'''
from pymongo import MongoClient
import pprint
client = MongoClient('mongodb://localhost:27017')
db = client.examples
def user_mentions():
# $... |
101cedb9b67c9004b1a4a5af955197ed7b71a4b9 | yingl910/MongoDB | /Basics/mdb_update.py | 1,899 | 4.25 | 4 |
'''These are examples of MongoDB example codes of save and update, two methods for updating'''
'''update method one: save'''
# a method on collection objects
# find_one just returns the first document it finds
city = db.cities.find_one({'name':"munchen",'country':'Germany'})
city['isoCountryCode'] = 'DEU'
db.cities.s... |
215fde65e225e0af5925393805fcea4381e7e6af | Zig12345/MACNode | /tools/imagewrite.py | 502 | 3.546875 | 4 | # # encoding:utf-8
# 用python3生成纯色图像
import cv2
import numpy
#全黑的灰度图
gray0=numpy.zeros((500,500),dtype=numpy.uint8)
cv2.imshow('0',gray0)
#全白的灰度图
gray0[:,:]=255
gray255=gray0[:,:]
cv2.imshow('255',gray255)
#将灰度图转换成彩色图
Img_rgb=cv2.cvtColor(gray255,cv2.COLOR_GRAY2RGB)
#将RGB通道全部置成0
Img_rgb[:,:,0:3]=0
cv2.imshow('(0,0,0)',... |
80d83838ee337f1e35b5c94ba5ac2b929de49a2c | ideadapt/basic-computer-games | /23 Checkers/python/checkers.py | 9,034 | 3.703125 | 4 | """
CHECKERS
How about a nice game of checkers?
Ported by Dave LeCompte
"""
PAGE_WIDTH = 64
HUMAN_PLAYER = 1
COMPUTER_PLAYER = -1
HUMAN_PIECE = 1
HUMAN_KING = 2
COMPUTER_PIECE = -1
COMPUTER_KING = -2
EMPTY_SPACE = 0
INVALID_MOVE = -99
def print_centered(msg):
spaces = " " * ((PAGE_WIDTH - len(msg)) // 2)
... |
e24b5a2a042fda13abdb24384747e19a023d5759 | stevexyz/BF-it | /Compiler/Compiler.py | 5,810 | 3.65625 | 4 | #!/usr/bin/env python3
from Compiler.Lexical_analyzer import analyze
from Compiler.FunctionCompiler import FunctionCompiler
from Compiler.Parser import Parser
from Compiler.General import *
"""
This file is responsible for creating FunctionCompiler objects and global variables objects
And finally return the code of t... |
12f14a392b85dd71884ec1cb1664fb99f27c3e59 | Martijn94b/Project-Benno | /Backup/Progress.py | 2,649 | 3.609375 | 4 | import matplotlib.pyplot as plt
import psycopg2
def progress():
conn_string = "host='localhost' dbname='Sportschool' user='postgres' password='Burdeos1'"
# print the connection string we will use to connect
print ("Connecting to database\n ->%s" % (conn_string))
# get a connection, if a connec... |
21bdb199831f085b7138edbd7fd6876ce31958a3 | EDSATeam11/team11_main | /function_3.py | 733 | 3.890625 | 4 | #3. Date Parser
#Write a function which takes a list of datetime strings and converts it into a list of strings with only the date.
def date_parser(list_dates):
#extract the date only : Mikael
new_list = []
for item in list_dates:
item = item.split(' ')
#append dates to new list : Mikael
... |
2425a62710c69d554ad8432fdeebb62632d3c344 | BramB-1952444/adventOfCode2020 | /day3/day3.py | 404 | 3.671875 | 4 | def countTrees(lines):
count = 0
x = 0
for i in range(len(lines)):
x = (i * 3) % len(lines[i])
if(lines[i][x] == "#"):
lines[i][x] = "X"
count += 1
lines[i][x] = "O"
return count
f = open('/home/bram/code/adventOfCode2020/day3/input.txt', 'r')
content = ... |
01e3f4220e458c97469a254e12c313a72f4a337c | mottrelleg/mycode | /lab_input/chall3b.py | 275 | 3.515625 | 4 | #!/usr/bin/env python3
medium= ["science", "turbo", {"eyes": "goggles", "goggles": "eyes"}, "nothing"]
print(f"My {medium[2]['goggles']}! The {medium[2]['eyes']} do {medium[3]}")
print("My " + medium[2]["goggles"] +"! " + "The " + medium[2]["eyes"] + " do " + easy[3] +"!")
|
8ac6b2fa6454658b035caa3a32cae127722fb67c | hacquees/RampingUp | /ClassMarks.py | 675 | 3.890625 | 4 | list1=[]
list2=[]
a=int(input("Enter Number Of Students : "))
def main():
take_input()
print_studentmarks()
print_averagemarks()
def take_input():
for i in range(0,a):
Name=str(input("Name : "))
Marks=int(input("Marks : "))
list1.append(Name)
list2.append(Marks)
... |
cd890912e0574154ac18385ac92f43fdd68f430d | PrabhudevMishra/PRO-97 | /numberGuessingGame.py | 497 | 4.15625 | 4 | import random
number = random.randint(0,10)
chances = 0
while chances < 5 :
guess = int(input("Enter your guess"))
chances = chances + 1
if guess < number:
print('Your guess is too low')
if guess > number:
print('Your guess is too high')
if guess == number:
brea... |
a963c2732d9c1aa5bb580bd302bd1c7aa1da48ef | mizan-cs/Coding-Practise | /matrix.py | 268 | 3.515625 | 4 | def visit_line(arr, row_start, col_start, increase):
for i in range(len(arr)):
input = [[1,2,3],[4,5,6],[7,8,9]]
row = len(input)
col = len(input[0])
current = 'right'
for i in range(0,row):
for i in range():
print(i)
#11, 12, 13, 23, 33, 32, 31, 21, 22 |
a7cd02391d3b6642434d5ed49ebb9262f34f7529 | limwonki0619/Python-lecture | /Python_coding_dojang/Test/Unit10.py | 421 | 3.984375 | 4 | # Unit 10. 심사문제 : range로 튜플 만들기
# 표준 입력으로 정수가 입력됩니다. 시작하는 숫자는 -10, 끝나는 숫자는 10이며
# 입력된 정수만큼 증가하는 숫자가 들어가도록 튜플을 만들고,
# 해당 튜플을 출력하는 프로그램을 만드세요(input에서 안내 문자열은 출력하지 않아야 합니다).
x = int(input())
print(tuple(range(-10, 10, x))) |
5dc8032666bd7831e735b03864f09c28af0547d8 | limwonki0619/Python-lecture | /Python_coding_dojang/Test/Unit18.py | 792 | 3.8125 | 4 | # 심사문제 : 두 수 사이의 숫자 중 3으로 끝나지 않는 숫자 출력하기
# 표준 입력으로 정수 두 개가 입력됩니다.
# (첫 번째 입력 값의 범위는 1~200, 두 번째 입력 값의 범위는 10~200이며
# 첫 번째 입력 값은 두 번째 입력 값보다 항상 작습니다).
# 다음 소스 코드를 완성하여 첫 번째 정수와 두 번째 정수 사이의 숫자 중 3으로 끝나지 않는 숫자가 출력되게 만드세요.
# 정답에 코드를 작성할 때는 while True:에 맞춰서 들여쓰기를 해주세요.
start, stop = map(int, input().split())
i = start
w... |
498bbf7e9ac923dffb0e6f4c93e1e9fcb4bbcaed | limwonki0619/Python-lecture | /Python_coding_dojang/Test/Unit24.py | 1,141 | 3.625 | 4 | # Unit 24 심사문제 1
# 표준 입력으로 문자열이 입력됩니다.
# 입력된 문자열에서 'the'의 개수를 출력하는 프로그램을 만드세요
# (input에서 안내 문자열은 출력하지 않아야 합니다).
# 단, 모든 문자가 소문자인 'the'만 찾으면 되며 'them', 'there', 'their' 등은 포함하지 않아야 합니다.
text = str(input())
words = text.split()
count = 0
for word in words:
if word.strip(',.') == 'the':
count += 1
print(cou... |
d37b1997d4fdf240a28d3d71308629907dc55f53 | limwonki0619/Python-lecture | /Python_coding_dojang/Test/Unit12.py | 727 | 3.59375 | 4 | # Unit 12. 심사문제 :
# alt+shift+e는 한줄씩 실행되어 다음과 같은 코드를 인식하지 못함.
# 따라서 코드 전체를 선택한 후 alt+shift+e를 실행하던지
# 파이썬 스크립트 전체를 실행해야 함. (전체를 실행키는 단축키는 alt+shift+F10)
# 표준 입력으로 문자열 여러 개와 숫자(실수) 여러 개가 두 줄로 입력됩니다.
# 입력된 첫 번째 줄은 키, 두 번째 줄은 값으로 하여 딕셔너리를 생성한
# 뒤 딕셔너리를 출력하는 프로그램을 만드세요.
# input().split()의 결과를 변수 한 개에 저장하면 리스트로 저장됩니다.
x ... |
af64f397f79e77e561f3303c042ac5ba8013cb20 | limwonki0619/Python-lecture | /Python_coding_dojang/Test/Unit19.py | 966 | 4.03125 | 4 | # 심사문제 : 산 모양 출력하기
# 표준 입력으로 삼각형의 높이가 입력됩니다.
# 입력된 높이만큼 산 모양으로 별을 출력하는 프로그램을 만드세요
# (input에서 안내 문자열은 출력하지 않아야 합니다).
# 이때 출력 결과는 예제와 정확히 일치해야 합니다.
# 모양이 같더라도 공백이나 빈 줄이 더 들어가면 틀린 것으로 처리됩니다.
step = int(input())
for i in range(step): # 내가 작성한 코드.. 심사는 통과하지 못함.. 왜 ??????????
for k in range(i, step):
print(' ... |
5248640cde73d5e864939737198fb2ddef1339ad | Cfhansen/stephenson-pywb94 | /main.py | 253 | 3.6875 | 4 | ###solution to exercise 94 from ben stephenson's "the python workbook".
import random
def password():
length = random.randint(7,10)
result = ''
for i in range(length):
result = result + chr(random.randint(33,126))
return result
print(password())
|
3e13712c7a4b57c4a45f6104e1343571489a012c | kwsherwood/portfolio | /nltk-learn/NatLang01.py | 752 | 3.59375 | 4 | from bs4 import BeautifulSoup
from urllib import request
import nltk
############### modifying tutorial from:https://humanitiesprogramming.github.io/resources/
############### These lines omitted so as to work on local version
#url = "https://raw.githubusercontent.com/humanitiesprogramming/scraping-corpus/master/full-t... |
7ad40515719dd9b1a45f7067abd5e54e18908b68 | kwsherwood/portfolio | /python/ex11.py | 321 | 4 | 4 | # THIS ITERATES THROUGH THE PAIR OF A dictionary using ".item"
# SO. Effecxtively ".items" turns a dictionary into a sequential list so that you can move through the items in order.
states_names ={"VA":"Virginia","MD":"Maryland"}
for abbrev, state in states_names.items():
print(abbrev+ " is the code for " + state)... |
da838c5c7a00dec5d32526b69dd53d7d8314be5d | kwsherwood/portfolio | /python/ex5.py | 139 | 3.796875 | 4 | # list and append
fruits = ['orange','peach','apple']
results = []
for item in fruits:
results.append(item)
results
# print(results)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.