Python Learning Check List ( see examples)

 
       Examples
variable types
      strings str_val = "Hello"  
      integers int_val = 24  
      converting int_val = int(val)  
str_val = str(int_val)  
     
      boolean variable type val - True, val = false, val = (a>b)     Click Here
if val : print("val is true")  
else: print("val is false")  
     
print print ("Integer is ",int_val,"\n")     Click Here
     
if statement (conditional) if ( str_val == "house):     Click Here
if (val <= 24):  
Loops
      while loop while ( count < 20):    Click Here
       for loop for val in range(1,20):    Click Here
     
Lists my_list = [ 1, 2,"word" ]    Click Here
print(my_list[0], my_list[2])  
for val in list:  
       print(val)  
list_length = len(my_list)  
     
User Input val= sys.stdin.readline()    Click Here
note: reads in a string  
int_val = int(val)  
     
Functions def  func_name( varialbles)    Click Here
        statement…  
        return ( variables)  
     
Dictionaries dict_1 = {}    Click Here
dict_1["first"] = "Harry"  
dict_1["last"] = "Baya"  
print(dict_1["first"].dict_1["last"]  
parts are keys and values  
 
File input and output
   
     create file to write in    Click Here
           write to file
   
     open  file , for read only    Click Here
             read from file
 
     open file for read or write
              read from file
              write to file