Numbers

Numbers is a buil-in data type in python. We have three formats of numbers in python.

  1. int
  2. float
  3. complex

int type

int stores positive or negative whole numbers.

float type

float stores positive or negative decimal numbers or fractions.

complex type

complex type stores numbers with real part and j in imaginary part in the form a + bj.

Note: You can not apply type casting on complex numbers.

Generating Random Number

We can generate a number in a given range using a function given below;

Practice Exercises

Complete these exercises to reinforce your learning and earn XP

Sign in to track your progress and earn XP!
Exercise 1 of 2Easy

Which of the following is a best practice in programming?

10 XP~2 min
Exercise 2 of 2Easy

Code that is easy to read and understand is called ___ code.

10 XP~2 min