Num1 = 50 # define Num1 as 50
Num2 = Num1 % 9 + 15  #  5 + 15 = 20, num2 = 20
Num3 = Num2 / Num1 + ( Num2 * 2 ) # 20/50 + (20*2) = 20/50 + 40 = 40.4 = num3
Num4 = Num3 + Num1 / 5 - 10 # 40.4 + 50/5 - 10 = 40.4 = num4
Result = Num4 - Num2 # 40.4 - 20 = 20.4 = Result --> the result should be 20.4
print(Result) # checking work
20.4
Num1 = 10 # set Num1 as 10
Num2 = Num1 % 3 * 4 # 10/3 is 3R3 --? 3*4 = 12 --> Num2 = 12
Num1 = Num2 # Num1 = 12
Num3 = Num1 * 3 # 12*3 = 36 --> Num3 = 36
Result = Num3 % 2 # 36/2 = 18R0 --> Result = 0
print(Result) # checking work
0
valueA = 4 
valueB = 90
valueC = 17
valueB = valueC - valueA # 17-4 = 13 --> valueB = 13
valueA = valueA * 10 # 4*10 = 40 --> valueA = 40
if valueB > 10: # this condition is met, since valueB = 13 and 13>10
    print(valueC) # it should print 17
17
type = "curly"
color = "brown"
length = "short"
type = "straight" # changes type from curly to straight
hair = type + color + length
print(hair) # should print straight brown short
straightbrownshort

Strings Hacks

Find the result of the following problems. Then convert the pseudocode to working python code using your knowledge of python string operators.

Noun = "MinYoongi" 
Adjective = "handsome" 
Adjective2 = "Very" 
Verb = "is" 
abrev =  Noun[3:9] # pseudocode: subtring(Noun, 1, 7) 
yoda = Adjective2 + " " + Adjective + " " + abrev + " " + Verb + "." # pseudocode: concat(Adjective2, " ", Adjective, " ", abrev, " ",Verb, ".") 
print(yoda) # pseudocode: display[yoda] # should print "Very handsome Yoongi is."
Very handsome Yoongi is.
# cookie = "choclate" 
# cookie2 = "rasin" 
# len1 = len(cookie) / 2 
# len2 = len(cookie2) * 45 
# vote1 = (cookie, "vote", len2) 
# vote2 = (cookie2, "vote", len1) 
# votes = concat(vote1, " ", vote2) 
# display[votes]

cookie = "chocolate" 
cookie2 = "raisin" 
len1 = (len(cookie) / 2)
len2 = (len(cookie2) * 45)
vote1 = (cookie + " " + "vote" + " " + str(len2)) 
vote2 = (cookie2 + " " + "vote" + " " + str(len1)) 
votes = vote1 + ", " + vote2
print(votes)
chocolate vote 270, raisin vote 4.5