# Python: Check whether an integer fits in 64 bits

## Python Basic: Exercise-127 with Solution

Write a Python program to check whether an integer fits in 64 bits.

**Sample Solution:**

**Python Code:**

```
# Assign the integer value 30 to the variable 'int_val'.
int_val = 30
# Check if the bit length of 'int_val' is less than or equal to 63.
if int_val.bit_length() <= 63:
# Print the bit length of the minimum 64-bit signed integer (-2^63).
print((-2 ** 63).bit_length())
# Print the bit length of the maximum 64-bit signed integer (2^63 - 1).
print((2 ** 63).bit_length())
```

Sample Output:

64 64

**Flowchart:**

**Python Code Editor:**

**Previous:** Write a Python program to get the actual module object for a given object.

**Next:** Write a Python program to check whether lowercase letters exist in a string.

**What is the difficulty level of this exercise?**

Test your Programming skills with w3resource's quiz.

**Weekly Trends**- 100 Python Projects for Beginners with solution
- Mastering NumPy: 100 Exercises with solutions
- SQL Tutorial
- SQL Inner Join
- Python Exercises, Practice, Solution
- Python Interview Questions and Answers: Comprehensive Guide
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript HTML Form Validation
- Java Collection Exercises