SlideShare a Scribd company logo
7
Most read
FORMATTING
VARIABLES AND
OUTPUT
CONSTANTS
DATA TYPE CONVERSION
• Can control how variables are interpreted within the
program:
• Two types:
• Evaluation
• Code: eval(string)
• Ex. eval(“51” + “52”)
• eval( str1 ** str2)
• test = eval(input(“Enter a num”))
• Conversion
• Code: datatype(value/variable)
• Ex. int(4.5)  4
• float(4)  4.0
• str(num)  “4”
THE ESCAPE SEQUENCE
• Used within a string to perform a specific task
• Code: print(“”This is an example”n”)
FORMATTING OUTPUT
• Controls how the information is displayed:
• size
• Position
• Justification
• padding
• number of digits
• Dataytype
• The format function formats a number, string, or both
and returns the information as a string.
• Code: format(variable, ‘format-specifier’)
THE FORMAT FUNCTION
 Code: print(format(item, ‘ ’)
 
 
THE FORMAT FUNCTION
 Code: print(format(item, ‘ ’)
 
 

More Related Content

PPTX
Seminar 2 coding_principles
PPTX
Single page application 06
PPTX
Seminar 2 coding_principles
PPTX
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PPT
T03 b basicioscanf
PPTX
Input output statement in C
PPTX
Basic Input and Output
PPTX
Data Input and Output
Seminar 2 coding_principles
Single page application 06
Seminar 2 coding_principles
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
T03 b basicioscanf
Input output statement in C
Basic Input and Output
Data Input and Output

Viewers also liked (11)

PPTX
For Loops and Nesting in Python
PPT
Conditional Loops Python
PPTX
Functions
PPTX
Function Returns
PPT
Intro to Python
PPT
PPTX
Variables and Expressions
PPTX
Logical Operators
PPT
Intro to Jeroo Python
PPT
Intro to Functions Python
PPTX
Computer Logic
For Loops and Nesting in Python
Conditional Loops Python
Functions
Function Returns
Intro to Python
Variables and Expressions
Logical Operators
Intro to Jeroo Python
Intro to Functions Python
Computer Logic
Ad

Similar to Formatting Output (20)

PPTX
20BCT23 – PYTHON PROGRAMMING.pptx
PPTX
PYTHON Introduction 1Deep learning 2.pptx
PPTX
Introduction of python Introduction of python Introduction of python
PPTX
What is Paython.pptx
PPTX
what-is-python-presentation.pptx
PPTX
Unit2 input output
PPTX
What is python-presentation FOR CLASS 10.pptx
PPTX
python-presentation.pptx
PPTX
Introduction to Python Programming language
PPTX
Python Programming - Variables, Objects and Classes
PPTX
uom-2552-what-is-python-presentation (1).pptx
PPTX
uom-2552-what-is-python-presentationalllllll.pptx
PPTX
uom-2552-what-is-python-presentation.pptx
PPTX
Intro to python programming (basics) in easy language
PPTX
Problem Solving and Python Programming PPT.This will be helpfull for first ye...
PPTX
python-presentationpython-presentationpython-presentation.pptx
PPTX
Python (Data Analysis) cleaning and visualize
PPTX
Presentation of Python Programming Language
PPTX
Integrating Python with SQL (12345).pptx
PPTX
VARIABLES AND DATA TYPES IN PYTHON NEED TO STUDY
20BCT23 – PYTHON PROGRAMMING.pptx
PYTHON Introduction 1Deep learning 2.pptx
Introduction of python Introduction of python Introduction of python
What is Paython.pptx
what-is-python-presentation.pptx
Unit2 input output
What is python-presentation FOR CLASS 10.pptx
python-presentation.pptx
Introduction to Python Programming language
Python Programming - Variables, Objects and Classes
uom-2552-what-is-python-presentation (1).pptx
uom-2552-what-is-python-presentationalllllll.pptx
uom-2552-what-is-python-presentation.pptx
Intro to python programming (basics) in easy language
Problem Solving and Python Programming PPT.This will be helpfull for first ye...
python-presentationpython-presentationpython-presentation.pptx
Python (Data Analysis) cleaning and visualize
Presentation of Python Programming Language
Integrating Python with SQL (12345).pptx
VARIABLES AND DATA TYPES IN PYTHON NEED TO STUDY
Ad

More from primeteacher32 (20)

PPT
Software Development Life Cycle
PPTX
Variable Scope
PPTX
Returning Data
PPTX
Intro to Functions
PPTX
Introduction to GUIs with guizero
PPTX
Function Parameters
PPTX
Nested Loops
PPT
Conditional Loops
PPTX
Introduction to Repetition Structures
PPTX
Input Validation
PPTX
Windows File Systems
PPTX
Nesting Conditionals
PPTX
Conditionals
PPT
Intro to Python with GPIO
PPTX
Variables and Statements
PPTX
Variables and User Input
PPT
Intro to Python
PPTX
Raspberry Pi
PPT
Hardware vs. Software Presentations
PPTX
Block chain security
Software Development Life Cycle
Variable Scope
Returning Data
Intro to Functions
Introduction to GUIs with guizero
Function Parameters
Nested Loops
Conditional Loops
Introduction to Repetition Structures
Input Validation
Windows File Systems
Nesting Conditionals
Conditionals
Intro to Python with GPIO
Variables and Statements
Variables and User Input
Intro to Python
Raspberry Pi
Hardware vs. Software Presentations
Block chain security

Recently uploaded (20)

PPTX
Principles of Inheritance and variation class 12.pptx
PPT
pwm ppt .pdf long description of pwm....
PDF
202s5_Luciano André Deitos Koslowski.pdf
PDF
MCQ Practice CBT OL Official Language 1.pptx.pdf
PDF
Shopify Store Management_ Complete Guide to E-commerce Success.pdf
PDF
servsafecomprehensive-ppt-full-140617222538-phpapp01.pdf
PDF
Sheri Ann Lowe Compliance Strategist Resume
PPTX
GPAT Presentation PPT and details about imp topics.pptx
PPTX
AREAS OF SPECIALIZATION AND CAREER OPPORTUNITIES FOR COMMUNICATORS AND JOURNA...
PDF
Blue-Modern-Elegant-Presentation (1).pdf
PPTX
Prokaryotes v Eukaryotes PowerPoint.pptx
PPTX
STS CHAP 4 human development as reflected
PPT
2- CELL INJURY L1 Medical (2) gggggggggg
PPT
NO000387 (1).pptsbsnsnsnsnsnsnsmsnnsnsnsjsnnsnsnsnnsnnansnwjwnshshshs
PDF
Career Overview of John Munro of Hilton Head
PPTX
mathsportfoliomanvi-211121071838 (1).pptx
PPTX
DPT-MAY24.pptx for review and ucploading
PPT
ALLIED MATHEMATICS -I UNIT III MATRICES.ppt
PPT
BCH3201 (Enzymes and biocatalysis)-JEB (1).ppt
PPTX
430838499-Anaesthesiiiia-Equipmenooot.pptx
Principles of Inheritance and variation class 12.pptx
pwm ppt .pdf long description of pwm....
202s5_Luciano André Deitos Koslowski.pdf
MCQ Practice CBT OL Official Language 1.pptx.pdf
Shopify Store Management_ Complete Guide to E-commerce Success.pdf
servsafecomprehensive-ppt-full-140617222538-phpapp01.pdf
Sheri Ann Lowe Compliance Strategist Resume
GPAT Presentation PPT and details about imp topics.pptx
AREAS OF SPECIALIZATION AND CAREER OPPORTUNITIES FOR COMMUNICATORS AND JOURNA...
Blue-Modern-Elegant-Presentation (1).pdf
Prokaryotes v Eukaryotes PowerPoint.pptx
STS CHAP 4 human development as reflected
2- CELL INJURY L1 Medical (2) gggggggggg
NO000387 (1).pptsbsnsnsnsnsnsnsmsnnsnsnsjsnnsnsnsnnsnnansnwjwnshshshs
Career Overview of John Munro of Hilton Head
mathsportfoliomanvi-211121071838 (1).pptx
DPT-MAY24.pptx for review and ucploading
ALLIED MATHEMATICS -I UNIT III MATRICES.ppt
BCH3201 (Enzymes and biocatalysis)-JEB (1).ppt
430838499-Anaesthesiiiia-Equipmenooot.pptx

Formatting Output

  • 3. DATA TYPE CONVERSION • Can control how variables are interpreted within the program: • Two types: • Evaluation • Code: eval(string) • Ex. eval(“51” + “52”) • eval( str1 ** str2) • test = eval(input(“Enter a num”)) • Conversion • Code: datatype(value/variable) • Ex. int(4.5)  4 • float(4)  4.0 • str(num)  “4”
  • 4. THE ESCAPE SEQUENCE • Used within a string to perform a specific task • Code: print(“”This is an example”n”)
  • 5. FORMATTING OUTPUT • Controls how the information is displayed: • size • Position • Justification • padding • number of digits • Dataytype • The format function formats a number, string, or both and returns the information as a string. • Code: format(variable, ‘format-specifier’)
  • 6. THE FORMAT FUNCTION  Code: print(format(item, ‘ ’)    
  • 7. THE FORMAT FUNCTION  Code: print(format(item, ‘ ’)