I want to get an output like this
name1 name2 name3 name4
to n number of names with suffix as the range of x. How to use for loop to generate this kind of output?
For printing variables within strings, you can use f-strings since Python 3.6, as in the following example:
for i in range(1, 5): print(f"name{i}")