Variables:-
variables are named containers in programs that store data and manipulate many times throughout the execution of the program.
Example:-
- x = 5
- y = "John"
- print(x)
- print(y)
here x and y are variables and 5 and "John" value assigned to it.
Data Types:-
Data Type help to Classify what kind of information we are storing. Data type includes number, Boolean, String, etc.
Example:-
- x = 5
- print(type(x))
Conditional Statements:-
Conditional statements evaluate a condition to be true and false. and based on results do a different task.
Example:-
- a = 200
- b = 33
- if b > a:
- print("Don't follow asrcoding")
- elif a == b:
- print("Think about following asrcoding")
- else:
- print("Follow asrcoding")
in the above example, three conditional statements are their (if), (elif), and (else).
Loop:-
Loop is a sequence of instructions that is repeated continuously until certain condition is reached.
Examples:-
While Loop Example:-
- i = 1
- while i < 6:
- print(i)
- i += 1
For loop Example:-
- fruits = ["apple", "banana", "cherry"]
- for x in fruits:
- print(x)
Functions:-
Functions is a block of code that is designed to perform a particular task which only runs when it is called. Parameters are passed into functions to return some data.
Examples:-
Creating a Function:-
- def asr_coding():
- print("Hello from a CodingGuys (ascrcoding)")
Calling a function:-
- def asr_coding():
- print("Hello from a CodingGuys (asrcoding)")
- asr_coding()
Hope this article helps you. If you have any suggestion Drop it in Comment Section and Join Our Family by Clicking Subscribe Button and For More Article/Post Like this Join us on:-
Join Our Channels:- Free Online Course & Government / Private Jobs Links
Other Important Links:-
No comments:
Post a Comment
Please do not enter spam link in the comment box.