Welcome Back :)
This is a Python refresher. Please pair up and complete this with a friend.
Variables and Casting
What would be the output of this program? intNumber = 5 intNumber = intNumber + 10 strNumber = str(intNumber) strNumber = strNumber + "23" intNumber = int(strNumber) intNumber = intNumber MOD 5 intNumber = intNumber + 9 intNumber = intNumber / 5 intNumber = int(intNumber) print(intNumber)
What is wrong here?
intTemp = int(input("Please enter the temp: ")) if intTemp > 5 then print("Oooooo it is a bit chilly. You should definitely wear a coat, hat and gloves") elseif intTemp > 16 then print("You had better put a jumper on!") elseif intTemp > 25 then print("Oh how lovely. You can go out in a T-shirt today")
What is wrong here?
intFavNum = int(input("Please guess my favourite number: ")) while intFavNum != 7 print("Try again!") endwhile print("Hurray you cracked it.")
What is wrong here?
#My code will output the contents of this array. #What is wrong Rainbow = [“red”, “yellow”, “orange”, “green”, “blue”, “indigo”, “violet”] for i =1 to 7 print(Rainbow[i]) next i
What will these print statements produce?
strName = "Fred Bloggs" print(strName.substring(0, 3)) print(strName.substring(5, 6)) print(strName(10, 1))
What will the output be?
myArray = ["Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"] print(myArray[3])