# SCRIPTS TEXT basicΒΆ

```# -*-Python-*-
# Created by bgrierson at 01 Nov 2015  16:24

print('Hello world!')

# Define a number
a = 1.0

# Print the number
print('The number')
print(a)

# Print the number as a string
print('The number as a string')
print(str(a))

###############
# Using "%"
###############

# Format the number as a string
print('The number as a string in a string')
print('a=%s' % str(a))

# Format the number (float) as an int.
print('The number in a string as an int')
print('a=%i' % a)

# Format the number as a string from an int.
print('The number in a string as a string from an int')
print('a=%s' % str(int(a)))

###############
# Using .format
###############
# Free-format
print('The number in free format using .format')
print('a={}'.format(a))

# Strict format says take first element (0th element as 0:) and
# format as a float with two decimals (.2f)
print('The number as a strict format float with two decimels')
print('a={0:.2f}'.format(a))

print('The number as a strict format scientific with four decimels')
print('a={0:.4e}'.format(a))
# Strict format as an int with two places leading zeros
print('The number as a strict format int with leading zeros')
print('a={0:0>2d}'.format(int(a)))

# Strict format with sign
print('The number as a strict format float with its sign')
print('a={0:+.2f}'.format(a))

# Format the number as a percentage with two decimals
print('The number as a strict format percentage with two decimals')
print('a={0:.2%}'.format(a))
```