Unit 2 | BP101T | Basic of Python Programming for Pharmaceutical sciences
CHAPTER 2: CONTROL STRUCTURES AND FUNCTIONS 2.1 Introduction to Control Structures In the previous chapter, we learned the basic concepts of Python programming, including variables, data types, input and output, operators, strings, libraries, and packages. In this chapter, we will learn how Python makes decisions, repeats instructions, and organizes code into reusable blocks using functions. In a Python program, statements are normally executed one after another, from top to bottom. However, real-world programs often require more flexibility. A program may need to make a decision based on a patient's temperature, repeat a calculation for several medicines, or perform the same operation multiple times. Python provides control structures to manage the flow of program execution. What are Control Structures? Control structures are programming statements that determine the order in which instructions are executed in a program. They allow a program to: Make decisions based on conditi...