Basics
variables and assignment
Variable can be combination of only letters and numbers and underscore "_". Can't start with a number. Variable names are case sensitive. Also, variable cannot have reserved words in python.
Types:-
- Integer: stores integer values, 1, -12 etc. "x=1".
- Float: stores floating values like 1.0, 1.2e-12 etc. "x=-12.56","x=float(1)".
- Complex: stores complex numbers. "x=1e12 + 12.65j","x=complex(1.5)".
- string: stores text in form of string of letters. "x="this is a string of words"".
"x=1" is same as "x = 1". Spaces in the beginning of a line has a meaning.
Input and output statements
- print(x),print("the value of x is",x," and the value of y is",y)
- x=input("the value of x is:")
No comments:
Post a Comment