0
I'm doing an assignment guys and new to this programming thing.X=2.5 print ("The value of x is %d" %x) The output is?
Assignment question.
2 Respuestas
+ 7
Use %f to format float, or 'format' method in Python 3.x ( to handle auto type cast ):
print("The value of x is {}".format(x))
More stuff about format() method and comparison old/new formatting style:
https://pyformat.info/
+ 2
"%d" stands for decimal signed integer and used when you want to print such an integer. Take a look at the following link for more information.
https://www.lix.polytechnique.fr/~liberti/public/computing/prog/c/C/FUNCTIONS/format.html
By the way, I think the output is 2.