CMPUT174 Lecture Notes - Lecture 14: Code Segment, Operand

160 views3 pages
ceruleanzebra152 and 30 others unlocked
CMPUT174 Full Course Notes
25
CMPUT174 Full Course Notes
Verified Note
25 documents

Document Summary

Q1 the code for the decide_continue method from poke version 1 is given in the top pane. Write the code for the decide_continue method in poke version 2 in the bottom pane. # - self is the game to update pass. # - self is the game to update if self. small_dot. intersects(self. big_dot): self. continue_game = false. The code now has a conditional statement instead of the pass statement. The conditional statement evaluates if the dots have intersected. If the condition evaluates to true, then self. continue_game is bound to false. Q2 list every operator(if any) and type of operand for the following code segment: Q3 replace the if statement in the given code segment with a single return statement so that the two code segments produce the same result. Equivalent code segment def iscold(temp): if temp <= 10: return true else: Def iscold(temp): return temp <= 10 return false.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents