Variables and types
It is allowed
it is allowed that is using underscore "_" between two names for variable.
It is not allowed i.e using no underscore
Syntax for defining "floating point number"
Python is completely object oriented its not necessary to declare variables before using them and declare their type as we did in C.
Numbers
Python supports 2 types of numbers -
1) Integers : 1,2,5,45,2,42,522 etc
2) Floating point numbers. 2.32,43.22432,43.523, 3.653 etc
Also supports complex numbers and that will be explained in later time but not in here)
Syntax for defining "Integer"
firstint = 10 // you can use any name instead of "firstint" it can be paris, sandy anything but no keywords are allowed to take as variable name e.g. print = 4. Here you will get an error.
Secondly dont use any number before your variable name. i.e. you cant use 4sandy or 123gold, or 32train etc but it is allowed to use number after the variable name e.g train32, gold123 etc
It is allowed
it is allowed that is using underscore "_" between two names for variable.
It is not allowed i.e using no underscore
Syntax for defining "floating point number"
firstfloat = 3.1416
Strings
Strings are defined either with a single quote or a double quotes i.e " "(double quote) or ' '(single quotes)
myname = "bijoy" // double quote used
urname = 'forgot' // single quote used // " "(double quote) and ' ' (single quote) both are allowed
Where to use double quotes and where to use single quotes????
if you have to use apostropes in your sentence then use double quotes otherwise it will ignore single quotes
e.g. Here I'm using double quotes
but you will get error if you use single quote and use apostropes in your sentence.
No comments:
Post a Comment