blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
2d2d5b3ee52d02505c3757837b9d0785c15f8f7a | gx-white/Coder | /AimAtOffer/FindPath/main.py | 2,225 | 3.515625 | 4 | # -*- coding:utf-8 -*-
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.x = []
# 返回二维列表,内部每个列表表示找到的路径
def FindPath(self, root, expectNumber):
# write code here
if(root == None):... |
20dc9e1f830577acaeec66083f463bcbd0848aa9 | gx-white/Coder | /AimAtOffer/FindContinuousSequence/main.py | 1,279 | 3.625 | 4 | # -*- coding:utf-8 -*-
'''
class Solution:
def FindContinuousSequence(self, tsum):
# write code here
if((tsum == 0) | (tsum == 1) | (tsum == 2)):
return []
start = 1
end = tsum / 2 + 1 + 1
result = []
for i in range(start, end):
number_sum = 0
... |
fbaaa1f8f38ced6dbb926b5e8d0f8b23b80d74a7 | gx-white/Coder | /AimAtOffer/IsPopOrder/main.py | 884 | 3.6875 | 4 | # -*- coding:utf-8 -*-
class Solution:
def __init__(self):
self.x = []
def IsPopOrder(self, pushV, popV):
# write code here
self.x.append(pushV[0])
pushV = pushV[1:]
while(pushV):
if(pushV[0] == popV[0]):
pushV.pop(0)
popV.pop(... |
41b9b38cfbe2400071963587522aa23952a5dc99 | gx-white/Coder | /Arrange/treereConstruct.py | 1,434 | 3.53125 | 4 | # -*- coding:utf-8 -*-
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class treereConstruct:
def reConstructPreoderInorder(self, pre, tin):
if(len(pre) == 0):
return None
if(len(pre) == 1):
return TreeNode(pr... |
ce2f28e1fe948b75486c7b217306e4147b87c986 | gx-white/Coder | /AimAtOffer/replaceSpace/main.py | 447 | 3.6875 | 4 | # -*- coding:utf-8 -*-
'''
class Solution:
# s 源字符串
def replaceSpace(self, s):
# write code here
length = len(s)
m = ''
for i in range(0, length):
if(s[i] == ' '):
m += '%20'
else:
m += s[i]
return m
'''
class Solut... |
b2ee3f0978f84a21cc30d2bebb38b0503e9a56d3 | muha-abdulaziz/langs-tests | /python-tests/function_keyword_args.py | 310 | 3.921875 | 4 | def print_name(first_name, last_name, reverse):
if reverse:
print(last_name + " " + first_name)
else:
# test
prin(first_name + " " + last_name)
#print(first_name + " " + last_name)
first = "Zaid"
last = "Omar"
print("Hello, lets begain")
print_name(first, last, False) |
c24e68e1d77ba3e532987225382ae2f325424426 | muha-abdulaziz/langs-tests | /python-tests/sqrt.py | 419 | 4.3125 | 4 | """
This program finds the square root.
"""
x = int(input('Enter an integer: '))
def sqrt(x):
'''
This program finds the square root.
'''
x = x
ans = 0
while ans ** 2 < abs(x):
ans = ans + 1
if ans ** 2 != abs(x):
print(x, "is not a perfect square.")
else:
if x... |
4e77c72219eec3043169f21e5ea39683d274d768 | vssousa/hacker-rank-solutions | /data_structures/linked_lists/merge_two_sorted_linked_lists.py | 982 | 4.34375 | 4 | """
Merge two linked lists
head could be None as well for empty list
Node is defined as
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
return back the head of the linked list in the below method.
"""
def MergeLists(headA, headB):
... |
866d69100bf11fa6508f0831af38d793fcbc1203 | CapstoneProject18/Twitter-sentiment-analysis | /s3.py | 711 | 4.34375 | 4 | #function to generate list of duplicate values in the list
def remove_Duplicate(list):
final_list = []
for letter in list: #empty final list to store duplicate values in list ... |
092f4c85b3f565f106a3589eddd9ad0842c1cb91 | CapstoneProject18/Twitter-sentiment-analysis | /s5.py | 905 | 4.0625 | 4 | import sys
# Function to return the sum of
# the minimum pair from the array
def smallest_pair(a, n) :
min = sys.maxsize
secondMin = sys.maxsize
for j in range(n) :
# If found new minimum
if (a[j] < min) :
# Minimum now becomes
... |
e237393d1bc65215de532bbe937ccb3fd8e2c25e | shoaibur/Tutorials | /LeetCode/Trees/max_depth_binary_tree.py | 337 | 3.59375 | 4 | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def max_depth_binary_tree(tree):
if not tree:
return 0
left_depth = max_depth_binary_tree(tree.left)
right_depth = max_depth_binary_tree(tree.right)
return max(left_depth, right... |
646bc72845f493989c9c58770bd994325c3cc4d6 | KovalevVasiliy/Python-labs | /task.py | 4,012 | 3.734375 | 4 |
def quad(a, n): #квадрат
if n==2:
return a*a
if n==1:
return a
if n%2!=0:
a =a*quad(a,n-1)
else:
a = quad(a*a,n//2)
return a
def NOD(a,b): #наибольший общий делитель
while a!=0 and b!=0:
if a > b:
a = a % b
else:
... |
6a95042055f70c57d1b7f162d425999f4ea0b9ef | rhaeguard/algorithms-and-interview-questions-python | /string-questions/reverse_string_recursion.py | 368 | 4.28125 | 4 | """
Reverse the string using recursion
"""
def reverse_recurse(string, st, end):
if st > end:
return ''.join(string)
else:
tmp_char = string[st]
string[st] = string[end]
string[end] = tmp_char
return reverse_recurse(string, st+1, end-1)
def reverse(string):
return... |
9d33f05c5942fff37f4fc5fc3e4787b38e07a15e | rhaeguard/algorithms-and-interview-questions-python | /string-questions/one_away_string.py | 1,397 | 3.859375 | 4 | """
One away string
It means if two strings are 1 edit away
1 edit - add, delete, change letter to other letter (even itself)
"""
def one_away_string(st1, st2):
if abs(len(st1) - len(st2)) > 1:
return False
if st1 == st2:
return True
if len(st1) < len(st2):
st1, st2 = st2, st1
... |
29780713ccfde18c564112343872fc00415e994b | rhaeguard/algorithms-and-interview-questions-python | /problem_solving/triple_step.py | 449 | 4.4375 | 4 | """
Triple Step: 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 triple_steps(step_size):
if step_size == 1 or step_size == 0:
return 1
elif step_size ==... |
a061cbbbe2a683f984582c6fe0ca5f7a357b544e | willrsousa94/Exercicios-Python | /cont 1 a 100/cont1a100.py | 240 | 3.671875 | 4 | n = 1
s1 = "Critical"
s2 = "Damage"
while(n <= 100):
if(n%5==0 and n%3==0):
print(s1 + " " + s2)
elif(n%5==0):
print(s2)
elif(n%3==0):
print(s1)
else:
print(n)
n+=1
|
7c09f8a939f4b2045429005a0caf846eb19f3238 | Tomoyamatsud/MachineLearning | /15pandas.py | 383 | 3.9375 | 4 | import matplot
import numpy
numpy.random.seed(42)
import pandas
# 10行5列の配列(要素は乱数)を作る
data = numpy.random.randn(10, 5)
print(data)
# dataを要素とするDataFrameを作る
df = pandas.DataFrame(data, columns=['A', 'B', 'C', 'D', 'E'] )
# 先頭3行を取得する
df.head(3)
# 後ろから3行を取得する
df.tail(3)
%matplotlib lnline
df.plot()
|
574bf21d351bba1d52f5aa49b50393e29a347128 | akashgkrishnan/HackerRank_Solutions | /Code_Chef/smallestNumberOFNotes.py | 432 | 3.75 | 4 | def findNoOfNotes(amount):
denominations = [100, 50, 10, 5, 2, 1]
numOfNotes = 0
idx = 0
while amount > 0 and idx < 6:
denom = denominations[idx]
if denom < amount:
numOfNotes += amount // denom
amount = amount % denom
idx += 1
return numOfNotes
for ... |
76c5b3e770142ba5e6657e948a435c7b874c17a1 | akashgkrishnan/HackerRank_Solutions | /Classes/point.py | 571 | 3.890625 | 4 | from math import sqrt
class Point:
def __init__(self, x, y):
self.xCord = x
self.yCord = y
def getX(self):
return self.xCord
def getY(self):
return self.yCord
def shif(self, x_inc, y_inc):
self.xCord += x_inc
self.yCord += y_inc
def __eq__(self, rhs... |
6f8425c452c9d92a9c562016e7b8117bc3e29d5e | akashgkrishnan/HackerRank_Solutions | /Code_Chef/reverse_number.py | 226 | 3.640625 | 4 | def helper(num):
rev_num = 0
while num > 0:
a = num % 10
rev_num = a + rev_num * 10
num = num//10
print(rev_num)
for i in range(int(input())):
num = int(input())
helper(num)
|
496167be42a7598a0be21f4ba6d2418638d91f74 | akashgkrishnan/HackerRank_Solutions | /geeks_for_geek/mailSystem.py | 3,024 | 3.890625 | 4 | class Node:
def __init__(self, msgId, value):
self.msgId = msgId
self.value = value
self.next = None
self.prev = None
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
def setHead(self, node):
if self.head is None:
s... |
999b23a2e035b40ef736214ba3abf484ac96d236 | akashgkrishnan/HackerRank_Solutions | /language_proficiency/exceptionss.py | 610 | 4.0625 | 4 | # You are given two values and .
# Perform integer division and print .
# Input Format
# The first line contains , the number of test cases.
# The next lines each contain the space separated values of and .
# Constraints
# Output Format
# Print the value of .
# In the case of ZeroDivisionError or ValueError, pr... |
4a5ff8792e2f2106205376b2e4ac135045abf3d9 | akashgkrishnan/HackerRank_Solutions | /language_proficiency/symmetric_difference.py | 741 | 4.34375 | 4 | # Given sets of integers, and , print their symmetric difference in ascending order. The term symmetric difference indicates those values that exist in either or but do not exist in both.
# Input Format
# The first line of input contains an integer, .
# The second line contains space-separated integers.
# The th... |
c9d43e4f2b6197cc05e5b860fcd3b0cad8df0402 | akashgkrishnan/HackerRank_Solutions | /InterviewPrep/ransomNote.py | 779 | 3.515625 | 4 | def checkMagazine(magazine, note):
magazine_dict = dict()
note_dict = dict()
for item in magazine:
if item in magazine_dict:
magazine_dict[item] += 1
else:
magazine_dict[item] = 1
for item in note:
if item in note_dict:
note_dict[item] += 1
... |
390cec90c940dff36d51ef01a2dd4aec1766b0c8 | akashgkrishnan/HackerRank_Solutions | /code_forces/lucky_numbers.py | 168 | 3.828125 | 4 | counter = 0
number = input()
for i in number:
if i == '7' or i == '4':
counter += 1
if counter == 7 or counter == 4:
print('YES')
else:
print('NO')
|
958a89b3ee653c405a5237f1185011642f702b6b | akashgkrishnan/HackerRank_Solutions | /geeks_for_geek/remove_loopLinkedList.py | 718 | 3.890625 | 4 | def remove_node(head):
if head is None or head.next is None:
return head
first = head.next
second = head.next.next
while first is not None and second is not None:
if first == second:
break
if first.next and second.next and second.next.next:
first = first... |
67b6b51ea22d0bad73fb7460744e70518e88d00d | akashgkrishnan/HackerRank_Solutions | /geeks_for_geek/queusUsingLL.py | 511 | 3.671875 | 4 |
class MyQueue:
def __init__(self):
self.head = None
def push(self, item):
newNode = Node(item)
if self.head is None:
self.head = newNode
else:
node = self.head
while node.next:
node = node.next
node.next = new... |
d24e433165453b44a908b8d9a375804a508c3b82 | akashgkrishnan/HackerRank_Solutions | /language_proficiency/regex_sub.py | 157 | 3.96875 | 4 | import re
for i in range(int(input())):
s = input()
new = re.sub(' &{2} ', ' and ', s)
after = re.sub(' \|{2} ', ' or ', new)
print(after)
|
3052aceea0c9904c1c0fca6b3c1daee403a6c517 | sunada/topcoder_srm | /1_SRM_144DIV1.py | 1,251 | 3.546875 | 4 | class BinaryCode:
string = ''
def __init__(self, string):
self.string = string
def cal(self, start):
#print
res = [str(start)]
cnt = len(self.string)
if cnt == 1:
next = int(self.string) - start
#print next,
if next < 0 or next > 1:
return "NONE"
else:
res.append(str(next))
retur... |
35dc43e1eceb288ca89b03e2547eb730ee805d5f | anjali-garadkar/loop | /hackthon loop aramstrong num.py | 335 | 4 | 4 | # num=int(input("enter the number"))
# sum=0
# x=num
# while num>0:
# sum=sum+(num%10)*(num%10)*(num%10)
# num=num//10
# if sum==x:
# print("it is aramstrong number")
# else:
# print("it is not aramstrong number")
#
#
# i=1
# while i<5:
# j=1
# while j<5:
# print(j)
# j=j+1
... |
39781356ad6c352c5e9bbffadff794e222b328d5 | Mujaid156/Error-Handling | /task.py | 1,378 | 3.546875 | 4 | from tkinter import *
from tkinter import messagebox
# Window details
authen = Tk()
authen.title("Authentication")
authen.geometry("300x300")
authen.config(bg="skyblue")
# Creating labels
detail = Label(authen, text="Please enter login details", bg="skyblue")
name = Label(authen, text="Username", bg="skyblue")
word ... |
abd707fc44a2588a4efd2ae32efab650fd98633a | blargg/2048Q | /Algorithms/QLearning.py | 4,453 | 3.75 | 4 | # Q-learning is a form of reinforcment learning. It learns a policy to collect
# The highest reward.
#
# For some set of states and some set of actions, we learn a quality function.
# Q: State X Action -> Real Numbers.
# For a given state, the policy is to take the action with the highest
# quality
#
# The reward... |
a7f202fb9003e2819cb5240760fc0255236b70db | flfelipelopes/Python-Curso-em-Video | /ex049.py | 409 | 3.625 | 4 | #Tabuada com estrutura de repetição
from time import sleep
print('\033[1m{:=^40}\033[m'
.format('TABUADA'))
n = int(input('{}Você deseja a tabuada de qual número?{} '
.format('\033[1m', '\033[m')))
print('{}={}'.format('\033[1m', '\033[m') * 40)
for c in range(0, 11):
print('{:2} x {:2} = {:2}'.... |
639b30452f5f34efe29d96fd296d4d2b09e92bc8 | flfelipelopes/Python-Curso-em-Video | /ex023.py | 416 | 3.796875 | 4 | #Faça um programa que leia um número de 0 a 9999 e mostre na tela cada um dos dígitos separados.
n1 = int(input('Insira um número: '))
print('A composição do número {} é: '.format(n1))
n2 = n1 // 1 % 10
n3 = n1 // 10 % 10
n4 = n1 // 100 % 10
n5 = n1 // 1000 % 10
print('Sendo:')
print('Unidade: {}'.format(n2))
print('D... |
f1b154b2f24f74be664e30fdfaf6a9c372359ed4 | flfelipelopes/Python-Curso-em-Video | /ex057.py | 268 | 3.9375 | 4 | #validação de dados simples
sexo = str(input('Informe o seu sexo [M/F]: ').strip().upper())
while sexo not in 'MmFf':
sexo = str(input('Dados inválidos. Por favor, informe seu sexo [M/F]: ')).strip().upper()
print('Sexo {} registrado com sucesso'.format(sexo))
|
f477d11965f31eecd3f66e82bc627859681d5d8e | flfelipelopes/Python-Curso-em-Video | /ex014.py | 326 | 4.0625 | 4 | #Conversor de Temperaturas
temp = float(input('Qual a temperatura em °C a ser convertida? '))
fahrenheit = (temp * 9/5) + 32
kelvin = (temp + 273.15)
print('A conversão de {}°C em (°F) Fahrenheit é {}°F.'.format(temp, fahrenheit))
print('A mesma temperatura de {}°C para (K) Kelvin é de {}K.'.format(temp, kelvin))
|
9dcf255642a374bb3fbb59628b0327a7c8b8bae3 | flfelipelopes/Python-Curso-em-Video | /ex048.py | 302 | 3.78125 | 4 | #Soma entre números impares multiplos de três entre 1 e 500
soma = 0
print('{:=^40}'.format('Números Ímpares Multíplos de 3'))
for c in range(0, 500, 3):
if (c / 2) % 1:
soma += c
print('A soma total de números ímpares múltiplos'
' de 3 entre 1 e 500 é de {}.'.format(soma))
|
baa735f24932031a50ed6fab483a21e8bcfafc0d | flfelipelopes/Python-Curso-em-Video | /ex051.py | 370 | 3.8125 | 4 | #Leia o 1º termo e a razão de uma PA. Mostre os 10 primeiros termos dessa progressão.
print('=' * 40)
print('{:^}'.format('10 TERMOS DE UMA P.A.'))
print('=' * 40)
termo = int(input('Primeiro termo: '))
razao = int(input('Razão: '))
decimo = termo + (10 - 1) * razao
for c in range(termo, decimo + razao, razao):
pri... |
86f8ad5142bc7ba82958c18bc09f78cb36a0ad17 | flfelipelopes/Python-Curso-em-Video | /ex007.py | 179 | 3.765625 | 4 | #Média entre dois números
n1 = float(input("Nota 1º semestre: "))
n2 = float(input("Nota 2º semestre: "))
m = (n1 + n2)/2
print('A média desse aluno é: {:=^7}'.format(m))
|
c4b02fa604cfbaeda727970e16450d9caceb3cd0 | namanm97/sl1 | /7a.py | 744 | 4.375 | 4 | # 7A
# Write a python program to define a student class that includes name,
# usn and marks of 3 subjects. Write functions calculate() - to calculate the
# sum of the marks print() to print the student details.
class student:
usn = " "
name = " "
marks1 = 0
marks2 = 0
marks3 = 0
def __init__(self,usn,name,ma... |
9fa0d191dd8611e741f24758e625f105fda7e198 | SilvesSun/learn-algorithm-in-python | /backtrack/306_累加数.py | 858 | 3.578125 | 4 | class Solution(object):
def isAdditiveNumber(self, num):
if len(num) < 3:
return False
path = []
res = self.backtrack(num, 0, path, '')
# print(path)
return res
def backtrack(self, num, idx, path, tmp_str):
if len(path) > 2 and path[-1] != path[-2] +... |
75cffe9e83788ad85282a288e8bd09e4eeeb50f0 | SilvesSun/learn-algorithm-in-python | /tree/404_左叶子之和.py | 946 | 3.53125 | 4 | # 计算给定二叉树的所有左叶子之和。
#
# 示例:
#
#
# 3
# / \
# 9 20
# / \
# 15 7
#
# 在这个二叉树中,有两个左叶子,分别是 9 和 15,所以返回 24
#
#
# Related Topics 树 深度优先搜索 广度优先搜索 二叉树
# 👍 366 👎 0
# leetcode submit region begin(Prohibit modification and deletion)
# Definition for a binary tree node.
# class TreeNode:
# def __init__(... |
72090f38b67a717f78b28cb9f4cdcc718cc589bc | SilvesSun/learn-algorithm-in-python | /array/括号匹配.py | 441 | 4.09375 | 4 | def match_brackets(str):
symbol = {'}': '{', ']': '[', ')': '('}
l, r = symbol.values(), symbol.keys()
arr = []
for i in str:
if i in l:
arr.append(i)
elif i in r:
if arr and arr[-1] == symbol[i]:
arr.pop()
else:
return... |
a49a16e0780a97c2842ef91e1d6a8d0dd9ea8515 | SilvesSun/learn-algorithm-in-python | /backtrack/77_组合.py | 510 | 3.703125 | 4 | class Solution(object):
def combine(self, n, k):
nums = list(range(1, n+1))
res = []
self.backtrack(nums, k, [], res)
return res
def backtrack(self, nums, k, path, res):
if len(path) == k:
res.append(path[:])
return
for i in range(len(nums... |
5e0a0d856b77e32aa54b34f796d87c074328f953 | SilvesSun/learn-algorithm-in-python | /backtrack/79_单词搜索.py | 1,412 | 3.515625 | 4 | class Solution(object):
directs = [[0, 1], [0, -1], [1, 0], [-1, 0]]
def exist(self, board, word):
rows_n = len(board)
if not rows_n:
return False
cols_n = len(board[0])
visit = [[0 for _ in range(cols_n)] for _ in range(rows_n)]
print(visit)
for i in... |
bc68f71eac65579f3b1ff55618806769776f68a5 | SilvesSun/learn-algorithm-in-python | /tree/113_路径总和II.py | 2,227 | 3.5625 | 4 | # 给你二叉树的根节点 root 和一个整数目标和 targetSum ,找出所有 从根节点到叶子节点 路径总和等于给定目标和的路径。
#
# 叶子节点 是指没有子节点的节点。
#
#
#
#
#
# 示例 1:
#
#
# 输入:root = [5,4,8,11,null,13,4,7,2,null,null,5,1], targetSum = 22
# 输出:[[5,4,11,2],[5,8,4,5]]
#
#
# 示例 2:
#
#
# 输入:root = [1,2,3], targetSum = 5
# 输出:[]
#
#
# 示例 3:
#
#
# 输入:root = [1,2], targetSum = 0
# ... |
8358cbef452c7ad231791c8667bab7acd127d918 | SilvesSun/learn-algorithm-in-python | /array/组合总和39.py | 2,574 | 3.546875 | 4 | # coding=utf-8
# 给定一个无重复元素的正整数数组 candidates 和一个正整数 target ,找出 candidates 中所有可以使数字和为目标数 target 的
# 唯一组合。
#
# candidates 中的数字可以无限制重复被选取。如果至少一个所选数字数量不同,则两种组合是唯一的。
#
# 对于给定的输入,保证和为 target 的唯一组合数少于 150 个。
#
#
#
# 示例 1:
#
#
# 输入: candidates = [2,3,6,7], target = 7
# 输出: [[7],[2,2,3]]
#
#
# 示例 2:
#
#
# 输入: candidates = [2... |
b50b252970354c8d2aa79c9155ef0cbe2a59d563 | SilvesSun/learn-algorithm-in-python | /string/43_字符串相乘.py | 1,687 | 3.65625 | 4 | # 给定两个以字符串形式表示的非负整数 num1 和 num2,返回 num1 和 num2 的乘积,它们的乘积也表示为字符串形式。
#
# 示例 1:
#
# 输入: num1 = "2", num2 = "3"
# 输出: "6"
#
# 示例 2:
#
# 输入: num1 = "123", num2 = "456"
# 输出: "56088"
#
# 说明:
#
#
# num1 和 num2 的长度小于110。
# num1 和 num2 只包含数字 0-9。
# num1 和 num2 均不以零开头,除非是数字 0 本身。
# 不能使用任何标准库的大数类型(比如 BigInteger)或直接将输入转换为... |
dfa58b071526414923872c6c6a5c1162efa96a9f | SilvesSun/learn-algorithm-in-python | /backtrack/17_电话号码的字母组合.py | 903 | 3.78125 | 4 | class Solution(object):
def __init__(self):
self.letter_map = {
"0": "",
"1": '',
"2": "abc",
"3": "def",
"4": "ghi",
"5": "jkl",
"6": "mno",
"7": "pqrs",
"8": "tuv",
"9": "wxyz"
}... |
2106593f1a9d32866a792c8b7cbfe3d102933480 | SilvesSun/learn-algorithm-in-python | /tree/108_将有序数组转换为二叉搜索树.py | 1,476 | 3.625 | 4 | # 给你一个整数数组 nums ,其中元素已经按 升序 排列,请你将其转换为一棵 高度平衡 二叉搜索树。
#
# 高度平衡 二叉树是一棵满足「每个节点的左右两个子树的高度差的绝对值不超过 1 」的二叉树。
#
#
#
# 示例 1:
#
#
# 输入:nums = [-10,-3,0,5,9]
# 输出:[0,-3,9,-10,null,5]
# 解释:[0,-10,5,null,-3,null,9] 也将被视为正确答案:
#
#
#
# 示例 2:
#
#
# 输入:nums = [1,3]
# 输出:[3,1]
# 解释:[1,3] 和 [3,1] 都是高度平衡二叉搜索树。
#
#
#
#
# 提示:
#
#
# 1 ... |
5e55aa6fded5b4aa6e7f633ab26fac4f7e210ee3 | SilvesSun/learn-algorithm-in-python | /tree/isSymmetric.py | 609 | 3.921875 | 4 | # Definition for a tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isSymmetric(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
def helper(p, q)... |
009097724bbca9a88677d1c8a96298e6ca6ee0e4 | SilvesSun/learn-algorithm-in-python | /array/59_螺旋矩阵.py | 1,406 | 3.703125 | 4 | # 给你一个正整数 n ,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的 n x n 正方形矩阵 matrix 。
#
#
#
# 示例 1:
#
#
# 输入:n = 3
# 输出:[[1,2,3],[8,9,4],[7,6,5]]
#
#
# 示例 2:
#
#
# 输入:n = 1
# 输出:[[1]]
#
#
#
#
# 提示:
#
#
# 1 <= n <= 20
#
# Related Topics 数组 矩阵 模拟
# 👍 557 👎 0
# leetcode submit region begin(Prohibit modification and deletion)
from... |
939096f3018271386ad45554cbaed87cd3f0b88b | SilvesSun/learn-algorithm-in-python | /string/415_字符串相加.py | 1,328 | 3.75 | 4 | # 给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和并同样以字符串形式返回。
#
# 你不能使用任何內建的用于处理大整数的库(比如 BigInteger), 也不能直接将输入的字符串转换为整数形式。
#
#
#
# 示例 1:
#
#
# 输入:num1 = "11", num2 = "123"
# 输出:"134"
#
#
# 示例 2:
#
#
# 输入:num1 = "456", num2 = "77"
# 输出:"533"
#
#
# 示例 3:
#
#
# 输入:num1 = "0", num2 = "0"
# 输出:"0"
#
#
#
#
#
#
# 提示:
#
#
# 1 <= num1.... |
55e3bb680f6b382e4e97d02e1528ba40a006d928 | SilvesSun/learn-algorithm-in-python | /array/85_最大矩形.py | 1,729 | 3.875 | 4 | # 给定一个仅包含 0 和 1 、大小为 rows x cols 的二维二进制矩阵,找出只包含 1 的最大矩形,并返回其面积。
#
#
#
# 示例 1:
#
#
# 输入:matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"]
# ,["1","0","0","1","0"]]
# 输出:6
# 解释:最大矩形如上图所示。
#
#
# 示例 2:
#
#
# 输入:matrix = []
# 输出:0
#
#
# 示例 3:
#
#
# 输入:matrix = [["0"]]
# 输出:0
#
#
# 示例 4:
#
#
# 输... |
ae5c1bea975892f11961e37be8ba61128c7a3590 | SilvesSun/learn-algorithm-in-python | /backtrack/37_解数独.py | 1,936 | 3.703125 | 4 | from pprint import pprint
class Solution(object):
def solveSudoku(self, board):
"""
:type board: List[List[str]]
:rtype: None Do not return anything, modify board in-place instead.
"""
self.backtrack(board)
pprint(board)
def backtrack(self, board):
for ... |
8bd124644c29661cecaab56016e2e0d7c9db2252 | Ikhan24/Py4e | /Course 1 - Programming for Everybody (Getting Started)/random/tryexcept.py | 201 | 3.953125 | 4 | rawstr = input("Enter a number")
try:
ifval = int(rawstr)
except:
ifval = -1
if ifval > 0 :
print("Great job you entered a number")
else :
print("Not a number you smartass")
|
7181131d43058adb02b6b43b183983d86cf332ff | Ikhan24/Py4e | /Course 1 - Programming for Everybody (Getting Started)/random/Loop.py | 79 | 3.515625 | 4 | n = 5
while n > 0 :
print(n)
n = n-1
print("Blastoff!")
print(n)
|
55974db3fac0791ba5ed05cb706edb0ad7fed46d | avihaie/real_time_open_weather | /current_city_weather.py | 8,149 | 3.828125 | 4 | """
User can retrieve a selected city weather report with relevant current weather
attributes as temperature ,humidity, wind , pressure & clouds statistics
Weather Data Library using data from https://openweathermap.org.
Access current weather data for any location on Earth including over 200,000
cities!
Current wea... |
4df86cde33516759722b962dda3757864da21111 | chenwenhang/AlgorithmPractice | /src/company/find_num.py | 1,556 | 4 | 4 | # 小美和小团在玩游戏。小美将会给出n个大小在1到n
# 之间(包括1和n)的整数,然后小美会再告诉小团一个整数k,小团需要找到一个最小的整数x满足以下条件:
# 整数x的大小在1到n之间(包括1和n)
# 在小美给出的n个整数中,恰好有k个数严格比x小
#
# 输入描述
# 第一行是一个数T,表示有T组数据。
# 对于每组数据:
# 第一行有两个整数n和k,分别表示小美将会给出n个数以及她给出的整数k。
# 接下来一行有n个用空格隔开的正整数,表示小美给出的n个正整数。
#
# 输出描述
# 对于每组数据:
# 如果存在满足要求的数x,第一行先输出“YES”(不含引号),第二行输出数x的值。
# 如果不存在满足要求的数x,输出“N... |
19fcb120c9552dcbb1ecc8f1402b1a358b6d053f | chenwenhang/AlgorithmPractice | /src/leetcode/generate_parentheses.py | 572 | 3.59375 | 4 | from typing import List
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
res = []
self.recursive("", n, n, res)
# print(res)
return res
def recursive(self, s: str, n: int, m: int, res: List[str]):
# 剪枝
if n > m:
return
if ... |
b60a1502167d4a0fe80a3f5d0c7cd148f4773dfa | chenwenhang/AlgorithmPractice | /src/leetcode/bracket_LCCI.py | 689 | 3.546875 | 4 | from typing import List
class Solution:
def __init__(self):
self.res = []
def generateParenthesis(self, n: int) -> List[str]:
self.recursive(n, n, [])
# print(self.res)
return self.res
def recursive(self, q: int, p: int, cur_s: List[str]):
if q == 0 and p == 0:
... |
adc31a4c0696008b642683a169e8e93f63422a47 | chenwenhang/AlgorithmPractice | /src/leetcode/successor_LCCI.py | 847 | 4.03125 | 4 | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.has_find = False
self.cur_node = None
def inorderSuccessor(self, root: TreeNode, p: TreeNode) -> Tre... |
e51045cb85647a7d9c339c2bdf6ea47c8ef360ea | rohitgupta29/NIELIT-Assignments | /A4_python.py | 1,810 | 3.71875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 15:46:10 2020
@author: infom
"""
#1. Write a script to display the distance between two points in XY plane.
import math
p = (4,6)
q = (6,3)
pq = math.sqrt(((p[0] - q[0])**2) + ((p[1]- q[1])**2))
print(pq)
#Q2>Write a script to display the di... |
6813da2d29e9f08c54a67dc53fc1818733f741a1 | dogukan99/Python-exercises | /Classes-2.py | 2,720 | 3.546875 | 4 | import random
import time
class kumanda():
def __init__(self,tv_durum="Kapalı",tv_ses="0",kanal_listesi=["TRT"],kanal="TRT"):
self.tv_durum= tv_durum
self.tv_ses=tv_ses
self.kanal_listesi=kanal_listesi
self.kanal=kanal
def tv_ac(self):
if(self.tv_durum =="Açık"):
... |
57970d0c4d360cb2efbee1272d167883a9af77e9 | pavanibalaram/python | /sampleprograms/maximumnumber.py | 204 | 4.1875 | 4 | def max():
if a<=b:
print(" {} is a maximum number" .format(b))
else:
print(" {} is a maximum number".format(a))
a=int(input("enter a number"))
b=int(input("enter a number"))
max() |
e657f700b719f9d7b75325ec01523018945dd7d6 | pavanibalaram/python | /sampleprograms/triangle.py | 421 | 4 | 4 | import math
a=input("enter the value a")
b=input("enter the value b")
c=input("enter the value c")
a=float(a)
b=float(b)
c=float(c)
AreaRT=1/2*a*b
print("area of a right angled triangle", AreaRT)
# area of equilateral triangle
AreaET=1.73*a*a/4
print("area of equiletral triangle", AreaET)
# perimeter of triangle
s=(a+b... |
f5de8b70bef6800e8d2710d3c8b531a2934a4454 | bgrgicak/SmartNinja | /gui/calculator.py | 1,087 | 3.640625 | 4 | import Tkinter
import tkMessageBox
window = Tkinter.Tk()
label1 = Tkinter.Label(window, text = "Unesi prvi broj")
label1.pack()
entry1 = Tkinter.Entry(window)
entry1.pack()
label2 = Tkinter.Label(window, text = "Unesi operator (+,-,*,/)")
label2.pack()
entry2 = Tkinter.Entry(window)
entry2.pack()
label3 = Tkinter.Labe... |
db093d5556b24728d0027dfebb713ab81abe08cd | bgrgicak/SmartNinja | /PythonOsnove/todo.py | 561 | 3.515625 | 4 | todos = {}
while True:
key = raw_input("Unesite task: ")
rijesen = raw_input("Task risen (da/ne): ")
todos[key] = (rijesen.lower() == "da")
jos = raw_input("Zelite li jos: (da/ne): ")
if jos.lower() != "da":
break
doc = open("todos.txt", "w+")
print "Rijeseni"
doc.write("Rijeseni\n")
for tas... |
5a488fbbe28d1820e3009e29b894dd949bdb3e72 | bgrgicak/SmartNinja | /PythonOsnove/list.py | 207 | 3.625 | 4 | lista = ["tekst", 333, 645.66]
print lista
print range(3)
varijabla1 = 55
var3 = "fd"
lista1 = [varijabla1, var3]
print lista1
for var in lista1:
print var
print lista1[0]
lista1[1] = 33
print lista1[1]
|
1ef45d9e4f21a8c0c7eecef53b6aab1c116cd3f5 | echeng1514/Python_Homework | /素数的快速方法.py | 305 | 3.578125 | 4 | import time
lst = []
start = time.clock()
for i in range(2,1000000):
if i == 2:
lst.append(i)
continue
for j in lst:
if i % j == 0:
break
else:
lst.append(i)
ends = time.clock()
print(len(lst))
print('time is :%f s' % (start - ends)) |
941c533063692c200f969bf425ec72ccbcc8a865 | HiCosta/Exercicios-de-Python | /Exercicios do curso em video/pythonProject/pythonteste/aula19.py | 298 | 3.671875 | 4 | pessoas = {'Nome': 'Gustavo', 'sexo': 'M', 'idade': 22} # exemplo de dicionário
print(pessoas.keys()) # chaves so dicionário
print(pessoas.values()) # valores do dicionário
print(pessoas.items()) # dicionário completo
del pessoas['sexo'] # apaga elemento do dicionário
print(pessoas)
|
76bfa192076bc004a381935461e2cf4ab36b01b3 | HiCosta/Exercicios-de-Python | /Exercicios do curso em video/pythonProject/pythonexercicios/ex028.py | 244 | 3.875 | 4 | from random import randint
n = randint(0, 5)
adv = int(input('Tente advinhar o número que pensei, uma dica: está entre 0 e 5: '))
if adv == n:
print('Você acertou, parabéns!')
else:
print('Você errou, mais sorte da próxima vez!')
|
f94d9a726ea1cdcf484a4f19e1ee767f2b9f416a | HiCosta/Exercicios-de-Python | /Exercicios do curso em video/pythonProject/pythonexercicios/ex029.py | 139 | 3.6875 | 4 | vel = int(input('Digite a velocidade que o carro está: '))
if vel > 80:
print('Você foi multado em {} reais'.format((vel - 80) * 7))
|
b1badf26d8d2f02c954e315b1ea75b9ccb3665a4 | HiCosta/Exercicios-de-Python | /Exercicios do curso em video/pythonProject/pythonexercicios/ex030.py | 146 | 3.984375 | 4 | n = int(input('Digite um número: '))
resto = n % 2
if resto == 0:
print('Esse número é par !')
else:
print('Esse número é ímpar !')
|
e772c8ec5fef4483b0ff0469dbf2dcba6dccfd72 | HiCosta/Exercicios-de-Python | /Exercicios do curso em video/pythonProject/pythonteste/aula21.py | 515 | 3.8125 | 4 | def contador(i, f, p): # ao abrir aspas duplas 3x após criar uma função, abre-se o campo para adc informção
"""
Faz a contagem e mostra na tela
:param i: inicio da contagem
:param f: fim da contagem
:param p: passo da contagem
:return: sem retorno
Função criada por Higor Costa, aluno do... |
171a913b2b85de355f4ce4a946e50fb752a1a5fa | HiCosta/Exercicios-de-Python | /Exercicios do curso em video/pythonProject/pythonexercicios/ex061.py | 249 | 3.734375 | 4 | print('Gerador de PA')
print('-=' * 10)
prim = int(input('Digite o primeiro termo: '))
raz = int(input('Razão da PA: '))
termo = prim
cont = 1
while cont <= 10:
print('{} → '.format(termo), end='')
termo += raz
cont += 1
print('Fim')
|
2fe7349cee038eae712a6d8c716e9ef4c5d8641a | HiCosta/Exercicios-de-Python | /Exercicios do curso em video/pythonProject/pythonexercicios/ex081.py | 783 | 4 | 4 | lista = []
while True:
lista.append(int(input('Digite um valor para adicioná-lo à lista: ')))
mais = input('Quer continuar? [S/N]: ')
while mais in 'Ss':
lista.append(int(input('Digite um valor para adicioná-lo à lista: ')))
mais = input('Quer continuar? [S/N]: ')
while mais not in 'SsNn... |
e3c26478c2722733e8780e97691bf561e72fae35 | mohsenrajabpour/Algorithmic-Toolbox | /Algorithmic_Toolbox_106.py | 454 | 3.671875 | 4 | # Uses python3
# Week 2, 3 Greatest Common Divisor
import sys
def gcd_naive(a, b):
i = 0
while i == 0:
a,b = max(a,b),min(a,b)
c = a % b
a,b = b,c
if c == 0:
i = 1
c = a
elif ((c%b) < 0):
i = 1
c = b
... |
c3ecbebec2e273dacfbee1be027444f0df88f437 | mohsenrajabpour/Algorithmic-Toolbox | /Algorithmic_Toolbox_104.py | 420 | 3.875 | 4 | # Uses python3
# Week 2, 1 Fibonacci Number
def calc_fib(n):
if (n <= 1):
return n
elif (n <= 3):
return n-1
return 3*calc_fib(n - 3) + 2*calc_fib(n - 4)
#def Tes (i):
#import time
#start_time = time.time()
n = int(input())#i
#print (i)
print (calc_fib(n))
#... |
640da5056e74e274d4f181c8da444d7e691cc1ae | ylachiver/hotjar | /test.py | 384 | 3.8125 | 4 | #!/usr/bin/env python
class People:
def __init__(self, age, name):
self.age = age
self.name = name
def __repr__(self):
return '{}: {}'.format(self.name, self.age)
def main():
a = People(12, 'a')
b = People(54, 'b')
c = People(32, 'y')
l = [a, b, c]
l.sort(key=lamb... |
5ed8e77c5a345a3f0a387c200c5e5330cd6ceee9 | lekhrajprasad/DevOps-notes | /Devops-Material/Python/python_programs_code/python_programs_code/day5_string_manuplation/ex7.py | 102 | 3.8125 | 4 | #!/usr/bin/python
n=5
space=0
for i in range(5,0,-1):
if i != 5:
space+=2
print space*' '+i*'*'
|
3b1ab9ec36d4d8e52daaa930e378d2896aeda744 | lekhrajprasad/DevOps-notes | /Devops-Material/Python/python_programs_code/python_programs_code/day3_forloop/ex13.py | 122 | 3.90625 | 4 | #!/usr/bin/python
array = [1, 2, 3, 4, 5, 2, 3, 4]
emp=[]
for i in array:
if i not in emp:
emp.append(i)
print emp
|
9e423773202a9b7cd8554760a0b3fe4671052462 | lekhrajprasad/DevOps-notes | /Devops-Material/Python/python_programs_code/python_programs_code/day4_whileloop/ex14.py | 142 | 3.921875 | 4 | #!/usr/bin/python
num=input("Please enter your number:")
output=str(num)
print "sum of 1st & last digit is",int(output[0])+int(output[-1])
|
93c91cbfdc828fe3d4271badcc63ad411865e43f | lekhrajprasad/DevOps-notes | /Devops-Material/Python/python_programs_code/python_programs_code/day6_list_manuplatioin/ex2.py | 195 | 3.75 | 4 | #!/usr/bin/python
string="Hello all how are you doing"
data=string.split(' ')
emp=[]
for i in data:
emp.append(len(i))
print "your input string is",data
print "Their respective size is",emp
|
768aa577a63598345459add373bfe32b9534fdca | lekhrajprasad/DevOps-notes | /Devops-Material/Python/python_programs_code/python_programs_code/day2_ifcond/ex1.py | 181 | 3.875 | 4 | #!/usr/bin/python
var1=input("please enter your 1st number:")
var2=input("Please provide your 2nd number:")
if var1>var2:
print "var1 is big",var1
else:
print "var is big",var2
|
7cd1c8281f4bc83d500bcf8477b1fb738e1f1384 | lostlang/hackerrank-interview-preparation-kit | /hourglassSum.py | 692 | 3.671875 | 4 |
def hourglass_sum(arr: list) -> int:
max_sum: int
sum_indexes: list = [
[-1, -1],
[-1, 0],
[-1, 1],
[0, 0],
[1, -1],
[1, 0],
[1, 1]
]
for i in range(1, 5):
for j in range(1, 5):
new_sum = sum([arr[x + i][y + j] fo... |
5b5c52ef5c1b3ed8d543ce46e30bcc277fa7600a | lostlang/hackerrank-interview-preparation-kit | /countTriplets.py | 820 | 3.65625 | 4 |
def get_counter(s: list) -> dict:
s_dict: dict = dict()
for i in s:
s_dict[i] = s_dict.get(i, 0) + 1
return s_dict
def count_triplets(arr: list, r: int):
triplets: int = 0
arr_counter: dict = get_counter(arr)
arr_counter2: dict = dict()
for i in arr:
pre = i /... |
5dd1ed785b251a3b6263ddb560079b1c14e7473f | lewisjbeech/210CT | /210 CT Coursework Folder/Week 1/Advanced Task 1/Aliens.py.py | 690 | 3.84375 | 4 | x = int(input("How many eggs each day do the aliens lay? "))
y = int(input("How long does it take for the eggs to hatch? "))
z = int(input("How many days do the aliens have to breed?" ))
#Takes all the variables and assigns them as integers
aliens = []
n = 0
while (n < z) is True:
aliens.append(0)
n = n... |
eb1966806ed93a6e0ae2a6481dca736df010ea50 | joanaritacouto/fdpython | /areaju.py | 442 | 3.703125 | 4 | soma= 0.0
media=0.0
n=0
while True:
l =float(input('largura: '))
c =float(input('comprimento: '))
if (l==0) or (c==0):
break
def area(l,c):
area= l*c
return area
#print('área de um retângulo: ', area(l, c))
a= area(l, c)
soma=soma+a
n= n+1
maior=a
if a>=maior:
maior=a
else:
maior=maior
... |
9f5959a773b8b29c0793c1b605f89412f60038db | joanaritacouto/fdpython | /FDP/aula9/ex6.py | 1,003 | 3.65625 | 4 | def loadfile(fname):
"""Abre o ficheiro fname e carrega o conteúdo para uma lista de tuplos."""
tbl = []
file = open (fname, 'r')
for line in file:
t = line.split (',')
# name, data, pabertura, pmax, pmin, pfecho, vol
tpl = t[0], t[1], float(t[2]), float(t[3]), float(t[4]), float(t[5]), int(t[6])
... |
1e1a748b19f0731d23e5fced0230d6c28117b9d0 | joanaritacouto/fdpython | /FDP/aula3/notafp.py | 221 | 3.765625 | 4 | x= float( input('API: '))
y= float( input('ATP: '))
z= float( input('EP: '))
n= 0.30*x + 0.30*y + 0.40*z
print('nota a fundamentos de programação', n)
if n >= 9.5:
print ('aprovado')
else:
print ('reprovado')
|
726365d65176f289e90768b472d9161eb5b97861 | joanaritacouto/fdpython | /2017-2018/AULA_5/aula05_ex1.py | 237 | 3.828125 | 4 | #encoding:utf8
def IMC(p,a):
IMC=p/(a**2)
return IMC
p=float(input("Peso(Kg): "))
a=float(input("Altura(m): "))
IMC=IMC(p,a)
print("O índice de massa corporal de uma pessoa com {} Kg e {} m de altura é {:.2f}.".format(p,a,IMC))
|
2dbdb08bb25d86e8d0e7fc21d481ad44f9c659ad | joanaritacouto/fdpython | /FDP/aula6/ex2b.py | 245 | 3.765625 | 4 | tel=[938555182,234567111,776882333]
nome=['Angelina','Brad', 'Claudia']
def ListadeCont(tel,nome):
name = input('Nome?')
cont = 0
for i in nome:
if i == name:
name= tel[cont]
print (name)
break
cont += 1
ListadeCont(tel,nome) |
9967cc398dad5112e445ac83e2f2a77bafa6d919 | joanaritacouto/fdpython | /diasdoano/damaaa.py | 1,198 | 3.6875 | 4 | #Adaptando o programa anterior de modo a pedir ao utilizador uma data composta pelo dia, mês, ano. Depois o programa deve determinar e imprimir a data do dia anterior e seguinte.
def diaanterior(d, m, a):
da= d - 1
ma= m
aa= a
if da == 0:
da= 31
ma= m - 1
if ma == 0:
ma= 12
aa= a - 1
return da, ma, a... |
afbe425c9380a111083d8e4776e238fce30b958c | joanaritacouto/fdpython | /FDP/aula3/litros.py | 158 | 3.625 | 4 | x = float ( input ('litros de combustivel: '))
y = x*1.40
z = x*1.40*0.90
if x <= 40 :
print('preço a pagar: ', y)
else :
print ('preço a pagar: ', z)
|
2d7b8d6317fc3899a4dd9e0322c68ccf84a28141 | joanaritacouto/fdpython | /FDP/aula6/ex1f.py | 427 | 3.78125 | 4 | import math
def listanum():
lista=[]
while True :
x= input('Número? ')
if len(x) == 0:
break
else:
x= float(x)
lista.append(x)
return lista
def maximo(l):
max=-math.inf
for i in l:
if i>max:
max=i
return max
def metademaximo():
l=listanum()
max = maximo(l)
numeros=0
ma... |
c51a2ee93806d7faa11c3413e842566c38afd97f | joanaritacouto/fdpython | /2017-2018/AULA_2/aula02_ex11.py | 548 | 3.984375 | 4 | #encoding:utf8
import math
abcissa_p1=float(input("Insira o valor da abcissa do ponto 1: "))
ordenada_p1=float(input("Insira o valor da ordenada do ponto 1: "))
abcissa_p2=float(input("Insira o valor da abcissa do ponto 2: "))
ordenada_p2=float(input("Insira o valor da ordenada do ponto 2: "))
dist_p1_p2=math.sqr... |
01f878ebc1a6f9cdec5a521dafd6960132afe2c0 | joanaritacouto/fdpython | /FDP/aula3/tempo.py | 127 | 3.6875 | 4 | x = float( input('tempo em segundos: '))
y = x//3600
z = (x%3600)//60
w = x- 60*z - 3600*y
print(y,' :', z, ' :', w, ' ')
|
f92dd3d6ed270e9d19b4140117334bc6452b0b79 | joanaritacouto/fdpython | /FDP/aula3/numeromaior.py | 168 | 4.0625 | 4 | x= int ( input ('numero 1: '))
y= int ( input ('numero 2: '))
if x < y:
print ('numero maior ', y)
elif x > y:
print ('numero maior ' , x)
else:
print ('IGUAIS')
|
346a447a617637ff991bcbaf10beaca279fe57c1 | joanaritacouto/fdpython | /FDP/aula5/ex11.py | 227 | 3.921875 | 4 | def soma(N):
somaa=0
for i in range(N):
x= float(input('número: '))
somaa=somaa+x
return somaa
N= int (input('número de valores desejados: '))
print('a soma de todos os {} valores é igual a {}'.format(N, soma(N))) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.