f-string , .format() in python #programming #python

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

While using .format( ), You can leave indexing in { } but then you have to provide all elements in the format ( ).

Example -

name = "Akash"
age = 21
print("My name is {} and I am {} years old. {} is my name again. I will be {} in five years.".format(name, age, name, age+5))

Output will be same as previous.

wedocoding