python code that takes 2 numbers and calculates the success rate. Say for example,…
Jump to turn (6)
- 1python code that takes 2 numbers and calculates the success rate. Say for exampl
- 2what does it look like with and without the .format?
- 3what would the result be?
- 4so why do we need format
- 5How to format the percent to only 2 decimal places
- 6print(YELLOW + f"Elapsed: {minutes}m {seconds}s | PID: {processID} | %{successra
- User
python code that takes 2 numbers and calculates the success rate.
Say for example, correct = 500 and incorrect = 300.
The sucess rate would be 60%. how to calculate it via python and print it out?
- Assistant
correct = 500 incorrect = 300
total_answers = correct + incorrect success_rate = (correct / total_answers) * 100
print("The success rate is: {}%".format(success_rate))
- User
what does it look like with and without the .format?
- Assistant