🐍
পাইথন বেসিক
  • পরিচিতি
  • ইনস্টলেশন
  • ব্যাসিক কনসেপ্ট
    • পাইথন এর জন্য সেটআপ visual studio code
    • প্রথম প্রোগ্রাম রান করি
    • print ফাংশন
      • প্রিন্ট ফাংশনের প্যারামিটার
    • Comment
      • DocString
      • comment এবং docstring এর পার্থক্য
    • আইডেন্টিফাইয়ারস
  • স্ট্রিং (Strings)
  • ভেরিয়েবল
    • কন্সট্যান্টস (constants)
  • String Formating
  • ব্যবহারকারীর ইনপুট (user input)
  • Python Statement
  • indentation
  • ডেটা টাইপ
    • টাইপ কনভারশন
    • List
  • Python Operator
    • Arithmetic Operators
    • Comparison Operators
    • Logical Operators
    • Identity Operators
    • Membership Operators
    • Assignment Operator
  • Python Flow Control
    • if,else স্টেটমেন্ট
  • ফাংশন
  • ব্যক্তিগত ফাংশন
  • for লুপ
  • while লুপ
  • পাইথন মডিউল (Python module)
    • মডিউল ইম্পোর্ট করা (import Module )
      • Import from another folder
  • পাইথন প্যাকেজ ইনস্টল
  • প্যাকেজ তৈরি
  • এক্সেপশন হ্যান্ডেলিং
  • PIP
  • ফাইল হ্যান্ডেলিং
  • Databse
    • sqlite3
  • PrettyTable
  • Print Coloured Text At Python
Powered by GitBook
On this page
  • f-strings (Python 3.6+):
  • format() method

String Formating

f-strings (Python 3.6+):

name = "Charlie"
weight = 68.5

formatted_string = f"My name is {name} and I weigh {weight:.2f} kg."
print(formatted_string)

.2f inside {weight:.2f} specifies formatting for the floating-point number.

format() method

name = "Alice"
age = 30
height = 165.75

formatted_string = "My name is {} and I am {} years old. My height is {:.2f} cm.".format(name, age, height)
print(formatted_string)
Previousকন্সট্যান্টস (constants)Nextব্যবহারকারীর ইনপুট (user input)

Last updated 1 year ago