My Python Notes

  A list must be homogeneous, its elements all should be from the same type. If an element in a […]

Read More

Python Review

##################################################### ###################### General ###################### ##################################################### print(“Bashar”) help(print)       # Helps you understand what the function print() does help(str.rjust)   # Helps you […]

Read More

APPENDIX

print(“Bashar”) dir(str) help(print) help(str.rjust) “Bashar”.rjust(35) input(“What is your name?”) if name == “Bashar”: print(name + ” is a lumberjack!”) { […]

Read More
Comments Off on APPENDIX

Guess The Number!

My Solution Guess a number from 1 to 10 game. import random def init_game(): print(“Guess a number between 1 and 10. […]

Read More
Comments Off on Guess The Number!

Putting the “Fun” Back in “Function”

Introduction To Functions Definition def say_hello( ): print(“Hello!”) Arguments def add_to_two(num): print(num+2) >>> add_to_two(2) 4 Return def square(num): return num*num […]

Read More
Comments Off on Putting the “Fun” Back in “Function”

Shopping List

Lists Lists my_list = [ 1, 2.5, ‘a’ ] >>> list(‘a’) # Function creates a list of characters from the […]

Read More
Comments Off on Shopping List

Things That Count

Numeric Variables a = 1, b = 2 c = a + b >>> print(c) 3  int( variable ) [string_multiply]: input_string […]

Read More
Comments Off on Things That Count

Ins & Outs

Input/Output Output: print(“Bashar”) Input:    input(“What is your name?”) >>> name = input(“What is your name? “) What is your name? Bashar >>> print(name) Bashar String Concatination [lumberjack.py]: name = input(“What’s your name? “) […]

Read More

Say Hello to Python

At the end of this course, we’re going to build a Guess the Number game. There are two ways to […]

Read More