# Simple Python problem

• print(("{:.1f}").format(20))

output

• 20.0

You let me made great Python refresher . Thank you. Please click on solution under this message to close this thread. Happy to help.

You want to combine this example

``````print("{:*^20s}".format("Geeks"))
``````

with the correct input, the fixed point format `f`, and replace `^` with the correct alignment.

• print(("{:.1f}").format(20))

output

• 20.0

You let me made great Python refresher . Thank you. Please click on solution under this message to close this thread. Happy to help.

@i-tech, its great that you want to help, but your solution is not correct and we try to help people work towards the correct answer rather than just giving them solutions so that they can better handle similar problems in the future. Thanks.

seems like this line of code works best

``````print("{:*>11f}".format(20))
``````

however im getting alot of decimal 0s
I guess ill give it my last try what do you say?
i fail i dont pass

The fixed point format is a little bit different than the integer format. You are very close, you just need to specify the number of digits after the decimal point.

``````print("{:4.2f}".format(42))
``````

what ??? my function is not correct ??? hhahahahahahah you sure ??? run it on w3school python editor and see

Your solution does not meet the requirements that were described.

1 Like

Correct. That is not the output requested by the assignment.

i did this and while it does give me two decimals 0s it increases the amount of *

``````print("{:*>11.2f}".format(20))
``````

Right. So you need to adjust the number in front of the decimal to change how many * you get.

In this format you have `[numDigitsTotal].[numDigitsAfter]f`

how many decimals you need?

only two.
The correct line of code is:

``````print("{:*>7.2f}".format(20))
``````

Thanks you all for your help

1 Like

I knew you could do it!

hahahaha this is a veeeeeeeery long way , try this one bro

print(("{:.2f}").format(20))

You are still failing to include asterisks (`**`) in your solution. @FreeCodingβs solution is correct.

I learned this simple yet powerful method during my Google IT Automation with Python Professional Certificate. Your method is complicated and hard to catch.
Anyway, most important thing, our friend case is solved. See ya.

Your solution is not correct. Itβs great that you are comfortable with Python, but in this case you did not provide an answer that met the requirements of the assignment. Formatting requirements in professional applications can be quite exacting. With more practice Iβm sure you will be able to find the solution like @FreeCoding did.

2 Likes