0% found this document useful (0 votes)
18 views

Variables and Identifiers: The Representation of Character Values

Lesson 9

Uploaded by

raasiboi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Variables and Identifiers: The Representation of Character Values

Lesson 9

Uploaded by

raasiboi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Variables and Identifiers

Art of Computing -> Algorithms -> Information Theory -> Computer Hardware
Data representation -> Hexa, Octal, Decimal and Conversions -> Boolean Logic ->
gates -> half bit full bit adders -> user application operating system hardware ->
Programming languages
Syntax -> compilers vs interpreters -> python -> basic arithmetic ->

Quiz tmrw

The representation of Character Values


Many Options introduced!
Unicode encoding scheme is most common now
Unicode has many variants, utilizing between 8 and 32 bits for each character
Python uses UTF-8, an 8-bit encoding compatible with ASCII
Over 100k Unicode defined characters for many of the languages of the world
4 billion or million
124 vs 124
Numeric Value

String Value

01111100

001100010011001000110100

124

The ord function gives the UTF-8 ASCII encoding of a character


For example,
Ord(A)

is

65

The chr function gives the character for a given encoding value
Chr(65)

is

Control Characters!
Control characters are special characters that are not displayed
They control the display of output

They dont have a corresponding keyboard character..


We use a combination of characters: escape sequence

Backslash(\) is the escape character in Python


E.g., \n is the newline control character, that begins a new screen line,

Print(Hello\nJennifer Smith)
>Hello
>Jennifer Smith

Built-in function format controls how strings are displayed,


Format(value, format_specifier)
Where:
Value is the value to be displayed,
Format_specifier can contain combination of formatting options
Formatted strings are left-justified by default
To center a string the ^ character is used:
Format(Hello, ^20)

You might also like