python cheat sheet

A Programming › Python cheat sheet in English by Kritanan
5,289 views 2,317 downloads 11 Feb 2016 History
3.7 avg · 0 ratings

vocabulary

Variable
Holds a value and can be change
strings
number, letter, symbols
float number
decimal number
boolean
true/false
integer number
whole number
length
length of string

Example

#kritanan chanta­waralak
"­"­"I wearing glasse­s"""

x=3
y=x+1
print(y*2)
print(­(st­r(x­)+s­tr(y)))

Firstname= input(­"what is your name:")
Lastname= input(­" what is your last name:")
print(­"­welcome to computer scienc­e",F­irs­tna­me,­Las­tna­me[0])

x= input(­"­enter the number­:")
x= int(x)
print(­(st­r(F­irs­tna­me,­Las­tna­me)­[x]))

y= input(­"how many times should i print this letter­?:")
y= int(y)
print(­((s­tr(­Fir­stn­ame­)[x]))
y)

symbol

#
single line commiting
"­"­"....."""
multi line commiting
+
add
-
subtract
*
multip­lic­ation
/
division
**
to the power of
%
modulu
!=
not equal to
//
divide and quotient is integer

what you should know

string
"...."
Operators
and , or , not
Compar­­ators
MATH symbol
user input
%s, input
condit­ional
if,Eli­f,Else

function

print()
display inform­ation on screen
input()
recieve inform­ation from user
int()
convert a value to an integer
float()
change number decimal number
str()
a list of number, letter and symbol
len()
length of string

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.