Input-output - English
- subtitles off
- captions off
- English
- Questions posted on Forums
- Python 3.4.3 Tutorials - English
-
For float output in print statement
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.
03-04M 50-60S sc256356
Answer last updated on: Aug. 1, 2023, 3:02 p.m.
-
format specifiers
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??
03-04M 0-10S Mitalidas
Answer last updated on: Aug. 11, 2020, 10:56 a.m.
-
Pring
print('The value of x is %3.2f' %x)What does 3 represent
03-04M 10-20S Praylin
Answer last updated on: May 6, 2020, 11 p.m.
-
1Getting started with IPython
-
2Using plot command interactively
-
3Embellishing a plot
-
4Saving plots
-
5Multiple plots
-
6Subplots
-
7Additional features of IPython
-
8Loading Data From Files
-
9Plotting Data
-
10Other Types Of Plots
-
11Plotting Charts
-
12Getting started with Lists
-
13Getting started with for
-
14Getting started with strings
-
15Getting started with files
-
16Parsing data
-
17Statistics
-
18Getting started with arrays
-
19Accessing parts of arrays
-
20Image manipulation using Arrays
-
21Basic Matrix Operations
-
22Advanced Matrix Operations
-
23Least square fit
-
24Basic datatypes and operators
-
25Sequence datatypes
-
Input-output
-
27Conditional Statements
-
28Loops
-
29Manipulating lists
-
30Manipulating strings
-
31Getting started with tuples
-
32Dictionaries
-
33Sets in Python
-
34Getting Started with Functions
-
35Advanced Features of Functions
-
36Using Python Modules
-
37Writing Python Scripts
-
38Testing and Debugging
-
39Handling Errors and Exceptions
Questions posted on ST Forums:
15605 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
Width: | 832 | Height: | 608 |
---|---|---|---|
Duration: | 00:10:10 | Size: | 4.2 MB |
Show video info