Skip to content

100 Days of Python

Udemy

Angela Yu

Day 1

  • All of this is stored in Dropbox/Python/100_days
  • Lecture 3 contains links to course resources.
  • Exercises ON REPL.IT - Fork to modify and run the assignments.
  • She recommends dark mode & large font on repl.it.
  • Looks to be fairly easy to click the fork the starting code, copy that code and then work on it in a local editor or ide.

Print

print("Hello World!") # print to console
- To print the quotes alternate single and double quotes:
print('She said: "Hello" and then left.')
- Or use a backslash to escape the character you want to print
print("She said: \"Hello\" and then left.")
- stack overflow - Q & A for programmers. - Editor shows errors by color highlighting.

Strings

  • \n (backslash-n) puts line feed in a string
    print ("Hello world!\nHello World!")
    
    Hello world! 
    Hello World!
    
  • Concatenate strings by + sign
    print ("Hello " + "Angela")
    
  • Indentation critical in Python
  • Turn on code intelligence in repl.it settings which shows errors as you're editing your program.

Input

name = input("What is your name?") 
print ("Hello " + input("what is your name?"))
- She likes the debug feature of Thonny - Comments are preceded by # in Python - ctrl+/ comments the line of code you're on or the highlighted lines of code in replit.it. - Using input on auditorium (the testing module she uses) don't use prompt text - And the inputs come from the input pane, you don't actually type them in.

Variables

  • variable names should be meaningful
  • use underscore to separate words in a variable name
    user_name
    
  • variable can't start with a number
  • don't use reserved words. Like print or input
  • variable names are case sensitive #tagcheck

tagcheck