Page 242 - CTS - CSA TP - Volume 2
P. 242

COMPUTER SOFTWARE APPLICATION - CITS




           # Print variables
           print(“Student Details”)

           print(“---------------”)
           print(“Name:”, name)
           print(“Age:”, age)
           print(“Height:”, height)

           print(“Is Student?”, is_student)
           Explanation:
           •  Variables (name, age, height, is_student) are declared with different data types (String, Integer, Float, Boolean).
           •  The print statements display the values of these variables.
           Output:


















           TASK 3: Multiple Assignments
           Code:
           # Example 3: Multiple Assignments
           # Multiple assignments in a single line
           x, y, z = 10, 20, 30

           # Print the variables
           print(“x:”, x)
           print(“y:”, y)
           print(“z:”, z)

           Explanation:
           •  Multiple variables (x, y, z) are assigned values in a single line.
           •  The print statements display the values of these variables.
           Output:



















                                                           227
                              CITS : IT & ITES - Computer Software Application - Exercise 122
   237   238   239   240   241   242   243   244   245   246   247