The program is simple and I'm still learning the basics, but I can't figure out how to put a $ (dollar sign) to a float input.
print("What is your name?")
fisrt_name: input()
#How can a $ appear after the user type a number?
print('How much would you like to give?')
amt1 = float(input())
I already tried:
amt1_dollar = "${:.2f}".format(amt1)
print(amt1_dollar)
But the output shows two numbers, the number the user typed and the print with a dollar sign. How can I do to appear only the number with the dollar sign? Image of the output
Im sorry if the question is too stupid.... and thank you. :)
Create a new string, convert your float to string and add "$" symbol before it.
You should add your program language in tags.
You should use ``` to mark your code.
The "first_name" variable is not matter for this question, just delete it.
Think simple and clean code