feat: added examples_tutorials

This commit is contained in:
xpk
2025-11-26 23:20:41 +08:00
parent 96ef5cb42e
commit 9d044c20c9
16 changed files with 201 additions and 70 deletions
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
# Main function
def main() -> None:
"""
Number formatting in f-string using format specifiers
The following prints will output
314%
3.14
12,345
00012345
12345
len(str(var1)) = 8
"""
var1: float = 3.141516
var2: float = 12345
print(f"{var1: .0%}")
print(f"{var1: .2f}")
print(f"{var2: ,}")
print(f"{var2: 09}")
print(f"{var2: >10}")
print(f"{len(str(var1)) = }")
# Call main function
if __name__ == '__main__':
main()