Working with Primitive Data Types

Practice Labs Module
Time
18 minutes
Difficulty
Intermediate

Welcome to the Working with Primitive Data Types Practice Lab. In this module, you will be provided with the instructions and devices needed to develop your hands-on skills: Configuring and running scheduled tests.

Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Overview

Introduction

Welcome to the Working with Primitive Data Types Practice Lab. In this module, you will be provided with the instructions and devices needed to develop your hands-on skills.

  • Configuring and running scheduled tests

Learning Outcomes

In this module, you will complete the following exercise:

  • Exercise 1 - Working with Primitive Data Types

After completing this lab, you will be able to:

  • Create a program to store and print data of types string, integer, float, and boolean
  • Run the program in both script and interactive mode using the IDLE environment

Exam Objectives

The following exam objective is covered in this lab:

  • 1.1 Evaluate an expression to identify the data type Python will assign to each variable

Lab Duration

It will take approximately 15 minutes to complete this lab.

Exercise 1 - Working with Primitive Data Types

In a programming language, data type is an entity that determines the type of data used in the programs. Primitive or the most basic data types are frequently used in programs. Similar to other programming languages, primitive data types are used in Python also. These are string, integer, float, and boolean. You need not explicitly mention the data types in Python programs. Data types are dynamically derived when you assign values to it. You will learn more about the dynamic derivation feature of Python data types in this module’s tasks.

Python is an interactive, object-oriented, high-level, and user-friendly programming language. The Integrated Development Environment (IDE) of Python is called IDLE. There are two modes in IDLE - interactive and script. The Python Shell window is the interactive mode and the Editor window is the script mode.

In the interactive mode, you get immediate output for every code typed at the prompt. However, you cannot save the typed code in a program file.

In the script mode, you can write a block of code, save it as a .py file, and execute it. The output of the .py file is displayed at the Shell prompt. You can reuse the stored .py file and make necessary changes whenever required.

In this exercise, you will learn to write Python programs in both script and interactive mode, and execute it respectively. In the programs, you will declare variables of primitive data types, assign values to it, and print the values.

Learning Outcomes

After completing this exercise, you will be able to:

  • Create a program to store and print data of types string, integer, float, and boolean
  • Run the program in both script and interactive mode using the IDLE environment
Learning Partner
Comprehensive Learning

See the full benefits of our immersive learning experience with interactive courses and guided career paths.