What is the difference between = and == in python?
Answers were Sorted based on User's Feedback
Answer / nashiinformaticssolutions
While // denotes floor division (result is an integer), / denotes precise division (result is a floating point value). For instance:
5//2 = 2 5/2 = 2.5
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / nashiinformaticssolutions
- `/` is the true division operator that always returns a float result, even if both operands are integers.
```python
result = 7 / 3 # Returns 2.3333...
```
- `//` is the floor division operator, which returns the largest integer less than or equal to the result.
```python
result = 7 // 3 # Returns 2
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / glibwaresoftsolutions
- `/` is the true division operator that always returns a float result, even if both operands are integers.
```python
result = 7 / 3 # Returns 2.3333...
```
- `//` is the floor division operator, which returns the largest integer less than or equal to the result.
```python
result = 7 // 3 # Returns 2
```
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / Vishal Srivastav
The '=' operator assigns a value to a variable. The '==' operator compares two values for equality.
| Is This Answer Correct ? | 0 Yes | 0 No |
How would you convert a string into an int in python?
How is python different from java?
What is pypi repository?
What does ** (double star/asterisk) and * (star/asterisk) do for parameters?
What are *args and *kwargs?
Does python do until loop?
What is anonymous function or lambda function?
Does python allow you to program in a structured style?
What happens when you execute python == python?
What are negative indices?
Is python better than matlab?
In python, can you name the data science and machine learning libraries?