Skip to content

Commit aee2e5e

Browse files
committed
Update f_strings.md
Added a couple code fixes
1 parent b6597b5 commit aee2e5e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎f_strings.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ Output:
8181
Comma separated: 1,234,567.89123
8282
Rounded to 2 decimals: 1234567.89
8383
Scientific notation: 1.23e+06
84-
Binary: 1234568 -> 100101011010000001000
85-
Hexadecimal: 12d6808
84+
f strings can print() integers in hex or binary format, not floats.
85+
Hexadecimal: 1234567 -> 12d687
86+
Binary: 1234567 -> 100101101011010000111
8687
```
88+
<small>(*Code correction updates on "Formatting Numbers" section, 2025-10-21 McCright*)</small>
8789

8890
---
8991

@@ -291,7 +293,7 @@ Use { and } to display curly braces.
291293
### 16. Lambda Functions Inside F-strings
292294

293295
```python
294-
square = lambda x: x 2
296+
square = lambda x: x ** 2
295297
print(f"5 squared is {square(5)}")
296298
```
297299

@@ -300,6 +302,7 @@ Output:
300302
```
301303
5 squared is 25
302304
```
305+
<small>(*Code correction updates on "Lambda Functions Inside F-strings" section, 2025-10-22 McCright*)</small>
303306

304307
---
305308

0 commit comments

Comments
 (0)