I have created a program.Here I need to leave some space and print an String after the spaces.I did that program with format in python.my code is below,
name = "myname"
print("{0:>10}".format(name))
#output=" myname"
Here, the sum of empty spaces and the length of name is equals to 10.I have declared the size inside print. But I need to declare the size as a variable.I tried it like this,
num = 10
name = "myname"
print("{0:>num}".format(name))
but it did not worked.I need to know how I can fix this.I need to take the same output with giving the size with an variable.please help...