29 lines
673 B
Python
29 lines
673 B
Python
import math
|
|
|
|
#Integers
|
|
someInteger = 3
|
|
someInteger2 = 456
|
|
|
|
#Floats
|
|
someFloat = 7.
|
|
someFloat2 = 78.9
|
|
dollarAmount = 696.05
|
|
piFloat = math.pi
|
|
|
|
#Basic Print
|
|
print("Basic Print")
|
|
print(someInteger, someFloat2)
|
|
print(someInteger2, piFloat)
|
|
|
|
# formatted Print without print spec
|
|
print("Formatted Print without print spec")
|
|
print(f"{someInteger} {someFloat2}")
|
|
print(f"{someInteger2} {piFloat}")
|
|
|
|
# formatted Print with print spec
|
|
# Note - 8.6f means format a float with a minimum
|
|
# of 8 spaces wide and 6 places to the right of the decimal point.
|
|
print("Formatted Print with print spec")
|
|
print(f"{someInteger:5d} {someFloat2:6.2f}")
|
|
print(f"{someInteger2:5d} {piFloat:8.6f}")
|
|
|