Totaro1996

Results 10 comments of Totaro1996

def test_fib(n, expected): result=fib(n) if result==expected: return True else: return False def fib(n): if n==0: return 0 elif n==1: return 1 else: return fib(n-1)+fib(n-2) print(test_fib(0,0)) print(test_fib(7,13)) print(test_fib(6,8) True True True

set_hobbit=set(["Frodo","Sam", "Pippin", "Merry"]) set_magician=set(["Saruman","Gandalf"]) first_dictionary=dict() first_dictionary["name"]="hobbit" first_dictionary["set"]=set_hobbit second_dictionary=dict() second_dictionary["name_two"]="magician" second_dictionary["set_two"]=set_magician first_dictionary.update(second_dictionary) print(first_dictionary)

hobbitset=set (["Frodo","Bilbo","Sam","Pippin","Merry"]) hobbitset.remove("Bilbo") #it removes the string "Bilbo" hobbitset.add("Galadriel") #it adds the string "Galadriel" new_set=set(["Saruman","Frodo","Gandalf"]) #it creates another set with new elements hobbitset.update(new_set) #it is used for adding all the...

hobbitset=set() hobbitset.add("Frodo") hobbitset.add("Bilbo") hobbitset.add("Sam") hobbitset.add("Pippin") hobbitset.add("Merry") print(hobbitset)

![untitled diagram](https://user-images.githubusercontent.com/44606764/48563412-96889d80-e8f4-11e8-9f16-80a8d0885787.jpg)

"spam" not in "spa span sparql" and not ("egg">"span") T and not F T and t True

my_queue=deque(["Draco", "Harry", "Hermione", "Ron", "Severus"]) my_queue.popleft() #it removes the first inserted element #output my_queue (["Harry", "Hermione", "Ron", "Severus"]) my_queue.append("Voldemort") #it adds one element at the end of the queue #output...

Characters_list=list( ) Characters_list.append ("Draco") Characters_list.append ("Harry") Characters_list.append ("Hermione") Characters_list.append ("Ron") Characters_list.append ("Severus") print (Characters_list)

from collections import deque Characters_stack=deque(["Draco", "Harry", "Hermione", "Severus"]) Characters_stack.pop() #it removes "Severus", the last element in the stack. #Characters_stack currently contains 4 elements ["Draco", "Herry", "Hermione", "Ron"] Characters_stack.pop() #it applies...

not (not True or False and True) or False not (False or False and True) or False not (False or False) or False not False or False True or False...