Python String center() in Hindi

Python Center Function in Hindi – python center method example in Hindi

Python

Python Center Function in Hindi : Center function in Hindi ko ham isliye istemal karte hai taki hame String Center Ka use karke dono taraf kuch print kra sake. isko ham example ke sath samanjh te hai.

Python Center Function in Hindi

Syntax :

string.center(width[, fillchar])

Aap upper diye gye syntax ko dekh sakte hai.

Python String center() in Hindi
Python String center()

Width Argument :- Width Argument matlab string ki jo length hoti wo width argument me likhi jati hai.

Fill Char Argument :- Fill Char Argument Matlab width argument ke alava kuch bhi add karna hai wo likha jata hai.

Python center with example in Hindi

Example :-

# use Center function () with width,fillchar argument  

string  = "Masterprograming"          # char width 16

dk = string.center(20,"*")

print(dk)

Aap dekh sakte hai hamne 1st argument yani width agrument me hamne character + 4 star (*) = 20 likha hai. or 2rd argument yani Fill char argument me (*) string pass kiya hai. ab iska jo output hoga usme 2 star right side or 2 start left side add ho jayega kyoki hamne character length + 4 star extra diya hai taki aage or piche 2 start print kra sake.

Output :-

**Masterprograming**

Aap upper Diye gye output ko dekh kar program ko samanjh sakte hai.

Example 2 :-

# use Center function () with width,fillchar argument  

string  = "Masterprograming"          # char width 16

dk = string.center(22,"-")

print(dk)

Aap dekh sakte hai hamne 1st argument yani width agrument me hamne character (16) + 6 (“-“) minus = 22 likha hai. or 2rd argument yani Fill char argument me (““) string pass kiya hai. ab iska jo output hoga usme 3
(“-“) right side or 3 (“-“) left side add ho jayega kyoki hamne character length + 6 (“-“) extra diya hai taki aage or piche 3 (-) minus print kra sake.

Output :-

---Masterprograming---

Aap Upper Diye gye output ko dekh kar program ko samanjh sakte hai.

Center Method

Python Center Function in Hindi

Also Read This Post:

Dosto mujhe ummed hai ki aap Center () function explained with Examples in hindi ko acchi tarah se samanj gye honge agar aap ko ye post acchi lage to mere is website ko jarur follow kre or ha agar aap video bhi dekhna chahte hai to aap mere channel ko bhi subscribe kar sakte hai. channel ka link aapko home page par mil jayega |

Leave a Reply

Your email address will not be published. Required fields are marked *