my python cheat sheet-ling

A Programming › Python cheat sheet in English by linqling
4,527 views 1,783 downloads 4 Feb 2016 History
3.7 avg · 0 ratings

vocaburary

int(ra­w_i­nput())
allows user to input a number instead of a string
\N(name)
Character named name in the Unicode databa­se(­Unicode only)
variable
holds a value and can be changed
string
a list of characters such as numbers, letters, symbols
 
float
the type used to represent number
Octothorpe (#)
Using this on the beginning of a line with comment out the rest of the line

Multip­­li­c­ation and Exponents

string * number
combine that string multiple times
string * string
crash
number * number
math - multiply
string ** string
crash
number ** number
math - exponents
string ** number
crash

Python Comparison Operators

<>
If values of two operands are not equal, then condition becomes true.
>
If the value of left operand is greater than the value of right operand, then condition becomes true.
==
If the values of two operands are equal, then the condition becomes true.
<
If the value of left operand is less than the value of right operand, then condition becomes true.

function

int()
converts a value to an integer
print()
displays info to the user
input()
receives info from the user

code

print (name.u­pp­er())
print (name.c­ap­ita­lize())
print (name.l­ow­er())
print (name.t­it­le())

addition

string + string
combine together
sting+­number
crash
number­+number
math - addition

example

def create­Lis­t(quit word) :
print ('keep entering words to add to the list')
print ('Quit When word=' , quitword)
mylist=[]
while true:
user_word = input(­'­Enter a word to add to the list:')
is user_word == quit word:
return mylist
duplic­ateword = false
if duplicate word == True:
print ('Du­plicate Word')

Badges

Good Cheat Sheet Nice Cheat Sheet

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.