+ 1

String formatting

# string formatting nums = [4, 5, 6] msg = "Numbers: {} {} {}". format(nums[0], nums[1], nums[2]) print(msg) output: Numbers: 4 5 6

11th May 2020, 9:14 AM
Taofeeq Olawale Saad
3 odpowiedzi
+ 2
Yea, I know but what are the differences compare to below program # string formatting nums = [4, 5, 6] msg = "Numbers: {0} {1} {2}". format(nums[0], nums[1], nums[2]) print(msg)
11th May 2020, 9:21 AM
Taofeeq Olawale Saad