Numbers Flashcards

1
Q

Why is Python one of the most powerful languages when it comes to manipulating numerical data?

A

It is equipped with

-support for several types of numbers,

-along with utilities for performing computations on them.

Python’s utilities enable you to process and
analyze numerical data effectively.

CHAT GPT 3

Python provides tools and functions that allow you to carry out various mathematical calculations and operations on data.

These utilities help you manipulate numbers, perform mathematical operations like addition, subtraction, multiplication, division, and more complex tasks like trigonometric functions, logarithms, and statistical analysis.

In essence, Python’s utilities enable you to process and
analyze numerical data effectively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the main types of numbers in Python?

A

The main types of numbers in Python are:

-Integers
-Floating-point numbers,
or FLOATS
-Complex numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Define Integers

A

The integer data type is comprised of all the positive and negative whole numbers.

Ex:
+8
-12

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define FLOATS or Floating-point numbers

A

FLOATS, refer to positive and negative decimal numbers.
Ex:
+1.23
-5.29

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define a complex number

A

Complex numbers are numbers made up of a real and an imaginary part.

Ex:

10+20j
2.5-18.2m

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Write a code to print the following integers:

+9 and -15

A

print(9)
print(-15)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you assign an integer to a variable? code using 23, -199, +27, -34

A

How do you assign an integer to a variable?

  • Code using 23, -199, +27, -34
    num=123
    print(num)
    num=-16
    print(num)

or
num = 123456789 # Assigning an integer to a variable
print(num)
num = -16000 # Assigning a new integer
print(num)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Create a code for the following numbers
1.34
-2.89
45.20
-3.16
print(1.00000000005) # A positive float
print(-85.6701) # A negative float
flt_pt = 1.23456789
print(flt_pt)

A

print(1.00000000005) # A positive float
print(-85.6701) # A negative float
flt_pt = 1.23456789
print(flt_pt)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Can you write a code that assigns a float to a variable? The floats will be:
[5, -3.14, 10, -2.71828, 7.5,]
[-2, 4.5, -10, 0.75, -6.2]

chatGPT:
Assigning ten mixed positive and negative numbers in a single line:
flt_pt = 1.23456789
print(flt_pt)

A

EX:

print(1.00000000005)
print(-85.6701)

flt_pt = 1.23456789
print(flt_pt)

Output:
1.00000000005
-85.6701
1.23456789

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the template for making a complex number?

  • complex(real, imaginary)
  • print(complex(10, 20))
    print(complex(2.5, -18.2))
    complex_1 = complex(0, 2)
    complex_2 = complex(2, 0)
    print(complex_1)
    print(complex_2)

-Output:
(10+20j)
(2.5-18.2j)
2j
(2+0j)

A

complex_1 = complex(0, 2)
complex_2 = complex(2, 0)
print(complex_1)
print(complex_2)

Output:
(10+20j)
(2.5-18.2j)
2j
(2+0j)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly