range(6) # => [0, 1, 2, 3, 4, 5] range(1, 6) # => [1, 2, 3, 4, 5] range(1, 6, 3) # => [1, 4] for loop Method 1 - for item in list:for item in list: print itemMethod 2 - iterate through indexes:for i in range(len(list)): print list[i] nested n = [[1, 2, 3], [4, 5, 6, 7, 8, 9]] # Add your function here def flatten(lists): result = [] for numbers in lists: for number in numbers: result.append(numbe..
Problem: Cisco packet tracer 6.2 student doesn't properly work.Solution: Use latest version of packet tracer which is 7.1.1Temporary solution: Make virtual machine and save empty file. copy to host machine and use.Temporary solution 2: downgrade java to version 7
get score letter fromstudent list lloyd = { "name": "Lloyd", "homework": [90.0, 97.0, 75.0, 92.0], "quizzes": [88.0, 40.0, 94.0], "tests": [75.0, 90.0] } alice = { "name": "Alice", "homework": [100.0, 92.0, 98.0, 100.0], "quizzes": [82.0, 83.0, 91.0], "tests": [89.0, 97.0] } tyler = { "name": "Tyler", "homework": [0.0, 87.0, 75.0, 22.0], "quizzes": [0.0, 75.0, 78.0], "tests": [100.0, 100.0] } # ..
Enable secret > enable password To keep enable mood(privileged level) Enable secret CCNA Enable password CCENT Switch(config)#line console 0 Switch(config-line)#login % Login disabled on line 0, until 'password' is set Switch(config-line)#password ? 7 Specifies a HIDDEN password will follow LINE The UNENCRYPTED (cleartext) line password Switch(config-line)#password basketball Username signal pas..
app name: travel alarmfeature: wake you up when you arrived destination.motivation: I slept over in train to home and missed the station that I need to get off. So I need to go back to the opposite direction.Target user: People who use public transportation and wants to concentrate to some work or sleep.Algorithm: based on estimated arrival time, wake up user. Or based on GPS information, wake u..
Cut Listsuitcase = ["sunglasses", "hat", "passport", "laptop", "suit", "shoes"] # The first and second items (index zero and one) first = suitcase[0:2] # Third and fourth items (index two and three) middle = suitcase[2:4] # The last two items (index four and five) last = suitcase[4:6] Cut stringanimals = "catdogfrog" # The first three characters of animals cat = animals[:3] # The fourth through ..
def speak(message): return message if happy(): speak("I'm happy!") elif sad(): speak("I'm sad.") else: speak("I don't know what I'm feeling.") import math print math.sqrt(13689) def is_numeric(num): return type(num) == int or type(num) == float: max(2, 3, 4) # 4 min(2, 3, 4) # 2 abs(2) # 2 abs(-2) # 2 def hotel_cost (nights): return 140 * nights def plane_ride_cost(city): if city == "Charlotte":..
Comparators3 = 5 10 == 10 12 != 13Boolean operatorsTrue or False (3 = 5) this() and not that()Conditional statementsif this_might_be_true(): print "This really is true." elif that_might_be_true(): print "That is true." else: print "None of the above." # Complete the if and elif statements! def grade_converter(grade): if grade >= 90: return "A" elif grade >= 80 : return "B" elif grade >= 70: retu..
Three ways to create strings'Alpha' "Bravo" str(3)String methodslen("Charlie") "Delta".upper() "Echo".lower()Printing a stringprint "Foxtrot"Advanced printing techniquesg = "Golf" h = "Hotel" print "%s, %s" % (g, h) Date and time from datetime import datetime now = datetime.now() print '%s/%s/%s %s:%s:%s' % (now.month, now.day, now.year, now.hour, now.minute, now.second)