Welcome to the official website of The Code NC Online School, Nigeria.


   PYTHON _ DATA TYPES AND BASIC SYNTAX

    CODE NC ACADEMY
   Created On: Mar 21st, 2023 5:25am



By the end of this lesson, the student should be familiar with some of the various data types in python. We would also be looking at the syntax for basic functions.


Title: PYTHON BASICS  Year: 2023


Hi.

Today, we should be looking at python data types.

In python, the basic data types are:
1. Numeric data types: int, float, complex
2. String data types: str
3. Sequence types: list, tuple, range
4. Binary types: bytes, bytearray, memoryview
5. Mapping data type: dict
6. Boolean type: bool
7. Set data types: set, frozenset

We shall focus on 1 & 2. The others might come up in an advanced class

NUMERIC DATA TYPES
int: Integer - whole numbers
float: Float - decimals, and is accurate up to 15 decimal places
complex: Complex - holds complex numbers




STRING DATA TYPES
str: String - a sequence of characters, maybe alphabets or numbers. Its usually enclosed in " "


BASIC SYNTAX
To display output we use the print command
print("Hello, World")

Sometimes, the data we want to display is stored in a variable. So we omit the quotation marks.
print(variable_name)

Remember that variable names are case sensitive. So Variable_name is not the same as variable_name. The difference is the capital letter V

Here are some rules for Python identifiers ?
1. Python Class names start with an uppercase letter. All other identifiers start with a lowercase letter.
2. Starting an identifier with a single leading underscore indicates that the identifier is private identifier.
3. Starting an identifier with two leading underscores indicates a strongly private identifier.
4. If the identifier also ends with two trailing underscores, the identifier is a language-defined special name.


Just like in virtually every programming language, python has reserved keywords - words that cannot be used as identifiers. This is because the words mean something else, and has a different function.

Here is a list of some of them:








REFERENCES


Click Here To Answer Questions On:
PYTHON _ DATA TYPES AND BASIC SYNTAX







Class Code:
Q76SA50Q




AUTHOR: NWEKE, CHIEME
EMAIL: codencsoftware@gmail.com
PHONE: 08037908912
SCHOOL: CODE NC ACADEMY
DEPARTMENT:
COURSE: COMPUTING
CLASS / LEVEL:

How Good Is This Lecture?
1 people rated this topic on average:
80.00 %
This page has been viewed: 382 times.
--
Zoom Meeting ID / Link: