blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
e08c9f11aab1e0131d5f37feeb01f6475ae6ec23 | Jwbeiisk/daily-coding-problem | /feb-2021/Feb22.py | 1,107 | 4.3125 | 4 | #!/usr/bin/env python3
"""
22th Feb 2021. #537: Easy
This problem was asked by Apple.
A Collatz sequence in mathematics can be defined as follows. Starting with any positive integer:
if n is even, the next number in the sequence is n / 2
if n is odd, the next number in the sequence is 3n + 1
It is conjectu... | true |
e72f31942b3077b838ec289bffcf5a22526eea40 | priyakrisv/priya-m | /set17.py | 400 | 4.1875 | 4 | print("Enter 'x' for exit.");
string1=input("enter first string to swap:");
if(string1=='x'):
exit()
string2=input("enter second string to swap:");
print("\nBoth string before swap:");
print("first string=",string1);
print("second string=",string2);
temp=string1;
string1=string2;
string2=temp;
print("\nBoth string afte... | true |
39959d08343f4ca027e3150e4a29186675a8ab2d | ramshaarshad/Algorithms | /number_swap.py | 305 | 4.21875 | 4 | '''
Swap the value of two int variables without using a third variable
'''
def number_swap(x,y):
print x,y
x = x+y
y = x-y
x = x-y
print x,y
number_swap(5.1,6.3)
def number_swap_bit(x,y):
print x,y
x = x^y
y = x^y
x = x^y
print x,y
print '\n'
number_swap_bit(5,6)
| true |
8712efb746ee37f10d0e3d235b47a0f16c4f2c9f | sunshineDrizzle/learn-python-the-hard-way | /ex11.py | 928 | 4.25 | 4 | print("How old are you?", end=' ')
age = input() # 在python3.0之后就没有raw_input()这个函数了
print("How tall are you?", end=' ')
height = input()
print("How much do you weigh?", end=' ')
weight = input()
print("So, you're %r old, %r tall and %r heavy." % (age, height, weight))
# study drill 1
# raw_input()(存在于python3.0之前的版本)的... | false |
50ea487c9c3dd452fc4ed94cd86b223554b7afc2 | rajivpaulsingh/python-codingbat | /List-2.py | 2,799 | 4.5 | 4 |
# count_evens
"""
Return the number of even ints in the given array.
Note: the % "mod" operator computes the remainder, e.g. 5 % 2 is 1.
count_evens([2, 1, 2, 3, 4]) → 3
count_evens([2, 2, 0]) → 3
count_evens([1, 3, 5]) → 0
"""
def count_evens(nums):
count = 0
for element in nums:
if element % 2 == 0:
... | true |
4404e39852e74e7ca1ad170550b02fd3b09f76dd | wilsonbow/CP1404 | /Prac03/gopher_population_simulator.py | 1,190 | 4.5 | 4 | """
This program will simulate the population of gophers over a ten year period.
"""
import random
BIRTH_RATE_MIN = 10 # 10%
BIRTH_RATE_MAX = 20 # 20%
DEATH_RATE_MIN = 5 # 5%
DEATH_RATE_MAX = 25 # 25%
YEARS = 10
print("Welcome to the Gopher Population Simulator!")
# Calculate births and deaths
def gopher_births(po... | true |
c1c268aa78f389abc625b582e37ba9316f36a849 | AlfredPianist/holbertonschool-higher_level_programming | /0x06-python-classes/100-singly_linked_list.py | 2,885 | 4.3125 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""100-singly_linked_list
A Node class storing integers, and a Singly Linked List class implementing a
sorted insertion.
"""
class Node:
"""A Node class. Stores a number and a type Node.
Attributes:
__data (int): The size of the square.
__next_node (... | true |
e62c99e0a88f67778b9573559d2de096255a3e2d | AlfredPianist/holbertonschool-higher_level_programming | /0x0B-python-input_output/2-append_write.py | 479 | 4.28125 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""2-append_write
This module has the function write_file which writes a text to a file.
"""
def append_write(filename="", text=""):
"""Writes some text to a file.
Args:
filename (str): The file name to be opened and read.
text (str): The text to be ... | true |
bbb4a67092b02f132bb0decd76bf80c7e219c761 | orlychaparro/python_cardio_platzi | /code/reto2_piedra_papel_tijera.py | 2,937 | 4.15625 | 4 | """ Reto 2 - Piedra, papel o tijera
Ejercicios realizados por Orlando Chaparro.
https://platzi.com/p/orlandochr
Escribe un programa que reciba como parámetro
“piedra”, “papel”, o “tijera”
y determine si ganó el jugador 1 o el jugador 2.
Bonus: determina que el ganador sea el jugador que gane 2 de 3 encuentros.
Ejemp... | false |
c51da4549dc5effcf1187071aaa8a55fbdd2be74 | Herrj3026/CTI110 | /P3HW2_DistanceTraveled_HerrJordan.py | 888 | 4.34375 | 4 | #
# A program to do a basic calcuation of how far you travled
# 6/22/2021
# CTI-110 P3HW2 - DistanceTraveled
# Jordan Herr
#
#section for the inputs
car_speed = float(input("Please enter car speed: "))
time_travled = float(input("Please enter distance travled: "))
#math section for the calculations
dis_... | true |
bcaa46b3e1cc5dbff52abb328b7eb3a11184df87 | xwmyth8023/python-date-structure | /queue/deque.py | 1,528 | 4.25 | 4 | """
deque(也称为双端队列)是与队列类似的项的有序集合。
它有两个端部,首部和尾部,并且项在集合中保持不变。
deque 不同的地方是添加和删除项是非限制性的。
可以在前面或后面添加新项。同样,可以从任一端移除现有项。
在某种意义上,这种混合线性结构提供了单个数据结构中的栈和队列的所有能力。
deque 操作如下:
1. Deque() 创建一个空的新 deque。它不需要参数,并返回空的 deque。
2. addFront(item) 将一个新项添加到 deque 的首部。它需要 item 参数 并不返回任何内容。
3. addRear(item) 将一个新项添加到 deque 的尾部。它需要 item 参数并不返回任... | false |
3cec4c83350a40b81dc8e58910b57ce3e5c5428d | SBrman/Project-Eular | /4.py | 792 | 4.1875 | 4 | #! python3
"""
Largest palindrome product
Problem 4
A palindromic number reads the same both ways. The largest palindrome made from
the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
"""
def isPalindrome(num):
num = str(... | true |
9af7f0f7a29798891798048deea3137e95eca3f4 | Jimmyopot/JimmyLeetcodeDev | /Easy/reverse_int.py | 2,193 | 4.15625 | 4 | '''
- Given a signed 32-bit integer x, return x with its digits reversed.
If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0.
Assume the environment does not allow you to store 64-bit integers (signed or unsigned).
'''
# soln 1
class Solution(object):
... | true |
b58ae8395c1283f60765b7dab5e0d80bb3b97751 | kevinawood/pythonprograms | /LeagueDraw.py | 1,539 | 4.125 | 4 | import random
import time
teams = ['Sevilla',
'Bayern',
'Roma',
'Barcelona',
'Manchester City',
'Liverpool',
'Juventus',
'Real Madrid']
draw = []
def draw():
#for i in range(len(teams)):
for i in range(len(teams), 1, ... | false |
399cb2a542e995969b17089d75fb73b1018dc706 | dspec12/real_python | /part1/chp05/invest.py | 923 | 4.375 | 4 | #!/usr/bin/env python3
'''
Write a script invest.py that will track the growing amount of an investment over time. This script includes an invest()
function that takes three inputs: the initial investment amount, the annual compounding rate, and the total number of years
to invest. So, the first line of the functio... | true |
665ba4de4b55bc221d03af876d0c17a9d3b6e602 | dspec12/real_python | /part1/chp05/5-2.py | 928 | 4.46875 | 4 | #!/usr/bin/env python3
#Write a for loop that prints out the integers 2 through 10, each on a new line, by using the range() function
for n in range(2, 11):
print("n = ", n)
print("Loop Finished")
"""
Use a while loop that prints out the integers 2 through 10 (Hint: you'll need to create a new integer first; ther... | true |
1e6aba46347bc53f8abe7a864d239759a1fd6f91 | Coryf65/Python-Basics | /PythonBasics.py | 807 | 4.1875 | 4 | #Python uses Snake Case for naming conventions
first_name = "Ada"
last_name = "Lovelace"
print("Hello," + first_name + " ")
print(first_name + " " + last_name + " is an awesome person!")
# print() automatically adds spaces
print("These", "will be joined", "together by spaces!")
# Python will save vars like JS kinda... | true |
c8799a82d96c4e2268663abd19bb2ee3578c10e1 | facunava92/1ro_Sistemas | /AED/Fichas/Ficha 02 - [Estructuras Secuenciales]/Guía de Ejercicios Prácticos - Ficha 02/3_EcuacionDeEinstein.py | 486 | 4.15625 | 4 | #!/usr/bin/python
#La famosa ecuación de Einstein para conversión de una masa m en energía viene dada por la fórmula:
#E = mc^2
#Donde c es la velocidad de la luz cuyo valor es c = 299792.458 km/seg. Desarrolle un programa que lea el valor una masa m en kilogramos y obtenga la cantidad de energía E producida en la co... | false |
055c85850dc8ca3356c4659ad534008cccb01a25 | facunava92/1ro_Sistemas | /AED/Fichas/Ficha 01 - [Fundamentos]/Guía de Ejercicios Prácticos - Ficha 01/4_UltimosDigitos.py | 637 | 4.15625 | 4 | #!/usr/bin/python
#¿Cómo usaría el operador resto (%) para obtener el valor del último dígito de un número entero? ¿Y cómo obtendría los dos últimos dígitos? Desarrolle un programa que cargue un número entero por teclado, y muestre el último dígito del mismo (por un lado) y los dos últimos dígitos (por otro lado) [Ayu... | false |
6eeb8bf68eeb0713e477617dc4c37b8c9f98e83a | aurimrv/src | /aula-07/turtle-01.py | 607 | 4.1875 | 4 | import turtle
from math import sqrt
L = input("Tamanho do lado: ");
N = input("Quantidade de quadrados: ");
L = int(L)
N = int(N)
pen = turtle.Pen()
A = L*L
soma = A
cont = 2
# desenhando quadrado
pen.forward(L)
pen.left(90)
pen.forward(L)
pen.left(90)
pen.forward(L)
pen.left(90)
pen.forward(L)
while cont <= N:... | false |
6338ec300caac0b9eeb18103ec9d35d12bb5d61b | mohsin-siddiqui/python_practice | /lpth_exercise/MyRandomPrograms/areaOfCircle.py | 238 | 4.21875 | 4 | pi = 22/7
R = input("Please Enter the Radius of the Circle(in meter):\n") # R stands for Radius of the circle
A = pi * float(R) ** 2 # A stands for Area of the circle
print("The required Area of the circle is :",round(A),"square-meters")
| true |
41c9edbb34832ccd2fc656a366bd89103b171e67 | arl9kin/Python_data | /Tasks/file_function_questions.py | 2,256 | 4.25 | 4 | '''
Question 1
Create a function that will calculate the sum of two numbers. Call it sum_two.
'''
# def sum_two(a, b):
# c = a + b
# print (c)
# sum_two (3,4)
'''
Question 2
Write a function that performs multiplication of two arguments. By default the
function should multiply the first argument by 2. Call it... | true |
348dc81dd001a621ab8fe2f5cf970a86981f6294 | letugade/Code-Club-UWCSEA | /Python/Lesson01/Lesson01.py | 508 | 4.21875 | 4 | # Printing
print("Hello world")
# Variables
a = 3
# Printing variables
print("The value of a is", a)
# User input
name = input("What is your name? ")
print("Hello", name)
# Conditional statements
if name == "Bob":
print("Your name is Bob")
elif name == "John":
print("Your name is John")
else:
print("Your name is... | true |
d8fd66f43d8a296a435c9bc94d0c79a67249abc9 | rmwenzel/project_euler | /p1/p1.py | 286 | 4.15625 | 4 | #!usr/bin/python
import numpy as np
def sum_multiples(n):
"""Sum multiples of 3 or 5 that are < n."""
def f(x):
return x if (x % 3 == 0 or x % 5 == 0) else 0
return sum(np.array(list(map(f, np.arange(1, n)))))
if __name__ == "__main__":
sum_multiples(1000)
| true |
5bc2ead9259f699053de317c62b911bc86f75e3f | vivek-x-jha/Python-Concepts | /lessons/cs14_decorators_args.py | 713 | 4.3125 | 4 | """
Python Tutorial: Decorators With Arguments
https://youtu.be/KlBPCzcQNU8
"""
def prefix_decorator(prefix):
def decorator_function(original_function):
def wrapper_function(*args, **kwargs):
print(prefix, 'Executed Before', original_function.__name__)
result = original_function(*a... | true |
564cb1318d466a5eeb2fbe7a7825380de3227322 | prasannakumar2495/QA-Master | /pythonPractice/samplePractice/IFcondition.py | 786 | 4.3125 | 4 | '''
Created on 25-Dec-2018
@author: prasannakumar
'''
number = False
string = False
if number or string:
print('either of the above statements are true')
else:
print('neither of the above statements are true')
if number:
print('either of the above statements are true')
elif not(string) and number:
p... | true |
5c2252aa3a09a3518282ca6ae984880da19a5b6d | zaurrasulov/Euler-Projects | /Euler9.py | 318 | 4.21875 | 4 |
#This application prints the Pythagorean triplet in which a+b+c=1000
import math
def Pythagorean_triplet(n):
for b in range(n):
for a in range(1, b):
c = math.sqrt( a * a + b * b)
if (c % 1 == 0 and a+b+c==1000):
print(a, b, int(c))
Pythagorean_triplet(1000) | false |
ea1f557a5eee486e0afd435d1eb339dd40caad0e | sis00337/BCIT-CST-Term-1-Programming-Methods | /02. Three Short Functions/create_name.py | 891 | 4.375 | 4 | """
Author: Min Soo Hwang
Github ID: Delivery_KiKi
"""
import random
import string
def create_name(length):
"""
Check if length of a name is less than or equal to 0.
:param length: an integer that indicates the length of a name
:return: the result of the function named create_random_name
"""
... | true |
9e80ca85c78c6ccba160eb3ce0a7e60ab1e49392 | DavidAlen123/Radius-of-a-circle | /Radius of a circle.py | 255 | 4.25 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue May 11 07:15:17 2021
@author: DAVID ALEN
"""
from math import pi
r = float(input ("Input the radius of the circle : "))
print ("The area of the circle with radius " + str(r) + " is: " + str(pi * r**2))
| true |
100cf26661e730aa38efa2852aaa63e87067bac4 | 4anajnaz/Devops-python | /largestnumber.py | 460 | 4.375 | 4 | #Python program to find largest number
try:
num1= input("Enter first number")
num2= input("Enter second number");
num3= input("Enter third number");
if (num1>num2) and (num1>num3):
largest = num1
elif (num2>num1) and (num2>num3):
largest = num2
else:
largest =... | true |
c5864d32adc2646fe4f605e8c5c4d9e2f44342be | Werifun/leetcode | /tree/199. 二叉树的右视图.py | 1,596 | 4.1875 | 4 | """
给定一棵二叉树,想象自己站在它的右侧,按照从顶部到底部的顺序,返回从右侧所能看到的节点值。
示例:
输入: [1,2,3,null,5,null,4]
输出: [1, 3, 4]
解释:
1 <---
/ \
2 3 <---
\ \
5 4 <---
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/binary-tree-right-side-view
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
"""
# Definition for a ... | false |
fb6243d1582229404e91b91dbcea5f98a093a67d | Werifun/leetcode | /tree/236. 二叉树的最近公共祖先.py | 1,573 | 4.21875 | 4 | """
给定一个二叉树, 找到该树中两个指定节点的最近公共祖先。
百度百科中最近公共祖先的定义为:“对于有根树 T 的两个结点 p、q,最近公共祖先表示为一个结点 x,满足 x 是 p、q 的祖先且 x 的深度尽可能大(一个节点也可以是它自己的祖先)。”
例如,给定如下二叉树: root = [3,5,1,6,2,0,8,null,null,7,4]
示例 1:
输入: root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1
输出: 3
解释: 节点 5 和节点 1 的最近公共祖先是节点 3。
来源:力扣(LeetCode)
链接:https://leetcode-... | false |
126fac3aba52940e7c6d68b6469b33a3687ec2fb | aaron-lee/mathmodule | /from math import constant.py | 257 | 4.15625 | 4 | from math import pi #importing only the pi constant from the module
def circumference(radius):
circum = 2*pi*radius #circumference formula
return circum
print("The circumference of circle with radius 20 is %f" % circumference(20))
| true |
1eba38a72a5777e42e51f82ad189db3764ca7689 | teamneem/pythonclass | /Projects/proj02.py | 2,144 | 4.65625 | 5 | #/****************************************************************************
# Section ?
# Computer Project #2
#****************************************************************************/
#Program to draw a pentagon
import turtle
import math
print 'This program will draw a congruent pentagon. Th... | true |
4a2dd635b536f0ce1f7be2cac11ed6b07c25ff87 | Giovanni-Venegas/Curso-python | /6. Colecciones en Python/7.1 05-Ejercicio-set.py | 724 | 4.25 | 4 | #set es una colección sin orden y sin índices, no permite elementos repetidos
#y los elementos no se pueden modificar, pero si agregar nuevos o eliminar
planetas = {"Marte", "Júpiter", "Venus"}
print(planetas)
#largo
print(len(planetas))
#revisar si un elemento está presente
print( "Marte" in planetas)
#agregar
planeta... | false |
df364a633145e4742ed9117caf8e5fd035e0b4a1 | abnerrf/cursoPython3 | /3.pythonIntermediario/aula9/aula9.py | 613 | 4.125 | 4 | '''
SETS EM PYTHON (CONJUNTOS)
add (adiciona), update (atualiza), clear, discard
union | (une)
intersection & (todos os elementos presentes nos dois sets)
difference - (elementos apenas no set da esquerda)
symmetric_difference ^ (elementos que estão nos dois sets, mas não em ambos)
'''
s1 = set()
s1.add(1)
s1.add(2)
s... | false |
11c11c814c2f833503bbea3fd4bcd90951af5a65 | iarzeno/MyFirstRepo | /list_ia.py | 792 | 4.125 | 4 | name = "Isa"
subjects = ["Math","French","English","Science"]
print("My name is " + name)
#print(subjects)
for i in subjects:
print("One of my classes is " + i)
tvshows = ["Gilmore Girls", "Friends", "How I met your mother"]
for i in tvshows:
if i == "Gilmore Girls":
print(i + " is th... | false |
5d88faa8306146450a306976ce89b540d106754e | kosmokato/python-4-infosec | /snippets/files.py | 2,417 | 4.125 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
PoC: Operaciones con ficheros
"""
# Abrir un fichero
f = open('filename', 'r') # asignamos un puntero al fichero a la variable f, abierto para LEER (r)
data = f.read()
f.close() # CIERRA LOS FICHEROS SIEMPRE
g = open('filename2', 'w') # asignamos fichero2 a 'g', para... | false |
99c3e82a14d1eb3a0fa1419a10d07812937784a0 | caiopetreanu/PythonMachineLearningForTradingCourseCodes | /_py/01-01_to_01-03/14_numpy_arrays_random_values.py | 1,172 | 4.125 | 4 | """ Generating random numbers. """
import numpy
import numpy as np
def run():
# generate an array full of random numbers, uniformly sampled from [0.0, 1.0)
print("pass in a size tuple", np.random.random((5, 4))) # pass in a size tuple
print("function arguments (not a tuple)", np.random.rand(5, 4)) # func... | true |
7c8cb97e1b50b85c8a7d5ec746a2b6c58bfee416 | chav-aniket/cs1531 | /labs/20T1-cs1531-lab05/encapsulate.py | 695 | 4.5 | 4 | '''
Lab05 Exercise 7
'''
import datetime
class Student:
'''
Creates a student object with name, birth year
and class age method
'''
def __init__(self, firstName, lastName, birth_year):
self.name = firstName + " " + lastName
self.birth_year = birth_year
def age(self):
''... | true |
8fcda1b10eebda946124e3654c56e5176782e20f | abbasegbeyemi/outfield | /psolv_ch_4/psolv_ch_4_ADT.py | 1,327 | 4.4375 | 4 | class Stack:
"""The stack class which is an abstract data type that appends to and removes from the end of a list"""
def __init__(self):
"""Constructor for Stack"""
self._stack_list = []
def push(self, item):
self._stack_list.append(item)
def pop(self):
return self._st... | false |
5bbbe57c31952c4e04e8ab5739e04cc3fb678474 | danisebastian9/Ciclo1MinTIC | /Semana5/funcExternas04.py | 903 | 4.125 | 4 |
'''
Definir una función inversa() que realice la inversión de una cadena.
Por ejemplo la cadena "estoy probando" debería devolver la cadena "odnaborp yotse"
Definir una función que diga si una cadena es palindrome "Sometamos o matemos" "oso" "radar" ""
'''
# def inversa(palabra):
# reversa = ''
# for i in ... | false |
c961c1845e80e88496fefbb12ff75ab957c59e1a | mdadil98/Python_Assignment | /21.py | 323 | 4.53125 | 5 | # Python3 program to print all numbers
# between 1 to N in reverse order
# Recursive function to print
# from N to 1
def PrintReverseOrder(N):
for i in range(N, 0, -1):
print(i, end=" ")
# Driver code
if __name__ == '__main__':
N = 5;
PrintReverseOrder(N);
# This code is contributed by 29AjayKum... | true |
bd7b188ddcb0026ce6c83a6ac7323b441ccc42a5 | brohum10/python_code | /daniel_liang/chapter06/6.12.py | 1,190 | 4.40625 | 4 | #Defining the function 'printChars'
def printChars(ch1, ch2, numberPerLine):
#y is a variable storing the count of
#elements printed on the screen
#as we have to print only a given number of characters per line
y=0
#Running a for loop
#'ord' function returns the ASCII value o... | true |
7bbecf05287d5a11f158524c18c01143f42d534c | MantaXXX/python | /6- while/6-1.py | 205 | 4.28125 | 4 | # For a given integer N, print all the squares of positive integers where the square is less than or equal to N, in ascending order.
n = int(input())
i = 1
while i**2 <= n:
print(i**2, end=' ')
i += 1 | true |
4a902e6c95a8b980fbcf6ca3193bbc2af259988c | MantaXXX/python | /3- if else /3.A.py | 392 | 4.15625 | 4 | # Given three integers. Determine how many of them are equal to each other. The program must print one of the numbers: 3 (if all are same), 2 (if two of them are equal to each other and the third one is different) or 0 (if all numbers are different).
a = int(input())
b = int(input())
c = int(input())
if a == b == c:
... | true |
6c8b2745c7e34271a007e2ecaaf634938cd3b851 | johnmarcampbell/concord | /concord/member.py | 956 | 4.25 | 4 | class Member(object):
"""This object represents one member of congress"""
def __init__(self, last_name='', first_name='', middle_name='',
bioguide_id='', birth_year='', death_year='', appointments=[]):
"""Set some values"""
self.last_name = last_name
self.first_name = first_nam... | true |
edd62710a5ae5ae17009b97d29296f58ad99f849 | sogouo/notes | /python/mydailydate.py | 1,625 | 4.1875 | 4 | # -*- coding: utf-8 -*-
"""关于命名不规范灰常👏走过路过大神瞬时指出
官方文档: https://docs.python.org/2/library/datetime.html
日常项目或者练习关于 datetime 模块的总结与Demo
"""
from datetime import timedelta, datetime, date
class MyDailyDate():
def get_day_of_each_month_in_datetime(self, *args):
""" 通过 datetime 对象获取上个月1号零时或者任何x号datet... | false |
62cd51f8869cda6893e815f3508fc07b61f7e91f | andelgado53/interviewProblems | /order_three_colors.py | 971 | 4.15625 | 4 | # Problem Statement:
# You are given n balls. Each of these balls are of one the three colors: Red, Green and Blue.
# They are arranged randomly in a line. Your task is to rearrange them such that all
# balls of the same color are together and their collective color groups are in this order:
# Red balls first, Green... | true |
e5376089499f5bce5631b85ee1581a57451f0cb2 | andelgado53/interviewProblems | /zig_zag_conversion.py | 2,140 | 4.15625 | 4 | import pprint
# The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this:
# (you may want to display this pattern in a fixed font for better legibility)
#
# P A H N
# A P L S I I G
# Y I R
# And then read line by line: "PAHNAPLSIIGYIR"
#
# Write the code that will take a ... | true |
9e84a0156febb09375208e2f1be5d4b3b30ae95e | andelgado53/interviewProblems | /set_matrix_zero.py | 1,956 | 4.28125 | 4 | # https://leetcode.com/problems/set-matrix-zeroes/
# Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place.
#
# Example 1:
#
# Input:
# [
# [1,1,1],
# [1,0,1],
# [1,1,1]
# ]
# Output:
# [
# [1,0,1],
# [0,0,0],
# [1,0,1]
# ]
# Example 2:
#
# Input:
# [
# [0,1,2,0],
# ... | false |
a9ca7660d5daf407247efa3219bde5714591e492 | sanket-qp/IK | /4-Trees/invert_binary_tree.py | 1,141 | 4.3125 | 4 | """
You are given root node of a binary tree T. You need to modify that tree in place,
transform it into the mirror image of the initial tree T.
https://medium.com/@theodoreyoong/coding-short-inverting-a-binary-tree-in-python-f178e50e4dac
______8______
/ \
1 __16
... | true |
df7b73944b7b1d4676d64edafeb1c3cbc976d483 | sanket-qp/IK | /3-Recursion/power.py | 1,109 | 4.1875 | 4 | """
The problem statement is straight forward. Given a base 'a' and an exponent 'b'. Your task is to find a^b.
The value could be large enough. So, calculate a^b % 1000000007.
Approach:
keep dividing the exponent by two pow(2, 8) will be handled as follows
2x2x2x2 x 2x2x2x2
... | true |
73601e344b62ecc1b895c7485c0654c73927cb81 | sanket-qp/IK | /3-Recursion/strings_from_wildcard.py | 2,544 | 4.34375 | 4 | """
You are given string s of length n, having m wildcard characters '?', where each wildcard character represent
a single character.
Write a program which returns list of all possible distinct strings
that can be generated by replacing each wildcard characters in s with either '0' or '1'.
Any string in returned list... | true |
91acc9bd925f21654d1992dc9048232b8a8482c6 | duhjesus/practice | /hackerrank/countingInversions.py | 2,916 | 4.25 | 4 | #!/bin/python3
import math
import os
import random
import re
import sys
# function: helper function
# merges left and right half arrays in sorted order
# input:nums= array to be sorted
# temp= place holder array, hard to do inplace sorting
# leftStart = start index of the left half array
# ... | true |
c393f87657b09fc9fb90621ef0d6ffe8eef1c47d | ErikBrany/python-lab2 | /Lab 2_Exercise 2.py | 914 | 4.125 | 4 | from sys import task_list
print(sorted(task_list))
index = int(input("1. Insert new task, 2. Remove task, 3. Show all existing tasks, 4. Close program, Choose an action 1-4: "))
while index != 4:
if index == 1:
new_list = input("What task would you like to add: ")
task_list.append(new_list)
... | true |
80c06bb6aeb90514d45d55fd50a8459630e99056 | Arboreus-zg/Unit_converter | /main.py | 642 | 4.53125 | 5 | print("Hello! This is unit converter. It will convert kilometers into miles. Just follow instruction on screen")
while True:
kilometers = float(input("Enter a number in kilometers: "))
conv_fac = 0.621371
miles = kilometers * conv_fac
print("Your kilometers converted into miles are: ",... | true |
e78ef7ff493875a8789ac1022917b9208ba1aadc | siddeshgr/python-practice | /main.py | 1,599 | 4.21875 | 4 | #1
print("hello world")
name = input("enter your name: ")
print("hello siddesh")
#1 variables in python
x = 100
y = 100
z = 200
print(x,y,z)
#2 float [float]
x1 = 20.20
y1 = 30.30
print(x1,y1)
name = "hello"
print("single character",name[1])
name = "hello"
print("snigle character",name[3])
... | true |
652ab15329f9c2dbf8ddc7f2053cbea0fe987617 | earamosb8/holbertonschool-web_back_end | /0x00-python_variable_annotations/7-to_kv.py | 305 | 4.125 | 4 | #!/usr/bin/env python3
"""
Module - string and int/float to tuple
"""
from typing import Union, Tuple
def to_kv(k: str, v: Union[int, float]) -> Tuple[str, float]:
"""function to_kv that takes a string k
and an int OR float v as arguments
and returns a tuple."""
return (k, v * v)
| true |
1e7d3ef971b8905b62be1a515dc9b82b24502def | earamosb8/holbertonschool-web_back_end | /0x00-python_variable_annotations/3-to_str.py | 224 | 4.15625 | 4 | #!/usr/bin/env python3
"""
Module - to string
"""
def to_str(n: float) -> str:
"""function to_str that takes a float n
as argument and returns the string
representation of the float."""
return str(n)
| true |
a64e0ebc2e4d156518ffa5f96713b742694d886a | Leporoni/PythonBasic | /src/estrutura_for.py | 568 | 4.125 | 4 | numero = int(input("Digite um número: "))
for i in range(11):
print( "{n} x {i} = {resultado}".format(n=numero, i=i, resultado=numero*i))
else:
print("**Processo Concluído**")
linguagens = ["Python", "Java", "C#", "Node", "Go"]
print("Algumas linguagens de programação são: ")
for linguagem in linguagens:
p... | false |
df29cb4575c299b3a6efb1bc4245ccb77b568998 | MarcosRigal/Master-en-Python-Udemy | /15-manejo-errores/main.py | 1,258 | 4.53125 | 5 | """
# Capturar excepciones y manejar errores en código
# susceptible a fallos/errores
try:#Comprueba el funcionamiento
nombre = input("¿Cual es tu nombre?")
if len(nombre) > 1:
nombre_usuario = "El nombre es: " + nombre
print(nombre_usuario)
except:#Si va mal
print("Ha ocurrido un error, introduzca un nom... | false |
b7e9e4dedabccd1f9cadb77bc04148f9a7bdb795 | MarcosRigal/Master-en-Python-Udemy | /10-sets-diccionarios/diccionarios.py | 730 | 4.4375 | 4 | """
Un diccionario es un tipo de dato que almacena otros conjuntos de datos en formato:
clave > valor (Es como un struct)
"""
persona = {
"nombre": "Marcos",
"apellidos": "Rivera",
"correo": "riveragavilanmarcos@gmail.com"
}
print(persona["correo"])
# Lista con diccionarios (Array de Structs)
contactos = [
... | false |
037a548be82d0320267eb5830baabafd0f9604d1 | yuta-inoue/soft2 | /3/mon5.py | 500 | 4.125 | 4 | # -*- coding:utf-8 -*-
# 再帰関数の線形再帰(フィボナッチ数列の線形再帰)
fib = []
# 配列の要素を先に初期化して保持しておく(ループはO(n))
def init(n):
fib.append(0)
fib.append(1)
for i in range(2,n):
fib.append(fib[i-1] + fib[i-2])
# 先にO(n)で初期化した配列のn番目の要素を返す
def fib_linear(n):
return fib[n]
def main():
init(10)
for i in range(10):
print(fib_... | false |
4693a753a7e8f36f6f7c8e7f051c3e1a345ca0cd | Moussaddak/holbertonschool-higher_level_programming | /0x0B-python-input_output/4-append_write.py | 317 | 4.3125 | 4 | #!/usr/bin/python3
""" Method """
def append_write(filename="", text=""):
""" appends a string at the end of
a text file (UTF8) and returns the
number of characters added: """
with open(filename, mode='a', encoding='utf-8') as file:
nb_char = file.write(text)
return nb_char
| true |
990e1956b147a5641d1bb759ddcb99da0ba470fc | SvWer/MultimediaInteractionTechnologies | /05_Excercises03_12/02.py | 637 | 4.3125 | 4 | #Write a Python program to calculate number of days between two dates. Sample dates: (2019, 7, 2) (2019, 7, 11)
from datetime import date
from datetime import timedelta
if __name__ == '__main__':
date1 = input("What is the first date (dd.mm.jjjj)")
print("Date 1: ", date1)
day1, month1, year1 = map(int, date1.spli... | true |
58b4ca15f45d8c5400b683b9a9ddbbddb159b816 | pniewiejski/algorithms-playground | /data-structures/Stack/bracket_validation.py | 955 | 4.21875 | 4 | # Task:
# You are given a string containing '(', ')', '{', '}', '[' and ']',
# check if the input string is valid.
# An input string is valid if:
# * Open brackets are closed by the same type of brackets.
# * Open brackets are closed in the correct order.
from collections import deque
OPENING_BR... | true |
4238ef5459c897e2dd8fff20c5f3045bbeceb15a | KinaD-D/Homework | /ДЗ 31.10.2020/Камень Ножницы Бумага.py | 2,406 | 4.125 | 4 | print('Добро пожаловать в камень ножницы бумага, сдесь вы будете играть с ботом.\nВ конце игры вам покажут статистику, если хотите что бы она была точнее играйте больше.')
Game = int(input('Введите сколько игр играть будете '))
scissors = bumaga = kamen = raza = wins = 0
import random
for i in range (Game):
input... | false |
e9c519040728ccf2b22ca6bda0c9c200840b68a8 | OlgaBukharova/Python_projects | /черепашка 1/черепашка 10.py | 276 | 4.375 | 4 | import turtle
from math import pi
turtle.shape ('turtle')
def circle (r):
l=2*pi*r
for i in range (360):
turtle.forward (l/360)
turtle.left (1)
r=100
d=3
for i in range (d):
circle (r)
turtle.left (180)
circle(r)
turtle.left (180/d)
| false |
393cfd774cdd988ec4b1ee0c5c958decf64c7939 | OlgaBukharova/Python_projects | /черепашка 1/черепашка 11.py | 279 | 4.375 | 4 | import turtle
from math import pi
turtle. shape ('turtle')
def circle (r):
l=2*pi*r
for i in range (360):
turtle.forward (l/360)
turtle.left (1)
for r in range (10,100,10):
for i in range (2):
circle (r)
turtle.left (180)
| false |
3c4465418f980be01250fa017db3031a6a69e33b | barenzimo/Basic-Python-Projects | /2-tipCalculator(2).py | 410 | 4.28125 | 4 | #A simple tip calculator to calculate your tips
print("Welcome to the tip calculator \n")
bill=float(input("What was the total bill paid? $"))
tip_percent=float(input("What percentage of bill would you like to give? 10, 12 or 15? "))
people=int(input("How many people are splitting the bill? "))
total=float(bill+(bill*... | true |
0c719b3acb3a4af4425fa11a271a079af4fdfba6 | felipovski/python-practice | /intro-data-science-python-coursera/curso1/semana3/ordemCrescente.py | 346 | 4.125 | 4 | def main():
numero1 = int(input("Digite o primeiro número inteiro: "))
numero2 = int(input("Digite o segundo número inteiro: "))
numero3 = int(input("Digite o terceiro número inteiro: "))
if numero2 >= numero1 and numero2 <= numero3:
print("crescente")
else:
print("não está em orde... | false |
2d462e37e3aae358cb78b7bb43b980fe0b0be395 | jc8702/Apex---Curso-Python | /apex-ensino-master/aula-12-08-2020/ex-08.py | 405 | 4.21875 | 4 | # Exercício 08
# Escreva um programa em Python que receba o nome e o sobrenome do usuário, em seguida os imprima em ordem reversa. Por exemplo:
if __name__ == '__main__':
nome = input("Digite um nome: ")
sobrenome = input("Digite um sobrenome: ")
print(f'{nome} {sobrenome} {3 * 3}')
# Apex Ensino
... | false |
30b7a0a95d92d3b3e7257b3d1a1f39ac6de5284e | jc8702/Apex---Curso-Python | /apex-ensino-master/aula-12-08-2020/ex-06.py | 683 | 4.34375 | 4 | # Exercício 06
# Escreva um programa Python que pedirá 3 números, informe qual deles é o menor.
if __name__ == '__main__':
numero1 = int(input("Digite o primeiro número: "))
numero2 = int(input("Digite o segundo número: "))
numero3 = int(input("Digite o terceiro número: "))
numeros = [numero1, numero2... | false |
cc7a99e42302c448bfd8d59d0e2c2b38670dbeae | linhuiyangcdns/leetcodepython | /两个数组的交集 II.py | 982 | 4.5625 | 5 | """
给定两个数组,写一个方法来计算它们的交集。
例如:
给定 nums1 = [1, 2, 2, 1], nums2 = [2, 2], 返回 [2, 2].
注意:
输出结果中每个元素出现的次数,应与元素在两个数组中出现的次数一致。
我们可以不考虑输出结果的顺序。
跟进:
如果给定的数组已经排好序呢?你将如何优化你的算法?
如果 nums1 的大小比 nums2 小很多,哪种方法更优?
如果nums2的元素存储在磁盘上,内存是有限的,你不能一次加载所有的元素到内存中,你该怎么办?
"""
class Solution:
def intersect(self, nums1, nums2):
... | false |
0a08293e35d0d181b03ef54814b13f75e8748f6f | chrihill/COM170-Python-Programming | /Program1.py | 590 | 4.21875 | 4 | # Christian Hill
#Program Assignment 1
#COMS-170-01
#Display basic information about a favorite book
#Variabels: strName - my name, strBookName - stores book name, strBookAuthor - author name, strDate - copy right date, strPage - number of pages
strName = 'Christian Hill'
strBookName = 'The Fall of Reach'
strB... | true |
8d9cf33139cfed49eaf6430074b80e7ba9e5b0f0 | PhungXuanAnh/python-note | /others.py | 711 | 4.4375 | 4 | def add(x):
return x + 1
def sample_map():
"""
map() func allows us to map an iterable to a function.
"""
print(list(map(add, [1, 2, 3])))
def sample_map_lambda():
"""
map() func allows us to map an iterable to a function.
using lambda for avoid define a func
"""
p... | false |
bf10ff9510a7274223d8764192a1f36366636bb7 | FernandaSlomp/Resumo_Tecnologias_Introdutorias | /Curso_Python_MEGAREVISAO/aprendendo/exercicios/ex037.py | 486 | 4.15625 | 4 | numero = int(input('Digite um número inteiro: '))
print('''Escolha uma das bases para a conversão
[1] converter para binário
[2] converter para octal
[3] converter para hexadecimal''')
opcao = int(input('Sua opção: '))
if opcao == 1:
print(f'{numero} em binário é igual a {bin(numero)}')
elif opcao == 2:
print(f... | false |
3ea0003beea89266866ca00c7ae40d08a3634a4d | tchka/python2 | /task_1.py | 585 | 4.1875 | 4 | # https://drive.google.com/file/d/18aEzzMoVyhGi9VjPBf_--2t-aVXVIvkW/view?usp=sharing
# Найти сумму и произведение цифр трехзначного числа, которое вводит пользователь.
number = int(input('Введите целое трехзначное число: '))
number = abs(number)
n0 = number % 10
print(n0)
number = number // 10
n1 = number % 10
print(... | false |
a25c3917dfc3fd580e9bcb107df8a50c0e9719ff | alliequintano/triangle | /main.py | 1,412 | 4.1875 | 4 | import unittest
# Function: triangle
#
# Given the lengths of three sides of a triangle, classify it
# by returning one of the following strings:
#
# "equ" - The triangle is equilateral, i.e. all sides are equal
# "iso" - The triangle is isoscelese, i.e. only two sides are equal
# "sca" - The triangle is scal... | true |
808e12eef51c92d2ef004a9b39a638b1e5334fd4 | Tometoyou1983/Python | /Automate boring stuff/collatz.py | 2,119 | 4.1875 | 4 | '''
import os, sys
os.system("clear")
print("Lets introduce you to collatz sequence or problem")
print("its an algorithm that starts with an integer and with multiple sequences reaches at 1")
numTries = 0
accumlatedNum = ""
newNumber = 0
def collatz(number):
if number % 2 == 0:
newNumber = number // 2
... | true |
08fd2a87081a0ddc7d56c5c9a6c393ba669efa75 | Kennethowl/Practicas-Java-y-Python | /Python/HelloWorld_Datatypes.py | 694 | 4.25 | 4 |
# Comentarios
print("Hola Mundo, como estan")
# Datatypes
# Maneras de imprimir string
print("Hola Mundo, como estan")
print("""Hola Mundo, como estan""")
print('Hola Mundo, como estan')
print('''Hola Mundo, como estan''')
# Comando Type
print(type(100))
# Concatenacion
print("See you around" + " " + "World")
# ... | false |
02822058efc7642aa91e374dab6dcecf41100159 | GT12ness/lectures | /examples/Ulohy_hodina4.py | 1,997 | 4.15625 | 4 | """
1. napiste program v pythone
- vypisete text: aka je vonku teplota?
- zadate vstup (cislo)
- vyhodnotite ak je teplota vyssie ako 25 tak vypiste: "zober si tricko. "
ak nie vypiste: "Zobrer si aj sveter. "
- na konci vypiste: "Mozes ist vonku"
mozne riesenie:
"""
temperature = float(input('What ... | false |
b4b469aeb580da7bf9a83b6b1b3c64a967cd3dc8 | Turhsus/coding_dojo | /python/bike.py | 736 | 4.21875 | 4 | class Bike(object):
def __init__(self, price, max_speed, miles = 0):
self.price = price
self.max_speed = max_speed
self.miles = miles
def displayInfo(self):
print "Price:", self.price, "Dollars; Max Speed:", self.max_speed, "MPH; Miles:", self.miles
return self
def ride(self):
print "Riding"
self.miles... | true |
740de0cb3d6afbb7c3b28752d15a1e7bdb751a12 | Breenori/Projects | /FH/SKS3/Units/urlParser/sqlite/sqlite.py | 570 | 4.15625 | 4 | import sqlite3
connection = sqlite3.connect('people.db')
cursor = connection.cursor()
cursor.execute("create table if not exists user(id integer primary key autoincrement, name text, age integer)")
cursor.execute("insert into user values (NULL, 'sebastian pritz', 22)")
#1
cursor.execute("select * from user")
row =... | true |
32d6d978ce4af56dd6ce8870450a4abe1addfd7e | MaxBI1c/afvinkopdracht-3-goed | /afvinkopdracht 3 opdracht 2 opdracht 2.py | 762 | 4.21875 | 4 | lengthrectangle_one = int(input('What is the length of the first rectangle?'))
widthrectangle_one = int(input('What is the width of the first rectangle?'))
lengthrectangle_two = int(input('What is the length of the second rectangle?'))
widthrectangle_two = int(input('What is the width of the second rectangle?'))
... | true |
b6f58732445c87338e5722342ab1cb8b26965886 | mac95860/Python-Practice | /working-with-zip.py | 1,100 | 4.15625 | 4 | list1 = [1,2,3,4,5]
list2 = ['one', 'two', 'three', 'four', 'five']
#must use this syntax in Python 3
#python will always trunkate and conform to the shortest list length
zipped = list(zip(list1, list2))
print(zipped)
# returns
# [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four'), (5, 'five')]
unzipped = list(zip(*... | true |
e6edf7e821959e69ebfbd514bfd6ebed4d6a3504 | taozhenting/python_introductory | /name_cases.py | 542 | 4.3125 | 4 | #练习
name="eric"
print('"Hello '+name.title()+',would you like to learn some Python today?"')
print(name.title())
print(name.upper())
print(name.lower())
print('Albert Einstein once said, "A person who never made a mistake never tried anything new."')
famous_person='Albert Einstein'
message=famous_person + ' once said,... | true |
c81d6c2c9354420b94c7133ef013d5c564ae367b | taozhenting/python_introductory | /4-3/练习.py | 572 | 4.28125 | 4 | #打印1-20
for value in range(1,21):
print(value)
#一百万
numbers = list(range(1,100001))
print(numbers)
print(min(numbers))
print(max(numbers))
print(sum(numbers))
#1到20的奇数
even_numbers = list(range(1,21,2))
for even_number in even_numbers:
print(even_number)
#3到30能被3整除
even_numbers = list(range(3,31,3))
for even_... | false |
78de74417139d34d6197348884cc2fb504b37223 | taozhenting/python_introductory | /6-3/favorite_languages.py | 1,303 | 4.15625 | 4 | favorite_languages = {
'jen':'python',
'sarah':'c',
'edward':'ruby',
'phil':'python',
}
#遍历字典
for name,language in favorite_languages.items():
print(name.title() + "'s favorite language is" +
language.title() + ".")
#遍历字典中的所有键
for name in favorite_languages.keys():
print(name.title())... | true |
15e07b16f0e6c1b0419de3232ecc28446a0ab3d0 | BI-JULEO/BI-TP | /tp3/utils/distance.py | 599 | 4.15625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
http://fr.wikipedia.org/wiki/Distance_%28math%C3%A9matiques%29
'''
import math
def euclidienne(x,y):
'''
distance euclidienne pour 2scalaires
:param x:
:param y:
:type x: int/float
:type y: int/float
:return: la distance euclidienne entr... | false |
60a3272b25d14ce17af91e2ba41803ba7e48e2c7 | IgorGarciaCosta/SomeExercises | /pyFiles/linkedListCycle.py | 1,354 | 4.15625 | 4 | class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class LinkedList:
# Function to initialize head
def __init__(self):
self.head = None
# Function to insert a new
# node at the beginning
def push(self, new_data):
new_node = ListNode(new_data... | true |
870dbcb30b9da785f1d82032c62171974f1fc6c0 | cdhutchings/csv_read_write | /csv_example.py | 796 | 4.125 | 4 | import csv
# Here we load the .csv
"""
-open file
-read line by line
-separate by commas
"""
# with open("order_details.csv", newline='') as csv_file:
# csvreader = csv.reader(csv_file, delimiter = ",")
# print(csvreader)
#
# for row in csvreader:
# print(row)
#
# iter() creates an iterable obje... | true |
b27ac5eca6442e9a0b09ef30d9836475deb593c3 | mzkaoq/codewars_python | /5kyu Valid Parentheses/main.py | 297 | 4.1875 | 4 | def valid_parentheses(string):
left = 0
right = 0
for i in string:
if left - right < 0:
return False
if i == "(":
left += 1
if i == ")":
right += 1
if left - right == 0:
return True
else:
return False
| true |
211faf6de66a218395512c29d17865aa5d5b38a3 | PhiphyZhou/Coding-Interview-Practice-Python | /Cracking-the-Coding-Interview/ch9-recursion-DP/s9-1.py | 763 | 4.3125 | 4 | # 9.1 A child is running up a staircase with n steps, and can hop either 1 step, 2 steps, or 3
# steps at a time. Implement a method to count how many possible ways the child can run up
# the stairs.
def count(n):
mem = [None]*n
return count_hop_ways(n, mem)
def count_hop_ways(n, mem):
if n == 0:
... | true |
220d4effabcc190fcd8690810724521ef9641da6 | PhiphyZhou/Coding-Interview-Practice-Python | /HackerRank/CCI-Sorting-Comparator.py | 1,213 | 4.25 | 4 | # Sorting: Comparator
# https://www.hackerrank.com/challenges/ctci-comparator-sorting
# Comparators are used to compare two objects. In this challenge, you'll create a comparator and use it to sort an array. The Player class is provided in the editor below; it has two fields:
#
# A string, .
# An integer, .
# Given an... | true |
3957b50146e927e27fb014345ebcfcd15972a288 | leikang123/python-code | /day9.py | 950 | 4.21875 | 4 | """
#汽车租
car = input("what is it car ?")
print("Let mw see if I can find you a Subaru :"+' '+car)
print("\n")
men = int(input("how much have pople meat,please?"))
print(men)
if men > 8 :
print("Not")
else :
print("Yes")
print("\n")
number = int(input("please input number :"))
print(number)
if number % 10 == 0... | false |
e96deebf5c52ab7eda648a973f5871cc21f50d7d | leikang123/python-code | /Algorithm/Tree.py | 1,417 | 4.21875 | 4 | """d定义二叉树"""
#树的节点
class Node():
#节点的属性,值,左节点,右节点
def __init__(self,value,left=None,right=None):
self.value = value
self.left= left
self.right = right
#二叉树
class BTree():
#根节点
_root = None
#跟节点属性
def __init__(self,root):
self._root = root
# 定义添加方法,node... | false |
2e57d87c04fcdd82734a5a0c4de8bb2f43bdd814 | hgy9709/p2_20161118 | /w5Main8.py | 327 | 4.15625 | 4 | height=input ("input user height (M): ")
weight=input ("input user weight (kg): ")
print "%.1f" %height, "%.1f" %weight
BMI=weight/(height*height)
print "%.1f" %BMI
if BMI<=18.5:
res= "Low weight"
elif 18.5<BMI<23:
res= "Nomal weight"
elif 23<=BMI<25:
res= "Over weight"
else:
res= "Very Over weight"
pri... | false |
7d16a8117e50750c2c4f9606aba2ab6612cd3b09 | chunin1103/nguyentuananh-c4e22 | /Fundamentals/session3/homework/crud_1.py | 2,589 | 4.125 | 4 | items = ["T-shirt", "Sweater"]
loop_counter = 0
while True:
if loop_counter == 0:
n = str(input("Welcome to our shop, what do you want? \n Please enter C, R, U, D or exit: "))
loop_counter += 1
else:
n = str(input("What else do you want? \n Please enter C, R, U, D or exit: "))
... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.