CJKV. Initialism of Chinese, Japanese, Korean and
Vietnamese: East Asian languages heavily influenced
by the Chinese writing system and vocabulary.
Who is Guido van Rossum?
Guido van Rossum is a noted Dutch computer programmer
and author, better known for creating the ‘Python’
programming language that earned him the title of the
"Benevolent Dictator for Life" (BDFL). He later stepped
down as the “BDFL” of Python in July 2018.
What does it mean for programs to be ‘portable’?
Portability, in relation to software, is a measure of
how easily an application can be transferred from one
computer environment to another.
What are the two versions of Python?
Python2.x and Python3.x
What character encoding should be used for Python programs?
UTF-8
What is a comment? What are the two types of comment in Python?
''' '''and#
There are two types of commenting features available
in Python: These are single-line comments and
multi-line comments. A single-line comment begins
with a hash(#) symbol and is useful in mentioning
that the whole line should be considered as a
comment until the end of the line.
What is the syntax of a Python variable name?
A variable name must start with a letter or the
underscore character. A variable name cannot start
with a number. A variable name can only contain
alpha-numeric characters and underscores
(A-z,0-9,and _ )
What is Camel Case?
camelCase is a naming convention in which the
first letter of each word in a compound word
is capitalized,exceptfor the first word.
What is the difference between a declaration (e.g. x = 1) and an assignment (e.g. x = 1 )?
A declaration has a variable and the value about it
Before assignment,variable was declared.
What is the difference between / and // ?
Such as:16/2=8and16//2=4
What is the difference between // and %?
Such as:16//2=4and16%2=0
What does x ** 2 mean?
x** same as x*x
What does x += 1 mean?
x+=1 same as x = x+1
What is the largest integer in Python?
import sys;
sys.maxsize
9223372036854775807
What is the longest string in Python?
Infinity
In something like: university = “Northwest” + “University” + “1902” What is the purpose of the backslash \ ?
You can use \ to continue onto the next
line
What does this do: ‘exchange rate is %3.1f’ % (9.09)
9.1
What is the difference between “1902” and 1902 ?
"1902"is a string and1902isint
What is type casting in Python? Give an example using the str() function
str(1902)="1902"
[ 18, 19, 20, 21, 22 ] [ -2 ]
21
[ 18, 19, 20, 21, 22 ] [ 2:4 ]
[29,20]
[ 18, 19, 20, 21, 22 ] [ -2:-5:-1 ]
[21,20,19]
input( 'Please enter your name: ’ )
Please enter your name:
print( ‘a’, end = ‘’ ); print( ‘b’ )
'a''b'
print( ‘a’, ‘b’, ‘c’, sep = ‘’ )
'a''b''c'
What is difference between True and true?
Boolean.TRUE is a reference to an object of the classBoolean,while true is just a value of the primitive boolean type.
What is difference between elif and else in if statement?
elif same aselseif
for x in [ ‘a’, ‘b’, ‘c’ ]: print( x )
'a''b''c'
for x in { ‘a’:1, ‘b’:2, ‘c’:3 }: print( x )
'a''b''c'
for x, y in { ‘a’:1, ‘b’:2, ‘c’:3 }.items(): print( x, y )
a 1
b 2
c 3
range( 5 )
0,1,2,3,4
range( 0, 5, 2 )
024
range( 5, 0, -2 )
5 3 1
range( 5, -1, -1 )
5 4 3 2 1 0 -1
What does break do in a while loop
Break will kill the nearest/innermost loop
for x in range( 0, 4 ): print( x ) if x == 1: continue print( ‘Last line’ )
0
Last line
12
Last line
3
Last line
message1 = ‘Global Variable’ def my_function(): global message1 # This is the line which has changed message1 = ‘Local Variable’ print( ‘\nInside the function:’ ) print( message1, ‘\n’ )
Inside the function:
Local Variable
38.defsome_function( a, b, c=1, d=2, e=3):39.defsome_function( a, c=1, d=2, e=3, b ):40.defadd_numbers(*num ):for i in num:print( i )41.defprint_member_age(**age ):for i, j in age.items():print( i, j )42.1. fargs
2.*args
3.**kwargs
43.import variable_num_params !!!!!
add_numbers(1,2,3)44. path Environment Variable
45. pythonpath Environment Variable
46. lab\myfile.txt # what is the difference?
c:\lab\myfile.txt
47.dir/b > files.txt
48.import os
cwd = os.getcwd()49.import os
os.chdir('c:\\project')
print( ‘answer’, end = ‘’ )
'answer'
print( ‘a’, ‘word’, sep = ‘’ )
'a''word'
52. f =open( filename,'r')
msg = f.read(10)53. tf =open( target_file,'wb')54.'Agile' software development
55. Stepwise Refinement software development
56. Space - Time Tradeoff
57. sys.maxsize 922337203685477580758.0b110o11 ?? 3959.int('10',2)260.hex(17)0x11