#2 Python :- Numbers
I decide to begin my journey by learning Python First.
Now today is my first day for learning python
While starting to learn python i started with numbers :-
Topic 1:- Numbers :-
We can use python as calculator :- Best example you can do in cmd
Open cmd and type python:-
Then you can use python as calculator like use following commands
1. Addition:- 2+2 (press enter) = 4
2. Substration:- 5-2=3
3. Multiplication 2*3=6
4. Division 8/2 = 4
Its really funny for me to use it like calculator wao now i am able to calculate using python it make it really interesting to learn and i am easily able to code. Yah! it really too easy now.
Now, we can also use python in following ways:-
5. To Find Remainder :- Yes, by using % symbol we can calculate remainder see how
a) 8%3=2
then by this way we can easily find remainder of any numbers.
Do you know?
Finding remainder make it easy for us to know about number is even or odd , also prime or not? etc. How?
to know number is easy or not simple use :- (number)%2
If result is 0 , then it is even
If result is 1 , then it is odd.
6) To find the square or cube of number also the nth power of numbers.
a) Sqaure:- i) 2**2 =4 (** denotes is raise to power)
ii) 3**2=9
b) Cube:- i) 2**3=8
ii) 3**3=27 etc.
c) nth power :- (number)**N (where N denotes the nth power)
These are the following things we can do with python . If you know more you can comment below...
Gurpreet Singh
Comments
Post a Comment