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 |
|---|---|---|---|---|---|---|
6e6d3f0f86ed5a3579331007ff6cf73468924ab7 | PrinceRios2000/CST205-Projects | /flask/task2.py | 526 | 3.609375 | 4 | #Authors: Prince Rios and Alex Espinoza
#Date: 4 March 2020
#Description: This code imports the flask class from the flask library. Then, creates a flask application followed by the route()
#function to connect the URL to the word hello. Finally, a function is created to print Hello world from Flask in the website.
fro... |
07c02e5c8e40175ca98087476eaa4df1c5ba6557 | redricasa/Dojo_Hackathon | /ninja.py | 673 | 3.640625 | 4 | class Ninja:
def __init__( self , name, strength, speed, health ):
self.name = name
self.strength = 10
self.speed = 5
self.health = 100
def show_stats( self ):
print(f"Name: {self.name}\nStrength: {self.strength}\nSpeed: {self.speed}\nHealth: {self.health}\n")
... |
a0c0c94d964d43a60a5473386310f66e3f2a7e5c | TokyGhoul/Coursera | /Week2/HW8.py | 538 | 4.21875 | 4 | '''
Шоколадка имеет вид прямоугольника, разделенного на n×m долек.
Шоколадку можно один раз разломить по прямой на две части.
Определите, можно ли таким образом отломить от шоколадки
ровно k долек.
'''
num1 = int(input())
num2 = int(input())
num3 = int(input())
if (num3 <= num1 * num2) and \
(num3 % num1 == 0 ... |
4a244edf97e52bbbc9eb012610359dd345db8009 | TokyGhoul/Coursera | /Week2/HW1.py | 323 | 3.9375 | 4 | '''
Напишите программу, которая считывает два целых числа A и B и
выводит наибольшее значение из них. Числа — целые от 1 до 1000.
'''
num1 = int(input())
num2 = int(input())
if num1 > num2:
print(num1)
else:
print(num2)
|
cbea431354921c463d0c4ebf4f923361203ba3b3 | TokyGhoul/Coursera | /Week2/HW14.py | 536 | 4.40625 | 4 | '''
Даны три целых числа. Определите, сколько среди них совпадающих.
Программа должна вывести одно из чисел: 3
(если все совпадают), 2 (если два совпадает) или 0 (если все числа различны).
'''
num1 = int(input())
num2 = int(input())
num3 = int(input())
if num1 == num2 or num2 == num3 or num1 == num3:
if num1 == nu... |
79575d2d6b90d9fc3aaceb057bf659db49d2d337 | TokyGhoul/Coursera | /Week2/HW7.py | 442 | 4.03125 | 4 | '''
Заданы две клетки шахматной доски.
Если они покрашены в один цвет, то выведите слово YES,
а если в разные цвета – то NO.
'''
x1 = int(input())
y1 = int(input())
x2 = int(input())
y2 = int(input())
num1 = x1 + y1
num2 = x2 + y2
if num1 % 2 == 0:
b = (num2 % 2 == 0)
else:
b = (num2 % 2 != 0)
if b:
pri... |
79c94817cdcab9cf7c776384a310b9a5dc2e2926 | anshulsharma8801/PythonProjects | /FirstClass.py | 981 | 3.890625 | 4 | class oo:
def sum(self,a,b):
return a+b
def subtract(self,a,b):
return a-b
def comparison(self):
a=int(input())
b=int(input())
if(a==b):
print("a and b are equal")
else:
print("values are not equal")
def identity(self):
try:... |
320abd8770caa1cf747b718383c0b4edb99eefb5 | gitghought/python1 | /day4/myfunc.py | 3,631 | 3.890625 | 4 |
#函数需要传递两个参数
def regUser (name, pwd) :
print("name = {0}".format(name))
print("pwd = {0}".format(pwd))
regUser("good", "123")
#函数需要传递两个参数
def regUser (name, pwd) :
print("name = {0}".format(name))
print("pwd = {0}".format(pwd))
#按照关键字传参的方式调用函数
regUser(pwd = "1234", name = "hehe")
#函数需要传递两个参数
#注意re... |
fcd89523ec988e761b4cc22611dd69548b449951 | gitghought/python1 | /day3/mendswith.py | 382 | 4.125 | 4 |
mstr = "u can u up, no can no 13 B"
#查看实现准备好的字符串是否以‘B’字符结尾
#该函数的返回值是布尔值
mbool = mstr.endswith("B")
print(mbool)
#查看实现准备好的字符串是否以‘B’字符结尾
#该方法指定了查找的范围,3-末尾
#该函数的返回值是布尔值
mbool = mstr.endswith("B", 3, mstr.__len__())
print(mbool)
|
a0ecd2a586a43902411a5bea1243da4846281011 | matthias4366/mf-2 | /projectmf/learn/learn_exception_attribute.py | 839 | 3.921875 | 4 | # A python program to create user-defined exception
# # class MyError is derived from super class Exception
# class MyError(Exception):
#
# # Constructor or Initializer
# def __init__(self, value):
# self.value = value
#
# # # __str__ is to print() the value
# # def __str__(self):
# # return(repr(self.value))
... |
9c6a978c2595de1301aef97991389bb02cb9855f | skipdev/python-work | /assignment-work/jedi.py | 554 | 4.15625 | 4 | def jedi():
#Display the message "Have you fear in your heart?"
print("Have you fear in your heart?")
#Read in the user’s string.
response = input(str())
#The program will then decide if the user can be a Jedi or not, based on their response.
if response.lower() == "yes":
print("Fear is the path t... |
42833ed6616327438957b2a79338171544ec86ad | skipdev/python-work | /less-serious-work/ghostbusters.py | 283 | 3.71875 | 4 | def WhoToCall(TroubleMaker):
if TroubleMaker == "fire":
x = "A fire fighter"
elif TroubleMaker == "burglar":
x = "A police officer"
elif TroubleMaker == "ghost":
x = "GHOSTBUSTERS!"
else:
x = "nobody"
print("Who you gonna call?", x)
WhoToCall("ghost")
|
b76cdc2e8a3bf58989bd280c7f3d82810c67f153 | skipdev/python-work | /assignment-work/jumanji.py | 543 | 4.28125 | 4 | number = 0
#Display the message "How many zones must I cross?"
print("How many zones must I cross?")
#Read in the user’s whole number.
number = int(input())
#Display the message "Crossing zones...".
print("Crossing zones...")
#Display all the numbers from the user's whole number to 1 in the form "…crossed zone [num... |
072bac7e650722c717a17abfa2bc288fde93e0f2 | skipdev/python-work | /work/repeating-work.py | 219 | 4.25 | 4 | #Get the user's name
name = str(input("Please enter your name: "))
#Find the number of characters in the name (x)
x = len(name)
#Use that number to print the name x amount of times
for count in range(x):
print(name) |
04a15af1fcb1ffccb529a4321c499c5bd1b88d04 | skipdev/python-work | /work/odd-even.py | 238 | 4.375 | 4 | #Asking for a whole number
number = (int(input("Please enter a whole number: ")))
#Is the number even or odd?
evenorodd = number % 2
#Display a message
if evenorodd == 0:
print("The number is even")
else:
print("The number is odd")
|
2390ab3aaae639694890493272c6e9daba173669 | skipdev/python-work | /tkinter/hotel-checkin.py | 995 | 3.65625 | 4 | #the class is a blueprint to describe what the gui looks and behaves like
from tkinter import *
def run():
window = Tk()
name_frame = Frame(window)
name_label = Label(name_frame, text = "Name", width = 50)
name_label.pack(side = LEFT)
name_entry = Entry(name_frame, width = 50)
name_ent... |
d5f0f5c74d8008e3b020c81517b05c31f630f86a | KCGprogrammingclub/mini-games | /python27/mastermind-game/mastermind.py | 1,946 | 3.78125 | 4 | import random
def contain_counter(word,guess):
word_items = set(list(word))
guess_items = set(list(guess))
contain_count = 0
for i in word_items:
if i in guess_items:
contain_count += 1
return contain_count
def pos_counter(word,guess):
word_list = list(word)
guess_list ... |
f7ae35e14d65b82c1ded1b59e24e4734003a76ea | MrT3313/Algo-Prep | /random/backspace_string_compare__leetCode30Day9/✅ backspace_string_compare.py | 670 | 3.96875 | 4 | def backspaceCompare(S, T):
newS = backspace(S)
print('--NEXT STRING--')
newT = backspace(T)
print('this is newS: ', newS)
print('this is newT: ', newT)
return newS == newT
def backspace(string):
result = []
for char in string:
if char != "#":
print("Char added to ... |
daba08801404eff3e7dc83e00e1e2afc54568676 | MrT3313/Algo-Prep | /random/product_sum/✅ product_sum.py | 219 | 3.578125 | 4 | def productSum(array, multiplier = 1):
sum = 0
for element in array:
if type(element) is list:
sum += productSum(element, multiplier + 1)
else:
sum += element |
327fb5ed101b28cc913695594794a4b40cb2d580 | MrT3313/Algo-Prep | /OPTIMIZATION/min_stack_leetCode30Day10/✅ min_stack.py | 1,012 | 3.734375 | 4 | class MinStack:
def __init__(self):
self.mainStack = []
self.altStack = []
def push(self, x: int) -> None:
if len(self.mainStack) == 0:
self.mainStack.append(x)
self.altStack.append(x)
else:
print(x, "--", self.altStack[-1])
... |
f2b76267a6fcd9f60e5c1c4745a8362ed3c9bd27 | MrT3313/Algo-Prep | /random/three_largest_numbers/✅ three_largest_numbers.py | 1,413 | 4.34375 | 4 | # - ! - RUNTIME ANALYSIS - ! - #
## Time Complexity: O(n)
## Space Complexity: O(1)
# - ! - START CODE - ! - #
# - 1 - # Define Main Function
def FIND_three_largest_numbers(array):
# 1.1: Create data structure to hold final array
finalResult = [None, None, None]
# 1.2: Loop through each item in the chec... |
3c84466bc01a6b2a5ddbd595fbb6dcb107b40e74 | MrT3313/Algo-Prep | /⭐️ Favorites ⭐️/Sort/⭐️ bubbleSort/✅ bubbleSort.py | 590 | 4.21875 | 4 |
def bubbleSort(array):
isSorted = False
counter = 0 # @ each iteration you know the last num is in correct position
while not isSorted:
isSorted = True
# -1 : is to prevent checking w/ out of bounds
# counter : makes a shorter array each iteration
for i in range(len(array)... |
6a24d30afe50a2af315cdee0c2ee357e6c8c8d5a | noweaver/codility | /python/hackerrank/python-domain/01-introduction/print-function.py | 148 | 3.75 | 4 | #!/usr/bin/env python
# -*- coding: utf8 -*-
if __name__ == "__main__":
n = int(input())
for i in range(1, n+1):
print(i, end="") |
19bad2add0da456202869a13e8a122a9b5f5a1ec | noweaver/codility | /python/hackerrank/python-domain/02-basic-data-types/lists.py | 668 | 3.859375 | 4 | #!/usr/bin/env python3
# -*- coding: utf8 -*-
if __name__ == "__main__":
list = []
N = int(input())
for i in range(N):
cmd = input().split()
for j in range(1, len(cmd)):
cmd[j] = int(cmd[j])
if cmd[0] == "insert":
list.insert(cmd[1], cmd[2])
elif... |
3e520021dcdd232b9cb8e62afd5dec2a0902d8c6 | stanislavrossolenko/python | /Task 3.3.py | 151 | 3.71875 | 4 | numbers = []
for i in range(3):
number = int(input('Введите число: '))
numbers.append(number)
print((sum(numbers)) - min(numbers))
|
1f8f73b55820e6068ac14d65b9b8aa5839739c30 | panchaly75/MyCaptainPythonProjects | /Assignment_1.0.py | 571 | 3.75 | 4 | #Question: Can we update the value of a key in dictionary? if yes, then how?
'''
yes, we update a value of a key in dictionary by following
'''
dict0 = {"Y" : "yttrium", "As" : "arsenic"}
dict0["H"] = "helium" #line 7 : explain how to new key-value pair m... |
71dc3f9110ad21660a526284e6b58b8834729e7a | ashNOLOGY/pytek | /Chapter_3/ash_ch3_coinFlipGame.py | 799 | 4.25 | 4 | '''
NCC
Chapter 3
The Coin Flip Game
Project: PyTek
Code by: ashNOLOGY
'''
import math
import random
#Name of the Game
print("\nThe Coin Flip Game"
"\n------------------\n")
#Set up the Heads & Tails as 0
h = 0
t = 0
#ask user how many flips should it do
howMany = int(input("How many fli... |
c880915511c5e9290e539caf88b33a8cfbcb35f5 | ashNOLOGY/pytek | /Chapter_4/ash_ch4_Counter-v1.py | 943 | 3.703125 | 4 | '''
NCC
CHAPTER 4
The Counter
Project: PyTek
Code by: ashNOLOGY
'''
#------ The Imports
import math
import random
import os
# intro
print("\n\t\t\t---------------"
"\n\t\t\t| The Counter | "
"\n\t\t\t---------------\n")
# Ask the user for a Starting number
start_num = int(... |
ec50a2764491acbd0731ef8a46e04b36aa79cee2 | ashNOLOGY/pytek | /Chapter_3/ash_ch3_GuessGame-Mod2-fixed.py | 1,354 | 4.0625 | 4 | '''
NCC + GitKraken
Chapter 3
The Guessing Game [mod // v2]
Project: PyTek
Code by: ashNOLOGY
'''
import math
import random
#Name of the Game
print("\nThe Guessing Game : MOD"
"\n-----------------------"
"\n\n")
#The computer randomly picks a number : cnum
cnum = random.randint(1,5) #r... |
6ff7bbf7571a4c4ad3ed7bdb66cce17cc99cd716 | songsuoyuan/Algorithms-Part-1-Python | /arrayStack.py | 2,676 | 3.890625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Stack implementation with resizing arrays (iterable)
# Double when stack is full, halve when stack is one-quarter full
#
# Methods:
# boolean isEmpty()
# int count()
# None push()
# item pop()
# item top()
#
# Test example:
# user$ more tobe.txt
#... |
968bb2e51e7c6cdac5408a61e5c725fa7879194e | hediac/example_repo | /python_sort/sortinglist.py | 830 | 3.921875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 22 11:54:41 2019
@author: hchagrao
This is a a script to sort list.
"""
my_list =[26, 54, 93, 17, 77,31, 44, 55, 20]
def find_max(my_list):
count = 0
for x in my_list:
if count == 0:
maximum = x
elif x > maximum:... |
135a4b8fcd04b603e1aed99fe95f0c8b9737654d | Dericrp6/CYPEricRP | /libro/ejemplo3_3.py | 223 | 3.890625 | 4 | CUECER = 0
N = int(input("Dame un numero entero positivo: "))
for I in range(0, N, 1):
NUM = int(input("Ingresa un entero: "))
if NUM == 0:
CUECER += 1
print(f"El numero de ceros capturados fue:", CUECER)
|
81f57d8b5bb4766ab576600e5312994015864843 | Dericrp6/CYPEricRP | /funcion_print.py | 725 | 4.03125 | 4 | # print tiene 4 formas de uso
"""
1.- con comas
2.- con signo'+'
3.- con la funciòn format()
4.- Es con una variable de format()
"""
# con comas , concatenar agregando
# un espacio y haciendo un casting de tipo
edad = 10
nombre = "Eric"
estatura = 1.67
print(edad , estatura , nombre)
# con '+' hace lo mismo pero no
# ... |
fab752c3f6a92d5c588640a7081533af5c964121 | Dericrp6/CYPEricRP | /diccionario.py | 1,687 | 3.65625 | 4 | #diccionarios {'llave':'valor'}
alumno = {'num_cta' : '201647757473',
'nombre':('jose','perez','garcia'),
'semestre': 1,
'promedio': 0.0,
'materias':['CYP','algebra','calculo','geometria','introICO'],
'regular': True,
'lagrimas_por_examen' : 5,
'dire... |
526cd3b53d497a1ae0fdfb8d416602d336e90862 | Dericrp6/CYPEricRP | /libro/ejemplo2_7.py | 277 | 3.84375 | 4 | NUM = int(input("Ingresa un numero entero positivo: "))
V = int(input("Ingresa otro numero entero positivo: "))
VAL = 0
if NUM == 1:
VAL = 100 * V
elif NUM == 2:
VAL = 100 ** V
elif NUM == 3:
VAL = 100 / V
else:
VAL = 0
print(VAL)
print("Fin del programa")
|
34ad31b64b9f28846e3cbb94d121b9886425dce7 | Dericrp6/CYPEricRP | /libro/problemas_resueltos/problema1_8.py | 319 | 3.953125 | 4 | print("DISTANCIA_ENTRE_DOS_PUNTOS")
X1 = float(input("Dame el numero de X1: "))
Y1 = float(input("Dame el numero de Y1: "))
X2 = float(input("Dame el numero de X2: "))
Y2 = float(input("Dame el numero de Y2: "))
DIS = ((X1 - X2) **2 + (Y1 - Y2) **2) **0.5
print(f"La distancia entre estos dos puntos es de {DIS} ")
|
b9da28fd5fbf786e6c221ad24a3322d073ee7c37 | Dericrp6/CYPEricRP | /libro/ejemplo1-11.py | 62 | 3.515625 | 4 | A, B, C, D = int(input("dame un numero entero")
D, C, B, A =
|
fce3b21999cbdb0873581a79a873fa8dbb7d25ca | FIU-SCIS-Senior-Projects/Automated-Document-Summarization-1.0 | /Code/Website/backend/app/summarizers/SumBasic.py | 2,270 | 3.5625 | 4 | from operator import itemgetter
import re
NUM_SUMMARIZED_SENTENCES = 5
MIN_SENTENCE_LENGTH = 5
from . import utils
# Calculates the score, or rank, of the given sentence based on the
# frequency of its words
def calc_sentence_score(sentence, word_prob):
if len(sentence.split()) < MIN_SENTENCE_LENGTH: return 0
sc... |
3fa7d2b74090cd3d04d065253a6b63e853cf2832 | kiyagak/Python | /get_csv_column_headers.py | 1,536 | 3.9375 | 4 | '''
Name: Kuteesa Kiyaga
Date: September 27, 2019
Function: Iterate through a JSON object array and
add the keys to an array if the array
doesn't already contain the key.
Useful for determing the complete list of columns
a .csv file will need.
'''
def get_csv_column_headers(array_writ... |
73fd0071a9dd1ec288e8c7ea1e0d48cc80afa847 | rafaelpiresm/studying-indexing | /distancia.py | 481 | 3.890625 | 4 | def adjacent ( A, B, C ):
return A < B < C or A > B > C
#array = map(int, raw_input().split())
array = [ 0, 3, 3, 7, 5, 3, 11, 1 ]
#num_test = input()
for r in xrange( len(array) ):
P, Q = ( int(P) for P in raw_input().split() )
for i, h in enumerate( array ):
if i != P and i != Q:
if adjacent ( array[P], ... |
34c6ee8a8faa4d3848110c3bd3ce82fc0ec54d61 | SasView/sasmodels | /sasmodels/exception.py | 1,467 | 3.609375 | 4 | """
Utility to add annotations to python exceptions.
"""
import sys
# Platform cruft: WindowsError is only defined on Windows.
try:
WindowsError
except NameError:
class WindowsError(Exception):
"""
Fake WindowsException when not on Windows.
"""
pass
def annotate_exception(msg, ... |
7297da642d5c6bfa1fc5bd8b270ba0f77aebf51e | abhinavbh08/NNTI-WS2021-NLP-Project | /src/utils.py | 1,822 | 3.6875 | 4 | import torch
import matplotlib.pyplot as plt
def calculate_accuracy(predictions, labels):
"""Calculates the average accuracy
Args:
predictions (torch.Tensor): The predicted label values.
labels (torch.Tensor): The true label values.
Returns:
accuracy (float): The average accuracy for the given predic... |
1fe39a126c76d6e21eb3941a1d514d37d37ab2b9 | MarkOrkenyi/Battleship-Python-Game | /shipboard_setup.py | 4,485 | 3.96875 | 4 | import os
import boardhandle
import random
import copy
import sound
shiplength = [5, 3, 3, 2, 1]
shipcord = []
# Puts a ship onto the current player's board
def addship(length, currentboard, playernumber, AI):
shipcord0 = []
validrow = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
validcolumn = ['A', 'B', 'C', 'D', '... |
1ead6d62ea5a01b50df2554d47d760501a332a55 | HanegaonkarAweZ/PythonCodingPractice | /AlgorithmDataStructure/NpTEL Course/GreatestCommonDivisor.py | 1,502 | 3.546875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 28 16:18:52 2021
@author: Awez
Metgod for finding gcd of two numbers
ex. gcd(8,16) is 8
"""
def gcd_a(m,n):
fm = []
for i in range(1, m+1):
if m%i == 0:
fm.append(i)
fn = []
for i in range (1, n+1):
if n%i =... |
a494320f224a78e13f565b69e7aebd406709c979 | RanabhatMilan/SimplePythonProjects | /GussingNum/guessing.py | 880 | 4.25 | 4 | # This is a simple guessing game.
# At first we import a inbuilt library to use a function to generate some random numbers
import random
def guess_num(total):
number = random.randint(1, 10)
num = int(input("Guess a number between 1 to 10: "))
while num != number:
if num > number:
num = ... |
f8a581b6c8a2f6c71e332e0e749dc8ce9988159d | mfleming1290/My-written-code | /Python/testing.py | 2,404 | 4.25 | 4 | # first_name = "Zen"
# last_name = "Coder"
# print "My name is {} {}".format(first_name, last_name)
# name = "Zen"
# age = 15
# print "My name is " + name + age
# name = "Zen"
# print "My name is", name, "i am ", 24
# hw = "hello %s" % 'world'
# print hw
# my_string = 'hello world'
# print my_string.capitalize()
#
... |
b293d65e24a384756d497a21e96a0d7ab7e14b4a | Matmozaur/IET_Lab_Python | /lab3_polynomial_and_university/university.py | 3,269 | 3.625 | 4 | from datetime import datetime
class Person:
def __init__(self, first_name, last_name, email):
self.first_name = first_name
self.last_name = last_name
self.email = email
self.inbox = dict()
def send_email(self, author, message):
self.inbox[(author, datetime.now().strft... |
4d61c75204992ab0e54f49b50cb4d518bce68e14 | Matmozaur/IET_Lab_Python | /lab11_library/model/user.py | 271 | 3.5625 | 4 | class User:
def __init__(self, first_name, last_name, login):
self.first_name = first_name
self.last_name = last_name
self.login = login
def __str__(self):
return self.first_name + ' ' + self.last_name + ', login: ' + self.login
|
9f87ffec1ff1611d97ac20b7550d84badb6b657a | Matmozaur/IET_Lab_Python | /lab7_unit_tests/test/math_utils_tests.py | 1,544 | 3.578125 | 4 | import unittest
from lab7_unit_tests.main.math_utils import quadratic_equation, find_straight_line
class QuadraticEquationTest(unittest.TestCase):
# Z tego co widziałem przeglądając pobieżnie internet niestety niemożliwe jest w tym momencie używanie
# almostEqual na setach przy użyciu wyłaćznie biblioteki un... |
6248c148da0140ed1ca95adbf88c3b0282be6145 | MagdalenaSvilenova/Python-Advanced | /tuples_and_sets/count_symbols.py | 126 | 3.625 | 4 | text = input()
sorted_text = sorted(list(set(text)))
for ch in sorted_text:
print(f"{ch}: {text.count(ch)} time/s") |
040dd6551bf45eb4c558635d0017ab974604bd04 | MagdalenaSvilenova/Python-Advanced | /multidimensional_lists/primary_diagonal.py | 304 | 3.6875 | 4 | size = int(input())
matrix = [[0] * size for row in range(0, size)]
for x in range(0, size):
line = list(map(int, input().split()))
for y in range(0, size):
matrix[x][y] = line[y]
sum_diagonal = sum(matrix[size - i - 1][size - i - 1] for i in range(size))
print(sum_diagonal)
|
c7cd1a0793107535f60b02ccff625a18deb6f36b | MagdalenaSvilenova/Python-Advanced | /comprehensions/flattening_matrix.py | 197 | 3.609375 | 4 | def read_matrix():
rows_count = int(input())
return [[int(x) for x in input().split(', ')] for _ in range(rows_count)]
matrix = read_matrix()
print([x for row in matrix for x in row]) |
050e82be2b4705d7f3885e6da1f59227086e7092 | RyanLove1/pandas_demo | /pandas_vlookup_demo.py | 1,319 | 4.03125 | 4 | import pandas as pd
# 学生成绩表
df_grade = pd.read_excel("D:/python基础课程/pandas/ant-learn-pandas/course_datas/c23_excel_vlookup/学生成绩表.xlsx")
print(df_grade.head())
# 学生信息表
df_sinfo = pd.read_excel("D:/python基础课程/pandas/ant-learn-pandas/course_datas/c23_excel_vlookup/学生信息表.xlsx")
print(df_sinfo.head())
# 实现两个表的关联
# 之筛选学生信... |
9058d92b2e93e1f7da21f850e8442f0238062270 | YuyuZha0/leetcode-python | /sort_list.py | 1,361 | 3.9375 | 4 | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def sortList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if not head or not head.next:
r... |
3b45d548f255ff648b5c13af5011ccd184677163 | YuyuZha0/leetcode-python | /factorial_trailing_zeroes.py | 336 | 3.5 | 4 | class Solution(object):
def trailingZeroes(self, n):
"""
:type n: int
:rtype: int
"""
if n < 5:
return 0
cnt, i = 0, 5
while n > i:
cnt += n / i
i *= 5
return cnt
if __name__ == '__main__':
print Solution().tra... |
613209de732131a697422076f2a5f7b394116fde | t27jiang/Python-study-practices | /hello.py | 240 | 3.765625 | 4 | #!/usr/bin/python -tt
import sys
def main():
if len(sys.argv) >= 2:
print 'Hello '+ sys.argv[1]
else:
print 'Hello World'
# This is the standard boilerplate that calls the main() function.
if __name__ == '__main__':
main() |
491aab9571deac3deebc1961a16ddb108f6e10b5 | Arjuna1513/Python_Selenium | /Logging/Py_Logging_Ex1.py | 471 | 3.53125 | 4 | import logging as log
class Py_Logging_Ex1:
def logging(self):
log.debug("Debug Message")
log.info("Info Message")
log.warning("Warning Message")
log.error("Error Message")
log.critical("Critical Message")
# by default loglevel will be set to warning so only warning/e... |
45c7f63e222766bdd413d53f65611e1ed83a54b3 | gmlwndla97/Algorithm_py | /프로그래머스/해시/전화번호목록(hash).py | 312 | 3.640625 | 4 | # phone_book=["119", "97674223", "1195524421"]
phone_book=["12","123","1235","567","88"]
map={}
for i in phone_book:
map[i]=1
for phone in map.keys():
temp=""
for idx in range(0, len(phone)):
temp+=phone[idx]
if temp in map and temp!=phone:
print('False')
print('True')
|
c623bf1938042042216eee8718f42ac4dfde418f | gmlwndla97/Algorithm_py | /프로그래머스/해시/전화번호목록.py | 518 | 3.53125 | 4 | import sys
phone_book=["119", "97674223", "1195524421"]
answer='YES'
dic = {}
for phone in phone_book:
if phone[0] not in dic.keys():
dic[phone[0]] = [phone]
else:
dic[phone[0]].append(phone)
for l in dic.keys():
if len(dic[l]) > 1:
for j in range(0, len(dic[l])):
for k... |
16e44a261b4970104d1598ffcb10e2544b916921 | xcleancode/Distributed_GPU_LSH_using_SYCL | /data_sets/convert_arff_to_binary.py | 1,402 | 3.890625 | 4 | # @author Marcel Breyer
# @date 2020-07-29
# @brief Python3 script for converting a .arff file in text format to a file in binary format.
import argparse
from scipy.io import arff
import numpy as np
import sys
def size_in_bytes(numpy_type):
return np.dtype(numpy_type).itemsize
real_type = np.float32
# real_ty... |
88b06813aabf80bfc88f1853845b3ddcb58f283b | kho226/programmingChallenges | /liveRamp/paintSkyline.py | 2,365 | 3.671875 | 4 | '''
Author: Kyle Ong
Date: 11/05/2017
Problem: Given an array of integers, which represent the heights of buildings. determine how many horizontal strokes needed to paint the skyline!
type: nums: arrayList[int]
rtype: strokes: int
time: O(n)
space: O(1)
constraints:
- 0 <= len(nums) <= 1000000000
- 0 <= nums[i] <... |
46229305455c2aa8df0437037a6df817a6fd56bf | kho226/programmingChallenges | /zendesk/algos/container_with_most_water.py | 647 | 3.515625 | 4 | '''
Author: Kyle Ong
Date: 03/23/2018
container with the most water from leetcode
'''
def container_with_most_water(arr):
'''
Author: Kyle Ong
Date: 03/23/2018
type: arr: arr[int]
runtime: O(n)
space: O(1)
'''
if not arr: return
ret = 0
... |
591805b48029b93aa134b07c0f829eaf813a2955 | mjurk456/100days | /10 Remove duplicate words.py | 691 | 3.796875 | 4 | """
100 DAYS OF PROGRAMMING CHALLENGE
+++++++ DAY 10 ++++++++
Write a program that accepts a sequence of whitespace separated words
as input and prints the words after removing all duplicate words
and sorting them alphanumerically.
Suppose the following input is supplied to the program:
hello world and practice makes p... |
3b19866a1ec5472690a82b016c2c028255b6aea7 | mjurk456/100days | /1 Divisible by 7 but not 5.py | 666 | 3.796875 | 4 | """ 100 DAYS OF PROGRAMMING CHALLENGE
+++++++ DAY 1 ++++++++
Write a program which will find
all such numbers which are divisible by 7
but are not a multiple of 5,
between 2000 and 3200 (both included).
The numbers obtained should be printed
in a comma-separated sequence on a single line.
"""
def main():
sequence ... |
06ec8ee0d28970a70581d1bd3d6a50145c01e83c | bushki/python-tutorial | /files.py | 555 | 3.875 | 4 | # CRUD operations on files
# open file
myFile = open('myfile.txt', 'w') # w is mode for writing
# get file info
print('Name: ', myFile.name)
print('Is closed: ', myFile.closed)
print('Opening mode: ', myFile.mode)
# write to file
myFile.write('this is a test using python')
myFile.write('\nsecond line')
myFile.clos... |
cf64c6a26c86f5af34c39f617763757d4ab270ed | bushki/python-tutorial | /tuples_sets.py | 1,801 | 4.53125 | 5 | # tuple - collection, unchangeable, allows dupes
'''
When to use tuples vs list?
Apart from tuples being immutable there is also a semantic distinction that should guide their usage.
Tuples are heterogeneous data structures (i.e., their entries have different meanings),
while lists are homogeneous sequences. Tuples... |
02b4c937f101d9523a8c2032e71c7242e8ad88a7 | J-Moravec/abmwipmrc_data | /run4/azure_output/$JobInputs/make_columns.py | 1,297 | 3.890625 | 4 | # This script will make columns of the same dimension as input file.
# It will make two columns: run and repeat, delimited by comma
#
# python make_columns.py --input infile.txt --repeat 1 --run 1
import argparse as arg
def get_num_lines(filename):
num_lines = sum(1 for line in open(filename))
return(num_lines... |
1266113a89294db6ec360a9443d42d17c9d1c631 | Timmifixedit/KryptologieUniUlm | /Blatt8/blindSignature.py | 1,162 | 3.6875 | 4 | def ext_ggt(a, b):
if b == 0:
return a, 1, 0
d, x, y = ext_ggt(b, a % b)
return d, y, x - (a // b) * y
def calc_inverse(a, n):
_, _, y = ext_ggt(n, a)
return y
def main():
n = 119
e = 11
m = 9
z = 3
m_tilde = z**e * m % n
print("a): Calculate ~m = z^e * m mod n ... |
4c0a0c175026a5b4f14c56ec3555ab0edbd88534 | budha321/mohanty | /test1/testb.py | 125 | 3.90625 | 4 | x=40
y=39
if x>y:
print("this is a mad man")
elif x==y:
print("this is a man")
else:
print("this is a lovable boy")
|
34c0a50daaa9b8fbdc3e2829103707577f8bf891 | ThetaSinner/aoc2020 | /day6-part1.py | 250 | 3.671875 | 4 | def split(word):
return [char for char in word]
f = open('day6-input')
input = f.read().split('\n\n')
clean_newlines = [x.replace('\n', '') for x in input]
sum_of_counts = sum([len(set(split(x))) for x in clean_newlines])
print(sum_of_counts)
|
6f0276de6fda4756849883ecdfd43ed299e19766 | sbhattathiri/pesolutions | /project_euler_03.py | 542 | 4.03125 | 4 | import math
def get_list_of_prime_numbers_below_x(x):
set_of_prime_factors = set()
while x%2 == 0:
set_of_prime_factors.add(2)
x = x/2
for divisor in range(3,int(math.sqrt(x))+1, 2):
while x%divisor == 0:
x = x/divisor
set_of_prime_factors.add(divisor)
... |
6575b594becd45420c94de5d9010a8e126271f79 | khandelwal/record-locator-1 | /tests/test_generation.py | 564 | 3.546875 | 4 | import unittest
from recordlocator import generator
class TestGenerator(unittest.TestCase):
def test_default_generation(self):
""" The default locator length is 8. Also check some basic things
about the locator. """
locator = generator.safe_generate()
self.assertEqual(len(locator... |
c921922efecf9efddf1a4f0fac4c00fec7c9d261 | Q-100/Python-study | /파이썬/딕셔너리.py | 2,283 | 3.90625 | 4 | # 딕셔너리의 키는 무조건 immutable한 객체여야됨
import collections
a = {1: 5, 3: 5}
a = {"a": 5, "a": 3} # 값은 중복될 수 있지만 키값은 중복되면 맨 마지막 키값만 적용되고 없어짐
print(a)
d = {'abc': 1, 'def': 2}
print(d["abc"]) # 딕셔너리는 순서가 없어서 인덱스로 접근 불가능 -> 대신 키값으로 접근해야됨
d["abc"] = 3 # 딕셔너리는 mutable한 객체이기 때문에 수정이 가능(키로 접근하여 수정)
print(d)
d["aaa"] = 5 # 이런식... |
af31a978e36e5e2a714258320a1e4d982d5ade7e | Q-100/Python-study | /파이썬/이터레이터.py | 776 | 3.703125 | 4 | # 이터레이터 : 값을 차례대로 꺼낼 수 있는 객체
# 이터레이터는 반복가능한 객체에서 __iter__로 이터레이터를 얻고 __next__로 다음 숫자를 꺼냄
import random
it = iter(range(3)) # iter()은 __iter__를 실행(iter(호출가능한객체(매개변수없는함수또는 람다),반복을 끝낼값) 또는 iter(반복가능한객체)
print(next(it)) # next()는 __next__를 실행하여 이터레이터에서 값을 차례대로 꺼냄
print(next(it))
print(next(it))
print(next(it,10)) # next(... |
152da6ae8a02e46901701d0495900fc9c5ae8107 | Q-100/Python-study | /파이썬/람다.py | 2,835 | 3.953125 | 4 | # 람다식은 함수의 인수부분을 간단하게 하기위해서 사용, 괄호밖의 변수도 사용가능
def plus_ten(x):
return x + 10
print(plus_ten(10))
lambda x: x + 10 # 람다는 익명함수라고도 불리는데 이름이 없기때문에 호출이 불가능하다
# lambda 매개변수: 반환값으로 사용할 식
ten = lambda x: x + 10 # 이런식으로 변수에다가 저장해서 사용함
print(ten(10))
print((lambda x: x + 10)(10)) # 이런식으로 괄호로 묶으면 변수에 저장하지않고 바로 호출가능
... |
90e1cdc03fe350411415be94f3261eb0bdbcbc8f | Rr-shan/Python_itc | /作业1-基础/main_02.py | 724 | 3.96875 | 4 | # -*- coding: utf-8 -*-
# @Time : 2020/6/4 8:54
# @Author : Sanzzi
'''
计算圆周长和圆面积
【问题描述】输入圆的半径r,计算圆周长和圆面积,保留2位小数
【输入形式】
Please enter radium:
【输出形式】
【样例输入输出】
Please enter radium: 10
Circumference is 62.83
Round area is 314.16
【样例说明】
注意:圆周率取math库中的常数量pi,另外输出用%f,保留2位小数
import math
后面就可以用ma... |
fd42e6da43002ce67e452c247f8000338283ba5c | Rr-shan/Python_itc | /作业4-序列/main_08.py | 2,193 | 3.546875 | 4 |
'''
凯撒加密
【问题描述】
凯撒密码是古罗马凯撒大帝用来保护重要军情的加密系统。这套密码系统在现在看来很低级,但是在古罗马时期还是发挥了重要作用的。
凯撒密码的根本思想是按照字母表排列顺序将明文中每个字母变换成其后第n个字母。这里,n(n=1~25)被称作秘钥。
请编写程序,针对不同的输入字符串和移动位数,输出经过凯撒加密之后的字符串。
【输入形式】
第一个输入参数是移动的位数n,中间间隔一个空格之后,第二个输入参数是待加密的原文字符串
【输出形式】
加密后的密文字符串。注意,只加密字母,且不改变字母大小写。待加密的字符串可能存在比如"hello worl... |
bd766f455232bbb561c2c370cec99e5df80a492b | Rr-shan/Python_itc | /作业2-条件/main_02.py | 353 | 3.796875 | 4 |
'''
统计字符串中非英文字母个数
【问题描述】统计字符串s中非英文字母的个数并输出。
【输入形式】字符串s
【输出形式】非英文字母的个数
【输入示例】a1b2
【输出示例】2
'''
x = input()
count = 0
for i in x:
if(i>'z' or i<'a'):
count+=1
print(count)
|
0e1b1cd485835a5de5b1dc8b86f28101b2a04b5e | Rr-shan/Python_itc | /作业2-条件/main_03.py | 465 | 3.828125 | 4 |
'''
字符串中字母大小写互换
【问题描述】编写程序,功能是把输入的字符串的大写字母变成小写字母,小写字母变成大写字母,非字母的字符不作变换。输出变换后的结果。
【输入形式】字符串,包含字母和非字母字符。
【输出形式】字符串,字母的大小写已经发生变换。
【样例输入】abcABC
【样例输出】ABCabc
'''
x = input()
print(x.swapcase()) |
c7c13d5b03f6e5453beb8b540f0bd145dd77022f | Rr-shan/Python_itc | /作业3-循环/main_01.py | 473 | 3.640625 | 4 |
'''
循环编程题
【问题描述】
已知y=1+1/3+1/5+…+1/2n-1:
求y<3时的最大n值以及最大n值对应的y值(y值保留小数点后2位)。
【样例输入】
无
【样例输出】
n=XXX,y=X.XX
【样例说明】
X代表求出的数。
【评分标准】
用循环完成,直接输出不得分。
'''
y = 0
n = 1
while y<3:
y += 1/(2*n-1)
n += 1
else: #
y -= 1/(2*n-1)
n -= 1
n -= 1
print("n=%d,y=%.2f"%(n,y)) |
a0039e41b61cf15702253646bf41fde1e21846b2 | Rr-shan/Python_itc | /作业3-循环/main_06.py | 1,223 | 3.90625 | 4 |
'''
翻译密码
【问题描述】翻译密码。为了保密,常不采用明文,而用密文,即按一定规则将字符转换为另一字符,收报人则按相反的规律转换得到原来的字符。本程序规则为:字母ascii码加5,其他字符不变,对原文进行加密,并显示密文。字母的最后5个加5不是字母了,处理规则为循环成前5个。比如“X”的密文为“C”。
【样例输入】
please input text:I love haha.
【样例输出】
N qtaj mfmf.
【样例说明】ord()函数主要用来返回对应字符的ascii码,chr()主要用来表示ascii码对应的字符
【评分标准】
'''
# 内置函数 ord()函数主要用来返回对应字符的as... |
32ff70bbc9d7fc47b94ddb1de8e50658291dacce | jlursenbach/internship | /scraper_code.py | 16,845 | 3.640625 | 4 | # author: Jacob Ursenbach
# date: 20210725
# project: Wikipedia Scraper for internship
# !interpreter [Python 3.8]
# -*- coding: utf-8 -*-
"""
This wikipedia scraper was created for an internship interview.
The prompt was followed:
We will ask for a link to a Python script written by you that takes in a W... |
b872376ec0cb20a8a4816b58f8ff5a170fd4da3a | WilliamYi96/Machine-Learning | /LeetCode/0240-2.py | 732 | 3.65625 | 4 | class Solution:
def searchMatrix(self, matrix, target):
if len(matrix) == 0 or len(matrix[0]) == 0:
return False
left, top = 0, 0
right, down = len(matrix[0])-1, len(matrix)-1
if target < matrix[top][left] or target > matrix[down][right]:
return False
... |
82d58378adb88a8cc870d90216f2ed3cfd6db66f | WilliamYi96/Machine-Learning | /LeetCode/0001.py | 598 | 3.875 | 4 | # Given an array of integers, return indices of the two numbers such that they add up to a specific target.
# You may assume that each input would have exactly one solution, and you may not use the same element twice.
# Solved on 09/10/2019 by William
def twoSum(aList, target):
values = {}
for i in range(len... |
a53e7d6d3625aff8e86ce34d7272c186544949e8 | popwin/DataStructure | /bubble.py | 535 | 3.5625 | 4 |
# coding: utf-8
# author = popwin
def bubble(x,low,high):
"""冒泡算法主体,返回最后一次比较的位置
避免重复比较已排序部分
"""
last = low
while(low<high):
if x[low]>x[low+1]:
last = low + 1
temp = x[low+1]
x[low+1] = x[low]
x[low] = temp
low += 1
return las... |
e4c7f47f69bf967fddd6ae8f43b0aaf6bd64b5fe | korallin/aulas | /python3/examples/arithmetic_operations_integers.py | 437 | 3.734375 | 4 | # -*- coding: utf-8 -*-
number_1 = 2
number_2 = 3
result_1 = number_1 * number_2
print(result_1)
result_2 = number_1 ** number_2
print(result_2)
result_3 = number_1 + number_2
print(result_3)
result_4 = number_1 - number_2
print(result_4)
result_5 = number_1 / number_2
print(result_5)
result_6 = number_1 // numb... |
3e486cb7a16cc2d87662bcafabddec03a890e26f | luned22/frappe | /Documents/beautiful.py | 789 | 3.609375 | 4 | from bs4 import BeautifulSoup
import urllib
userinput=raw_input("Input URL: ")
r = urllib.urlopen(userinput).read()
soup = BeautifulSoup(r)
#if lazada
if "lazada" in userinput:
print "This is Lazada"
letters = soup.find_all("span", class_="price")
result = str(letters[1])
print result[result.find("RP"):result.fi... |
8e6012d9243466627915acfda25ea4811fe61680 | XinyueZ/some-python-codes | /machine_learning/tf_read_csv.py | 7,894 | 3.546875 | 4 | #
# Use a small collection of CSV data to display data from
# reading, transforming, training, evaluating training, and finally predict.
#
# Ref: https://www.tensorflow.org/get_started/datasets_quickstart
#
import tensorflow as tf
import pandas as pd
from tensorflow import keras
import numpy as np
from sklearn.preproce... |
893aa72db9d4f693fc98fc49c4e2bba1662a295d | MauricioBritoCon/EstudosdePython | /aulasDeQuarta/texto.py | 687 | 4.09375 | 4 | '''1- Faça um programa que receba o nome de duas pessoas e dê uma mensagem de boas vindas com o nome delas.
2- Faça um programa que receba o nome, o ano de nascimento de uma pessoa e o ano atual, e mostre uma mensagem com o nome, a idade dessa pessoa e quantos anos ela terá em 2050.
3- Faça um programa que receba 3 n... |
11325d68ecaffa9e465037ea5046662c78e8ed12 | MauricioBritoCon/EstudosdePython | /aulasDeQuarta/primeiroDia.py | 725 | 4.03125 | 4 | '''felipe.martinelli@professores.unimetrocamp.edu.br
'''
import math
raio = float(input('Digite o valor do raio do circulo: '))
area = math.pi * (raio ** 2)
print(f'A área do seu circulo é de: {area:.3f}')
nota1 = float(input('Digite a primera nota: '))
nota2 = float(input('Digite a segunda nota: '))
medi... |
fa7a3e3f228e9dcd5d89c0ecd5e5022362de5aba | MauricioBritoCon/EstudosdePython | /Mundo2/lacosDeRepeticoes.py | 2,607 | 3.859375 | 4 | import time
import datetime
anoatual = datetime.datetime.now()
n = 0
m = 0
o = 0
p = ""
q = 0
r = 0
t = 0
u = 0
idadeMedia = 0
nomeVelho = ''
idadeVelha = 0
mulherNova = 0
for c in range(0, 4, 1):
nome = str(input("Digite seu nome"))
sexo = str(input("Digite se é do sexo 'masculino' ou 'femin... |
762d4e4b13b668e6aa500cefb6b7443fffa91090 | jeremylumanbailey/python_challenges | /solved/largest_prime_factor.py | 770 | 3.671875 | 4 | # https://projecteuler.net/problem=3
# The prime factors of 13195 are 5, 7, 13 and 29.
#
# What is the largest prime factor of the number 600851475143 ?
possible_primes = []
num = 600851475143
def is_prime_number(x):
if x >= 2:
for y in range(2,x):
if not ( x % y ):
return Fa... |
608ebfba133558aafffaf8febb5720d7725cd852 | YZYloveTDQ/Tdq_Adventure | /Tdq_adventure/tdq_adventure/map.py | 722 | 3.953125 | 4 | """定义地图"""
import pygame
class Map():
"""移动的地图"""
def __init__(self, x, y):
self.bg = pygame.image.load("image/bg.png").convert_alpha() # 加载图片,convert_alpha()使得图像具有像素透明度
self.x = x # 地图相对screen的位置
self.y = y
def map_rolling(self):
if self.x < -790: # 地图图片大小未... |
d38cfd133d1f9503ce6e251e30e491b930d336d3 | eclelucien/python_exercice | /lubin.py | 4,457 | 3.859375 | 4 | class Bank:
nome= ''
sobrenome=''
cpf=0
numero_de_cartao=0
senha=0
Limite_de_credito=0
compra=''
movi=''
saldo=''
lista=[]
import re
def isCpfValid(cpf):
if not isinstance(cpf,str):
return False
cpf = re.sub("[^0-9]",'',cpf)
for i in range(1, 10):
if cpf == str(i)*11:
... |
dd1968970a0da8f6cf61b86fded7b2c565819383 | selinkaraceper/udacity-project-3 | /bikeshare.py | 7,990 | 4.4375 | 4 | import time
import pandas as pd
import numpy as np
CITY_DATA = { 'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv' }
MONTHS = ['january', 'february', 'march', 'april', 'may', 'june']
DAYS = ['monday', 'tuesday', 'wednesday', 'friday', '... |
50a8823980d381208d415901ddb761ef92a429d5 | victor-erazo/ciclo_python | /Reto2-leo/reto2-Yeison.py | 2,935 | 3.5 | 4 | # AUTOR YEISON CAMILO MORENO GRUPO 09 MISION TIC 2022
'''
Escriba una función que reciba como parámetro un diccionario en el cual las llaves son los
nombres de las variables antes mencionadas. Retorne un diccionario con las llaves
“id_diagnostico”, “resultado” y “estado”. Tenga en cuenta que si el resultado es 1 el m... |
f8b384b60a9b271604df86cdc32955d36c326084 | victor-erazo/ciclo_python | /talleres ciclo1/Ejercicios_Uni_2_1al6.py | 2,065 | 4 | 4 | # Determinar si dado un entero, éste termina en 4
'''
Tenemos que responder 3 cosas
1ro. Que el dato sea un número. TRY - EXCEPT
2do. Que se un número entero. Toca recibir el dato como Tipo INT
3ro. Que este termine en 4. Verificar bajo un IF (si termina en 4)
a = input('ingrese un número entero: ') # Recibe el dato... |
d6b41c4a43dc1d3752ce14e395f811ea6e7f4f26 | victor-erazo/ciclo_python | /Mision-TIC-GRUPO-09-master(16-06-21)/Semana 4/ejercicio15.py | 246 | 3.671875 | 4 | # Libreria numpy
import numpy as np
a = np.array([34, 25, 7])
print(type(a))
print(a)
print(a.shape)
print(a[0], a[1], a[2])
a[0] = 45
print(a)
b = np.array([
[1,2,3],
[4,5,6]
])
print(b)
print(b.shape)
print(b[0,0], b[0,1], b[1,2]) |
6c331f09eecf54c032fc5f1d4787fda5bd8ca2b0 | victor-erazo/ciclo_python | /Mision-TIC-GRUPO-09-master(16-06-21)/Semana 4/ejercicio18.py | 387 | 3.90625 | 4 | # Libreria numpy - rango mas bajo y matriz general
import numpy as np
a = np.array([
[1,2,3,4],
[5,6,7,8],
[9,10,11,12]
])
print(a)
row_r1 = a[1,:]
row_r2 = a[1:2,:]
print(row_r1, row_r1.shape)
print(row_r2, row_r2.shape)
print(row_r1[2])
print(row_r2[0,2])
col_c1 = a[:,1]
col_c2 = a[:,1:2]
print(col... |
0cc4ae5b935c13da17b2f33cad4f2c454f46e91b | victor-erazo/ciclo_python | /talleres ciclo1/ejersem2.py | 5,845 | 4.1875 | 4 | #Determinar si dado un número entero, termina en 4(Desiciones en cascada)
'''
a = input("ingrese un numero entero") #Recibe el dato por la terminal
if int(a)/1 == int(a):
if a[-1] == "4":
print("termina en 4")
else:
print("no termina en 4")
else:
print("ingrese solo numero")
'''
# D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.