forked from klebera-santos/devs_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Subindo os arquivos em Python
- Loading branch information
0 parents
commit b0ed542
Showing
12 changed files
with
331 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from getpass import getpass | ||
from inspect import EndOfBlock | ||
from tkinter import END | ||
|
||
print("Crie seu usuário e senha!!!!") | ||
username = input("Crie com seu usuário: ") | ||
password = getpass("Crie com sua senha: ") | ||
|
||
valida_user = input("Digite o seu usuário: ") | ||
valida_pass_user = getpass("Digite a sua senha: ") | ||
|
||
|
||
|
||
if ('valida_user' == 'username' and 'valida_pass_user' == 'password'): | ||
print("Usuário Logado com Sucesso!") | ||
elif ('validar_user' == 'username' and 'valida_pass_user' != 'password'): | ||
print("Senha Incorreta") | ||
else: 'valida_user' != 'username' and 'valida_pass_user' != 'password' | ||
print("Usuário ou senha incorretos") | ||
|
||
|
||
''' | ||
elif valida_user != username: | ||
print("Usuário incorreto") | ||
else: | ||
valida_user = input("Digite o seu usuário:") | ||
END | ||
''' | ||
''' elif | ||
'valida_pass_user' != 'password': | ||
print("Senha incorreta") | ||
elif 'valida_user' == 'username' and 'valida_pass_user' == 'password': | ||
print("Usuário logado com Sucesso") | ||
else: | ||
print("Usuário e Senha incorretos") | ||
''' | ||
|
||
''' | ||
Realizando a soma no Python | ||
print(2*5) | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
print("Bem vindo a Tabuada") | ||
num_base = int(input("Digite um numero base ")) | ||
num_cont = 1 | ||
ref_saida = " * " | ||
ref_saida2 = " = " | ||
|
||
for num_cont in range(11): | ||
resultado = num_base * num_cont | ||
print (resultado) | ||
|
||
#print (num_base + " * " + "2 " + "= " + num_base * 2) | ||
#print (num_base + " * " + "3 " + "= " + num_base * 3) | ||
#print (num_base + " * " + "4 " + "= " + num_base * 4) | ||
#print (num_base + " * " + "5 " + "= " + num_base * 5) | ||
#print (num_base + " * " + "6 " + "= " + num_base * 6) | ||
#print (num_base + " * " + "7 " + "= " + num_base * 7) | ||
#print (num_base + " * " + "8 " + "= " + num_base * 8) | ||
#print (num_base + " * " + "9 " + "= " + num_base * 9) | ||
#print (num_base + " * " + "10 " + "= " + num_base * 10) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# First things, first. Import the wxPython package. | ||
import wx | ||
|
||
# Next, create an application object. | ||
app = wx.App() | ||
|
||
# Then a frame. | ||
frm = wx.Frame(None, title="Hello World") | ||
|
||
# Show it. | ||
frm.Show() | ||
|
||
# Start the event loop. | ||
app.MainLoop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#import wx; a=wx.App(); wx.Frame(None, title="Hello World").Show(); a.MainLoop() | ||
|
||
#!/usr/bin/env python | ||
""" | ||
Hello World, but with more meat. | ||
""" | ||
|
||
import wx | ||
|
||
class HelloFrame(wx.Frame): | ||
""" | ||
A Frame that says Hello World | ||
""" | ||
|
||
def __init__(self, *args, **kw): | ||
# ensure the parent's __init__ is called | ||
super(HelloFrame, self).__init__(*args, **kw) | ||
|
||
# create a panel in the frame | ||
pnl = wx.Panel(self) | ||
|
||
# put some text with a larger bold font on it | ||
st = wx.StaticText(pnl, label="Hello World!") | ||
font = st.GetFont() | ||
font.PointSize += 10 | ||
font = font.Bold() | ||
st.SetFont(font) | ||
|
||
# and create a sizer to manage the layout of child widgets | ||
sizer = wx.BoxSizer(wx.VERTICAL) | ||
sizer.Add(st, wx.SizerFlags().Border(wx.TOP|wx.LEFT, 25)) | ||
pnl.SetSizer(sizer) | ||
|
||
# create a menu bar | ||
self.makeMenuBar() | ||
|
||
# and a status bar | ||
self.CreateStatusBar() | ||
self.SetStatusText("Welcome to wxPython!") | ||
|
||
|
||
def makeMenuBar(self): | ||
""" | ||
A menu bar is composed of menus, which are composed of menu items. | ||
This method builds a set of menus and binds handlers to be called | ||
when the menu item is selected. | ||
""" | ||
|
||
# Make a file menu with Hello and Exit items | ||
fileMenu = wx.Menu() | ||
# The "\t..." syntax defines an accelerator key that also triggers | ||
# the same event | ||
helloItem = fileMenu.Append(-1, "&Hello...\tCtrl-H", | ||
"Help string shown in status bar for this menu item") | ||
fileMenu.AppendSeparator() | ||
# When using a stock ID we don't need to specify the menu item's | ||
# label | ||
exitItem = fileMenu.Append(wx.ID_EXIT) | ||
|
||
# Now a help menu for the about item | ||
helpMenu = wx.Menu() | ||
aboutItem = helpMenu.Append(wx.ID_ABOUT) | ||
|
||
# Make the menu bar and add the two menus to it. The '&' defines | ||
# that the next letter is the "mnemonic" for the menu item. On the | ||
# platforms that support it those letters are underlined and can be | ||
# triggered from the keyboard. | ||
menuBar = wx.MenuBar() | ||
menuBar.Append(fileMenu, "&File") | ||
menuBar.Append(helpMenu, "&Help") | ||
|
||
# Give the menu bar to the frame | ||
self.SetMenuBar(menuBar) | ||
|
||
# Finally, associate a handler function with the EVT_MENU event for | ||
# each of the menu items. That means that when that menu item is | ||
# activated then the associated handler function will be called. | ||
self.Bind(wx.EVT_MENU, self.OnHello, helloItem) | ||
self.Bind(wx.EVT_MENU, self.OnExit, exitItem) | ||
self.Bind(wx.EVT_MENU, self.OnAbout, aboutItem) | ||
|
||
|
||
def OnExit(self, event): | ||
"""Close the frame, terminating the application.""" | ||
self.Close(True) | ||
|
||
|
||
def OnHello(self, event): | ||
"""Say hello to the user.""" | ||
wx.MessageBox("Hello again from wxPython") | ||
|
||
|
||
def OnAbout(self, event): | ||
"""Display an About Dialog""" | ||
wx.MessageBox("This is a wxPython Hello World sample", | ||
"About Hello World 2", | ||
wx.OK|wx.ICON_INFORMATION) | ||
|
||
|
||
if __name__ == '__main__': | ||
# When this module is run (not imported) then create the app, the | ||
# frame, show it, and start the event loop. | ||
app = wx.App() | ||
frm = HelloFrame(None, title='Hello World 2') | ||
frm.Show() | ||
app.MainLoop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from tkinter import * | ||
class Application: | ||
def __init__(self, master=None): | ||
self.widget1 = Frame(master) | ||
self.widget1.pack() | ||
self.msg = Label(self.widget1, text="Primeiro widget") | ||
self.msg.pack () | ||
root = Tk() | ||
Application(root) | ||
root.mainloop() | ||
|
||
texto_resposta.grid(column=0, row=2, padx=10, pady=10) | ||
|
||
janela.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
usuario = input("Qual o usuário?" ).strip() | ||
|
||
usuario1 = usuario == "Kleber" | ||
usuario2 = usuario == "Re" | ||
usuario3 = usuario == "Gui" | ||
usuario4 = usuario == "Ana" | ||
|
||
if(usuario1 or usuario2 or usuario3 or usuario4): | ||
print(f"Seja bem-vindo {usuario}!") | ||
else: | ||
print("Usuario não encontrado!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
|
||
import folium | ||
|
||
#Criando o mapa | ||
mapa = folium.Map( | ||
location = [-23.550093493433984, -46.6341472592547], | ||
tiles='Stamen Terrain', #estilo do mapa | ||
zoom_start=16 | ||
) | ||
|
||
#Adicion o marcardor no mapa | ||
folium.Marker( | ||
[-23.550093493433984, -46.6341472592547], | ||
popup='<i>Praça da Sé</i>', | ||
tooltip='Click aqui!' | ||
).add_to(mapa) | ||
|
||
#Salva html do mapa # | ||
mapa.save(r'.\mapa.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
#Instalando o pacote | ||
from gettext import install | ||
|
||
""" | ||
en(English, default) | ||
am(Amharic) | ||
ar(Arabic) | ||
cz(Czech) | ||
de (German) | ||
dk(Danish) | ||
it(Lithuanian) | ||
lv(Latvian) | ||
no(Norwegian) | ||
pl(Polish) | ||
pt(Portuguese) | ||
pt_br(Portuguese - Brazilian) | ||
""" | ||
|
||
|
||
#!pip -q install num2words #type: ignore | ||
|
||
#Importando o pacote | ||
from num2words import num2words | ||
|
||
#Coletando o número do usuário | ||
#Neste exemplo usaremos o número | ||
numero = int(input('Digite um número: ')) | ||
|
||
#Utilizando a função num2words para gerar o número por extenso | ||
num_pt_br = num2words(numero, lang = 'pt-br') | ||
num_en = num2words(numero, lang = 'en') | ||
|
||
#Imprimindo o resultado na tela | ||
print(f'Em Portugues: {num_pt_br}') | ||
print(f'Em Ingles: {num_en}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Lista vazia para armazenar os resultados | ||
quadrados = [] | ||
|
||
#Loop pelo range de números. | ||
|
||
#for i in range(1,11): | ||
# quadrados.append(i * i) | ||
|
||
#print(quadrados) | ||
|
||
### | ||
#Forma mais expert de fazer | ||
|
||
quadrados = [i * i for i in range(1,11)] | ||
|
||
print(quadrados) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
count = 1 | ||
|
||
def func(): | ||
global count | ||
for i in (1, 2, 3): | ||
count += 1 | ||
|
||
func() | ||
print(count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from pytube import YouTube | ||
import movie.py.editor as mp | ||
import re | ||
import os | ||
|
||
#Digite o link do video e o local que deseja salvar o mp3 # | ||
link = input("Digite o link do video que deseja baixar:") | ||
path = input("Digite o diretorio que deseja salvar o arquivo:") | ||
yt = YouTube(link) | ||
|
||
#Começa o Download # | ||
print("Baixando ...") | ||
ys = yt.streams.filter(only_audio=True).first().download(path) | ||
print("Download Completo") | ||
|
||
#Converte mp4 para mp3# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from getpass import getpass | ||
|
||
def validauser(): | ||
print("Validando o usuário") | ||
valida_user = input("Digite o seu usuário: ") | ||
valida_pass_user = getpass("Digite a sua senha: ") | ||
|
||
print("Crie seu usuário e senha!!!!") | ||
username = input("Crie com seu usuário: ") | ||
password = getpass("Crie com sua senha: ") | ||
print("Usuário inserido com sucesso!!!") | ||
|
||
|
||
|
||
if valida_user == username: | ||
print("Usuário correto") | ||
elseif | ||
print("Usuário Incorreto") | ||
|
||
''' | ||
Realizando a soma no Python | ||
print(2*5) | ||
''' |