I'm working on a program that
- receives a positive integer as an input
- multiplies the input by a certain number
- returns the result so that it has 2-decimal places
This is how the program currently functions:
// Enter a positive integer...: 1
// [Expected Outcome] Result: 1.00
// [Actual Outcome] ValueError: Invalid format specifier
There seems to be a problem with the say I'm formatting the f-string when printing the result. Could you please check what's wrong with the syntax?
rand_num = 1.0
value = int(input('Enter a positive integer...: '))
result = rand_num * value
print(f'Result: {result:.2f if value > 0 else "Why don't you check your input value again?"}')