You are on page 1of 8
and accordingly SS ae : The general form of decision-making structure ae ea any non-zero and cei vas null, it is assumed as a FALSE value. z . Python provides the following types of decision-making a © if statement @ if..clse statement © clif statement @ nested if statements own in the flowchart (Fig 17 ; as TRUE, and if itis either zor, | : - If condition, IF STATEMENT Roe a | eae The if statement contains a logical expression. | By using this expression, the data are compared and a decision is made based on the result of the comparison (Fig. 11.1). , Fig 11.1 Flowchart of If the expression evaluates to TRUE, the block of statements) inside the i is executed. If expression evaluates to FALSE, the first set of codes after th the if statement(s) is executed. Example 1: Write a program to check if the number is positive and print a m Ask the user to input Bo pri me no iis postive py - Ox/Pytnon/peine the ne if ig od a number. Ble fen format bn Option Window Help # if the number is # Tf the number is positive, print 3 message positive, print a message num = float (inpat mumber: *)) if mm > 0: num = float print (” ve number*) (input (* a number: * if num > number”) IF...ELSE STATEMENT ! In the last program, if the number was not If condition Positive, no output was displayed. is false An else statement can be combined with if statement that will execute if the condition resolves FALSE value (Fig. 11.4). If condition Syntax: is true Y if expres statemen else i statement Example 2: Write a program to check if the number is positive or negative and print an appropriate message. Ask the user to input a number. ’ Fig. 11.4 Flowchart of if..else statemen Output # Program to check Baryon 380 et eo. x i le Eat Shell Debug Options Window Help — eee ooen is Be ee gece (eags/v3,8.0;faS19t6, Oct 14 2019, 19:21'29) OSC v.T5i6 positive or negative PEE ane 9s seu or Lcamel* for nore inert and display an appropriate message reser: ;/rpon/if ve member 15 positive OF DAgAtive.py @ nuaber: 15 4 the nunber {s positive or negative.py =~ Fig. 11.5 The output screen “Negative number”) IF...ELIF...ELSE STATEMENT The elif statement allows you to check multiple conditions for True (Fig. 11.6). It executes a block of code as soon as one of the conditions evaluate to true. ‘elif’ is a shortened way of saying ‘else if’. Similar to the else, the elif statement is optional. tatement (8) False eexpreesion2: pracement (5) True False ge: e expressions jeatement (5) Eno Je 3: Write a program to c heck if eS umber is zero, positive or negative. oe : en, print an appropriate message M Is0, ask the user to input a number. program to check the input of a number and check Humber is positive or negative or zero and disp propriate message Fig. 11.6 Flow chart of if. eli...else statement if lay an 3m float (input ("Ent a mbe Tye num > Og print ("Positive number”) Bie mum == (0 print ("Zero” else: print ("Negative number” Output: DB Pinon 280 She Dox fe fot Se Deben Opters Wow tp ce Ha Fare, 3O:B1vFB) (WHE v-19H6 37 BEE 3.8.0 (eags/¥).6.0:fa91946, pore infomation Cnvel)} on wind? siicense" for Gmeetidape. rcoprright*, Teredits” or DD cans: Dz /ytnca/eneck Lf the member is pantsive oF aegning OTST py Fneer number: 33 B7E oes, pyfersnen/check 41 tae member ts veuicire © pegative of 2250.0Y ~ OF eve meee: fost oe too ated Pysotant: D:/Pytbs Fig. 11.7 The ouput screen INTRODUCTION Ai if there is a form and you can easil Ming the data in Datasheet View? You can create a form in Access 2016. A form is a data Enter, change and view the data in a database. CREATING FORMS USING THE FORM WIZARD To create a form for a table, follow these steps: Step 1: On the Create tab, in the Forms group, =Step 1 iy enter data of students or books iMsteag base object. It allows you to select Form Wizard (Fig. 5.1) Fig. 5.1 Form Wizard option in Create tab The Form Wizard dialog box appears (Fig. 5-2). Fig. 5.2 Form Wizard dialog box Step 2: Select the table from the Tables/Queries drop-down list box. Step 3: Click the Add All >> button to select all the fields under the Selected Fields |ist Step 4: Click the Next button (Fig. 5.3), Step 5: Select the desired layout from the options and click te NEXt button (Fig. 5.4). the form name in ck the Finish button js created. By default, splays the first Step 8: Click the New (blank) record button in the Reco! Navigation bar to open anew blank record (Fig. 5-6)- The Record Navigation bar shows the number of records in a table. It also provides numerous navigation buttons to view the records. the details of the the form. CREaq; Tables ING A TABLE IN HTML vee to arrange and organize content. You have already learn, m™, : ; Nt to, format in rrTny Seles 9 Microsoft Word. Data can also be displayed in 9 tay, z ar buy} © Create tables in HTML, the following tags are used. Table 8.1 Tags used to create tables in HTML poe aien It creates the structure of a table. It sets a column heading in a table. The contents of the. heading are displayed in bold. It.creates a row ina table. ~~ Itstores data ina cell. It can contain HTML elemengs<9~ text, images, lists and other tables. The default alignmeny "a Of contents is left but can be changed using the align attrib It gives the caption or title to a table. It must be inserteg —~ immediately after the tag.A table should ha, ‘ more than one caption. Header Row 1 Cell 1 Row 1 Cell 2 < Row 1 Cell 3 _ «tr «td> Row Cell 1 ta etd> Row 2_Cell td Row 1 poe? yer @ tobientm x Be Be ¢ Cc ® File | DyHTML%20Codes/table.htm bod eo Column1 Header Column? Header Column3 Header Row! Celll Row 1_Cell2_— Row 1_Cell 3 Row2 Cell] Row2 Cell2 — Row2_Cell 3 Fig. 8.1 Output pid you notice that the table created does not have a border? ATTRIBUTES OF TAG ~cable> tag defines a table in an HTML document. The attributes of gre listed in Table 8.2. Table 8.2
tag attributes Eee NTU re te) “
attributes cellpaddin, 8 and cellspacing. Beeeteee towed By default, table headings are bold ang Ind centre aligned. © wiletecernin 4 > © © Ae Da mMNZICcdmnabi2o%er Row Cell? Row2_cell Row 2 Cell2 Fig. 82 Cod - : : Fig. 8.3 Output

You might also like