CSE 1010 Lecture Notes - Lecture 5: Relational Operator
CSE 1010 verified notes
5/29View all
Document Summary
Cse 1010 - introduction to computer science and engineering. True and false are the only boolean values. The type is shown as A boolean value is the result of a relational expression. The double equal operator tests for equality: Relational operator example: (note: the (c) is called a centigrade) >>> temp = int(input( enter the temperature (c): )) This whole command is an assignment statement, but the temp < 0 is also the relational expression (you don"t need to know this difference for the exam) The if statement (also known as the conditional or choice statement) This statement is also known as a conditional statement. It has two basic forms: if condition: consequent if condition: consequent else: alternate. Remember to use indentation for this! (either four spaces or hit tab in idle) The consequent and alternate are groups of one or more statements.