Professor,For float output in print statement somewhere say in line In[9] you are using %3.2f here in line no. In[12], you are using %2.1f. How you are deciding 2 or 3? I understood about .2 or .4 or .1 that they specify the round off to decimal place value.
Why do we use %3.2f and %2.1f? Can we use any other value apart from these? I do understand that the value after the decimal represents the number of places to be displayed after the decimal point. But what is the use of 3 and 2??
print('The value of x is %3.2f' %x)What does 3 represent
14943 visits
Outline:Various output statements Print a string Print a string with newline character How to use format operators? Example for integer format Example for string format Example for float format Getting input from the user using Input()function Display a prompt to get the input Save the script as filename.py and execute using %run command
Various output statements Print a string Print a string with newline character How to use format operators? Example for integer format Example for string format Example for float format Getting input from the user using Input()function Display a prompt to get the input Save the script as filename.py and execute using %run command
Show video info
Pre-requisite