Various methods of String Formatting in Python
name = "Abdur"
age = 35
print("Hello %s!" % name) # %s used for strings
print("Age is %d" % age) # %d used for numbers
print("%s is %d years old." %(name, age))
print("Hello {}!".format(name))
print(f"Hello {name}!")
Comments
Post a Comment
Write something to CodeWithAbdur!