f string decimal places 1

f string decimal places

valor_hora_trabalho = float(input("Valor por hora trabalhada: "))
horas_trabalhadas = float(input("Horas trabalhadas: "))

salario  = valor_hora_trabalho * horas_trabalhadas

print(f"Salário do mês: R${salario:.2f}")

Here is what the above code is Doing:
1. We ask the user to input the value of the hour worked.
2. We ask the user to input the number of hours worked.
3. We calculate the salary by multiplying the value of the hour worked by the number of hours worked.
4. We print the salary of the month.

Similar Posts