Python has a control flow tool - if statements which may contain zero or more elif parts.
We will understand this flow by doing some exercises-
So keep practicing by your own with above examples in your notebook and comment if you face any issue.
We will understand this flow by doing some exercises-
- Make a list of names that includes at least four people.
- Write a if test that prints a message about the room being crowded, if there are more than three people in your list.
- Modify your list so that there are only two people in it. Use one of the methods for removing people from the list, don't just redefine the list.
- Store your if test in a function called something like crowd_test and call that function.
- Add some names to your list, so that there are at least six people in the list.
- Modify your tests so that
- If there are more than 5 people, a message is printed about there being a mob in the room.
- If there are 3-5 people, a message is printed about the room being crowded.
- If there are 1 or 2 people, a message is printed about the room not being crowded.
- If there are no people in the room, a message is printed about the room being empty
So keep practicing by your own with above examples in your notebook and comment if you face any issue.
very nice blog, I have read whole blog. Content is so valuable and informative, Keep on posting.
ReplyDeleteOnline Java Course in Kolkata, Mumbai, Delhi and many other cities in India.
This comment has been removed by the author.
ReplyDeleteGreat blog, I liked your way to convincing , IT courses are high in demand. Students who want to build a successful career. They should Choose IT courses. If you want to build your career in Java, You can read this Java: A Secure Programming Language for Today's Market
ReplyDelete