blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
09fb28996aa732c01df70d674a369fafa05e0939 | mcampo2/python-exercises | /chapter_01/exercise_18.py | 410 | 4.5 | 4 | #/usr/bin/env python3
# (Turtle: draw a star) Write a program that draws a star, as shown in Figure 1.19c.
# (Hint: The inner angle of each point in the star is 36 degrees.)
import turtle
turtle.right(36+36)
turtle.forward(180)
turtle.right(180-36)
turtle.forward(180)
turtle.right(180-36)
turtle.forward(180)
turtle.... | true |
b39fc4b4543d890072f04ce215d29dc50827c3ff | mcampo2/python-exercises | /chapter_03/exercise_16.py | 2,135 | 4.53125 | 5 | #!/usr/bin/env python3
# (Turtle: draw shapes) Write a program that draws a triangle, square, pentagon,
# hexagon, and octagon, as shown in Figure 3.6b. Note that the bottom edges of
# these shapes are parallel to the x-axis. (Hint: For a triangle with a bottom line
# parallel to the x-axis, set the turtle's heading t... | false |
b0c6434539536ee3c7db23fb6977ca940037d147 | mcampo2/python-exercises | /chapter_03/exercise_02.py | 1,594 | 4.53125 | 5 | #!/usr/bin/env python3
# (Geometry: great circle distance) The great circle distance is the distance between
# two points on the surface of a sphere. Let (x1, y2) and (x2, y2) be the geographical
# latitude and longitude of two points. The great circle distance between the two
# points can be computed using the follow... | true |
e4c59a6991788b320fdfd4aeea0e8c894d403d39 | mcampo2/python-exercises | /chapter_02/exercise_06.py | 680 | 4.46875 | 4 | #!/usr/bin/env python3
# (Sum the digits in an integer) Write a program that reads an integer between 0 and
# 1000 and adds all the digits in the integer. For example, if an integer is 932, the
# sum of all it's digits is 14. (Hint: Use the % operator to extract digits, and use the //)
# operator to remove the extract... | true |
ebb74354b22feb3d6d6a27b546111115d4ae8964 | praisethedeviI/1-course-python | /fourth/pin_checker.py | 788 | 4.125 | 4 | def check_pin(pin):
nums = list(map(int, pin.split("-")))
if is_prime_num(nums[0]) and is_palindrome_num(nums[1]) and is_a_power_of_two(nums[2]):
message = "Корректен"
else:
message = "Некорректен"
return message
def is_prime_num(num):
tmp = 2
while num % tmp != 0:
... | true |
65378f3f4696073f33c1708935fc45f8deb2e5d1 | ishaansathaye/APCSP | /programs/guessingGame.py | 1,677 | 4.125 | 4 | # from tkinter import *
#
# root = Tk()
# root.title("Computer Guessing Game")
# root.geometry("500x500")
# lowVar = StringVar()
# highVar = StringVar()
# labelVar = StringVar()
# guessVar = StringVar()
#
# def range():
# lowLabel = Label(root, textvariable=lowVar)
# lowVar.set("What is the lower bound of the r... | true |
920ed667628f9fbb5783d72dd234a372c1f0ab87 | Asish-Kumar/Python_Continued | /CountingValleys.py | 743 | 4.25 | 4 | """
A mountain is a sequence of consecutive steps above sea level, starting with a step up from sea level and ending with a step down to sea level.
A valley is a sequence of consecutive steps below sea level, starting with a step down from sea level and ending with a step up to sea level.
example input : UDDDUDUU
"""
d... | true |
5e36170af1209383fed6749d2c7302971cd6c354 | dhalimon/Turtle | /race.py | 1,883 | 4.25 | 4 | import turtle
import random
player_one = turtle.Turtle()
player_one.color("green")
player_one.shape("turtle")
player_one.penup()
player_one.goto(-200,100)
player_two = player_one.clone()
player_two.color("blue")
player_two.penup()
player_two.goto(-200,100)
player_one.goto(300,60)
player_one.pendown()
player_one.circl... | true |
e346adc9388fadbb152c9c5698b5425a8f78afd1 | hungnv21292/Machine-Learning-on-Coursera | /exe1/gradientDescent.py | 1,511 | 4.125 | 4 | import numpy as np
from computeCost import computeCost
def gradientDescent(X, y, theta, alpha, num_iters):
#GRADIENTDESCENT Performs gradient descent to learn theta
# theta = GRADIENTDESENT(X, y, theta, alpha, num_iters) updates theta by
# taking num_iters gradient steps with learning rate alpha
... | true |
5cce1caf8666c82ea5f180d45188272a82e290d3 | Anupam-dagar/Work-with-Python | /Very Basic/remove_vowel.py | 435 | 4.5625 | 5 | #remove vowel from the string.
def anti_vowel(text):
result = ""
for char in text:
if char == "A" or char == "a" or char == "E" or char == "e" or char == "I" or char == "i" or char == "O" or char == "o" or char == "U" or char == "u":
result = result
else:
result = ... | true |
0fb68f202520e3370e544f8b7d53a2ad0ad69c42 | Anupam-dagar/Work-with-Python | /Very Basic/factorial.py | 228 | 4.1875 | 4 | #calculate factoial of a number
def factorial(x):
result = 1
for i in range(1,x+1):
result = result * i
return result
number = int(raw_input("enter a number:"))
answer = factorial(number)
print answer | true |
fb067a66d72ae73131adf2dc34c0ce568ab87cad | kushagraagarwal19/PythonHomeworks | /HW2/5.py | 876 | 4.15625 | 4 | johnDays = int(input("Please enter the number of days John has worked"))
johnHours = int(input("Please enter the number of hours John has worked"))
johnMinutes = int(input("Please enter the number of minutes John has worked"))
billDays = int(input("Please enter the number of days bill has worked"))
billHours = int(inp... | true |
200e529f8f5c8d35758263c382cb995d8e467399 | alaminbhuyan/Python-solve | /problem/Map&Lambda.py | 459 | 4.125 | 4 | #
# n = int(input())
#
# def fibonacci(num):
# lis = [0,1]
# for i in range(2,num):
# lis.append(lis[i-2]+lis[i-1])
# return (lis[0:num])
# x = fibonacci(n)
# print(list(map(lambda x: pow(x,3),x)))
def fibonacci(num):
lis = [0,1]
for i in range(2,num):
lis.append(lis[i-2]+lis[i-1])
... | false |
df23c42f672c812f81c6f10ee3558bce3f51946c | BarnaTB/Level-Up | /user_model.py | 2,023 | 4.28125 | 4 | import re
class User:
"""
This class creates a user instance upon sign up of a user,
validates their email and password, combines their first and last names
then returns the appropriate message for each case.
"""
def __init__(self, first_name, last_name, phone_number, email, password):
... | true |
d5a2414bc8d3e3fb711cc0c43fac1122173d4388 | mitchellroe/exercises-for-programmers | /python/02-counting-the-number-of-characters/count.py | 381 | 4.3125 | 4 | #!/usr/bin/env python3
"""
Prompt for an input string and print the number of characters
"""
def main():
"""
Prompt for an input string and print the number of characters
"""
my_string = input("What is the input string? ")
num_of_chars = len(my_string)
print(my_string + " has " + str(num_of_cha... | true |
59af2128b9e6d314ca90fa7cd770f0f1f4278030 | siraiwaqarali/Python-Learning | /Chapter-02/UserInput.py | 297 | 4.15625 | 4 | # To take input from user we use input() function
name = input("Enter your name: ")
print("Hello "+name)
# input(Always takes input as a string)
age=input("Enter your age: ") # This age is in String
print("Your age is "+age) # Agr age int mn huta tou ye concatenate ni huta
| false |
5d9192fb3a7f91af57e796ab3325891af0c2cabe | siraiwaqarali/Python-Learning | /Chapter-05/10. More About Lists.py | 582 | 4.15625 | 4 | # generate list with range function
# index method
generated_list = list(range(1, 11))
print(generated_list) # output: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3]
print(numbers.index(3)) # gives the index of the provided element
print(numb... | true |
9e0d8659be7a01bfaccc5d978b4b495e571491a1 | siraiwaqarali/Python-Learning | /Chapter-03/ForLoopExample1.py | 405 | 4.125 | 4 | # sum of first ten natural numbers
total=0
for i in range(1,11): # for sum of 20 numbers range(1,21)
total+=i
print(f"Sum of first ten natural numbers is {total}")
# Sum of n natural numbers
n=input("Enter the number: ")
n=int(n)
total=0
for i in range(1,n+1): # Second argument is excluded so to reach... | true |
bf1c0a0d7e98d1d89ff053e71fdd374152848ae6 | siraiwaqarali/Python-Learning | /Chapter-01/PythonCalculations.py | 758 | 4.375 | 4 | print(2+3)
print(2-3)
print(2*3)
print(2/4) # This gives answer in fraction
print(4/2) # This gives 2.0
print(4//2) # This gives 2 beacuse it is integer division
print(2//4) # This gives 0 beacuse it is integer division
print(11//3) # This gives 3 beacuse it is integer division
print(6%2) ... | true |
9ebdd87c5067140b6e3d5af41a58569552b85a11 | siraiwaqarali/Python-Learning | /Chapter-16/Exercise3.py | 652 | 4.15625 | 4 | '''
Exercise#03: Create any class and count no. of objects created for that class
'''
class Person:
count_instance = 0
def __init__(self, first_name, last_name, age):
self.first_name = first_name
self.last_name = last_name
self.age = age
# Increment count_instance ea... | true |
01fa9082ef45132e18e8db69a9e00b278d4f0167 | siraiwaqarali/Python-Learning | /Chapter-16/14. Special magic(dunder) method, operator overloading, polymorphism.py | 1,858 | 4.21875 | 4 | # Special magic/dunder methods
# operator overloading
# polymorphism - kisi cheez ki ek se zyada forms - one example is method overriding
class Phone:
def __init__(self, brand, model, price):
self.brand = brand
self.model = model
self.price = price
def phone_name(self):
... | false |
d1ecd5f71b352f254142854248f00f9188a11718 | siraiwaqarali/Python-Learning | /Chapter-05/6. is vs equals.py | 392 | 4.15625 | 4 | # compare lists
# ==, is
# == check values inside list
# is checks address inside memory
fruits1 = ['orange', 'apple', 'pear']
fruits2 = ['banana', 'kiwi', 'apple']
fruits3 = ['orange', 'apple', 'pear']
print(fruits1==fruits2) # False
print(fruits1==fruits3) ... | true |
d351fdf978fde1ea7045c7681b8afe871e25d6d4 | siraiwaqarali/Python-Learning | /Chapter-09/4. Nested List Comprehension.py | 388 | 4.4375 | 4 | example = [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
# Create a list same as above using nested list comprehension
# new_list = []
# for j in range(3):
# new_list.append([1, 2, 3])
# print(new_list)
# nested_comp = [ [1, 2, 3] for i in range(3)] # but also generate nested list using list comprehension
nested_com... | true |
34b5bbfbf050c3d35eb2e35c005a836091f49b07 | siraiwaqarali/Python-Learning | /Chapter-02/StringConcatenation.py | 545 | 4.21875 | 4 | first_name="Waqar"
last_name="Siyal"
full_name=first_name+last_name
print(full_name)
first_name="Waqar"
last_name="Siyal"
full_name=first_name + " " +last_name
print(full_name)
#String ke sath kisi number ko add ni kr skte string mn srf string ko add kr skte hain
#print(first_name+3) This will give error
... | false |
e4ca3edda19ce73a875e890dcfdb832e3b9ae62f | siraiwaqarali/Python-Learning | /Chapter-02/StepArgument.py | 585 | 4.21875 | 4 | #Syntax: [start argument:stop argument:step argument]
print("Waqar"[1:3])
#Step argument yani jitna step dengy utna step agy lekr chlega
print("Waqar"[0:5:1]) #ek ka step lega koi frk ni prega q wese bi next word he ayega
print("Waqar"[0:5:2]) #ab do ka step lega
print("Computer"[0::2])
print("Waqar"[0::3])
#... | false |
e13a6a3c3047813a8f6aeff7232b8efb65855cf8 | JSNavas/CursoPython2.7 | /7.listas.py | 1,401 | 4.75 | 5 | # Listas = arreglos o vectores
# Acceder a listas dentro de otra lista
# Se accede a traves del indice de donde se encuentra la lista
# que esta dentro de la lista principal y al lado se coloca el
# indice al que queramos acceder de la lista que esta adentro.
# En este caso la lista que esta adentro se encuentra e... | false |
03347c9073840ac9da09d62c75e217d0db49e849 | advinstai/python | /solucoes/Duan-Python/Lista1-Python/problem02.py | 314 | 4.375 | 4 | # iteracao manual
print("hello, world!")
print("hello, world!")
print("hello, world!")
print("hello, world!")
print("--------------")
# iteracao com FOR
for i in range(1,5):
print("hello, world!")
print("==============")
# iteracao com WHILE
j=1
while j<=4:
print("hello, world!")
j+=1
print("..............")
| false |
3789bb48da7c905c0414e30904e3b7af05473316 | advinstai/python | /solucoes/Duan-Python/Lista3-Python/p29.py | 205 | 4.1875 | 4 | def enumerate(lista):
return [(lista.index(i),i) for i in lista]
''' Testando a funcao
lista = ["a","b","c"]
print(enumerate(lista))
[print(index,value) for index, value in enumerate(["a","b","c"])]
'''
| false |
d6c33d2dc1ca4b5913aaa65fbc33f4c9622ec43d | EEsparaquia/Python_project | /script2.py | 420 | 4.25 | 4 | #! Python3
# Print functions and String
print('This is an example of print function')
#Everything in single quots is an String
print("\n")
print("This is an example of 'Single quots' " )
print("\n")
print('We\'re going to store')
print("\n")
print('Hi'+'There')
#Plus sign concatenate both strings
print('Hi','There')... | true |
5e1d7603eec9b98a94386628eed855ce39e05199 | EEsparaquia/Python_project | /script25.py | 911 | 4.40625 | 4 | #! Python3
# Programming tutorial:
# Reading from a CSV spreadsheet
## Example of the content of the file
## called example.csv:
# 1/2/2014,5,8,red
# 1/3/2014,5,2,green
# 1/4/2014,9,1,blue
import csv
with open('example.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
print(row... | true |
f8202c0b6613dbf791d2e0f02dbe7896cd0cf166 | cmgc/moocology-python-assignments | /week_1/fizz_buzz.py | 341 | 4.125 | 4 | #!/usr/bin/env python
user_input = raw_input("Enter number:")
def fizz_buzz(user_input):
length = int(user_input) + 1
for i in range(1, length):
if i % 3 == 0 and i % 5 == 0:
print("%i FizzBuzz") % (i)
elif i % 5 == 0:
print("%i Buzz") % (i)
elif i % 3 == 0:
print("%i Fizz") % (i)
f... | false |
07ecbbc1a8bf0e46b6432dbea343063da6d55a7b | medisean/python-algorithm | /quick_sort.py | 645 | 4.125 | 4 | '''
Quick sort in python. Quick sort is not stable.
Time complexity: O(nlogn)
Space complexity: O(log2n)
'''
def quick_sort(lists, left, right):
if left >= right:
return lists
first = left
last = right
key = lists[first]
while first < last:
while first < last and lists[last] >= key:
last = last - 1
... | true |
19adac4e6b7c3168a84b2d9875ac3771afc8fa4d | sat5297/hacktober-coding | /Mergesort.py | 2,754 | 4.125 | 4 | # Python program for implementation of MergeSort
# Merges two subarrays of arr[].
# First subarray is arr[l..m]
# Second subarray is arr[m+1..r]
def merge(arr, l, m, r):
n1 = m - l + 1
n2 = r- m
# create temp arrays
L = [0] * (n1)
R = [0] * (n2)
# Copy data to temp arrays L[] and R[]
for i in range(... | false |
0d31b00864cf9ca4c43c1d683594399ad9480f5d | junhao69535/pycookbook | /chapter2/del_unneed_char_from_str.py | 967 | 4.1875 | 4 | #!coding=utf-8
"""
删除字符串中不需要的字符
"""
# 想去掉文本字符串开头,结尾或者中间不想要的字符,比如空白
# strip()方法用于删除开始和结尾的字符。lstrip()和rstrip()分别从左和从右执行
# 删除操作。默认情况下,这下方法会删除空白字符,但也可以指定
s = ' hello world \n'
print s.strip() # 'hello world' 会把换行符也删掉
print s.lstrip() # 'hello world \n'
print s.rstrip() # ' hello world'
t = '-----hello====='
print... | false |
5884711de2f5b7cadbbc4c2b317d4c388e4ae145 | junhao69535/pycookbook | /chapter2/bytestr.py | 1,140 | 4.15625 | 4 | #!coding=utf-8
"""
字节字符串上的字符串操作
"""
# 想在字节字符串上执行普通的文本操作(比如移除,搜索和替换)。
# 字节字符串同样支持大部分和文本字符串一样的内置操作。
data = 'Hello World' # 在python2,str就是字节字符串,不需要加b
print data[0:5]
print data.startswith('Hello')
print data.split()
print data.replace('Hello', 'Hello Cruel')
# 这些操作同样也适用于字节数组
data = bytearray('Hello World')
print d... | false |
882c2faa3ca3aed3faebdb2a261ef8c9a5411bac | junhao69535/pycookbook | /chapter4/permutation.py | 1,171 | 4.1875 | 4 | #!coding=utf-8
"""
排列组合的迭代
"""
# 像迭代遍历一个集合中元素的所有可能的排列或组合
# itertools模块提供了三个函数来解决这类问题,其中一个是 itertools.permutations() ,
# 它接受一个集合并产生一个元组序列,每个元组由集合中所有元素的一个可能排列组成。
from itertools import permutations # 排列
items = ['a', 'b', 'c']
for p in permutations(items): # A33
print p
# 如果想得到指定长度的所有排列,可以:
for p in permutat... | false |
4eec7dce66ee380c61c8e0c1b5b680a03b6fa4ad | ccaniano15/inClassWork | /text.py | 338 | 4.25 | 4 | shape = input("triangle or rectangle?")
if shape == "triangle":
width = int(input("what is the length?"))
height = int(input("what is the height?"))
print(width * height / 2)
elif shape == "rectangle":
width = int(input("what is the length?"))
height = int(input("what is the height?"))
print(width * height)
else:... | true |
b6375a70de01303ae87311ff5d37816cd853742c | ArunKarthi-Git/pythonProject | /Program54.py | 467 | 4.1875 | 4 | if __name__=='__main__':
a=input("Enter the character:")
while a != '$':
if ord(a) >=65 and ord(a)<=90:
print("The given character is upper",a)
elif ord(a)>=96 and ord(a)<=122:
print("The given character is lower",a)
elif ord(a)>=46 and ord(a)<=57:
pri... | false |
d03b2a6a44cae8d7a5a2829f3d25040e47932f66 | ArunKarthi-Git/pythonProject | /Program72.py | 1,186 | 4.1875 | 4 | if __name__=='__main__':
matrix = []
print("Enter the entries rowwise:")
i=0
while i<3:
i+=1
a=[]
j=0
while j<3:
j+=1
a.append(int(input()))
#print(a)
matrix.append(a)
matrix1 = []
print("Enter the entries rowwise:")
i ... | false |
953f98b68c708b40b32bdc581a3eaeaf74662549 | Floreit/PRG105 | /KyleLud4.1.py | 994 | 4.15625 | 4 | #Declare variables to be used in the while loop
stop = 0
calories = 4.2
minutes = 0
time = 0
#while loop with if statements to count the intervals, increments by 1 minute every iteration, when it hits an interval it will display the calories burned
while stop != 1:
minutes = minutes + 1
if minutes == ... | true |
1885b7c5930b016b448bff1741f70d7b2ab74941 | Hank310/RockPaperScissors | /RPS1.py | 2,028 | 4.1875 | 4 | #Hank Warner, P1
#Rock, Paper Scissors game
# break int0 pieces
# Welcome screenm with name enterable thing
# Score Screen, computer wins, player wins, and ties
# gives options for r p s & q
# Game will loop until q is pressed
# Eack loop a random choice will be generated
# a choice from thge player, compare,... | true |
7d11564338a3b1f1add3d647eb7bf2fff00910fd | PranaKnight/Dominando-Python | /print.py | 1,000 | 4.34375 | 4 | #Formas de imprimir o número para o usuário em Python
print("Este é o capítulo 2 do livro")
A = 12
print(A)
B = 19
print(B)
print(A, B)
print("Valor de A =", A)
print("Valor de A = {0} e valor de B = {1}" .format(A, B))
print("=+"*40)
print(A, B, sep="-")
print(A, B, sep=";")
#utilização de separadores
print("... | false |
8098951d28b3ca5f954b63e74ab6d887b0664e9f | lyndsiWilliams/cs-module-project-iterative-sorting | /src/searching/searching.py | 1,337 | 4.25 | 4 | def linear_search(arr, target):
# Your code here
# Loop through the length of the array
for i in range(len(arr)):
# If this iteration matches the target value
if arr[i] == target:
# Return the value
return i
return -1 # not found
# Write an iterative impleme... | true |
f04167639ad0509853dc1c01fa872b250fc95863 | mraguilar-mahs/AP_CSP_Into_to_Python | /10_23_Lesson.py | 429 | 4.1875 | 4 |
#Lesson 1.3 Python - Class 10/23
#Obj:
#Standard:
#Modulus - Reminder in a division:
# Ex 1: 9/2 = 4 r 1
# Ex 2: 4/10 = 0 r 4
# modulus: % --> 9 mod 2
print(9%2)
print(234%1000)
print(10%2)
print(9%2) # <- with mod 2, check for even/odd
# Mod can check for divisibility, if equal to 0
#User Input:
user_name = str(in... | true |
d8c4c9b73b5537685496a2216616a341bc10ac05 | krishnagrover1000/My-Python-Work | /Lists Refrence.py | 470 | 4.25 | 4 | #%%
# List == Collection Of Data Types
a = [1, 2, 3, 9, 8, 6, 12, 456]
b = [1, "String", 'icji', 0.765, True]
c = ["Aryan", "Vardaan", "Niya"]
x = ["Aryan", "Vardaan", "Ajay"]
y = ["Cool", "Is", "Cool"]
z = ["Niya", "Is", "Smart"]
#%%
# Printing Out Index's From []
print(x[0], y[1], z[2])
#%%
# This Rever... | false |
064717582f1799c539e0df68005379819f932491 | cristianoxavier/Campinas-Tech-Talents | /Exercicios/15.py | 779 | 4.1875 | 4 | # Fazer um sistema de Feira Livre(Deve imprimir uma lista com as frutas e pedir para o solicitante colocar o nome e selecionar a fruta e depois deve imprimir o nome do solicitante e a fruta).
frutas = {
"Banana"
,"Maça"
,"Tomate"
,"Melancia"
,"Uva"
,"Ameixa"
,"Pera"
,"Goiaba"
,"Ac... | false |
e6a292d99dae34dd81c792d81910d0f2095663ec | cristianoxavier/Campinas-Tech-Talents | /Aula_004/dicionarios.py | 802 | 4.21875 | 4 | '''
Dicionario é mais proximo do JSON.
Dicionarios recebem valores sensiveis, devem se respeitar os tipos de dados(string, int, float, boolean...)
São definidas chaves e valores.
Ex:
dict = {'Keys': 'value', key: value, key: true or false}
'''
dict = {}
dict['one'] = "This is one"
dict[2] = "This is two"... | false |
a4bd5e100a710fb1e8efdd0132324795da4f64af | cristianoxavier/Campinas-Tech-Talents | /Exercicios/3.py | 648 | 4.21875 | 4 | #Algoritmo para trocar o pneu do carro (Imprimir a sequência para trocar o pneu do carro).
print("Bem vindo, você gostaria de trocar o pneu do carro?")
trocar = input("Sim? ou Não?: ")
if trocar == "Sim" or "sim":
print("Qual dos pneus quer trocar?")
escolha1 = input("Os da frente? ou os de tras?: ")
if ... | false |
a1f4cc9a7b531b3bcbd01ac5eb1285ee44d1e51f | abhishekk26/NashVentures | /Random number Generation.py | 2,066 | 4.1875 | 4 |
import math, time
class MyRNG:
# MyRNG class. This is the class declaration for the random number
# generator. The constructor initializes data members "m_min" and
# "m_max" which stores the minimum and maximum range of values in which
# the random numbers will generate. There is another variable ... | true |
c95c502184424b7d7f56da51ec7df1bd24c11499 | rosexw/LearningPython | /Exercise Files/Ch2/loops_start.py | 843 | 4.25 | 4 | #
# Example file for working with loops
#
def main():
x = 0
# define a while loop
# while (x < 5):
# print(x)
# x = x+1
# define a for loop
# for x in range(5,10):
# print (x)
# use a for loop over a collection
# days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
# for d in days:
# p... | true |
914544f42b91b5d6b7c17378a310add1ea9a67a6 | Adarsh2412/python- | /python11.py | 663 | 4.21875 | 4 | def calculator(number_1, number_2, operation):
if(operation=='addition'):
result=number_1+number_2
return result
elif(operation=='subtract'):
result=number_1-number_2
return result
elif(operation=='multiply'):
result=number_1*number_2
return result
... | true |
d9de8d029ec05b744ce3e349f7043d6c4a9ff332 | irobbwu/Python-3.7-Study-Note | /basic Grammar/10. 函数:python的乐高积木.py | 1,471 | 4.125 | 4 | # 10.7 作业
# 函数:python的乐高积木
# 1.编写一个函数power()模拟内建函数pow(),即power(x, y)为计算并返回x的y次幂的值。
def power(x, y):
return (x ** y)
# 参考答案:
def power(x,y):
result = x**y
return result
print(power(2, 8))
# 2.编写一个函数,利用欧几里得算法求最大公约数,例如gcd(x, y)返回值为参数x和参数y的最大公约数
def gcd(x,y):
c = 1
w... | false |
dbe00f7712f950e33b36e69e05d56d7465609c04 | StevenM42/Sandbox | /password_check.py | 389 | 4.3125 | 4 | """Password check program that returns asterisks of password length"""
Minimum_character_limit = 6
password = input("Please enter password at least {} characters long: ".format(Minimum_character_limit))
while len(password) < Minimum_character_limit:
password = input("Please enter password at least {} characters ... | true |
ffac4f7a078c8221458dbba66af1ee4f95ad374c | shreesha-bhat/Python | /reverseofanumber.py | 309 | 4.28125 | 4 | #program to accept a number from the user and find the reverse of the entered number
number = int(input("Enter any number : "))
rev = 0
while (number > 0):
remainder = number % 10
rev = (rev * 10) + remainder
number //= 10
print("Reverse of the entered number is ",rev) | true |
45d3281927b36d539619554889b92fac37af3460 | shreesha-bhat/Python | /Series1.py | 339 | 4.15625 | 4 | #Program to accept a number “n” from the user; then display the sum of the series 1+1/2+1/3+……….+1/n
num = int(input("Enter the value of N : "))
for i in range(1,num+1):
if i == 1:
print(i,end='+')
if i != 1 and i != num:
print(f"1/{i}",end='+')
if i == num:
print(f"1/{i}... | true |
3c23bc4b31be19db9439b1b1e8e96b5069c3bd35 | shreesha-bhat/Python | /Swapnumbers.py | 376 | 4.1875 | 4 | #Program to swap numbers
Number1 = int(input("Enter the First number : "))
Number2 = int(input("Enter the Second number : "))
print(f"Before swap, the values of num1 = {Number1} and num2 = {Number2}")
Number1 = Number1 + Number2
Number2 = Number1 - Number2
Number1 = Number1 - Number2
print(f"After swa... | true |
92a5b52e620fabf557ff30f4d1e471d783db4f2c | shreesha-bhat/Python | /series3.py | 417 | 4.125 | 4 | #Program to accept a number “n” from the user; find the sum of the series 1/23+1/33+1/43……..+1/n3
num = int(input("Enter the value of N : "))
sum = 0
for i in range(1,num+1):
if i == 1:
print(i,end='+')
if i != 1 and i != num:
print(f"1/{i}^3",end='+')
if i == num:
print(f... | true |
e28735a52f2ad739072e8d781353efe1e52badcf | lufeng0614/leetcode | /leetcode-350.py | 618 | 4.3125 | 4 | 给定两个数组,编写一个函数来计算它们的交集。
示例 1:
输入: nums1 = [1,2,2,1], nums2 = [2,2]
输出: [2]
示例 2:
输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
输出: [9,4]
说明:
输出结果中的每个元素一定是唯一的。
我们可以不考虑输出结果的顺序。
=======================================================================
class Solution(object):
def intersection(self, nums1, nums2):
... | false |
1cc2bade7b9c08be021593f117bed4971658184d | samdawes/iD-Emory-Python-Projects | /MAD.py | 1,155 | 4.15625 | 4 | print("Mad Libs is starting!")
adjective1 = input("Enter an adjective: ")
name = input("Enter a name:")
verb1 = input("Enter a verb: ")
place = input("Enter a place: ")
animal = input("Enter a plural animal: ")
thing = input("Enter a thing: ")
verb2 = input("Enter a second verb: ")
noun2 = input... | false |
a452c61845d7ec8f285b3aec32bbb707b8ac38e8 | rcmhunt71/hackerrank | /DLLs/insert_into_dllist.py | 2,038 | 4.15625 | 4 | #!/bin/python3
class DoublyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next = None
self.prev = None
class DoublyLinkedList:
def __init__(self):
self.head = None
self.tail = None
def insert_node(self, node_data):
node = Doubly... | true |
d9b437283616b1d92f2881a77c4505c421a7f10b | mariasilviamorlino/python-programming-morlino | /PB_implementations/backward_hmm.py | 2,510 | 4.21875 | 4 | """
Backward algorithm implementation for hmms
###########
INPUT:
model parameters
sequence to evaluate
OUTPUT:
probability of sequence given model
###########
Setup
Read list of states
Read transition probabilities
Read emission probabilities
Read sequence
rows = n. of states
cols = length of sequence
Create a ro... | true |
4fc95e4391dddac7a54da9841cdac8b62b2f8072 | barseghyanmher/HTI-1-Practical-Group-1-Mher-Barseghyan | /Classwork_1/triangl.py | 361 | 4.1875 | 4 | a = int(input("Enter a number :"))
b = int(input("Enter a number :"))
c = int(input("Enter a number :"))
if a >= b and a >= c:
c,a = a,c
elif b >= a and b >= c:
b,c = c,b
if c>= a + b:
print("Not a triangle")
elif c*c == a*a + b*b:
print("Right triangle")
elif c*c < a*a + b*b:
print("Acure triang... | false |
7dab3037afa1f2cf84dd957060a094840efe7308 | gibbs-shih/stanCode_Projects | /stanCode_Projects/Weather Master/quadratic_solver.py | 1,207 | 4.5 | 4 | """
File: quadratic_solver.py
-----------------------
This program should implement a console program
that asks 3 inputs (a, b, and c)
from users to compute the roots of equation
ax^2 + bx + c = 0
Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
import math
def main():
""... | true |
9139e03d276b2d33323343e59a2bf01ad9600911 | gibbs-shih/stanCode_Projects | /stanCode_Projects/Hangman Game/similarity.py | 1,801 | 4.34375 | 4 | """
Name: Gibbs
File: similarity.py
----------------------------
This program compares short dna sequence, s2,
with sub sequences of a long dna sequence, s1
The way of approaching this task is the same as
what people are doing in the bio industry.
"""
def main():
"""
This function is used to find the most sim... | true |
0619ec96483920be456730016ece7f7ef5b3ed57 | takisforgit/Projects-2017-2018 | /hash-example1.py | 2,939 | 4.1875 | 4 | import hashlib
print(hashlib.algorithms_available)
print(hashlib.algorithms_guaranteed)
## MD5 example ##
'''
It is important to note the "b" preceding the string literal,
this converts the string to bytes, because the hashing function only takes
a sequence of bytes as a parameter
'''
hash_object = hashli... | true |
d64e446e9730ed833bb0dfd669d3c6aba98e6653 | Deepti3006/InterviewPractise | /Amazon Interview/OccuranceOfElementInArray.py | 370 | 4.15625 | 4 | def numberOfOccurancesOfNumberinArray():
n = int(input("Enter number of Elements"))
arr =[]
for i in range(n):
elem = input("enter the array number")
arr.append(elem)
print(arr)
find_element = input("Enter the element to be found")
Occurances = arr.count(find_element)
print... | true |
2eb7016701c2f1b1d6368a1ba08994e89930be57 | Jenell-M-Hogg/Codility-Lesson-Solutions | /Lesson1-FrogJmp.py | 1,296 | 4.125 | 4 | '''A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small frog always jumps a fixed distance, D.
Count the minimal number of jumps that the small frog must perform to reach its target.
Write a function:
d... | true |
74b87ea175e4c7ef7ac9802e865783101a87097d | JennSosa-lpsr/class-samples | /4-2WritingFiles/writeList.py | 405 | 4.125 | 4 | # open a file for writing
# r is for reading
# r + is for reading and writing(existing file)
# w is writing (be careful! starts writing from the beginning.)
# a is append - is for writing *from the end*
myFile = open("numlist.txt", "w")
# creat a list to write to my file
nums = range(1, 501)
# write each item to the ... | true |
715cfb565d350b68bf0d20367cedcde62562e66c | JennSosa-lpsr/class-samples | /remotecontrol.py | 1,080 | 4.40625 | 4 | import turtle
from Tkinter import *
# create the root Tkinter window and a Frame to go in it
root = Tk()
frame = Frame(root)
# create our turtle
shawn = turtle.Turtle()
myTurtle = turtle.Turtle()
def triangle(myTurtle):
sidecount = 0
while sidecount < 3:
myTurtle.forward(100)
myTurtle.right(120)
... | true |
f623fbc9ad297294904cf231202e7e2ae1282524 | AJoh96/BasicTrack_Alida_WS2021 | /Week38/2.14_5.py | 476 | 4.25 | 4 | #solution from Lecture
principal_amount = float(input("What is the principal amount?"))
frequency = int(input("How many times per year is the interest compounded?"))
interest_rate = float(input("What is the interest rate per year, as decimal?"))
duration = int(input("For what number of years would like to calculate th... | true |
98d574a3e170f6bdf927c16d61e01eb9003c303b | andreyQq972/base_of_Python | /homework_1/task_2.py | 525 | 4.125 | 4 | time = int(input("Введите количество секунд и мы переведем их в формат чч:мм:сс: "))
time_hours = time // 3600
time_minutes = (time % 3600) // 60
time_seconds = ((time % 3600) % 60)
# print(f"{time_hours}:{time_minutes}:{time_seconds}")
if time < 360000:
print ("%02i:%02i:%02i" % (time_hours, time_minutes, time_sec... | false |
92077bb80eda2fe5208c7b2eeeac3d53c4251ebc | PriyankaBangale/30Day-s_Code | /day_8_DictionaryMapping.py | 1,381 | 4.34375 | 4 | """Objective
Today, we're learning about Key-Value pair mappings using a Map or Dictionary data structure. Check out the Tutorial tab for learning materials and an instructional video!
Task
Given names and phone numbers, assemble a phone book that maps friends' names to their respective phone numbers. You will th... | true |
015cac95f4680a6fa0f62999caff7e8d500634b9 | assuom7827/Hacktoberfest_DSA_2021 | /Code/game_projects/word guessing game/word_guessing_game.py | 1,088 | 4.28125 | 4 | from random import choice
# list of words(fruits and vegetables)
words=["apple","banana","orange","kiwi","pine","melon","potato","carrot","tomato","chilly","pumpkin","brinjol","cucumber","olive","pea","corn","beet","cabbage","spinach"]
c_word = choice(words)
lives=3
unknown = ["_"]*len(c_word)
while lives>0:
gue... | true |
9c32992faf3335c9e0746ce48c6c25b1348e4dc3 | assuom7827/Hacktoberfest_DSA_2021 | /Code/matrix/matrix_multiplication/python.py | 1,241 | 4.25 | 4 | r1=int(input("Enter number of Rows of Matrix A: "))
c1=int(input("Enter number of Columns of Matrix A: "))
A=[[0 for i in range(c1)] for j in range(r1)] #initialize matrix A
print("Enter Matrix Elements of A:")
#input matrix A
for i in range(r1):
for j in range(c1):
x=int(input())
A[i][j]=x
r2=int(i... | false |
fb278d9975471e74e188f621cc722444410ada76 | Sarthak1503/Python-Assignments | /Assignment4.py | 1,100 | 4.28125 | 4 | #1.Find the length of tuple
t=(2,4,6,9,1)
print(len(t))
#2.Find the largest and smallest element of a tuple.
t=(2,4,6,8,1)
print(max(t))
print(min(t))
#3.Write a program to find the product os all elements of a tuple.
def pro(t):
r=1
for i in t:
r=r*i
return r
t=(1,2,3,4)
p=pro(t)
print(p)
#4.Cal... | true |
9b7380e82a01b8a68bec953a32119f10b2f34ad1 | Sarthak1503/Python-Assignments | /Assignment11.py | 1,317 | 4.34375 | 4 | import threading
from threading import Thread
import time
#1. Create a threading process such that it sleeps for 5 seconds and
# then prints out a message.
def show():
time.sleep(5)
print(threading.current_thread().getName(),"Electronics & Communication Engineering")
t= Thread(target=show)
t.setName("B.tech... | true |
a1e326537c4cadefbae38f73356c33a3cb920f1c | ArnabC27/Hactoberfest2021 | /rock-paper-scissor.py | 1,678 | 4.125 | 4 | '''
Rock Paper Scissor Game in Python using Tkinter
Code By : Arnab Chakraborty
Github : https://github.com/ArnabC27
'''
import random
import tkinter as tk
stats = []
def getWinner(call):
if random.random() <= (1/3):
throw = 'Rock'
elif (1/3) < random.random() <= (2/3):
throw = 'Scissors'
... | true |
c66911b7118dfe6ca6dde2d28c00b8eeaf0ace72 | MacHu-GWU/pyclopedia-project | /pyclopedia/p01_beginner/p03_data_structure/p03_set/p01_constructor.py | 1,219 | 4.28125 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Set Constructor
==============================================================================
"""
import random
import string
def construct_a_set():
"""Syntax: ``set(iterable)``
"""
assert set([1, 2, 3]) == {1, 2, 3}
assert set(range(3)) == {0, 1, 2... | true |
6c983ff6d1b91561c632b8f954aff02a09370b8b | MacHu-GWU/pyclopedia-project | /pyclopedia/p02_ref/p03_objective_oriented/p04_magic_method/p07__hash__.py | 599 | 4.15625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
``__hash__(self)`` 定义了 hash(obj)的行为。
"""
class MyClass(object):
def __init__(self, a):
self.a = a
def __hash__(self):
return hash(self.a)
def __eq__(self, other):
return self.a == other.a
if __name__ == "__main__":
m1 = MyC... | false |
7e37a1798223d3e1a75f8a329ca64b22ad088e6e | ichHowell/WHL_Python | /ex8.py | 546 | 4.15625 | 4 | formatter = "{} {} {} {}" #做好框,等待填进去,取代{}
print(formatter.format(1,2,3,4)) #数值不用双引号
print(formatter.format("one","two","three","four")) #字符串需要双引号才能填进去
print(formatter.format(True,False,True,True)) #布尔字符页不需要双引号
print(formatter.format(formatter,formatter,formatter,formatter)) #我填我自己,12个{}
print(formatter.format(
"Try yo... | false |
96290a7e696a0c6c70bcf234648877536d5c53e2 | DiQuUCLA/python_59_skill | /3_python_bytes_str_unicode.py | 1,180 | 4.1875 | 4 | """
Two types that represent sequence of char: str and bytes(Python3), unicode and str(Python2)
Python3:
str: Unicode character
bytes: 8 bits raw data
Python2:
unicode: Unicode character
str: 8 bits raw data
"""
import sys
version = sys.version_info[0]
if version is 3:
#encoding will take unicode ... | true |
184b7da2b7085944213de2c86efe221bd29c8454 | nekoTheShadow/my_answers_of_rosetta_code | /babbage_problem/main.py | 862 | 4.125 | 4 | """
Babbage problem: http://rosettacode.org/wiki/Babbage_problem
269,696で終わる自然数のうち、最小の平方数は何か?
チャールズ・バベッジはこの問題の答えを9,947,269,696(=99,736^2)と予想した。
さてこの予想は正しいだろうか? 君の眼で確かめてみよう --というのが本問の趣旨。
===
端的に述べると、彼の予想は間違っている。答えは638269696=25264^2。
平方数判定はもう少しエレガントに書きたかった(´・ω・`)
"""
import math
def is_square(x):
sqrt = int(math.sq... | false |
9c30b847859dc19b8cdaa8c16f56f4e6d8651e89 | MatheusKlebson/Python-Course | /TERCEIRO MUNDO - THIRD WORLD/Análise de dados em uma tupla - 75.py | 946 | 4.21875 | 4 | #Exercício Python 075: Desenvolva um programa que leia quatro valores pelo teclado
# guarde-os em uma tupla. No final, mostre:
#A) Quantas vezes apareceu o valor 9.
#B) Em que posição foi digitado o primeiro valor 3.
#C) Quais foram os números pares.
valores = (int(input("Primeiro valor: ")),
int(input("Segu... | false |
b45e42273efc868dea8f4690154fa383bea5c1ab | MatheusKlebson/Python-Course | /TERCEIRO MUNDO - THIRD WORLD/Melhorando a matriz - 87.py | 1,399 | 4.15625 | 4 | #Exercício Python 087: Aprimore o desafio anterior, mostrando no final:
# A) A soma de todos os valores pares digitados.
# B) A soma dos valores da terceira coluna. ... | false |
76d8f4bb927db5d23dec1970d05e0b86b51a130e | MatheusKlebson/Python-Course | /SECUNDO MUNDO - SECOND WORLD/Factorial - 60.py | 462 | 4.21875 | 4 | #Exercício Python 060: Faça um programa que leia um número qualquer e mostre o seu fatorial.
# Exemplo: 5! = 5 x 4 x 3 x 2 x 1 = 120
from time import sleep
from math import factorial
num = int(input("Número: "))
cont = num
f = factorial(num)
print("Calculando factorial...")
sleep(2)
while cont > 0:
print(" {} ".for... | false |
290e8ba810b59b20c4cd3a3ed33339649d3f011b | MatheusKlebson/Python-Course | /TERCEIRO MUNDO - THIRD WORLD/Função de contador - 98.py | 1,553 | 4.1875 | 4 | ''' Exercício Python 098: Faça um programa que tenha uma função chamada contador(),
que receba três parâmetros: início, fim e passo.
Seu programa tem que realizar três contagens através da função criada:
a) de 1 até 10, de 1 em 1 ... | false |
ae17752fa96c1a869fe80c2346f85508dbd48c01 | MatheusKlebson/Python-Course | /TERCEIRO MUNDO - THIRD WORLD/Organizando uma lista sem o sort() - 80.py | 721 | 4.21875 | 4 | #Exercício Python 080: Crie um programa onde o usuário possa digitar cinco valores numéricos
#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.
numbers = []
for accountant in range(0,5):
num = int(input(f"Write a number: "))
if accountant == ... | false |
072db63bb43c2d09bddf30bba01b8bb925a20ecc | MatheusKlebson/Python-Course | /TERCEIRO MUNDO - THIRD WORLD/Analisando e gerando Dicionários - 105.py | 1,950 | 4.21875 | 4 | # Exercício Python 105: Faça um programa que tenha uma função notas()
# que pode receber várias notas de alunos e vai retornar um dicionário com as seguintes informações:
'''– Quantidade de notas ... | false |
05f0de12aa2a42cf35c87f7fff3b5f9306ad0ec6 | MatheusKlebson/Python-Course | /TERCEIRO MUNDO - THIRD WORLD/Lista de preços com tupla - 76.py | 645 | 4.15625 | 4 | #Exercício Python 076: Crie um programa que tenha uma tupla única com nomes de produtos
# seus respectivos preços, na sequência.
# No final, mostre uma listagem de preços, organizando os dados em forma tabular.
produtos = ("COMPUTADOR",1220,
"TABLET",355,
"CELULAR",420,
"GELADEIRA",3... | false |
8480108953305c02872b0655c56ff18c44afca8d | MatheusKlebson/Python-Course | /PRIMEIRO MUNDO - FIRST WORLD/Analisador de textos - 22.py | 603 | 4.25 | 4 | #Exercício Python 022: Crie um programa que leia o nome completo de uma pessoa e mostre:
#- O nome com todas as letras maiúsculas e minúsculas.
#- Quantas letras ao total (sem considerar espaços).
#- Quantas letras tem o primeiro nome
from time import sleep
nome = str(input("Nome completo: ")).strip()
n = nome.split()
... | false |
e5d3d5fcc86b340efb23b0cf99b4652daa6e3e4d | juanjosua/codewars | /find_the_odd_int.py | 599 | 4.1875 | 4 | """
Find the Odd Int
LINK: https://www.codewars.com/kata/54da5a58ea159efa38000836/train/python
Given an array of integers, find the one that appears an odd number of times.
There will always be only one integer that appears an odd number of times.
"""
def find_it(seq):
numbers = set(seq)
return[n for n in numbers ... | true |
9555bd3ece66087b254256195488cdb03fe87f8d | kyletgithub/notes-or-something | /twod_lists.py | 701 | 4.15625 | 4 | a = [[1,2,3],
[4,5,6]]
## one way to traverse a 2d list
#for i in range(len(a)):
# for j in range(len(a[i])):
# print(a[i][j],end=' ')
# print()
##another way
#def print_2dlist(lst):
#for row in a:
# for element in lst:
# print(element,end=' ')
# print()
#add all elements
#sum = 0
#for ... | false |
6115fe58abcf4cedf25d90d87613590919ec494a | lisamryl/oo-melons | /melons.py | 2,057 | 4.15625 | 4 | """Classes for melon orders."""
import random
import datetime
class AbstractMelonOrder(object):
"""Abstract for both domestic and international melon orders."""
def __init__(self, species, qty):
"""Initialize melon order attributes."""
self.species = species
self.qty = qty
se... | true |
96a58d71f67b01d07897d83fca08c3beb5c718cd | loudsoda/CalebDemos | /Multiples_3_5/Multiples_3_5.py | 1,228 | 4.125 | 4 | '''
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.
Note: If the number is a multiple of both 3 and 5, only count it once.
Courte... | true |
ee7195c77b6de0b24df33b938058b4a2f45ec48e | sunnysunita/BinaryTree | /take_levelwise_input.py | 1,353 | 4.25 | 4 | from queue import Queue
class BinaryTree:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def print_binary_tree(root):
if root is None:
return
else:
print(root.data, end=":")
if root.left != None:
print("L", root.lef... | true |
c368badfeda0bd1f7079c807eb072dbbb6938641 | weinbrek8115/CTI110 | /P4HW2_RunningTotal_WeinbrennerKarla.py | 628 | 4.15625 | 4 | #CTI-110
#P4HW2
#Karla Weinbrenner
#22 March 2018
#Write a program that asks the user to enter a series of numbers
#It should loop, adding these numbers to a running total
#Until a negative number is entered, the program should exit the loop
#Print the total before exiting
#accumulator variable
runningTota... | true |
0f2ce0d0219274578f21b0e9ef8a5ddf99809d83 | GuidoTorres/codigo8 | /Seman4/Dia4-python/03-funcion-new.py | 1,011 | 4.28125 | 4 |
#Metodos magicos
class Empleado:
def __new__(cls):
print("El metodo magico_new_ ha sido invocado")
instancia = object.__new__(cls)
print(instancia)
return instancia
def __init__(self):
print("El metodo magico __init__ ha sido invocado")
def __str__(sel... | false |
d84cadab27615c30f1d12d7e9dff4237c97b5780 | GuidoTorres/codigo8 | /Seman4/Dia2-Python/ejer.py | 1,437 | 4.1875 | 4 |
class Coordenadas():
def __init__(self, coordenadaX , coordenadaY):
self.coordenadaX = coordenadaX
self.coordenadaY = coordenadaY
def valores(self):
print("Los valores ingresados fueron:","(" , self.coordenadaX,",", self.coordenadaY ,")")
def cuadrante(self):
if... | false |
8b89727db39b09e46e6378ea6718001951cc9f78 | GuidoTorres/codigo8 | /Seman4/Dia1/06-esxcepciones.py | 969 | 4.15625 | 4 |
# excepciones => try ... except ... else ... finally
# try:
# #Todo lo que va a suceder dentro del try y si hay un error
# #no va incidir con el funcionamiento de nuestro programa
# n1 = int(input("Ingrese numero 1: "))
# n2 = int(input("Ingrese numero 2: "))
# division = n1 / n2
# print(di... | false |
9af3ae57b8654e1d3ab98bbbb4df26e0b8aa4dd5 | zubun/DZ_3 | /hw3_3.py | 636 | 4.125 | 4 |
def my_func (arg_1, arg_2, arg_3):
'''adding two maximum numbers - сложение двух максимальных чисел'''
list_1 = [arg_1, arg_2, arg_3]
number_1 = max(list_1)
list_1.pop(list_1.index(max(list_1)))
number_2 = max(list_1)
summ = number_1 + number_2
return summ
arg_1 = float(input("Введите перво... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.