blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
d7ded4bd6b84f72097781d00e904945e986ad760
deesaw/PythonD-04
/File I-O/18_writelines.py
204
3.59375
4
#Writes sequence of strings to file data = ["hello Hyderabad\n", "Its going to rain today\n"] fin = open("input2.txt", "w") print("Name of the file: ", fin.name) line = fin.writelines( data ) fin.close()
6e02941b3d651c3a16f453698a447335b4b5b656
deesaw/PythonD-04
/File I-O/fileIOall.py
1,232
4.34375
4
#File handling my_file=open("input.txt","r") print my_file.read() my_file.close() #how to seek within a file To move to the beginning of a file f.tell() #gives the current position f.seek(a,b) a=integer b=0#from start b=1#from current position b=2#from end f=open("text.txt","r+") print f.tell() #gives the curr...
97c010803e79c8667c17c91f5721c701b093841b
deesaw/PythonD-04
/File I-O/20_readChar.py
92
3.515625
4
#Read file char by char f=open('input.txt','r') print(f.read(1)) print(f.read(1)) f.close()
b8361aec915cd891157d1487cc6be2897f934066
markTTTT/OSS
/002_Python/Week2_SimplePrograms/decimal_to_binary.py
384
3.953125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 19 16:42:43 2017 @author: markt """ print("Enter number: ") num = int(input()) if num < 0: isNeg = True num = abs(num) else: isNeg = False result = '' if num == 0: result = '0' while num > 0: result = str(num%2) + result ...
89196f44daaa79d6299870e8cf263998a4f6626f
markTTTT/OSS
/002_Python/Week3_StructuredTypes/PSET3/prob6_exam.py
864
3.609375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 12 21:55:10 2018 @author: markt """ def max_val(t): if type(t) == int: return t elif type(t) == tuple: return fn_for_tuple(t) else: return fn_for_loe(t) def fn_for_tuple(t): if t == (): return 0 ...
ca736f42206a18ba3d3c1ce134d746fd40d7479e
tharunikasaravanaraj/python-programming
/prime intervals.py
160
3.65625
4
a=int(input()) b=int(input()) for num in range(a,b+1): if(num>1): for n in range(2,num): if(num%n)==0: break else: print(a,b=" ")
2946e768969f21dca1388235c970936e62d3b17c
aakashverma7869/Small-projects
/cal.py
5,349
3.78125
4
import tkinter as tk from tkinter import messagebox number = None val = ""; A = 0 operator ="" def Entry1(): global val val = val+"1" number.set(val) def Entry2(): global val val = val+"2" number.set(val) def Entry3(): global val val = val+...
bda91029bac1384c32dd54d05f74f0506883887d
seongjinah/openSource
/py_lab/aver_num.py
213
4.21875
4
#!/usr/bin/python N=int(input("How many numbers you want to calculate average?: ")) sum=0 for i in range(N): num=int(input("number {}: ".format(i+1))) sum=sum+num ave=sum/N print("average ", ave)
6674b6c6bd6d2d93bbb8ee08381f93cc65358915
LukeDoyle22/LearningPython
/main.py
148
3.84375
4
age = input("How old are you?\n") if int (age) >= 16: print("Access Granted") else: print("Access Denied, Authorities have been notified")
4bb71b9104207dead1ae3e07fd59abc14cac50d3
jdamato41/python4e
/chap2_ex2.py
192
4.09375
4
#this program converts a farenheit temperature to celius print ('welcone to the Temperature Converter') farh=input("enter a temperature in degrees fareheit \n") farh= int(farh) print (farh*2)
5249c858c2e66343bf8be63c4bf8ca9376a276e2
jdamato41/python4e
/it2.py
504
4.03125
4
num=0 total=0# needed to initialze these variable while True: sval=input("enter a number- ") if sval=="done": break try: fval=int(sval) except: print("not valid") continue#needed this continue ...
5420dac3926c4f17eae8cd2418fd65d3e33be481
BarabanovAnton/return_to_basic
/base_python.py
4,426
3.671875
4
# test_commit # test = 21 # print(test) # # my_true = True # my_false = False # str() int() float() bool() # x = 5.2 # print(x, type(x)) # x = bool(x) # print(x, type(x)) # words = 'Hello \nworld!' # print(words) # verse = '''\ # asas # asasad # fsafsafsfa\ # ''' # print(verse) # s = r'C:\d\new.txt' #сырая строка # ...
3b2a0fe4ebe85b1a3984ed49b5f096091957afd3
goran-peic/Palindrome_Machine
/palindrome.py
2,056
3.78125
4
# Goran Peic, Ph.D. # Palindrome Exercise import pandas as pd import os import progressbar as pb def checkPalindrome(number): if str(number) == str(number)[::-1]: return True else: return False def main(): print("Welcome to GP's Lean Mean Palindrome Machine!") print("This script searches for and outputs all ...
6b12b98595b22e3bd479c4cd9da9a26c680b8137
Sdubazan/wtc-projects
/submission_005-toy-robot-2/.last_tmp.py
5,173
4.3125
4
def robot_name(): """ function used to set robot name """ set_name = input('What do you want to name your robot? ') if len(set_name) == 0: return robot_name() return set_name def print_out(r_name,text): print(r_name+': '+text) def get_command_input(r_name): """function to get robot nam...
e2670bff295be4d8428f04f75469ffc0ec9218da
Sdubazan/wtc-projects
/submission_001-hangman/hangman.py
1,095
4.34375
4
#TIP: use random.randint to get a random word from the list import random def read_file(file_name): """ TODO: Step 1 - open file and read lines as words """ words_file = open(file_name, 'r') list = words_file.readlines() return list def select_random_word(words): """ TODO: Step 2 - s...
0c047164917a965ec67e2d9d4d7b3a12a2f6f339
nagasu529/ComputingScience
/ForceCalculation.py
589
4.03125
4
#Force calcuation and comparison between pushing on the same way and pushing on the difference way situation. def ForceCalc(mass, acceleration1, acceleration2): #Force calculation method forceResult1 = mass * acceleration1 forceResult2 = mass * acceleration2 print("The total force with same direction s...
04cb6d836525c479a55c101c07600dc933337088
the-alex-b/Football-Tracking
/SCCvSD_Utils/rotation_util.py
1,889
3.75
4
import numpy as np import math import cv2 as cv class RotationUtil: @staticmethod def rotate_x_axis(angle): """ rotate coordinate with X axis https://en.wikipedia.org/wiki/Rotation_matrix + transpose http://mathworld.wolfram.com/RotationMatrix.html :param angle: in degr...
1321951446400b600da445ad2b1bc2de8d43ae70
Yamase31/python-craps
/project10/wargame.py
3,578
3.828125
4
""" Author: Beth Ann Townsend and James Lawson File: wargame.py Project 10 Simulates a game of the card game War. """ from cards import Deck class WarGame(object): #this what makes the game def __init__(self): #initializes with the necessary components: two players, the war pile, the game's state, and the deck o...
4a0151c389c2063d914d95338e6c18813facfd22
rafidakhter/DataStrctures
/doubly_linkedlist.py
3,012
4.1875
4
class node: def __init__(self,data=None): self.data=data self.next=None self.previous=None class linkedlist: def __init__(self): self.head=node() #adds an element to the linked list:c def append(self,data): newnode=node(data) current_node=self.head...
4019b3b5f83c2ce59bbccbe6a15b2e588b99a4ac
rafidakhter/DataStrctures
/pratice_problem/modifiedStacks.py
1,672
3.84375
4
class Node(): def __init__(self,data=None): self.data=data self.next=None class modifiedStacks(): def __init__(self,data=None): self.head=Node(data) self.length=1 def peek(self): return self.head.data def push(self,data): newNode=Node(data) ...
1fe263f01b31e647d1fa34b519d362a012b0e2b9
craftoid/twitterbot-examples
/awkwardbot/google.py
1,044
3.65625
4
""" small collection of google search functions """ import urllib, urllib2 import json import sys def query_url(query): """ create a google query """ return "http://www.google.com/search?" + urllib.urlencode({"q": query}) def autocomplete(query): """ get autocompletions using google autocomplete """ # cre...
78e3350fdb582f810f3a61743243438c435f2df7
craftoid/twitterbot-examples
/authorize/autorize.py
741
3.5
4
import tweepy import keys import webbrowser # create auth handler auth = tweepy.OAuthHandler(keys.consumer_key, keys.consumer_secret) # go to redirect URL to get a pin code try: redirect_url = auth.get_authorization_url() print(redirect_url) except tweepy.TweepError: print("Error! Failed to get request to...
a03022cc3eafa71efc699025db6f1953beb8c09c
Ncalo19/keras_practice
/Deploy Keras Neural Network to Flask Web Service/flask_apps/hello_app.py
1,355
3.84375
4
from flask import request from flask import jsonify from flask import Flask app = Flask(__name__) # import app variable to create an instance of the flask class @app.route('/hello',methods=['POST']) # Specify app decorator. methods = ['POST']: specifies what type of http request is allowed (post:user #posts data) de...
d8d80dd017c68a6243c91f4957d63b550808cd0e
George-Eremin/Geekbrains_Python_Basics
/Lesson_1/L1_01_variables.py
271
3.875
4
var_1: int = 1 var_2 = 2 name = input("Введите свое имя: ") favorite_number = int(input("Введите ваше любимое число, " + name + ": ")) print(f"Здравствуйте, {name}, ваше любимое число {favorite_number}")
e9797dec2a5d5413fcfafcc7a795e8d3f762eb96
George-Eremin/Geekbrains_Python_Basics
/Lesson_8/L8_2.py
1,342
3.8125
4
""" 2. Создайте собственный класс-исключение, обрабатывающий ситуацию деления на нуль. Проверьте его работу на данных, вводимых пользователем. При вводе пользователем нуля в качестве делителя программа должна корректно обработать эту ситуацию и не завершиться с ошибкой. """ class OwnExceptionZeroDivision(Exception): ...
f47856d2a30a7957819c226f05874c013d91c594
UrbanKaos/Meus-programas
/q02.py
1,409
4
4
print("Marcos Vinicius Andrade Urban\n") LMin = int(input("Digite o valor mínimo: ")) LMax = int(input("Digite o valor máximo: ")) if LMin <= 0: while LMin <= 0: print("\nValor mínimo inválido, digite novamente\n") LMin = int(input("Digite o valor mínimo: ")) if LMax < LMin: while ...
e0684263a49c55fe2b8e460f3b7af846dcc624d8
UrbanKaos/Meus-programas
/Exercicioslista3.py
159
4
4
cont = 1 lista = [] while cont <= 10: X = float(input("Digite um número: ")) lista.append(X) cont = cont + 1 lista.reverse() print(lista)
9a25fced232806b7d4a4315c1fcd8c6a7d4db5ca
UrbanKaos/Meus-programas
/exercicioslista 1 03.05.py
821
3.953125
4
N = int(input("Digite um número entre 0 e 50: ")) A = [] cont = 0 NEG = [] POS = [] somp = 0 somn = 0 if N < 0 or N > 50: while N < 0 or N > 50: print("Número Inválido") N = int(input("Digite um número entre 0 e 50: ")) if N >= 0 and N <= 50: while cont < N: X = ...
461fe2ef864dc2ecff4b18aa79526f9f28e2005a
onursahil/HackerRank_Problems
/Data_Structures/Linked_Lists/get_node_value.py
1,169
4
4
""" Given a pointer to the head of a linked list and a specific position, determine the data value at that position. Count backwards from the tail node. The tail is at postion 0, its parent is at 1 and so on. """ class Node: def __init__(self, data): self.data = data self.next = None class L...
d9be9c3567541f67d7270446e5cb8d723fec7346
fmanana/JUB_Programming-in-Python
/Assignment_6/Problem_6.1_A_square.py
357
4
4
from turtle import Turtle def drawSquare(t, length): t.up() t.forward(length/2) t.left(90) t.forward(length/2) t.left(90) t.down() for sides in range(4): t.forward(length) t.left(90) t.up t = Turtle() t.screen.setup(width = 600, height = 600) length = int(input("Enter ...
0ffe9b41f089d80379f3c42de08b1214f170be82
fmanana/JUB_Programming-in-Python
/Assignment_4/Problem_4.8_Vowels.py
324
3.953125
4
# JTSK-350111 # a4 p8.py # Fezile Manana # f.manana@jacobs-university.de def count_vowels(s): s = s.lower() count = 0 for i in s: if i == 'a' or i == 'e' or i == 'i' or i == 'o' or i == 'u': count += 1 print("There are", count, "vowels in the string.") str = input("Please ent...
63dcae22a54f6271835737c25f938538bbcadde3
fmanana/JUB_Programming-in-Python
/Assignment_3/Problem_3.6_Writing_Characters-II.py
197
3.6875
4
# JTSK-350111 # a3 p6.py # Fezile Manana # f.manana@jacobs-university.de ch = input("Enter a character: ") n = input("Enter an integer: ") n = int(n) ch = ord(ch) for i in range(0, n + 1): asc = chr(ch+i) print(asc)
058dd6a38fc7225b0805d951356407eafdcc1d65
fmanana/JUB_Programming-in-Python
/Assignment_2/Problem_2.5_Time_Calculation-II.py
216
3.71875
4
# JTSK-350111 # a2 p5.py # Fezile Manana # f.manana@jacobs-university.de minutes = input("Minutes: ") minutes = int(minutes) if(minutes < 0): print("Invalid input!") else: hours = minutes//60 print(hours, "hrs", minutes%60, "mins")
4c0b7d16e10f923c2d0dc72aa27d7afbf41b2b7d
fmanana/JUB_Programming-in-Python
/Assignment_2/Problem_2.4_Fahrenheit_&_Celsius.py
306
3.703125
4
# JTSK-350111 # a2 p4.py # Fezile Manana # f.manana@jacobs-university.de C = input("Temperature in Celcius: ") while(C != 'quit'): C = float(C) F = (9/5)*C + 32 if(F < 32): print(F,"F (cold)") elif(F > 104): print(F, "F (hot)") else: print(F, "F") C = input("Temperature...
ffaea7a57a990a521b15a0dc702d5786e275c510
AshleyLemos/HackerRank
/rotate_string.py
2,253
4.15625
4
#!/bin/python3 import math import os import random import re import sys # # Complete the 'getShiftedString' function below. # # The function is expected to return a STRING. # The function accepts following parameters: # 1. STRING s # 2. INTEGER leftShifts # 3. INTEGER rightShifts # def valid...
a5db3f4345d864aa027eda5eca80c222e24f4f70
GermanCM/machine_learning_concepts_checks
/project/models_tuning/lin_reg_pred_int_tests.py
2,391
3.53125
4
#%% # generate related variables from numpy import mean from numpy import std from numpy.random import randn from numpy.random import seed from matplotlib import pyplot # seed random number generator seed(1) # prepare data x = 20 * randn(1000) + 100 y = x + (10 * randn(1000) + 50) # summarize print('x: mean=%.3f stdv=%...
ac4f74889445ac54e9c21493c0ad08dcbe667b23
Pranav-Vijay343/PythonRepository1345
/compare_3_numbers.py
378
4.1875
4
while True: a = int(input("Enter a number.")) b = int(input("Enter a second number.")) c = int(input("Enter a third number.")) var1 = "This is the largest number:" if a>b>c or a>c>b: print(var1) print(a) elif b>c>a or b>a>c: print(var1) print(b) eli...
1bfd0dcdc539087c7066332c1c1a4d9008419315
xxh890324/learn_python
/13-6.py
939
3.96875
4
# coding:utf-8 import math class Point_1(object): ''' 以元组对的形式返回坐标 求两点间的长度 求斜率:k=tanα=(y2-y1)/(x2-x1) 特殊情况:直线与X轴垂直则K不存在返回None,直线与X轴平行则K等于0 ''' def __init__(self, x=0, y=0, x1=0, y1=0): self.x = x self.y = y self.x1 = x1 self.y1 = y1 def __str__(self): ...
5beed0bc477b3d283057b5eae21d865c135611cc
xxh890324/learn_python
/13-8.py
2,069
3.546875
4
# coding:utf-8 class Stack(object): ''' 堆栈先进后出 pushit方法压入一个数据项 popit方法删除一个数据项 isempty方法判断stack是否为空,空返回1,非空返回0 peek方法取出最顶端的数据项,不删除 ''' def __init__(self, stack=[]): self.stack = stack def pushit(self): ''' 往stack中压入数据项 ''' self.stack.append(r...
e4e06d0679b65fb6b1d856f3758b884ba4becac8
loracsz/cursoemvideo-python
/Guanabara, CursoemVídeo - Exercícios/Desafio 3 - Mostrar a soma de dois numeros.py
136
3.8125
4
primeiro = int(input('primeiro número')) segundo = int(input('segundo número')) print('O resultado da soma é', (primeiro + segundo))
567e0c276b6f4a40586d15b9ddc3c221ee9486f9
Casady-ComSci/fam-assignment-SophiaH22
/arith.py
503
4.34375
4
# Write the python code to print 2*3 print(2*3) # Write the python code to assign the integer 3 to x, the string "yes" to y, and # the integer 5 to z. x = 3 y = 'yes' z = 5 # Write the python code to print the type of y. print(y) # Write the python code to assign x+z to sum, and then print the sum. x+z=sum print(su...
afe5fe22ac4a72681cffee219f41151f165b0858
alsomilo/Jupyter
/quicksort.py
599
3.75
4
import numpy as np def quicksort_np(a): if len(a) < 2: return a mid = a[0] a = a[1:] return np.concatenate((quicksort_np(a[a[:] <= mid]), [mid] , quicksort_np(a[a[:] > mid]))) def quicksort(a): if len(a) < 2: return a return quicksort([x for x in a[1:] if x <= a[0]]) + [a[0]] ...
41f72e3315a24ba5ea2ec071badd11e89c4a37df
arvind-india/SMART-COUNSELLING-BOT
/audio_analysis.py
3,176
3.609375
4
# Import the required module for text # to speech conversion from gtts import gTTS from playsound import playsound import time import pyaudio import wave import speech_recognition as sr from sentiment_emotion import emotion from sentiment_emotion import sentiment from sentiment_emotion import final_report_dict from...
f78de2db728338551f5bbedb223a19275a387121
SL0TR/python-practice
/guessing-game.py
348
3.90625
4
secret_game = "giraffe" guess = "" tries = 0 try_limit = 3 out_of_tries = False while guess != secret_game and not(out_of_tries): if tries < try_limit: guess = input("Enter guess: ") tries += 1 else: out_of_tries = True if out_of_tries: print("You are out of tries, YOU LOSE :(") els...
e37415824aeaf5bfc38c014746c6b9c85b048e07
untalinfo/holberton-system_engineering-devops
/0x16-api_advanced/0-subs.py
748
3.59375
4
#!/usr/bin/python3 """ function that queries the Reddit API and returns the number of subscribers (not active users, total subscribers) for a given subreddit. If an invalid subreddit is given, the function should return 0. """ import json import requests def number_of_subscribers(subreddit): """ Get all users...
1e1bd4864ddfde0fba469a07a52634667fede9cd
robwasab/Permutation
/binarySearch.py.bak
1,058
3.53125
4
#! /usr/bin/python import sys import extractValues def binarySearch(list, target): length = len(list) length /= 2 length = int(length) #sample the first item of the list if type(list[0]) is extractValues.Component: #print 'List of components switching target...' target = extra...
b59894f1369ddeaa5649c0f18352b4736273cb9a
Whateverdoa/Numeric_Matrix_Processor
/Numeric Matrix Processor/task/processor/processor.py
203
3.59375
4
print('matrix is a list of list of sort') # input = size of matrix!? # checknmatrix against matrix else is FALSE # dus als matrix shape = x y # dan is aantal nummers x*yield
543cd6439591a9eaab9a45c396e2b0e1b0f0baf0
adambldwn/Python-Assignment
/Assignment-3(Is it Armstrong Number).py
387
3.609375
4
sayi = input('bir sayı giriniz') sayi_list = list(sayi) toplam = 0 if sayi.isdigit(): for i in range(len(sayi_list)): toplam += (int(sayi_list[i])**len(sayi_list)) if toplam == int(sayi): print(f'{sayi} Armstrong sayıdır') else: print(f'{sayi} Armstrong sayı degildir') else: ...
93bbdfdbf74647b3b834dbf4c716b88ae9444558
aldrowanda/isapy9
/nauka/dzien2 zad_1.py
443
3.78125
4
imie= input(' Dzień dobry,\nJak masz na imię? ') imie=imie.strip(' ') print('Dzień dobry '+imie.capitalize()+'\n:)') #pierwsza liczba się zawiera a ostatnia nie ilosc_liter=len(imie) ostatnia_litera=imie[ilosc_liter-1] print('Twoje imie ma ' + str(ostatnia_litera) + ' liter') print( 'Ostatnia litera Twojego imienia to...
16ec11759a9251be6fbff0486c5f2702ae22d2ef
aldrowanda/isapy9
/Praca domowa/dzien_3/domowa3_2c.py
536
3.859375
4
# 2) Program przyjmuje kwotę # w parametrze i wylicza jak rozmienić to na monety: 5, 2, 1, 0.5, 0.2, 0.1 wydając ich jak najmniej. # rozwiązanie algorytmiczne 2 kwota = float(input('podaj swoją kwotę do rozmienienia: ')) bilon = (5, 2, 1, 0.5, 0.2, 0.1) bilon_str = ('5zł', '2zł', '1zł', '0.5zł', '0.2zł', '0.1zł') i ...
5c5df9130017ce1f938f5824fde964f8ce3b01e4
aldrowanda/isapy9
/Praca domowa/dzien_3/domowa3_2a.py
897
4.03125
4
# 2) Program przyjmuje kwotę w parametrze i wylicza jak rozmienić to na monety: # 5, 2, 1, 0.5, 0.2, 0.1 wydając ich jak najmniej. # rozwiązanie łopatologiczne kwota_str = input('podaj swoją kwotę rozmienienia: ') kwota = float(kwota_str) piatki = int(kwota // 5) kwota = round(kwota % 5, 1) dwojki = int(kwota // 2)...
ce17f14b8b8469fd5854d40b24f19a5ea683fb33
ynjacobs/python_fundamentals2
/exercise7.py
794
4
4
runner_ids = [1,2,3] # TODO: Prompt the user to specify how many racers print(f"How many racers?") runner_ids = range(int(input())) def collect_runner_info(id): print(f"How far did person {id} run (in metres)?") distance = float(input()) print(f"How long (in minutes) did person 1 run take to run {distance} me...
fa04588d17b8bc291b1aafa927662f5af3271d9b
mucheniski/curso-em-video-python
/Mundo2/001CondicoesAninhadas/038ComparandoValores.py
616
3.921875
4
# Exercício Python 038: Escreva um programa que leia dois números inteiros # e compare-os. mostrando na tela uma mensagem: #– O primeiro valor é maior #– O segundo valor é maior #– Não existe valor maior, os dois são iguais numero1 = int(input('Informe o primeiro número: ')) numero2 = int(input('Informe o segun...
fbe0009e78dda10e4aadae3f9528dbbc77177f77
mucheniski/curso-em-video-python
/Mundo3/listas/073CampeonatoBrasileiro.py
775
4.34375
4
# Exercício Python 73: Crie uma tupla preenchida com os 20 primeiros colocados da # Tabela do Campeonato Brasileiro de Futebol, na ordem de colocação. Depois mostre: # a) Os 5 primeiros times. # b) Os últimos 4 colocados. # c) Times em ordem alfabética. # d) Em que posição está o time da Chapecoense. times = ('Cu...
9ec3b36b4429a73263d3ee846f5d22d7fb99f72f
mucheniski/curso-em-video-python
/Mundo1/004UsandoModulosDoPython/018SenoCossenoTangente.py
456
4.03125
4
# Exercício Python 18: Faça um programa que leia um ângulo qualquer e mostre na tela o valor do seno, cosseno e tangente desse ângulo. import math angulo = float(input('Informe um angulo: ')) anguloEmRadiandos = math.radians(angulo) seno = math.sin(anguloEmRadiandos) cosseno = math.cos(anguloEmRadiandos) tangen...
cf1857d5872f3c3e9abf75d56b0b239e033174c7
mucheniski/curso-em-video-python
/Mundo2/003EstruturasDeRepeticao/060Fatorial.py
677
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 math import factorial numero = int(input('Informe um número para saber seu fatorial: ')) fatorial = factorial(numero) print('O fatorial do numero {} é {}'.format(numero, fato...
998da6d6238251027b7b7838fbae03f9940e9d59
mucheniski/curso-em-video-python
/Mundo1/006CoresNoTerminal/Aula01CoresNoTerminal.py
464
3.734375
4
print('\033[1;31;46m Olá vermelho negrito com fundo amarelo! \033[m') print('\033[30m Não sei por que não ficou branco \033[m') print('\033[7m invertido do padrão \033[m') a = 3 b = 6 print('Os valores são \033[31m{}\033[m e \033[33m{}\033[m '.format(a,b)) cor = {'fecha': '\033[m', 'verde': '\033[32m', 'amarelo...
b1ae448bdc29bc73d6e114254f16beb52f8b81be
mucheniski/curso-em-video-python
/Mundo3/funcoes/097EscrevaTextoAdaptavel.py
412
4.0625
4
# Exercício Python 097: Faça um programa que tenha uma função chamada escreva(), # que receba um texto qualquer como parâmetro e mostre uma mensagem com tamanho adaptável. # Ex: # escreva(‘Olá, Mundo!’) # # Saída: # ~~~~~~~~~ # Olá, Mundo! # ~~~~~~~~~ def escreva(texto): print('-'*len(texto)) print...
48d0b8a9e7254cd99d41768db97e47abf39bd958
mucheniski/curso-em-video-python
/Mundo3/listasCompostas/088MegaSena.py
637
4.21875
4
# Exercício Python 088: Faça um programa que ajude um jogador da MEGA SENA a criar palpites. # O programa vai perguntar quantos jogos serão gerados e vai sortear 6 números entre 1 e 60 para cada jogo, # cadastrando tudo em uma lista composta. from random import randint print('================MEGA SENA============...
0b18665f63849876d01a18af73cf05bb01004cac
mucheniski/curso-em-video-python
/Mundo2/001CondicoesAninhadas/040MediaDoAluno.py
600
3.8125
4
# Exercício Python 040: Crie um programa que leia duas notas de um aluno e # calcule sua média, mostrando uma mensagem no final, de acordo com a média atingida: # – Média abaixo de 5.0: REPROVADO # – Média entre 5.0 e 6.9: RECUPERAÇÃO # – Média 7.0 ou superior: APROVADO nota1 = float(input('Nota1 ')) nota2 = floa...
b8014b1947ed01eac93f89ee3e97934522899660
mucheniski/curso-em-video-python
/Mundo2/003EstruturasDeRepeticao/051TermosProgressaoAritmetica.py
259
3.953125
4
termo = int(input('Informe o termo: ')) razao = int(input('Informe a razão: ')) # Enésimo termo de uma razão decimo = termo + (10 - 1) * razao for i in range(termo, decimo + razao, razao): print('{} '.format(i), end=' -> ') print('ACABOU!')
52ebe4bdcb390ae83df64b1b806ee71e7ea4bcbf
mucheniski/curso-em-video-python
/Mundo2/001CondicoesAninhadas/039AlistamentoMilitar.py
1,517
4.03125
4
# Exercício Python 39: Faça um programa que leia o ano de nascimento de um jovem # e informe, de acordo com a sua idade, se ele ainda vai se alistar ao serviço militar, # se é a hora exata de se alistar ou se já passou do tempo do alistamento. # Seu programa também deverá mostrar o tempo que falta ou que passou do p...
e85ad5948c515957c9aa2a85b442a7a14a66e55f
mucheniski/curso-em-video-python
/Mundo3/funcoes/Aula21Funcoes2.py
1,252
4.03125
4
help(print) def contador(inicio, fim, passo): """ :param inicio: :param fim: :param passo: :return o contador entre inicio fim pulando o valor do passo: Função criada por Diego Mucheniski em 18/05/2021 """ for i in range(inicio, fim, passo): print(i) # Funcão com...
f9f90ae2b9a3b95ba61bac518a374fdfec1b8caa
mucheniski/curso-em-video-python
/Mundo3/modularicacao/107ModuloMoeda/moeda.py
945
3.84375
4
# Exercício Python 107: Crie um módulo chamado moeda.py que tenha as funções incorporadas # aumentar(), diminuir(), dobro() e metade(). # Faça também um programa que importe esse módulo e use algumas dessas funções. def aumentar(valor, formatar=False): retorno = valor + 1 if formatar: return for...
91213ec54668861bc84af77be155b0c0f6b1a672
mucheniski/curso-em-video-python
/Mundo3/listas/081InformacoesDaLista.py
996
4.09375
4
# Exercício Python 081: Crie um programa que vai ler vários números e colocar em uma lista. # Depois disso, mostre: # A) Quantos números foram digitados. # B) A lista de valores, ordenada de forma decrescente. # C) Se o valor 5 foi digitado e está ou não na lista. lista = list() while True: numero = int(inpu...
b73311df82d25fd2d07c851449d6bdf4bc87edb0
mucheniski/curso-em-video-python
/Mundo1/004UsandoModulosDoPython/001RaizQuadradaImportIndividual.py
447
4.0625
4
# importando somente alguns objetos # quando importado dessa forma não preciso mais referenciar math.sqrt já chamo direto from math import sqrt, ceil, floor numero = int(input('Digite um número: ')) raizQuadrada = sqrt(numero) print('A raiz de {} é igual a {}'.format(numero, raizQuadrada)) print('A raiz arredon...
d4e94b5162f64fa0056f5d2b78d673dd68f45e6a
mucheniski/curso-em-video-python
/Mundo3/listasCompostas/086Matriz.py
325
3.875
4
matriz = [[0,0,0],[0,0,0],[0,0,0]] for linha in range(0,3): for coluna in range(0,3): matriz[linha][coluna] = int(input(f'Informe o valor para [{linha}][{coluna}]: ')) print('='*50) for linha in range(0,3): for coluna in range(0,3): print(f'[{matriz[linha][coluna]:^5}]', end='') pr...
12c09f553fc0e032e2deef64e28cc0fa9b3f35c4
mucheniski/curso-em-video-python
/Mundo2/003EstruturasDeRepeticao/Aula15InterrompendoRepeticoesWhile.py
368
3.734375
4
numero = soma = 0 while True: numero = int(input('Digite um número: ')) if numero == 999: break soma += numero # print('A soma é {}'.format(soma)) # Print com fstring a partir da versão 3 do python print(f'A soma é {soma}') nome = 'Diego' idade = 34 salario = 18000.00 print(f'o {nome...
a85f8606f875e241283d1696e9334a4ade06a793
mucheniski/curso-em-video-python
/Mundo3/modularicacao/modulos/Aula22Modulos.py
198
3.703125
4
import uteis numero = int(input('Digite um valor: ')) fatorial = uteis.fatorial(numero) dobro = uteis.dobro(numero) print(f'O fatorial de {numero} é {fatorial}') print(f'O dobro é {dobro}')
ff1627d6df5d61a251a91bd12fd939aa43f31e9c
AlexDevi/Pasic
/src/pasic/lexer.py
1,974
3.734375
4
''' Created on Apr 17, 2012 @author: alex ''' import string class Token(object): token_type = '' value = '' class BasicLexer(object): ''' A lexer for the BASIC language ''' tokens = [] position = 0 # TODO move this to a central basic language class operators = [ ...
01ffde273ac25ea68d6356432d54e313dc7eda67
jinyangturbo/ResidualCF
/Model/NMF_attention_inter.py
15,333
3.546875
4
import functools import tensorflow as tf import numpy as np def doublewrap(function): """ A decorator decorator, allowing to use the decorator to be used without parentheses if not arguments are provided. All arguments must be optional. """ @functools.wraps(function) def decorator(*args, **kwa...
f81c9c4a086035ee6684144d87a9b864473c78f4
rogelio2117/curso-python
/contador.py
613
3.90625
4
#dado el texto 'esto es una prueba' imprimir una cadena formateada de la siguiente manera #'esto es una prueba<nombre>' #-imprimir cuantas letra 'e' tiene la cadena #-capitalizar la cadena #-imprimir longitud de la cadena #- reemplazar en la cadena la letra 'o' por 0 dato = (input("Ingrese texto por favor: ")) ...
522f9ce4f6c5102a0c5065cb19599e30564b9c08
wiliq/Python-Essential
/WQ operaciones basicas.py
873
3.984375
4
# -*- coding: utf-8 -*- """ Spyder Editor Autor: Wilson Quito """ def suma(a, b): return a+b def resta(a, b): return a-b def mult(x, y): return x * y def div(x, y): return x / y print("Operaciónes") print("1 Suma") print("2 Resta") print("3 Multiplicar") print("4 Dividir") signo = in...
9656bea10a64e6f58d318986380cbb871d7d9fc3
victorheid/nesclock-display-scrollphathd
/clock.py
1,582
3.875
4
#!/usr/bin/env python import time import scrollphathd import font3x7 print(""" Scroll pHAT HD: Clock Displays hours and minutes in text, plus a seconds progress bar. Press Ctrl+C to exit! """) BRIGHTNESS = 0.9 # Uncomment the below if your display is upside down # (e.g. if you're using it in a Pimoroni Scroll...
69665f45820da7142d3e7d16251c1a7faee14c7d
tominagamaya/python-test
/fib.py
954
4.125
4
""" フィボナッチ数を返却する ・fib(0) = 0 ・fib(1) = 1 ・fib(n+2) = fib(n) + fib(n+1) (n ≧ 0) """ from unittest import TestCase def fib(num): if num == 0 or num == 1: return num else: return fib(num - 1) + fib(num - 2) class Test(TestCase): def test_fib1(self): """0を渡したら0を返すテスト""" exp...
cdcf135aee7da7daba6668157888197b9b31aabe
raghumina/Python_for_DataScience
/Practice.py
5,827
4.28125
4
# In this file i am solving the python problems # i am practicing a lot of python problems # problems may be or may not be related to data Science ''' # Problem 1 # Best cellular plan # Find the most economical cellular plan in terms of cheapest per minute calling cost # # Instructions # We have provided you with det...
b3d4f574fbe15057690dd19cd7fe361c2ccc1f5c
pll33/geocompact
/geocompact/methods/area_perimeter.py
523
3.5
4
import math def area_perimeter(polygon_pts): area = 0.0 perimeter = 0.0 len_pts = len(polygon_pts) if (len_pts > 0): if (len_pts % 2 == 1): polygon_pts.append(polygon_pts[0]) for i in range(len_pts): pt0 = polygon_pts[i] pt1 = polygon_pts[(i+1) % l...
1b757692b7ff7ea87f1a91a688ffe7ade9edb4bd
WeglarzK/cdv
/Podstawy_Programowania/5_listy.py
643
3.875
4
programowanie=['Python','PHP','C#','JS', 'Java'] print(programowanie) print(type(programowanie)) first=programowanie[0] print(first) threeElements = programowanie[0:3] print(threeElements) lastElement = programowanie[-1] print(lastElement) #Dodawanie nowego elementu na koniec listy programowanie.append('R') program...
527c6f11c6e4f0bd4b78694887e7f95370579b7b
WeglarzK/cdv
/Podstawy_Programowania/egzamin_#1.py
442
3.734375
4
print("Podaj liczbę a: ") a = float(input()) print("Podaj liczbe b: ") b = float(input()) print("Podaj liczbe c: ") c = float(input()) if (a-b != 0): if c>0: print("Wartosc wyrazenia wynosi: ") print((a**2)+b) if c<0: print("Wartosc wyrazenia wynosi: ") print(a-(b**2)) if...
a2e50c5f939107786909729f561391c9952038fa
pavan-kc/Learnings
/Qspiders/Python/programs/greatestOfFourNumbersWithuserInput.py
284
4.125
4
a,b,c,d=input("enter a"),input("enter b"),input("enter c"),input("enter d") if a>b and a>c and a>d: print("a "+str(a)+ " is greatest") elif b>c and b>d: print("b "+str(b)+" is greater") elif c>d: print("c "+str(c)+" is greater") else: print("d "+str(d)+" is greater")
7c6cce33c0f9f8e00e8f5a562ef01600f49b8388
MartinDardis/Algoritmos-2-FIUBA
/TP3/procesar_linea.py
1,166
3.53125
4
def separar(entrada): split = entrada.split(' ') if split [0] == 'viaje': comando = split[0]+' '+split[1] param_1='' for i in range(2,len(split)): param_1 +=split[i] if not i == len(split): param_1 += ' ' param_1 = param_1.rstri...
6119e63c80a27f2657815c9b8673ba2abb621d2b
danielsiwiec/adventofcode2020
/day5/two.py
601
3.515625
4
def calculate_seat_id(str): row = calculate_row(str[:7]) col = calculate_col(str[-3:]) return row * 8 + col def calculate_col(str): binary_list = ['0' if char == 'L' else '1' for char in str ] return int(''.join(binary_list), 2) def calculate_row(str): binary_list = ['0' if char == 'F' else '1' for char i...
868558a2f9b9d215d814b2aa252fa86c960d06cf
lugo7/wordsForToday
/CreateDictDb.py
1,707
4.03125
4
#turn dictionary.txt into python dictionary #First program to run #using python 3.6.1 import sqlite3 def dictList(): '''Parses 'dictonary.txt text' file into a list, and strips newlines, and NULL entries.''' try: with open('dictionary.txt','r', encoding="utf-8") as doc: wordsList=doc.read()...
8b7b45ed6d556fc83e1f1c29c1d8c2b5be027012
LenWinkler/Algorithms
/recipe_batches/recipe_batches.py
1,382
3.96875
4
#!/usr/bin/python import math def recipe_batches(recipe, ingredients): # create arr for recipe and arr for ingredients recipe_keys = [*recipe] ingredients_keys = [*ingredients] # create var to skip for loop if we don't have all the ingredients skip = False # need to make sure ingredients contains all keys ...
658c478e3ab31e30d921433ef4e8f440cd470079
gekif/completewebcoursedeveloperrp
/12-Python/IfStatements.py
605
4.125
4
#!C:/Python27/python.exe print "Content-type: text/html\n\n" # name = 'Fikar' name = 'Gusti' # if name == "Fikar": if name == "Fikar" or name == 'Gusti': print "Hello " + name + "<br>" else: print "You're not Fikar or Gusti, but you're " + name + "<br>" # Create a program which display the first 50 as prime...
6bcac0d515ff1f11d7f3fb4a00dfc96c7a6f56aa
Musawir-Ahmed/OOP
/WEEK-1/PROGRAMING_DAY/WARMUP_TASKS/10_NUMBER_AS_INPUT_SUM_seperate_loop.py
357
4.09375
4
# MAKING A LIST TO STORE number = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] sum1 = 0 # taking input from the user in the list for i in range(0, 10): number[i] = int(input("ENTER A NUMBER =")) print(number) # USING LOOP TO SUM ALL THE ELEMENTS IN A LIST for i in range(0, 10): sum1 = sum1+number[i] print("SUM OF ...
2238740faa6ce7aa016b928aaa2c8fea0f95f7d1
Musawir-Ahmed/OOP
/WEEK-1/PROGRAMING_DAY/WARMUP_TASKS/10_NUMBER_AS_INPUT.py
161
3.921875
4
# making a list to input data number = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for i in range(0, 10): number[i] = int(input("ENTER A NUMBER =")) print(number)
ff36d64d9e923b7b4137617723af0c8ee0321312
Musawir-Ahmed/OOP
/WEEK-1/PDF 2/MUESIUM_DISSCOUNT.py
639
4.09375
4
# TAKING DAY NUMBER FROM THE USER AS A INPUT day_number = int(input("ENTER DAY IN NUMBER =")) # TAKING AGE FROM THE USER AS THE INPUT age = int(input("ENTER YOUR AGE =")) # COMPARING AS THE GIVEN CONDITIONS if(day_number == 1): print("MUESIUM IS CLOSED ON MONDAY") elif(day_number == 2 or day_number == 4): ...
5b6be85c6ae9e63eab9e7c9522b479dd623f7085
Musawir-Ahmed/OOP
/WEEK-1/PROGRAMING_DAY/WARMUP_TASKS/10_NUMBER_AS_INPUT_SUM.py
249
3.9375
4
# making a list to input data number = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] sum1 = 0 for i in range(0, 10): temp = int(input("ENTER A NUMBER =")) sum1 = sum1+temp number[i] = temp print(number) print("SUM OF THE NUMBERS ARE =", sum1)
069832bda6c1740668a6fca2d520460bf6245fae
Musawir-Ahmed/OOP
/WEEK-1/PDF 3/SMART_LILLY_PROBLEM.py
962
4.09375
4
# SMART LILY PROBLEM # TAKING AGE AS A INPUT age = int(input(" ENTER AGE =")) # TAKING PRICE OF THE WSHING MACHINE AS THE INPUT pricewm = float(input("ENTER PRICE OF THE WASHING MACHINE =")) # TAKING TOYPRICES AS THE INPUT toyprice = float(input("ENTER PRICE OF THE TOY =")) toys = 0 toys = float(toys) money = ...
d083568fec71f160ec80f4eecda8301e59084155
Musawir-Ahmed/OOP
/WEEK-1/PDF 3/PRIME_NUMBER.py
777
4.1875
4
# PROGRAM TO TEL LWHETHER A NUMBER IS PRIME OR NOT # TAKIMG A NUMBER AS A INPUT number = int(input("ENTER A POSITIVE INTEGER =")) counter = 0 condition = False # COMPARIG THAT IF NUMBER IS NOT EQUAL TO 2 OR 1 THEN STATEMENTS IN IT WILL BE EXECUTED OTHERWISE NOT if(number != 2 and number != 1): for i in range...
fa3da745133a2137d538577af0a7b98f4996d832
Musawir-Ahmed/OOP
/WEEK-1/PDF 1/FIRST_FIVE_MULTIPLE_OF_TWO_NUMBERS.py
875
4.28125
4
# to find the first 5 multiple of the number we will multiply them by 1 2 3 4 5 number1 = input("ENTER FIRST NUMBER TO FIND ITS FIVE MULTIPLE =") number1 = int(number1) number2 = input("ENTER SECOND NUMBER TO FIND ITS FIVE MULTIPLE =") number2 = int(number2) # to find the ultiple of the fiest number print("...
f1c8ae785ed59416fd9926506084324c54d3e4da
kento-pan/IID
/main.py
3,105
3.609375
4
import os import requests import shutil import geturl from pathlib import Path from bs4 import BeautifulSoup # from PIL import Image, ImageFile // Not used for now. print("###########################################") print("## ##") print("## Instagram Image Downloader ...
1ce7f58f561fbbcd3b3e8cf886877d146cc09cbd
ariyaths/toronto
/test_swap_k.py
2,938
3.796875
4
import a1 import unittest class TestSwapK(unittest.TestCase): """ Test class for function a1.swap_k. """ # Add your test methods for a1.swap_k here. def test_smallest_interesting_case(self): """blank is the smallest valid input""" """for a zero length list k = 0""" self.assertEqua...
4f7d0f2569170b0c1ea5ef0f7029d1c36636f943
cmdantes/move
/sample2.py
102
3.890625
4
# add one dimensional array arr = [1,2,3] for i in range(1,len(arr)): arr[1]+=arr[i-1] print(arr)
43316a90b9b9121a659fb4017124c9044bd48528
shoisaitoh/nlp100_drills
/test05_1.py
733
3.828125
4
#coding: utf-8 def n_gram(char, n, mode = "word"): """ Args: char: 対象の文字列 n: Nの値 mode: 単語で区切るなら「word」, 文字で区切るなら「char」.デフォルトはword Return: n_gram: N-gramで分解した結果 """ n_gram = [] if (mode == "word"): chars = text.split() elif(mode == "char"): chars...
2f0b8a4cda1b79a97b597ce7e305e415c12d7681
shoisaitoh/nlp100_drills
/test09.py
618
4.03125
4
#!/usr/bin/env python #coding: utf-8 import random def word_typoglycemia(word): if len(word) <= 4: return word middle = list(word[1:-1]) while middle == list(word[1:-1]): random.shuffle(middle) return word[0] + "".join(middle) + word[-1] def str_typoglycemia(str): sh...
67c4b1a2782d3509427de2a382e1dae8a27bfaa8
shoisaitoh/nlp100_drills
/test02.py
148
3.640625
4
#coding: utf-8 str1 = u"パトカー" str2 = u"タクシー" str3 = u"" for a, b in zip(str1, str2): str3 = str3 + a + b print(str3)
359afc3fdb68014f7878649f8f07142611b54495
Philani1/pre-bootcamp-challenges
/number_to_hours_and_minutes.py
454
4.0625
4
def number_to_hours_and_min(num): hours = num / 60 minutes = num % 60 hour_unit = "" minute_unit = "" if int(hours) == 1: hour_unit = "hour" else: hour_unit = "hours" if minutes == 1: minute_unit = "minute" else: minute_unit = "minutes" return f"{int...
355d7bfe244cb5af43fd559786f7590135283d1b
lshang0311/pandas-examples
/pretty_printing_a_dataframe_with_tabulate.py
232
3.53125
4
import numpy as np import pandas as pd from tabulate import tabulate df = pd.DataFrame( data=np.random.randint(0, 10, (5, 3)), columns=list(['A', 'B', 'C']) ) print(df) print(tabulate(df, headers='keys', tablefmt='psql'))