Python

BASIC:
 * Variables : name ='ada loverace'
 * Methods with printing print(name.title)'
 * Concatenating print(" Hello, " + full_name.title + " !" )
 * Tabs, new lines print(" \n" + "This is new line char" + "\t" + "This is tab character"
 * Stripping whitespace right: favourite.rstrip, left : lstrip, strip
 * Printing strings: print( str(variable))
 * inputing: message = input( "Tell me something" ), print(message)
 * numerical input-  age = input( "How old are you?" ) print(str(age))
 * WHILE LOOP
 * while loop: while current_number <=5: print(current_number) current_number +=1
 * using flag with while loop : active= True, while active: if message == 'quit': active = False
 * break, while True: if x>5: break
 * continue- omit some part of loop while number>10: number +=1 if number % == 2: continue

Data structures:
 * LIST - collection of items in a particular order
 * basic
 * bicycles = [ 'trek', 'giant', 'red', 'specialized']
 * accessing is through index, bicycles[0], bicycles[1], last item - bicycles[-1]
 * we can using elements through index with methods, bicycles[0].title
 * replacing elements bicycles[0]= 'ducati'
 * adding to the end of the list motorcycles.append('ducati')
 * inserting on 2 place on a list, motorcycles.insert(2, 'ducati')
 * removing del motorcycles[0]
 * popping motorcycles.pop - by default last item, but we can motorcycles.pop(0) - first element
 * removing by item - motorcycles.remove('ducati')
 * sorting - cars.sort, reverse order cars.sort(reverse=True), temporarily sorting sorted(cars)
 * changing to reverse order - cars.reverse
 * lenght of the list - len(cars), printing will be print( "Lenght of the list is: " + str(len(cars))"
 * Looping through list : for magicians in magician: print(magician.title)
 * numerical list: for value in range(1,5): print(value)
 * numbers = list(range(1,6))
 * even_numbers= list(range(2,11,2), odd_numbers=list(range(1,11,2))
 * methods: min(even_numbers), max(even_numbers), sum(odd_numbers)
 * list comprehensions : squares= [ value **2 for value in range(1,11)]
 * slicing the list: print(players[0:3]) - first three elements, or [:3]
 * looping through slice, for player in players[:3]:
 * copying the list friends_food= my_foods[:]
 * if condition, for car in cars: if car =='bmw': , elif:, else:
 * numerical if - if answer !=42:
 * checking if value is not in the list : if user not in banned_users:
 * checking if list is not empty : if requested_toppings:
 * using multiple lists - for requested_topping in requested_toppings: if requested_toppings in available_toppings:
 * TUPLES - List tat values canoot change, dimensions = (200,50) , print(dimensions[0])
 * looping through tuple; for dimension in dimensions:
 * we can only redefine dimensions=(400,1000)
 * DICTIONARIES: key-value
 * alien_0= {'color': 'green', 'points': 5}
 * accesing = print(alien_0['color'])
 * adding new keys with values: alien_0['x_position'] = 0
 * removing key - del alien_0['points']
 * looping through keys and values; for key,value in alien_0.items:
 * looping through only keys in order: for key in sorted(alien_0.keys):
 * looping through all values for values in alien_0.values:
 * list of dictionaries: alien_0 = { 'color:'green'}, alien_1= { 'color': 'red'} , aliens=[alien_0,alien_1] for alien in aliens:
 * a list in dictionary : pizza = { 'crust': 'thick, 'toppings': ['mushrooms', 'extra chesse'] }, for topping in pizza['toppings']:
 * a dictionary in dictionary:  users = { 'ainstein': { 'fist': albert', 'last': 'einstein'}, 'mcurie': { 'first': 'marie' , 'last': 'curie', } } for username, user_info in users.items: print(username)
 * FUNCTION - blocks of code that are designed to do one specific job
 * defining function def greet_user(parameter):, greet_user('argument')
 * positional argument- def describe_pet(animal_type,pet_name) describe_pet('harry','hamster')
 * key-word argument describe_pet(animal_type='hamster', pet_name='harry')
 * default values - def describe_pet(pet,name,animal_type='dog')
 * optional_argument - get formatted_name(first_name,last_name,middle_name=' ')
 * preventing a function from modyfying a list - print_models(unprinted_designs[ : ],completed_models)
 * passing an arbitary number of arguments- def make_pizza(,size,*toppings) - creates a tuple, must be placet last in the function definition
 * passing a arbitary keyword arguments - def build_profile(first,last,**user_info): profile{} profile['first_name'] = first profile['last_name']= last for key,value in user_info.items: profile[key] = value -- creates dictionary
 * importing modules from other python program - import pizza
 * importing only some function - from pizza import make_pizza
 * giving a alias - from pizza import make_pizza as mp, mp(16,'pepperoni')
 * importing all functions - from pizza import *

    def __init__(self, name, age): ## main function, the self is requried at first place            self.name = name            self.age = age   def sit(self):            print(self.name.title + " is now sitting.")   def roll_over(self):            print(self.name.title + " rolle d over!") ​                                     print("My Cat name is " + my_cat.title + ".")
 * Class - to create objects on class. When you write a class, you define the general behaviour that whole category of object can have.
 * class Cat:
 * making instance - my_cat=Cat('Kocur',6)

                                     print("My cat is + str(my_cat.age) + " years old")             """Initialize attributes to describe a car.""" <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">self.make = make <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">self.model = model <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">self.year = year <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">          self.odometer_reading = 0
 * calling the methods - my_cat.sit, my_cat.roll_over
 * default value for attribute -  <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">  <span style="color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">class Motor:
 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">       <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">def __init__(self, make, model, year):

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">def get_descriptive_name(self): <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;"> <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">  def read_odometer(self): <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           """Print a statement showing the car's mileage.""" <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           print("This motor has " + str(self.odometer_reading) + " miles on it.")

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">my_new_motor = Car('Suzuki', 'Rs', 2016) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">print(my_new_motor.get_descriptive_name) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   my_new_motor.read_odometer


 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">modyfying attribute


 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">​directly - my_new_motor.odometer_reading = 23
 * through method - def update_odometer(self,mileage): self.odometer= mileage, my_new_motor.update_odometer(23)
 * incrementing attribute through method -  def inc_odometer(self,miles): self.odometer_reading +=miles
 * Inheritance  - 
 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">​ <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">class ElectricMotor(Motor):

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">       """Represent aspects of a car, specific to electric vehicles.""" <span style="color:rgb(51,51,51);font-size:18.8799991607666px;line-height:31.1520004272461px;">   <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;"> def __init__(self, make, model, year): <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           """Initialize attributes of the parent class.""" <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">         super.__init__(make, model, year)

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;"> my_motor= ElectricMotor('tesla', 'model q', 2016) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   print(my_motor.get_descriptive_name) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">​
 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">​ Classes as attributes
 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">class Battery:

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;"> def __init__(self, battery_size=70): <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           " <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           self.battery_size = battery_size

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">  def describe_battery(self): <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           """Print a statement describing the battery size.""" <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           print("This motor has a " + str(self.battery_size) + "-kWh battery.")


 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">​ <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">class ElectricMotor(Motor):

<p style="border:0px;font-weight:normal;margin:0.4em0px0.5em216px;padding:0px;vertical-align:baseline;color:rgb(58,58,58);font-family:Helvetica,Arial,sans-serif;font-size:13px;font-variant:normal;letter-spacing:normal;line-height:21px;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"><span style="border:0px;font-weight:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">       """Represent aspects of a car, specific to electric vehicles.""" <span style="border:0px;font-weight:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(51,51,51);font-size:18.8799991607666px;line-height:31.1520004272461px;">   <span style="border:0px;font-weight:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;"> def __init__(self, make, model, year): <span style="border:0px;font-weight:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           """Initialize attributes of the parent class.""" <span style="border:0px;font-weight:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">         super.__init__(make, model, year)

<p style="border:0px;font-weight:normal;margin:0.4em0px0.5em216px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">          self.battery= Battery  <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;border:0px;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;font-weight:inherit;margin:0px;padding:0px;vertical-align:baseline;"> my_motor= ElectricMotor('tesla', 'model q', 2016) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;border:0px;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;font-weight:inherit;margin:0px;padding:0px;vertical-align:baseline;">   print(my_motor.get_descriptive_name

<p style="border:0px;font-weight:normal;margin:0.4em0px0.5em216px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"><span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;border:0px;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;font-weight:inherit;margin:0px;padding:0px;vertical-align:baseline;">my_motor.battery.describe_battery 

<p style="border:0px;margin:0.4em0px0.5em240px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"><span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">​ <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">filename = 'digits.txt' <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">with open(filename) as file_object: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   for line in file_object: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">          print(line)
 * Importing classes - <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">  <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">from motor import Motor
 * ====Importing entire module - <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">import c <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">ar ====
 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">FILES 
 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">​reading line by line -  <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">

<p style="border:0px;margin:0.4em0px0.5em240px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"><span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">filename = 'pi_digits.txt' <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">with open(filename) as file_object: <span class="ent" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;font-family:ArialUnicodeMS;color:rgb(51,51,51);font-size:18.8799991607666px;line-height:31.1520004272461px;">➊ <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">     lines = file_object.readlines <span class="ent" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;font-family:ArialUnicodeMS;color:rgb(51,51,51);font-size:18.8799991607666px;line-height:31.1520004272461px;">➋ <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;"> for line in lines: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">       print(line.rstrip)
 * Stores values in the list 

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">


 * writing to file  - <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">You can open a file  <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">in read mode<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;"> ( <span class="literal" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;font-family:CourierNew;font-size:0.8em;color:rgb(51,51,51);line-height:31.1520004272461px;">'r' <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">),  write mode<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;"> ( <span class="literal" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;font-family:CourierNew;font-size:0.8em;color:rgb(51,51,51);line-height:31.1520004272461px;">'w' <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">),  append mode<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;"> ( <span class="literal" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;font-family:CourierNew;font-size:0.8em;color:rgb(51,51,51);line-height:31.1520004272461px;">'a' <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">), or a mode that allows you to read and write to the file ( <span class="literal" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;font-family:CourierNew;font-size:0.8em;color:rgb(51,51,51);line-height:31.1520004272461px;">'r+' <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">)
 * <span class="annotator-hl annotator-hl-temporary" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;background:rgba(254,209,0,0.298039);"> with open(filename, 'w') as file_object:


 * <span class="annotator-hl annotator-hl-temporary" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;background:rgba(254,209,0,0.298039);">    file_object.write("I love programming.")

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">     <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">print(5/0) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">except ZeroDivisionError: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    print("You can't divide by zero!") <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">print("Enter 'q' to quit.")
 * ====<span style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;font-weight:700;">Exception -  ====
 * 1) <span style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;font-weight:700;">​ <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">try:
 * 1) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">  <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">print("Give me two numbers, and I'll divide them.")

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">while True: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">first_number = input("\nFirst number: ") <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">if first_number == 'q': <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">break <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">second_number = input("Second number: ") <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    try: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">answer = int(first_number) / int(second_number) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;"> except ZeroDivisionError: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           print("You can't divide by 0!") <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   else: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">print(answer)
 * 1) <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">filename = 'alice.txt'

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">try: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">     <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">with open(filename) as f_obj: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">         <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">contents = f_obj.read <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">except FileNotFoundError: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    msg = "Sorry, the file " + filename + " does not exist." <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    print(msg) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">"""Count the approximate number of words in a file.""" <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">try: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">--<span class="codeitalic" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;font-family:CourierNew;font-style:italic;">snip -- <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">except FileNotFoundError: <span style="color:rgb(51,51,51);font-size:18.8799991607666px;line-height:31.1520004272461px;">  <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">         pass <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">else:
 * 1) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">def count_words(filename):
 * JSON 

<p style="border:0px;margin:0.4em0px0.5em192px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"><span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">​ <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">i <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">mport json
 * ​dumpling  -  <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">

<p style="border:0px;margin:0.4em0px0.5em192px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"><span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">​ <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   numbers = [2, 3, 5, 7, 11, 13]


 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   filename = 'numbers.json'


 * <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   with open(filename, 'w') as f_obj:

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   json.dump(numbers, f_obj) <p style="border:0px;margin:0.4em0px0.5em192px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"><span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">import json <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">
 * reading 

<p style="border:0px;margin:0.4em0px0.5em192px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"> <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">filename = 'username.json' <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">

<p style="border:0px;margin:0.4em0px0.5em192px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"> <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">               with open(filename) as f_obj: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">

<p style="border:0px;margin:0.4em0px0.5em192px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"><span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">username = json.load(f_obj) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">

<p style="border:0px;margin:0.4em0px0.5em192px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;"><span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">print("Welcome back, " + username + "!")

<p style="border:0px;margin:0.4em0px0.5em192px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin:0.4em0px0.5em192px;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">


 * :: <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">import json

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   def get_stored_username: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">   """Get stored username if available.""" <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">filename = 'username.json' <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">try: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">with open(filename) as f_obj: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">                <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">username = json.load(f_obj) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">except FileNotFoundError: <span style="color:rgb(51,51,51);font-size:18.8799991607666px;line-height:31.1520004272461px;">    <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        return None <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">       else: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           return username <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">def greet_user: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">        <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">"""Greet the user by name.""" <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">       username = get_stored_username <span style="color:rgb(51,51,51);font-size:18.8799991607666px;line-height:31.1520004272461px;">   <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    if username: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">           print("Welcome back, " + username + "!") <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">       else: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">username = input("What is your name? ") <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">filename = 'username.json' <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">            <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">with open(filename, 'w') as f_obj: <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">                <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">json.dump(username, f_obj) <span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">                <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">print("We'll remember you when you come back, " + username + "!")

<span style="color:rgb(51,51,51);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">    <span class="ash" style="box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;color:rgb(147,149,152);font-family:Georgia,'DroidSerif',Times,serif;font-size:18.8799991607666px;line-height:31.1520004272461px;">greet_user

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">

<p style="border:0px;margin-top:0.4em;margin-right:0px;margin-bottom:0.5em;padding:0px;vertical-align:baseline;font-variant:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;">