Python-Literals

Wed 12 November 2025
#  created : 20250112
#  https://www.scientecheasy.com/2022/09/literals-in-python.html/
#  python literals
# Types of literals

# String literals
# Numeric literals
# Boolean literalsb
# Literal Collections
#  single line string
sigle_line_string = 'Welcome \
to \
Scientech Easy'
print(sigle_line_string)
Welcome to Scientech Easy
multi_line_string = '''Welcome \
to \
Scientech Easy, \
Dhanbad'''
print(multi_line_string)
Welcome to Scientech Easy, Dhanbad
#  Numeric literals
decimal_int = 100        
negative_int = -45
print(f'decimal literals :{decimal_int}')
print(f'negative literals :{negative_int}')
decimal literals :100
negative literals :-45
positive_float = 3.14   
negative_float = -0.001
print(f'positive floating literals :{positive_float}')
positive floating literals :3.14
print(f'positive negativ literals :{negative_float}')
positive negativ literals :-0.001
#  Boolean literals
greater_than = 10 > 5    
less_than = 3 < 1        
equal_to = 4 == 4        
not_equal_to = 7 != 7 
print(greater_than)
print(less_than)
print(equal_to)
print(not_equal_to)
True
False
True
False


Score: 15

Category: python-basics