blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
b76db936d110914c8a3cfa76411014253d940222 | YingZi18/1 | /rpsls.py | 2,048 | 4.1875 | 4 | #coding:gbk
"""
һСĿRock-paper-scissors-lizard-Spock
ߣӢ
ڣ2020.4.9
"""
import random
print("ӭʹRPSLSϷ")
print("ѡ:")
choice_name=input()
print("----------------")
def name_to_number(choice_name): #ѡתΪ
if choice_name=="":
return 4
elif choice_name=="ʯͷ":
return choice_name==0
elif choice_name=="ʷ":
... | false |
cd8dbf34d866708f6f1953a387bc3519ac4bc05b | jmuguerza/adventofcode | /2017/day17.py | 1,976 | 4.15625 | 4 | #/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
PART 1
There's a spinlock with the following algorithm:
* starts with a circular buffer filled with zeros.
* steps forward some number, and inserts a 1 after the number
it stopped on. The inserted value becomes the current position.
* Idem, but inserts a 2. Rin... | true |
fa2f83e4a96be139adcfa59660ebc96dd120a6fe | nihalgaurav/pythonprep | /MixedSeries.py | 1,203 | 4.4375 | 4 | """Consider the below series:
1, 2, 1, 3, 2, 5, 3, 7, 5, 11, 8, 13, 13, 17, ...
This series is a mixture of 2 series - all the odd terms in this series form a Fibonacci series
and all the even terms are the prime numbers in ascending order.
Write a program to find the Nth term in this series.
The value N is a Positive ... | true |
c80b92dfa26817fc051fd4609230815fe1cfc8be | Dylandk10/fun_challenges | /python/palindrome_number.py | 632 | 4.25 | 4 | """
Given an integer x, return true if x is palindrome integer.
An integer is a palindrome when it reads the same backward as forward.
For example, 121 is palindrome while 123 is not.
examples
Input: x = 121
Output: true
Input: x = -121
Output: false
Explanation: From left to right, it reads -121. From right to left,... | true |
7d6065d6e222eaec66ef5c383e7442303b265a8b | zerolinux5/Python-Tutorials | /chapter1.py | 1,310 | 4.15625 | 4 | movies = ["The Holy Grail", "The Life of Brian", "The Meaning of Life"]
print(movies[1])
"""
cast = ["Cleese", 'Palin', 'Jones', "Idle"]
print(cast)
print(len(cast))
print(cast[1])
cast.append("Gilliam")
print(cast)
cast.pop()
print(cast)
cast.extend(["Gilliam", "Chapman"])
print(cast)
cast.remove("Chapman")
print(ca... | false |
8b0e54cf78a1a82c8ae92655723fc3b313e18185 | DauntlessDev/py-compilation | /Prime or not.py | 412 | 4.21875 | 4 | # Python program to check if the input number is prime or not
number = 123
if number > 1:
# check for factors
for i in range(2,number):
if (number % i) == 0:
print(number,"is not a prime number")
print(i,"times",number//i,"is",number)
break
else:
pri... | true |
6b982842a841b71f48d49b9af48e75f4066ca224 | juriemaeac/Data-Structure-and-Algorithm | /Lab Exercise 1/DecimalToBinary.py | 414 | 4.3125 | 4 | num = int(input("Enter a decimal number: "))
#Empty string to hold the binary form of the number
b = ""
while num != 0:
if (num % 2) == 1:
b += "1"
else:
b += "0"
#this is equivalent to num = num // 2 ----- num/=2 results to decimal
#use double slash to result in integer
num//=2
... | true |
959d40e7949962c427e5edb64a366133c119faf8 | juriemaeac/Data-Structure-and-Algorithm | /Lab Exercise 1/Palindrome.py | 556 | 4.40625 | 4 | '''
by Jurie Mae Castronuevo
from BSCOE 2-6
[November 22, 2020]
'''
import re
z = input("Enter a word: ")
x = z.lower()
#x[::-1] is used to reverse all the elements
#source lesson: https://jakevdp.github.io/PythonDataScienceHandbook/02.02-the-basics-of-numpy-arrays.html
#library that accepts word with some symbols and... | true |
8b2a5bed4207d1f5c8f63e857148d1faf7d92a59 | kg55555/pypractice | /Part 1/Chapter 6/exercise_6.6.py | 341 | 4.1875 | 4 | favorite_languages = {
'jen': 'python',
'sarah': 'c',
'edward': 'ruby',
'phil': 'python',
'bob': '',
'joe': ''
}
for name, language in favorite_languages.items():
if language != '':
print(f"{name}, your favourite language is {language}")
else:
print(f"Please take our lang... | false |
af63ebe4e641ab2b8ce18f8602a7a89a3ace4b27 | kg55555/pypractice | /Part 1/Chapter 6/exercise_6.11.py | 518 | 4.375 | 4 | tokyo = {'country': 'japan', 'population': 12338734, 'fact': 'Tokyo is beautiful!'}
vancouver = {'country': 'canada', 'population': 4829453, 'fact': 'Vancouver is cold!'}
new_york = {'country': 'usa', 'population': 7943854, 'fact': 'New York is busy!'}
cities = {'tokyo': tokyo, 'vancouver': vancouver, "new york": new_... | false |
241c25f337622ce86f3c8a246a7384869e025ad6 | kg55555/pypractice | /Part 1/Chapter 3/exercise_3.5.py | 487 | 4.125 | 4 | famous = ['steve jobs','bill gates', 'gandhi']
print(f"Hello {famous[0].title()}, I'd like to invite you to dinner with me!")
print(f"Hello {famous[1].title()}, I'd like to invite you to dinner with me!")
print(f"Hello {famous[2].title()}, I'd like to invite you to dinner with me!")
print(f"Oh no! {famous.pop().title()... | true |
9fae3d11dd9fa50aeafba53bb0a5c1bb44861a21 | PAJADK/myPythonLektioner | /lektion5/chapter8-2.py | 975 | 4.1875 | 4 | def make_album(name, title, number_of_tracks=''):
if number_of_tracks:
album = {'artist_name': name, 'album_titel': title, 'tracks':number_of_tracks}
else:
album ={'artist_name': name, 'album_titel': title}
return album
albums = make_album('jime', 'henrikx')
print(albums)
albums = make_al... | false |
e80b8a5f48ebca0f07d57f823bb6374c9d6baae3 | valemescudero/Python-Practice | /Class 1/04. Primality Test.py | 658 | 4.21875 | 4 | # Write a function that recieves a number and returns True when it's a prime number and False when it's not.
# Through a for loop check for the primality of numbers 1 to 20.
def is_prime(num):
if num == 1:
primality = False
else:
primality = True
if num > 2:
rang = (num ** 0.5)
rang = int(r... | true |
6262980f0a0d1083a33767d9efdb2cd7bc695cc4 | adarshrao007/Python_Assignment | /18.py | 971 | 4.125 | 4 | #Implement a calculator program for above using getopt.
import sys
import getopt
def add(a, b):
return a + b
def subtract(a, b):
return a - b
def multiply(a,b):
return a*b
def division(a,b):
return a/b
opts,args=getopt.getopt(sys.argv[1:],"a:o:b:",["num1=","operator=","num2="])
for key,value in opts:
if ... | false |
79f798b37cf5b8e4af75ffdf6e6049a0bd247294 | NatanLisboa/python | /exercicios-cursoemvideo/Mundo2/ex062.py | 2,704 | 4.125 | 4 | # Aula 14 - Estrutura de repetição while (Estrutura de repetição com teste lógico)
# Desafio 061 - Refaça o DESAFIO 051, lendo o primeiro termo e a razão de uma PA, mostrando os 10 primeiros termos da
# progessão usando a estrutura while.
print('\nDesafio 062 - Super Progressão Aritmética v3.0\n')
numeroValido = 0
... | false |
15ed653c0cc88186fd582d9f4a4ae007e6bda8f3 | NatanLisboa/python | /exercicios-cursoemvideo/Mundo1/ex028.py | 1,178 | 4.34375 | 4 | # Desafio 028 - Escreva um programa que faça o computador "pensar" em um número inteiro entre 0 e 5 e peça para o usuá -
# rio tentar descobrir qual foi o número escolhido pelo computador. O programa deverá escrever na tela se o usuário ven-
# ceu ou perdeu.
from random import randint
from time import sleep
print('\n... | false |
b4dcf36c8a25b01cc3ab83a92919cfe7c82748f6 | NatanLisboa/python | /exercicios-cursoemvideo/Mundo1/ex022.py | 842 | 4.46875 | 4 | # Desafio 022 - Crie um programa que leia o nome completo de uma pessoa e mostre:
# - O nome com todas as letras maiúsculas
# - O nome com todas as letras minúsculas
# - Quantas letras ao todo (sem considerar espaços)
# - Quantas letras têm o primeiro nome
print('Desafio 022 - Analisador de textos')
nome = str(in... | false |
3be6bb6b703becc5424664dc8bee033f932cfd70 | NatanLisboa/python | /exercicios-cursoemvideo/Mundo1/ex005.py | 1,004 | 4.125 | 4 | # Desafio 005 - Faça um programa que leia um número inteiro e mostre na tela o seu sucessor e seu antecessor
coresLetra = {
'padrao': '\033[m',
'vermelho': '\033[31m',
'verde': '\033[32m',
'azul': '\033[34m'
}
print('Desafio 005 - Antecessor e sucessor')
n =... | false |
54d83e81f6d7eadc7ec2f6528e99eea296a2992b | NatanLisboa/python | /exercicios-cursoemvideo/Mundo2/ex037.py | 1,049 | 4.21875 | 4 | # Mundo 2 - Aula 12 - Condições Aninhadas
# Desafio 037 - Escreva um programa que leia um número inteiro qualquer e peça para o usuário escolher qual será a base
# de conversão:
# - 1 para binário
# - 2 para octal
# - 3 para hexadecimal
print('\nDesafio 037 - Conversor de Bases Numéricas')
numeroInteiro = int(input(... | false |
f7dfcf2fefc9d23c7487cf368d1858759f603265 | NatanLisboa/python | /exercicios-cursoemvideo/Mundo3/ex080.py | 1,903 | 4.59375 | 5 | # Mundo 3 - Aula 17 - Variáveis Compostas - Listas
# Exercício Python 080: Crie um programa onde o usuário possa digitar cinco valores numéricos e cadastre-os em uma
# lista, já na posição correta de inserção (sem usar o sort()). No final, mostre a lista ordenada na tela.
print('\nExercício 80 – Lista ordenada sem re... | false |
24bee83c3dc3cce9a72e336d3c7a5bb5867fd442 | NatanLisboa/python | /exercicios-cursoemvideo/Mundo1/ex016.py | 456 | 4.15625 | 4 | # Desafio 016 - Crie um programa que leia um número real qualquer pelo teclado e mostre na tela a sua porção inteira.
# from math import trunc
print('Desafio 016 - Quebrando um número')
numeroReal = float(input('Digite um número real (com casas decimais): '))
print('\n', end='')
# print('O número {} tem a parte in... | false |
1291f99844e533f595854aeeeef5c29e71fd8c8c | mazhewitt/python-training | /Day 3/week2_Lists_2.py | 736 | 4.53125 | 5 | ### Excercise 2 ###
# 2. Let's plan some shopping. We want to get some fruits, vegies and diary products:
fruits = ['Banana', 'Apple', 'Lemon', 'Orange']
vegies = ['Carrot', 'Pumpkin']
diary = ['Milk', 'Cheese', 'Butter']
# 2.1 Check how many product from each category we want to buy
# 2.2 Create one shopping... | true |
a279637aee7839aa7c13a020144d76a47b92631d | anhnguyendepocen/Mphil | /POPE/func.py | 1,690 | 4.5 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
func.py
Purpose:
Playing with functions
Version:
1 First start
Date:
2019/08/27
Author:
Aishameriane Venes Schmidt
"""
###########################################################
### Imports
import numpy as np
# import pandas as pd
# import ma... | true |
73097d41a3939d867dc82f3e1563e140bef10873 | ParthG-Gulati/Python-Day3 | /average.py | 340 | 4.15625 | 4 | # Average of five numbers
print("Enter five numbers to find average:")
a = int(input("Enter number1:"))
b = int(input("Enter number2:"))
c = int(input("Enter number3:"))
d = int(input("Enter number4:"))
e = int(input("Enter number5:"))
total = a + b + c + d + e
average = total / 5
print("Average of five numb... | false |
421c5d172261beb8aa1fa56fc237d13fb8672e3b | Anoosha16798/Python-Programs | /Binary-HexaDec-Converter.py | 939 | 4.15625 | 4 | print("Welcome to Binary-HexaDecimal Converter App!")
max_val = int(input("\n Compute the Binary and Hexa-Decimal values upto the following decimal numbers: "))
decimal = list(range(1,max_val+1))
binary = []
hexaDec = []
for num in decimal:
binary.append(bin(num))
hexaDec.append(hex(num))
print("The portion o... | false |
679f659f2cb83e2c9b4e2c33324c5e9afe16a692 | Anoosha16798/Python-Programs | /Favourite-Teacher-Program.py | 661 | 4.15625 | 4 | print("Welcome")
rank = []
rank.append(input("Enter the list of Teachers\n"))
rank.append(input("Enter the list of Teachers\n"))
rank.append(input("Enter the list of Teachers\n"))
rank.append(input("Enter the list of Teachers\n"))
rank.append(input("Enter the list of Teachers\n"))
print("This is your present rank of t... | false |
869fe2e3779ac48cd64c1deb595eaa1886929441 | MrCodemaker/python_work | /while/age.py | 814 | 4.28125 | 4 | """
Функция int() преобразует строковое представление числа в само число:
"""
age = input("How old are you? ")
# How old are you? 21
age = int(age)
age >= 18
# True
"""
В этом примере введенный текст 21 интерпретируется как строка,
но затем он преобразуется в числовое представление вызовом int().
Теперь Python может ... | false |
da03b97692eb1ec784171938e339fa68b2ca3a24 | JLL32/MBCP | /Python - fundamentals/UNIT 4: Functions/countchoice.py | 673 | 4.21875 | 4 | # Defining a countdown method
def countdown(n):
if n <= 0:
print('Blastoff!')
else:
print(n)
countdown(n-1)
# Testing an input
countdown(5)
# Defining a countup method
def countup(n):
if n == 0:
print('Blastoff!')
elif n < 0:
print(n)
c... | false |
146b1e0937b0b3decc261b8170024c8a9c44525a | JLL32/MBCP | /Python - fundamentals/UNIT 8: Dictionaries and Files/inverse.py | 1,012 | 4.4375 | 4 | ##### Create a dictionary where values are lists #####
people = {"names":["noura","amine"],"ages":[22,28],"profession":["Software Engineer", "Red Hat"]}
print(people)
# From Section 11.5 of:
# Downey, A. (2015). Think Python: How to think like a computer scientist. Needham, Massachusetts: Green Tree Press.
def i... | true |
2bb0d8834b23146dbb2e204026452cb3e3f380e7 | joshua-scott/python | /ch9 Advanced datastructures.py | 1,630 | 4.3125 | 4 | # Task 1
# Basic lists
myList = [ "Blue", "Red", "Yellow", "Green" ]
print("The first item in the list is:", myList[0])
print("The entire list printed one at a time:")
for i in myList: print(i)
# Task 2
# Use lists to allow the user to:
# (1) add products, (2) remove items and (3) print the list and quit.
def main(... | true |
9b4d6e1e4a4a67f47fc74397890841fdd4061624 | SakibKhan1/most_frequent_word | /most_frequent_word.py | 1,301 | 4.40625 | 4 | def most_frequently_occuring_word(strings):
word_counts = {}
most_word = ""
most_word_count = 0
for s in strings:
words = s.split()
# We can then iterate over each word in that string.
for word in words:
# If the word isn't yet in the count dict... | true |
3318e928ef6cd5e68563e3fdc20a6fd77204be63 | districtem/ProjectEuler | /euler4.py | 815 | 4.375 | 4 | '''
def the_function():
get all 3 digit numbers between 900 and 999, store those numbers
for numbers in range
start with highest number and multiply by each number less than that number
test if product is palindrome
if palindrome store in something
compare all palindromes... | true |
38044d199f319874a0611493b8e997bdbe685a97 | jRobinson33/Python | /map_filter_reduce.py | 2,029 | 4.4375 | 4 | #examples of mapping filtering and reducing
#6/18/2019
import math
def area(r):
"""Area of a circle with radius 'r'."""
return math.pi * (r**2)
radii = [2, 5, 7.1, 0.3, 10]
# Method 1: Direct method
areas = []
for r in radii:
a = area(r)
areas.append(a)
print("Direct method areas: ", areas)
# Metho... | true |
7d0c5941f30b676d12ebaec45512e9a676649044 | vaaishalijain/Leetcode | /May-LeetCode-Challenge-Solutions/29_Course_Schedule.py | 2,081 | 4.125 | 4 | """
Course Schedule
Q. There are a total of numCourses courses you have to take, labeled from 0 to numCourses-1.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1,
which is expressed as a pair: [0,1]
Given the total number of courses and... | true |
e95bb74e1ee878076d8803977922c595b7d1f4b3 | Empow-PAT/fall2020game | /pickle_func.py | 1,248 | 4.15625 | 4 | import os
import pickle
import platform
# Use this to create a pickle file
def create_file(filename: str):
# Checks if the file doesn't exist
if not os.path.isfile(filename):
# Creates the file
open(filename, 'xb')
# Checks whether the person is using Windows or MacOS(Darwin) and accord... | true |
744ef4cf2fbd4f37c8bac9e8184bd0a7d21f3716 | ccoo/Multiprocessing-and-Multithreading | /Multi-processing and Multi-threading in Python/Multi-threading/Race Condition Demo by Raymond Hettinger/race_condition.py | 1,405 | 4.28125 | 4 | #!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Simple demo of race condition, amplified by fuzzing technique.
"""
import random
import time
from threading import Thread
# Fizzing is a technique for amplifying race condition to make them more
# visible.
# Basically, define a fuzz() function, which simply sleeps a ... | true |
aef7c9805f73bf47454ee4bfa666ab5a0f12a856 | M-Jawad-Malik/Python | /Python_Fundamentals/11.if-elif-else.py | 214 | 4.375 | 4 | # This is program of checking a no whether it is even or odd using if and else keywords #
x=eval(input('Enter Number'))
if x%2==0:
print('Entered number is Even')
else:
print('Entered number is odd')
| true |
6e16d5f3d0cb07695b68a48025b2ee6090c95100 | M-Jawad-Malik/Python | /Python_Fundamentals/16.list_append().py | 224 | 4.21875 | 4 | #this is way of adding single element at the end of list#
list=['1',2,'Jawad']
list.append('Muhammad')
#this is way of adding one list to other#
list2=[3,4,5,]
list.append(list2)
print('List after modification: ',list) | true |
0e75e6d92b7aefb4ff3cc69a24681ac462e3316b | M-Jawad-Malik/Python | /Python_Fundamentals/36.Python_function.py | 540 | 4.15625 | 4 | # Here a function for checking a number either it is odd or even is defied#
def even_odd(number):
if number%2==0:
return True
else:
return False
# _________________________________#
# Here main function is defined#
def main():
number=[1,2,3,4,5,6,7]
for i in number:
if... | true |
685fe33ac4fd79dc861d605c01694e1489ec2ee4 | herysantos/cursos-em-video-python | /desafios/desafio59.py | 992 | 4.1875 | 4 | #
# Crie um programa que leia dois valores e mostre um menu na tela.
#
# [1] somar
# [2] multiplicar
# [3] maior
# [4] novos numeros
# [5] sair
#
# Seu programa deverá realizar a operação em cada caso.
#
n1 = float(input('Informe um valor'))
n2 = float(input('Informe outro valor'))
menu = -1
while menu != 5:
menu... | false |
30927c7b556233523f1c9ef68b55dd0ea9665a47 | herysantos/cursos-em-video-python | /desafios/desafio11.py | 283 | 4.15625 | 4 | l = float(input('Say me how largest is the wall:'))
a = float(input('Say me how higher is the wall'))
print('Ok! your wall have the dimension {:.2f}x{:.2f} e your area is {}m²'.format(l, a, (a*l)))
print('To paint this wall you will need {:.2f} liters of paint.'.format(((a*l)/2)))
| true |
f3f9a1b622820c093d39e210684f9250da820fd6 | elliottqian/DataStructure | /tree/huffman_tree.py | 1,947 | 4.3125 | 4 | # -*- coding: utf-8 -*-
"""
用Python来定义一个Huffman树
输入例子:
A:13,B:11,C:4,D:22
"""
class Node(object):
"""
The Huffman Tree's Node Structure.
"""
weight = None
left = None
right = None
def __init__(self, left=None, right=None, weight=None, name=None):
self.left = left
self.r... | true |
62410bff55419e32fada6c28270e5ff83fc52913 | JCMolin/hw8Project2 | /main.py | 865 | 4.21875 | 4 | #! /usr/bin/python
# Exercise No. 2
# File Name: hw8Project2.py
# Programmer: James Molin
# Date: July 16, 2020
#
# Problem Statement: make a picture grayscale
#
#
# Overall Plan:
# 1. import the picture
# 2. calculate a way to turn the picture grayscale
# 3. print the result
#
#
# import the necessar... | true |
a7f85a8a4ed7affe287449bd085c7bd10509149f | IrisDyr/demo | /Week 1/H1 Exercise 1.py | 813 | 4.1875 | 4 |
def adding(x,y): #sum
return x + y
def substracting(x,y): #substraction
return x - y
def divide(x,y): #division
return x / y
def multiplication(x, y): #multiplication
return x * y
num1 = int(input("Input the first number ")) #inputing values
num2 = int(input("Input the second number "... | true |
4d47678a12fb82c3f98dc59bfd2a6d69b6b423e0 | ZoltanSzeman/python-bootcamp-projects | /fibonacci_sequence.py | 540 | 4.25 | 4 | # Created by Zoltan Szeman
# 2020-09-09
# Task: Print the fibonacci sequence to the nth digit
while True:
try:
seq_no = int(input('Enter the length of the fibonacci sequence '
'you would like to print: '))
break
except ValueError:
print('\nPlease enter a valid whole number!\... | true |
418cece77b7fc1ed8397623ade04a0d4247000d9 | Mannizhang/learn | /笨方法学python/练习3.py | 485 | 4.1875 | 4 | print('I Will now count my chickens:')
print('Hens')
print(25+30/6)
print("Roosters")
print(100-25*3%4)
print('now i whil count the eggs:')
print(int(3+2+1-5+4%2-1/4+6))
print('is it true that 3+2<5-7?')
print(3+2<5-7)
print('what is 3+2?')
print(3+2)
print('what is 5-7?')
print(5-7)
print("oh no that's why it's fals... | true |
5aeee69ab4be5e023c37f452e30d8e334807b2b3 | gongtian1234/-offer | /test58_翻转字符串.py | 1,276 | 4.15625 | 4 | '''
题目一:翻转单词顺序。输入一个英文句子,翻转句子中单词的顺序,但单词内字符的顺序不变。为简单起见,标点符号和普通字母一样处理。例如,输入字符串
"I am a student.",则输出"student. a am I"
思路:
先切分开,翻转后再用空格链接回去
题目二:左旋转字符串。字符串的左旋转操作是把字符串前面的若干个字符转移到字符串的尾部。例如,输入字符串'abcdefg'和数字2,该函数将返回左旋转两位
得到的结果'cdefgab'
思路:将前面的n个字符串移动到后面即可/
'''
class Solution1:
def reverseSentence(self, sent... | false |
c0ad3d9f12b00aad6a6080edac90d54a422d075b | Minhaj9800/BasicPython | /print_frmt.py | 1,362 | 4.1875 | 4 | another_quote = "He said \"You are amazing\", Yesterday"
print(another_quote)
#or do below
second_quote = "I am doing Okay, 'Man'"
print(second_quote)
multilines="""" Hello This is Minhajur Rahman I am a 4th year student at UPEI. I am planing start my Hnours Thesis at the end of this year.
I am originally from Moulvib... | true |
cdb1afe5559a5c3c9f9bc45d9f504bd79064a960 | Minhaj9800/BasicPython | /destructuring.py | 340 | 4.4375 | 4 | currencies = 0.8, 1.2 # Making a tuple.
usd,euro = currencies # usd = 0.8, euro = 1.2. This is called desturturing. Taking a tuple and make it two different variables.
friends_age = [("Rolf",25),("John",30),("Anne",23)] # List of tuples
for name, age in friends_age: #destructuring inside a for loop.
print(f"{name} is... | true |
9636799164bddc7a2f408bd42ac69772cef007a4 | zvovov/goodrich | /C-4.17.py | 562 | 4.375 | 4 | # Write a short recursive Python function that determines if a string s is a
# palindrome, that is, it is equal to its reverse. For example, racecar and
# gohangasalamiimalasagnahog are palindromes.
def is_palindrome(s):
"""
Returns True if s is palindrome
False otherwise
:param s: input string
:re... | true |
dace58879101e50ee872a8ffa3838a52477cf309 | MosheBakshi/HANGMAN | /Conditions/4.3.1.py | 692 | 4.15625 | 4 | user_input = input("Guess a letter: ")
ENGLISH_FLAG = user_input.isascii()
LENGTH_FLAG = len(user_input) < 2
SIGNS_FLAG = user_input.isalpha()
if (LENGTH_FLAG is False and # IN CASE MORE THAN 1 LETTER BUT ELSE IS FINE
ENGLISH_FLAG is True and
SIGNS_FLAG is True):
print("E1")
elif (LENGTH_FLAG is T... | true |
329dd32bb3263ebcfccdffc0ccbd701e4544e1f7 | mxor111/Play-ROCK-Paper-Scissor | /rps-starter-code12.py | 2,989 | 4.25 | 4 | #!/usr/bin/env python3
# ROCK PAPER SCISSOR - MICHELE
"""This program plays a game of Rock, Paper, Scissors between two Players,
and reports both Player's scores each round."""
import random
moves = ['rock', 'paper', 'scissors']
p1 = input("Player 1 Whats's your name?")
p2 = input("Player 2 What's your name?... | true |
a7515e51deac103a155dca3b88f04f68631f3e70 | mlassoff/PFAB52014 | /greetings.py | 301 | 4.125 | 4 | #raw_input is for strings-- does not attempt conversion
name = raw_input("What is your name?")
print "Hello and greetings", name
#input is for integers or floating point numbers
age = input("How old are you?")
print "You are", age, "years old."
print "In dog years you are ", (age*7) , "years old"
| true |
eb370baa70a807d3f9fa050712235bd94503b7f1 | manitghogar/lpthw | /3/ex3.py | 968 | 4.3125 | 4 | #start of the task, will start counting chickens
print "I will now count my chickens:"
#counts number of hens
print "Hens", 25.0 + 30.0 / 6.0
#counts number of Roosters
print "Roosters", 100.0 - 25.0 * 3.0 % 4.0
#will start counting eggs
print "Now I will count the eggs:"
#counting eggs
print 3.0 + 2.0 + 1.0 - 5.0 + 4.... | true |
2bbb70dfaa362bf182e2d0a314b2bf5895195a45 | manitghogar/lpthw | /14/ex14.py | 1,020 | 4.1875 | 4 |
#importing argv from sys
from sys import argv
#unpacking argv into three variables v0, v1 and v2
script, user_name, birth_country = argv
#setting a consistent prompt that shows up everytime a question is asked
prompt = '>>'
#strings that use the argv arguments
print "Hi %s of %s, I'm the %s script." % (user_name, bi... | true |
b8caa7819abc898dc5fcc1335d302ff94dceffe6 | nivb52/python-basics | /05- Classes/06- Magic-Methods.py | 1,133 | 4.34375 | 4 | # rszalski.github.io/megicmethods
class MyPoint:
def __init__(self, x, y):
self.x = x
self.y = y
def draw(self):
print(f"Point ( {self.x} , {self.y} )" )
point = MyPoint(1,2)
print(point)
# // <__main__.MyPoint object at 0x00C191D8>
# __str__ ^ give us the above which is magic m... | false |
397660a71a23fa37977b5db7842b53721c42bb23 | barankurtulusozan/Algorithms-and-Data-Structures | /Python/PY_01_List_Tuple_Dictionary.py | 1,178 | 4.40625 | 4 | #PY_List_Tuple_Dictionary
#Lists
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']
#This will create a list made by characters
print(alphabet[0:6])
#will print characters till g
#Lets create a list of names
names = ["John","Erica","Stephen"]
#If we want to append names to this list
names += ["Joseph... | true |
2277a6705349b81f2918382f2ed72313bd9c4af3 | renchao7060/studynotebook | /数图游戏/打印菱形.py | 1,479 | 4.25 | 4 | '''
# rhombus /ˈrɑːmbəs/ 菱形
*
***
*****
*******
*****
***
*
行 *数量 空格数量--->行转换为---->推算空格数量---->推算每行*数量
1 1 3 -(7//2)=-3 abs(-3) 7-2*abs(-3)=1
2 3 2 -2 abs(-2) 7-2*abs(-2)=3
3 5 1 -1 abs(-1) 7-2*abs(-1)=5
... | false |
73a63f4440793041849743e30a02a5a6cd388a10 | renchao7060/studynotebook | /基础学习/p64.py | 547 | 4.25 | 4 |
#如何进行反向迭代以及如何实现反向迭代
class FloatRange(object):
def __init__(self,start,end,step):
self.start=start
self.end=end
self.step=step
def __iter__(self):
t=self.start
while t<=self.end:
yield t
t+=self.step
def __reversed__(self):
t=self.end... | false |
bf0e35adb8b9fc6ec55a21837105cc864b5fadfd | renchao7060/studynotebook | /基础学习/py94.py | 1,222 | 4.1875 | 4 | # 模拟购物车流程
product_list=[
('Iphone',5800),
('Mac Pro',9800),
('Bike',800),
('Coffee',30),
('Alex python',120)
]
shopping_list=[]
salary=input("Input your salary:")
if salary.isdigit():
salary=int(salary)
while True:
for index,item in enumerate(product_list):
print(index,i... | true |
3f8e44a1c120f3b725d64c83f6b51726ff4830f6 | Codeology/LessonPlans | /Spring2017/Week1/searchInsertPosition.py | 909 | 4.1875 | 4 | #!/usr/local/bin/python
# coding: latin-1
# https://leetcode.com/problems/search-insert-position
#
# Given a sorted array and a target value, return the index if
# the target is found. If not, return the index where it would
# be if it were inserted in order.
#
# You may assume no duplicates in the array.
#
# Here are... | true |
9cfdfab5ed7eea89812de216b4e4fa9e39ea0647 | Akash21-art/solidprinciple | /Inheritance.py | 897 | 4.125 | 4 | # A Python program to demonstrate inheritance
class Parent(object):
# Constructor
def __init__(self, name):
self.name = name
# To get name
def getName(self):
return self.name
# Inherited or Sub class
class Child(parent):
# Constructor
... | true |
26e5cdb0e2c2e9b88bfd438d584d78743faa796c | themarcelor/perfectTheCraft | /coding_questions/matrix/matrix.py | 809 | 4.40625 | 4 | # --- Directions
# Write a function that accepts an integer N
# and returns a NxN spiral matrix.
# --- Examples
# matrix(2)
# [[1, 2],
# [4, 3]]
# matrix(3)
# [[1, 2, 3],
# [8, 9, 4],
# [7, 6, 5]]
# matrix(4)
# [[1, 2, 3, 4],
# [12, 13, 14, 5],
# [11, 16, 15, 6],
# [10, 9, ... | true |
b6fc02ea30e11d9feee4ba57487c7cf62c4cb890 | Guithublherme/Python | /Primeiros Passos/Aulas/Aula1.py | 697 | 4.3125 | 4 | #aula 1 váriaveis, tipos, entradas e saídas, operadores matemáticos
#saídas
print("Olá mundo!");
print('Segundo print\noutra linha\t Usando o tab');
#variáveis
Nome = "Guilherme";
idade = 27;
altura = 1.75;
print(Nome);
print("Nome:"+ Nome); #concatena Strings apenas
print("Nome:",Nome,"tem",idade,"anos");
tipoNom... | false |
5c231792e7a9bf0578182618690a4df7efcd706b | claireyegian/unit4 | /functionDemo.py | 396 | 4.1875 | 4 | #Claire Yegian
#10/17/17
#functionDemo.py - learning functions
def hw():
print('Hello, world!')
def bigger(num1,num2): #prints which number is bigger
if num1>num2:
print(num1)
else:
print(num2)
def slope(x1,y1,x2,y2): #calculates slope
print((y2-y1)/(x2-x1))
#tests for the various fu... | true |
be0d6748fc3267953041330cdfc66e6cb76a8d95 | claireyegian/unit4 | /stringUnion.py | 325 | 4.25 | 4 | #Claire Yegian
#10/26/17
#stringUnion.py - takes two strings and returns all letters that appear in either word
def stringUnion(word1,word2):
string = ''
for ch in word1 + word2:
if not ch.lower() in string:
string = string+ch.lower()
return string
print(stringUnion('Mississippi','Pens... | true |
9a6b2c668b70d8d6e3b52babd32fe8fd94eaa904 | yanehi/student_management_python | /student/student.py | 2,757 | 4.21875 | 4 | class Student():
def __init__(self, first_name, last_name, matriculation_number, language, term, average_grade, username, state, street_name, street_number):
self.first_name = first_name
self.last_name = last_name
self.matriculation_number = matriculation_number
self.language ... | false |
44cfa8fa73162bc9618bc6fb2b30f26458c0b0ae | maryclareok/python | /list_class.py | 2,542 | 4.3125 | 4 | # lst=[1,2,3,4,5]
# list=["jane","kemi","obi","mose"]
# print(len(lst))
# print(lst [0 : 3])
# print(list)
# num=lst[0]*lst[1]#using list for mathematical operation
# print(num)
# print(list[1:])
# print(list[1::2])
# print(lst[-1])
# print(lst[:-1])
# list3=["david","john",2,"ben",7,9,"germany"]
# print(list3[1])
# #c... | true |
0d136d5f6e1d4086d232f60c24f92f43abad5949 | ravikuril/DesignPatterns | /facade.py | 1,914 | 4.28125 | 4 | class Washing:
'''Subsystem # 1'''
def wash(self):
print("Washing...")
class Rinsing:
'''Subsystem # 2'''
def rinse(self):
print("Rinsing...")
class Spinning:
'''Subsystem # 3'''
def spin(self):
print("Spinning...")
class WashingMachine... | true |
e1c8a88572cd610ac68ba546ff5b701974931b4a | papunmohanty/password-encryption | /encryptedPassword.py | 1,921 | 4.125 | 4 | def encryption():
count = 0
print "========================================================="
password = raw_input("Enter your Password between 6 to 8 Characters: ")
tempPassword = []
if len(password) < 7 or len(password) > 8:
print "Your Password Must be 7 - 8 Characters Long --- Try Again"... | false |
6a132dc98dde7afabeaed73e31954944eb37f06c | billypriv05/bit-calculater | /image_bit_calc.py | 1,276 | 4.125 | 4 | # checks imput is a number more than
def num_check(question, low):
valid = False
while not valid:
error = "please enter a interger that is more or than "
"(or equal to) {}".format(low)
try:
# ask the user to enter a number
response = int(input(questi... | true |
3ef8781a23a3139f9055129e6c8774a9bbe0de90 | Gaurav812/Learn-Python-the-hard-way | /Ex3.py | 580 | 4.34375 | 4 | #Ex3
# <= less-than-equal
# >= greater-than-equal
#print("I will now count my chickens:")
#print("Hens", 25 + 30 / 6)
#print("Roosters", 100 - 25 * 3 % 4)
#print ("Now I will count the eggs:")
#print (3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6)
#print ("Is it true that 3 + 2 < 5 - 7?")
#print(3+2<5-7)
#print ("Oh, that'... | true |
753cca8c21a22551ecbe3b70e767c638a7a0147e | nyangeDix/automate-the-boring-stuff-with-python | /automate_the_boring_stuff/dictionaries and structuring data/dict_setDefault.py | 419 | 4.40625 | 4 | #Adds a default dictionary item to an already existing dictionary
#This only applies when the key and value are not available in the dictionary
food = {'fruits':'apples',
'vegetables':'kales',
'cereals':'maize',
'drinks':'vodka'
}
"""
if 'drugs' not in food:
food['drugs'] = 'w... | true |
c8c77d1cc9a83234eb5fa2152b931d05a73de0d8 | nyangeDix/automate-the-boring-stuff-with-python | /automate_the_boring_stuff/pattern_matching_with_regex/regex_pipe.py | 2,080 | 4.125 | 4 | #The character "|" is called the pipe key
import re
findName = re.compile(r'Dickson | Nyange')
mo = findName.search('Dickson is Nyange')
print(mo.group())
#note the difference between the two set of codes
findName2 = re.compile(r'Nyange | Dickson')
mo2 = findName2.search('Nyange is Dickson')
print(mo2.group())
... | true |
c827732bd723bd387ddeccc1a4b4ed48135831a4 | jamalamar/Python-function-challenges | /challenges.py | 1,182 | 4.28125 | 4 |
#Function that takes a number "n" and returns the sum of the numbers from 1 to "n".
# def sum_to(n):
# x = list(range(n))
# y = sum(x) + n
# print(y)
def sum_to(num):
sum = 0
for i in range(num + 1):
sum += i
print("The sum from 1 to "+ str(num) + ": " + str(sum))
sum_to(10)
#Function that takes a... | true |
7e6f5908a6be5ba6d574ba51da9ffe4dc75750de | Chibizov96/project | /Lesson 6-3.py | 1,526 | 4.3125 | 4 | """
Реализовать базовый класс Worker (работник),
в котором определить атрибуты: name, surname, position (должность), income (доход).
Последний атрибут должен быть защищенным и ссылаться на словарь, содержащий элементы:
оклад и премия, например, {"wage": wage, "bonus": bonus}.
Создать класс Position (должность) на базе ... | false |
f5402726633ba15c54c8ad1867c16188dcdbb4fb | GauPippo/C4E9-Son | /ss1/ss1.py | 866 | 4.125 | 4 | #1.
'''
- How to check a variable's type?
type()
- Three difference examples of invalid name.
1992abc = 10
abc$ = "name"
True = 'hahaha'
'''
#2.
from math import *
from turtle import *
import turtle
##pi = 3.14
##radius = int(input("Radius?"))
##print ("Area =", radius * pi)
##print ("hihihi")
###3... | true |
88ab14671d8ceda24786eb76c012c2f33f077258 | BattenfE8799/CSC121 | /dictionary example from instructor.py | 763 | 4.15625 | 4 | #example via instructor
petNum = int(input("How many pets do you have? "))
pets = {}
for num in range(1, petNum+1): # always add 1 to userinput # to end there
name = input("Enter name for pet "+str(num)+":") #input only takes one arguement and str(num) converts num into a string
age = input... | true |
3d50d7392672c8fc3080eeb4e1ccfa88210567a2 | burnhamup/facebook-hacker-cup | /2013/pretty.py | 1,821 | 4.125 | 4 | '''
Created on Jan 25, 2013
@author: Chris
'''
"""
The algorithim is to take the string. Make everything lowercase, strip out any thing that isn't a letter.
Calculate frequency of each letter.
Maybe create an array with each index being a different letter and the value is the frequency. Sort this.
The letter with... | true |
badf867dca7ad2e09d8b9f19c99daca10f56327f | hebertca18/tddAsgn | /Greeting_Kata.py | 1,181 | 4.125 | 4 | def greet(name):
if name is None:
name = 'my friend'
if isinstance(name, str):
if name.isupper():
string = 'HELLO ' + name + '!'
else:
string = 'Hello, ' + str(name) + '.'
else:
string = 'Hello, '
upperName = ''
sepNames = []
fo... | false |
d49e21ed77380072e925dd1ff07735d96a2f0594 | nehamehta2110/LeetCode-August-Challenge | /Day2-DesignHashSet.py | 1,649 | 4.125 | 4 | """
Design a HashSet without using any built-in hash table libraries.
To be specific, your design should include these functions:
add(value): Insert a value into the HashSet.
contains(value) : Return whether the value exists in the HashSet or not.
remove(value): Remove a value in the HashSet. If the value does not exis... | true |
a133dd7c5093c6bf9180947048551ef4992c2ee6 | Ranimru/Mycode | /palindrome.py | 251 | 4.15625 | 4 | def isPalindrome(String):
#this is a method to check whether a string is a Palindrome
for s in range(0,len(String)//2):
if String[s]!=String[(len(String)-1)-s]:
return False
return True
print(isPalindrome('foolloof'))
| true |
ce1f2c1d619358a2f36f790838c02addca9f15a0 | Rashmiii-00/Python-programs | /Check for palindrome and factorial of a number.py | 941 | 4.28125 | 4 | option=''
while True:
print("Enter 1 for pallindrome \n2 for factorial \n3 for Exit")
op = int(input("Enter Your choice:"))
#while op<3:
if op==1:
s2=input("Enter any String or integer ")
print()
n = len(s2)
#s1=s1.split()
s1 = list(s2)
for i in... | false |
6a4130acf82fb745bc6688f177afc57c04c9b7ae | Ianwanarua/Password-locker | /user.py | 1,266 | 4.125 | 4 | class Users:
"""
class that generates new instances of users
"""
user_list = []
def __init__ (self,username,first_name,last_name,password):
'''
This is a blueprint that every user instance must conform to
'''
self.username = username
... | true |
78833a4cb9fb94c912be389f227cdf7aa85aa310 | DanielMalheiros/geekuniversity_logica_de_programacao | /Python/secao06/exercicio10.py | 768 | 4.15625 | 4 | """Seção 06 - Exercício 10
Elabore um algoritmo que dada a idade de um nadador classifique-o em uma das seguintes categorias:
Infantil-a = 5 a 7 anos
Infantil-b = a 11 anos
Juvenil-a = 12 a 13 anos
Juvenil-b = 14 a 17 anos
Adultos = Maiores de 18 anos
"""
# entrada
idade = int(input("Qual a idade do nadad... | false |
fa232e5df4a0bdb2e99b702b953ba73e3acbd353 | chenyongda2018/PythonShortTerm | /课件/example/example_05.py | 442 | 4.15625 | 4 | #string
char_1 = 'A'
print(ord(char_1))
char_1 = 'Z'
print(ord(char_1))
char_1 = 'a'
print(ord(char_1))
char_1 = 'z'
print(ord(char_1))
#--------------------------------
number_1 = 65
print(chr(number_1))
#---------------------------------
str1 = 'hello'
print(len(str1))
str2 = '你好'
print(len(str2))
#------------... | false |
cb8b44720c634935d9c2337af1f9d1d4d401d5fb | chenyongda2018/PythonShortTerm | /day03/demo03_python_dict.py | 690 | 4.40625 | 4 | # 定义词典
dict1 = {'no1' :{'name':'zhangsan', 'age' :20, 'sex' : 'male'}, 'no2':{'name' :'list', 'age' :30, 'sex' :'male'}}
# 访问字典,也是用类似数组下标索引的方式
print(dict1['no1'])
print(dict1['no1']['name'])
# 怎么来得到字典里所有的key
for key in dict1.keys():
print(key)
# 怎样来得到所有的value
print(dict1.values())
# 通过get key来得到key对应的value
prin... | false |
7bdb3cbdd71b2b342270621c08dfb68c7e58f448 | chenyongda2018/PythonShortTerm | /day03/demo01_python_list.py | 1,089 | 4.34375 | 4 | # 定义list
lista = [1, 'xiaojiejie', 20, 'female']
print(type(lista))
print(lista)
# 遍历列表
for element in lista:
print(element)
pass
# 下标取列表元素
print(lista[1])
# 使用range来生成list
listb = list(range(10))
print(listb)
# 生成0到10的偶数
listc = list(range(0, 10, 2))
print(listc)
print(range(10))
# list切片
listd = list(... | false |
83b774feafd4887d086285205a027c660d36d86f | MarkParenti/intermediate-python-course | /dice_roller.py | 569 | 4.15625 | 4 | import random
def main():
dice_sum = 0
dice_rolls = int(input("How many dice would you like to roll?"))
sides = int(input("How many sides should the die have?"))
for i in range(0, dice_rolls):
roll = random.randint(1,sides)
if roll == 1:
print(f'You rolled a {roll}! Critical Fail')
elif... | true |
ec9786119c231f6a43b75cbae4b2bf33318bf701 | MinwooRhee/unit_two | /d4_unit_two_warmups.py | 237 | 4.15625 | 4 | print(9 * 5)
print(2 / 5)
# // sign is integer division
print(12 // 5)
print(27 // 4)
print(2 // 5)
# % sign gives the remainder
# very useful when telling odd or even number
print(5 % 2)
print(9 % 5)
print(6 % 6)
print(2 % 7)
| true |
2253395f3a5f76f00452f3bf03067af3d1d95d7b | amogh-dongre/dotfiles | /python_projects/Binary_search.py | 729 | 4.21875 | 4 | #!/usr/bin/env python3
# This is the python implementation of Binary search
def Binary_searcher(arr, l, f, num):
while f <= l:
mid_index = (l + f) / 2
if num == arr[mid_index]:
return mid_index
elif num < arr[mid_index]:
f = mid_index + 1
else:
l =... | true |
644e2b5ae4e9dce423e812d548f9a3999fd42ae2 | ihuei801/leetcode | /MyLeetCode/python/Merge k Sorted Lists.py | 2,446 | 4.1875 | 4 | #######################################################################
# Priority Queue
# Time Complexity: O(nk*log k) k:num of lists n: num of elements
# Heap implementation: http://algorithms.tutorialhorizon.com/binary-min-max-heap/
# A binary heap is a heap data structure created using a binary tree.
# Two rules ... | true |
a5cc6bdbd44719c30639f8bf040f1ac3fa2d7066 | jdlambright/Hello-World | /100 Days/day 20-29/24 notes/read_write.py | 1,464 | 4.25 | 4 | #these are notes on how to open write and read files
#the first way. this is less efficient because you have to remember to close it
#open is a built in keyword
# file = open("my_file.txt")
#
# #read method returns contents of file as a string
# #we save it into a variable
# contents = file.read()
#
# print(contents)... | true |
0ed789707b311da154308a4c38bca69fe5e72024 | Naouali/Leetcode_Python | /climbing_stairs.py | 213 | 4.15625 | 4 | #!/usr/bin/python3
def staire(n):
step = n
value = 0
while n > 0:
n = n - 2
if n < 0:
break
value += 1
return value + step
print(staire(3))
print(staire(3))
| false |
622dad3a18f2f2acd6614d81702ca71370b7b98b | pyl135/Introduction-to-Computing-using-Python | /Unit 4- Data Structures/Ch 4.4- File Input and Output/Reading Files in Python 1.py | 942 | 4.3125 | 4 | #Write a function called "find_coffee" that expects a
#filename as a parameter. The function should open the
#given file and return True if the file contains the word
#"coffee". Otherwise, the function should return False.
#
#Hint: the file.read() method will return the entire
#contents of the file as one big string... | true |
122f50f5a0e6298094df98172406ed300afd6690 | pyl135/Introduction-to-Computing-using-Python | /Unit 5- Objects and Algorithms/Ch 5.2- Algorithms/Coding Problem 5.2.5.py | 1,321 | 4.375 | 4 | #Write a function called string_search() that takes two
#parameters, a list of strings, and a string. This function
#should return a list of all the indices at which the
#string is found within the list.
#
#You may assume that you do not need to search inside the
#items in the list; for examples:
#
# string_search(["... | true |
bd3c39f51cf2831fa120921591769c1699e4208f | TytarenkoVictor/Travel_planner_project | /date_estimation.py | 2,342 | 4.15625 | 4 | import datetime
class CheckDate:
"""This class checks users input dates."""
def __init__(self, d1, d2):
"""This method initializes."""
self.day1 = d1.split('/')[0]
self.day2 = d2.split('/')[0]
self.month1 = d1.split('/')[1]
self.month2 = d2.split('/')[1]
... | true |
a3f2ac2183a06475c23408002fdef2f8cbec0e1c | GarethOLeary/GraphTheory_WeeklyExercises | /basics.py | 535 | 4.125 | 4 | #Gareth O'Leary
#Python Basics
#print("Hello World")
a = 1
b = 1.0
s = "Hello, world from a string!"
t = 'Hello, from a different string'
#print (a,b,s,t)
#print(s[3:10:2])
x = [1,2,3,"Hello",1.0]
#print(x)
#print(x[0])
#print(x[2])
#print(x[-1])
#for i in x[::2]:
# print(i)
# print... | false |
dcd775541280e0ed58433e8cb652c745e87484c7 | Zhamshid2121/2.7 | /hw.py | 457 | 4.375 | 4 | #Создайте класс. Добавьте к классу 3 параметра. Напишите
# 1 метод, который будет выводить
# на экран все 3 параметра. Создайте экземпляр класса.
# Вызовите его метод
class Jon:
born = 15
height = 50
step = 25
def men(self):
return self.born + self.height +self.step
c = Jon()
c.men()
print... | false |
0e7d762c83a93f480cf1494236eaacd04d6aa92f | flores-jacob/exercism | /python/meetup/meetup.py | 748 | 4.15625 | 4 | from datetime import date
import calendar
def meetup_day(year, month, day_of_the_week, which):
if which == "teenth":
date_range = range(13, 20)
elif which == "last":
last_day_of_month = calendar.monthrange(year, month)[1]
date_range = range(last_day_of_month, 1, -1)
else:
... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.