Posts

Showing posts from July, 2021

python cheat sheet

  Python CheatSheet Loading... Basics Basic syntax from the python programming language Showing Output To User the print function is used to display or print output print ( "Content that you wanna print on screen" ) Copy Taking Input From User the input function is used to take input from the user var1 = input ( "Enter your name: " ) Copy Empty List This method allows you to create an empty list my_list = [ ] Copy Empty Dictionary By putting two curly braces, you can create a blank dictionary my_dict = { } Copy Range Function range function returns a sequence of numbers, eg, numbers starting from 0 to n-1 for range(0, n) range ( int_value ) Copy Comments Comments are used to make the code more understandable for programmers, and they are not executed by compiler or interpreter. Single line comment #This is a single line comment Copy Multi-line comment '''This is a multi-line comment''' Copy Escape Sequence An escape sequence is a sequence ...