You are on page 1of 1
kS3 Computing Python Quick Reference Guide www.mrfraser.org, Reet Ace edad If input 1 is True AND input 2 is True, DO eR Te Yco Banoo output is True else output is False Ifinput 2is True OR input2is True, output is True else output is False VAT_RATE = 20.8 (CONSTANTS IN UPPER CASE Ifinput is True, output is False else — output is True eeu Greater than if totalcost >= 20 : Greater than 0 EXECUTED WHEN, postage = pias tier or equal to elif totalCost >= 10: Less than postage = 1.5 else : Less than Equal to Not equal to Wee LOOP COUNTER for x in range('2, 10, 2'): while distance > @ : total = total + x print ("Are we there yet?") distance -= 1 pi: Start Value (optional) CODE TO LOOP: 2: Stop Value (CODE TO LOOP Is INDENTED 3: Step Value (optional) JDENTED Es Assignment Return length of String Get character with index 3 (*h*) Concatenation (“Woohoooo! ") + Addition - Subtraction / Division // Floor Division s*2 Replication ("oohsoooWoohoooo") |’ urtiplication s-upper() Convert to upper case ("NOOHO000") | ¢ Remainder s.replace(" Replace characters ("Weeheeee") @

You might also like