Answers for "F-Strings decilamal places"

0

F-Strings decilamal places

#!/usr/bin/env python3

val = 12.3

print(f'{val:.2f}')
print(f'{val:.5f}')
Posted by: Guest on April-29-2020
0

F-Strings decilamal places

#!/usr/bin/env python3

s1 = 'a'
s2 = 'ab'
s3 = 'abc'
s4 = 'abcd'

print(f'{s1:>10}')
print(f'{s2:>10}')
print(f'{s3:>10}')
print(f'{s4:>10}')
Posted by: Guest on March-19-2021
0

F-Strings decilamal places

#!/usr/bin/env python3

a = 300

# hexadecimal
print(f"{a:x}")

# octal
print(f"{a:o}")

# scientific
print(f"{a:e}")
Posted by: Guest on March-19-2021
0

F-Strings decilamal places

#!/usr/bin/env python3

for x in range(1, 11):
    print(f'{x:02} {x*x:3} {x*x*x:4}')
Posted by: Guest on March-19-2021
0

F-Strings decilamal places

#!/usr/bin/env python3

import datetime

now = datetime.datetime.now()

print(f'{now:%Y-%m-%d %H:%M}')
Posted by: Guest on March-19-2021

Code answers related to "F-Strings decilamal places"

Python Answers by Framework

Browse Popular Code Answers by Language