Introduction 02

Consider python code:

str_vowels = "aeiou"
for value in "Lets learn python":
    if value in str_vowels:
        print(value)

system output:

e
e
a
o

Python initialize dynamically for String, Integer, Float or Double.  String characters are enclosed either with " " or ' ' ( double or single quotes). 

Reference from >> https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex

String   :  "aeiou" or "1234.90" or 'python003'

Integer   :  12345

Float      :  12.004 or 0.00023 or 234.5f

Longint :  1234L


Errors on way while code:

Bad code mistakes leads to unnecessary errors, good way is to understand each Types of python variables.

Error-Code 01

str_vow = AEIOU
print(str_vow)


system ouput:
...
NameError: name 'AEIOU' is not defined


This cause due to String declaration is missing ' ' or " " quotes, is shown as NameError.

GoTo Next Page>> DataTypes-03

Comments

Most popular

Learn Python Basics