Web Design My Hobby
Wednesday, 7 September 2022
Saturday, 27 August 2022
Saturday, 25 April 2020
Tuesday, 31 March 2020
Date types in python
There are various data types in Python. Some of the important types are listed below.
- Number
- String.
- List
- Tuple
- Set
- Dictionary
Thursday, 26 March 2020
while loop practice problems python
Example
Print i as long as i is less than 6:
i-> start from 1. While -> condition (Print i as long as i is less than 6 ). Print () -> display.
I + = 1 -> every round (loop)add 1
i-> start from 1. While -> condition (Print i as long as i is less than 6 ). Print () -> display.
I + = 1 -> every round (loop)add 1
i = 1
while i < 6:
print(i)
i += 1
while i < 6:
print(i)
i += 1
For loops and some exercises
For loops are used for sequential traversal. For example: traversing a list or string or array etc. In Python, there is no C style for loop, i.e.,
for (i=0; i<n; i++). There is “for in” loop which is similar to for each loop in other languages.
for var in iterable
# statements
In Python, iterable means an object can be used in iteration.
Subscribe to:
Posts (Atom)



