Who can tell me how to pass python exam?
How to calculate the difference between current time and given time?
1 Answer
Basic Concepts
fundamental concepts: interpreting and the interpreter, compilation and the compiler, language elements, lexis, syntax and semantics, Python keywords, instructions, indenting
literals: Boolean, integer, floating-point numbers, scientific notation, strings
comments
the print() function
the input() function
numeral systems (binary, octal, decimal, hexadecimal)
numeric operators: ** * / % // + –
string operators: * +
assignments and shortcut operators
Data Types, Evaluations, and Basic I/O Operations
operators: unary and binary, priorities and binding
bitwise operators: ~ & ^ | << >>Boolean operators: not and or
Boolean expressions
relational operators ( == != > >= < <= ), building complex Boolean expressions
accuracy of floating-point numbers
also, basic input and output operations using the input(), print(), int(), float(), str(), len() functions
formatting print() output with end= and sep= arguments
type casting
also, basic calculations
simple strings: constructing, assigning, indexing, immutability
Flow Control – loops and conditional blocks
conditional statements: if, if-else, if-elif, if-elif-else
also, multiple conditional statements
the pass instruction
building loops: while, for, range(), initerating through sequences
expanding loops: while-else, for-elsenesting loops and conditional statements
also, controlling loop execution: break, continue
Data Collections – Lists, Tuples, and Dictionaries
simple lists: constructing vectors, indexing and slicing, the len() function
lists in detail: indexing, slicing, basic methods (append(), insert(), index()) and functions (len(), sorted(), etc.), del instruction, iterating lists with the for loop, initializing, in and not in operators, list comprehension, copying and cloning
lists in lists: matrices and cubes
tuples: indexing, slicing, building, immutability
tuples vs. lists: similarities and differences, lists inside tuples and tuples inside lists
dictionaries: building, indexing, adding and removing keys, iterating through dictionaries as well as their keys and values, checking key existence, keys(), items() and values() methods
strings in detail: escaping using the \ character, quotes and apostrophes inside strings, multiline strings, basic string functions.
Functions
defining and invoking your own functions and generators
also, return and yield keywords, returning results, the None keyword,recursion
parameters vs. arguments,positional keyword and mixed argument passing,default parameter values
Also, converting generator objects into lists using the list() function
name scopes, name hiding (shadowing), the global keyword