Python Flashcards
By-heart this... (47 cards)
Modulus
is the remainder of the division of the left operand and the right operand,returns the decimal part (remainder) of the quotient.
Float
is a term is used in various programming languages to define a variable with a fractional value. Numbers created using a float variable declaration will have digits on both sides of a decimal point.
This is in contrast to the integer data type, which houses an integer or whole number
Variable
is a reserved memory location to store values,it gives data to the computer for processing
len()
is an inbuilt function in Python programming language that returns the length of the string.
Return Value: It returns an integer which is the length of the string.
format()
is one of the string formatting methods that which allows multiple substitutions and value formatting. This method lets us concatenate elements within a string through positional formatting.
Strings
are arrays of bytes representing Unicode characters. However, Python does not have a character data type, a single character is simply a string with a length of 1. Square brackets can be used to access elements of the string
Dictionary
is a data structure that maps one value to another,kind of like how an English dictionary maps a word to its definition.
{ } are used for embedding variables
Boolean Strings
A string in Python can be tested for truth value.
The return type will be in Boolean value (True or False)
end= ‘ ‘
Python’s print() function comes with a parameter called ‘end’. By default, the value of this parameter is ‘\n’, i.e. the new line character. You can end a print statement with any character/string using this parameter.
Triple quotes
are treated as regular strings with the exception that they can span multiple lines
print “\”
Prints Backslash
print “'”
Prints Single-Quote
print “"”
Prints double quote
print “\a”
ASCII bell makes ringing the bell alert sounds
example.xterm
print “hello\fworld”
ASCII form-feed ( FF )
hello
world
print “hello\nworld”
ASCII linefeed ( LF )
print “\t* hello”
ASCII horizontal TAB
print u”\u041b
Prints 16-bit hex value Unicode character
print u”\U000001a9”
Prints 32-bit hex value Unicode character
print “\043”
Prints character based on its octal value
print “\x23”
Prints character based on its hex value
LinuxConfig.org
print(“How old are you?”, end=’’)
age = input()
end=’’ allows to give input on the same line
argv
are called features that are called “Modules” that we import like (import sys module),these are also called libraries by programmers
print(“*” * 10)