Mensagens

A mostrar mensagens de novembro, 2023

Advento do Natal

import datetime import random data_atual = datetime.date.today() data_inicio_advento = datetime.date(data_atual.year , 12 , 1 ) dias_ate_natal = (datetime.date(data_atual.year , 12 , 25 ) - data_atual).days if data_atual >= data_inicio_advento: dia_atual = (data_atual - data_inicio_advento).days + 1 print ( f'Dia { dia_atual } do Calendário de Advento:' ) # Lista expandida de atividades lista = [ "Assista a um filme natalino em família." , "Faça um anjo de papel." , "Cozinhe biscoitos de Natal." , "Escreva uma carta para o Pai Natal." , "Faça um passeio noturno para ver as decorações de Natal." , "Faça um cartão de Natal para um estranho." , "Crie um álbum de fotos de Natal." , "Faça uma noite de jogos em família." , "Visite um mercado de artesanato natalino." , "Faça uma caminhada à lu...

Crescimento Anual Composto

from tkinter import * root = Tk() root.geometry( "450x430" ) root.resizable( 0 , 0 ) root.config( bg = "#104375" ) root.title( "Crescimento Anual Composto (CAGR)" ) titulo = Label( text = "Crescimento Anual Composto (CAGR)" , font =( "Arial" , "15" , "bold" ) , bg = "#104375" , fg = "#16b6de" ) titulo.place( relx = 0.09 , rely = 0.05 ) texto_sub1 = Label( text = "Valor Inicial:" , font =( "Arial" , "12" , "bold" ) , bg = "#104375" , fg = "#16b6de" ) texto_sub1.place( relx = 0.2 , rely = 0.2 ) texto_sub2 = Label( text = "Valor Final:" , font =( "Arial" , "12" , "bold" ) , bg = "#104375" , fg = "#16b6de" ) texto_sub2.place( relx = 0.2 , rely = 0.35 ) texto_sub3 = Label( text = "Número de Anos:" , ...

Calcular Moda

lista_numero = [ 12 , 16 , 20 , 20 , 12 , 30 , 25 , 23 , 24 , 20 ] def moda (): frequency = {} for i in lista_numero: frequency.setdefault(i , 0 ) frequency[i] += 1 frequent = max (frequency.values()) for i , j in frequency.items(): if j == frequent: moda = i print ( f" \n\n A moda é de { moda } " ) escolha= True while escolha: print ( " \n " ) print ( "Calcular Moda" ) print ( """ 1. Moda 2. Exit/Quit/Saída """ ) escolha= input ( "Escolha uma opção: " ) if escolha== "1" : moda() elif escolha== "2" : print ( "Fim do Programa" ) quit () else : print ( " \n Escolha não válida. \n Tente outra vez." )

Armstrong

from tkinter import * root = Tk() root.geometry( "400x300" ) root.resizable( 0 , 0 ) root.config( bg = "#053666" ) root.title( "Armstrong" ) titulo = Label( text = "Armstrong" , font =( "Arial" , "50" , "bold" ) , bg = "#053666" , fg = "#6196c9" ) titulo.place( relx = 0.05 , rely = 0.05 ) texto_sub1 = Label( text = "Número Inteiro:" , font =( "Arial" , "15" , "bold" ) , bg = "#053666" , fg = "#6196c9" ) texto_sub1.place( relx = 0.05 , rely = 0.4 ) Número_Inteiro = IntVar() Número_Inteiro_entrada = Entry( textvariable =Número_Inteiro , font =( "Arial" , "12" , "bold" ) , bg = "white" , fg = "blue" , justify = 'center' ) Número_Inteiro_entrada.place( relx = 0.5 , rely = 0.4 , relwidth = 0....

Liquidez Imediata

from tkinter import * root = Tk() root.geometry( "400x500" ) root.resizable( 0 , 0 ) root.config( bg = "#024a73" ) root.title( "Liquidez Imediata" ) titulo = Label( text = "Liquidez Imediata" , font =( "Arial" , "33" , "bold" ) , bg = "#024a73" , fg = "#1ea1eb" ) titulo.place( relx = 0.05 , rely = 0.05 ) texto_sub1 = Label( text = "Activos Circulantes :" , font =( "Arial" , "15" , "bold" ) , bg = "#024a73" , fg = "#1ea1eb" ) texto_sub1.place( relx = 0.05 , rely = 0.25 ) Activos_Circulantes = DoubleVar() Activos_Circulantes_entrada = Entry( textvariable =Activos_Circulantes , font =( "Arial" , "12" , "bold" ) , bg = "white" , fg = "blue" , justify = 'center' ) Activos_Circulantes_entrada.pl...

Newtons para kilogramas

from tkinter import * root = Tk() root.geometry( "400x300" ) root.resizable( 0 , 0 ) root.config( bg = "#0b376e" ) root.title( "Newtons para kilogramas" ) titulo = Label( text = "Newtons para kilogramas" , font =( "Arial" , "23" , "bold" ) , bg = "#0b376e" , fg = "#1deef5" ) titulo.place( relx = 0.05 , rely = 0.05 ) texto_sub1 = Label( text = "Newtons:" , font =( "Arial" , "18" , "bold" ) , bg = "#0b376e" , fg = "#1deef5" ) texto_sub1.place( relx = 0.15 , rely = 0.35 ) Newtons = DoubleVar() Newtons_entrada = Entry( textvariable =Newtons , font =( "Arial" , "12" , "bold" ) , bg = "white" , fg = "blue" , justify = 'center' ) Newtons_entrada.place( relx = 0.5 , rely = 0.35 , relwidth = 0.4 ) ...

Força Resultante

from tkinter import * root = Tk() root.geometry( "400x400" ) root.resizable( 0 , 0 ) root.config( bg = "#0e6475" ) root.title( "Força Resultante" ) titulo = Label( text = "Força Resultante" , font =( "Arial" , "30" , "bold" ) , bg = "#0e6475" , fg = "#46dcfa" ) titulo.place( relx = 0.1 , rely = 0.05 ) texto_sub1 = Label( text = "Massa (kg) :" , font =( "Arial" , "15" , "bold" ) , bg = "#0e6475" , fg = "#46dcfa" ) texto_sub1.place( relx = 0.15 , rely = 0.3 ) texto_sub2 = Label( text = "Aceleração (m/s^2) :" , font =( "Arial" , "13" , "bold" ) , bg = "#0e6475" , fg = "#46dcfa" ) texto_sub2.place( relx = 0.05 , rely = 0.45 ) Massa = DoubleVar() Massa_entrada = Entry( textvariable =Massa , font =( ...

Determinar o Sinal

from tkinter import * root = Tk() root.geometry( "400x300" ) root.resizable( 0 , 0 ) root.config( bg = "#10626b" ) root.title( "Determinar o Sinal" ) titulo = Label( text = "Determinar o Sinal" , font =( "Arial" , "30" , "bold" ) , bg = "#10626b" , fg = "#3edced" ) titulo.place( relx = 0.07 , rely = 0.05 ) texto_sub1 = Label( text = "Número:" , font =( "Arial" , "18" , "bold" ) , bg = "#10626b" , fg = "#3edced" ) texto_sub1.place( relx = 0.15 , rely = 0.35 ) numero = DoubleVar() numero_entrada = Entry( textvariable =numero , font =( "Arial" , "12" , "bold" ) , bg = "white" , fg = "blue" , justify = 'center' ) numero_entrada.place( relx = 0.45 , rely = 0.37 , relwidth = 0.45 ) def app (): ...

Classificar Número

from tkinter import * root = Tk() root.geometry( "400x350" ) root.resizable( 0 , 0 ) root.config( bg = "#1e547d" ) root.title( "Classificar Número " ) titulo = Label( text = "Classificar Número" , font =( "Arial" , "29" , "bold" ) , bg = "#1e547d" , fg = "#26d1e0" ) titulo.place( relx = 0.04 , rely = 0.05 ) texto_sub1 = Label( text = "Número Inteiro: " , font =( "Arial" , "18" , "bold" ) , bg = "#1e547d" , fg = "#26d1e0" ) texto_sub1.place( relx = 0.05 , rely = 0.25 ) Número = IntVar() Número_entrada = Entry( textvariable =Número , font =( "Arial" , "12" , "bold" ) , bg = "white" , fg = "blue" , justify = 'center' ) Número_entrada.place( relx = 0.53 , rely = 0.25 , relwidth = 0.35 ) def app (): n = ...

Litros para Gramas e Vice-Versa

def store_temp (sel_temp): global tempVal tempVal = sel_temp def call_convert (rlabel1 , inputn , number2Input , numberInput ): tem = inputn.get() densidade = number2Input.get() try : tem = float (tem) densidade = float (densidade) except ValueError : rlabel1.config( text = "Por favor, insira valores válidos." ) return if tempVal == 'Litros' : gramas = tem * densidade rlabel1.config( text = f" { tem } Litros é igual a { gramas : .2f } Gramas" ) elif tempVal == 'Gramas' : litros = tem / densidade rlabel1.config( text = f" { tem } Gramas é igual a { litros : .2f } Litros" ) root = tk.Tk() root.geometry( '400x300' ) root.title( 'Litros para Gramas e Vice-Versa' ) root.configure( background = '#09A3BA' ) root.resizable( width = False, height = False ) root.grid_columnconfigure( 1 , weight = 1 ) root.grid_rowconfigure( 0 , ...