Python programming: Difference between revisions

From GotOpinion
Jump to navigation Jump to search
m Created page with "== Python basics == == Python operators == <center>To Python</center>"
 
Line 1: Line 1:
== Python basics ==
== Python basics ==
=== Escape sequences ===
Insert list or link to list of escape sequences
=== Type conversions ===
int()
float()
=== Conditionals ===
{| border="1" cellspacing="0" cellpadding="5" align="center"
|-
! Operator
! Conditions when true
|-
| x == y
| x and y have same value
|-
| x != y
| x and y don't have same value
|-
| x < y
| x value is less than y value
|-
| x <= y
| x value is less than or equal to y value
|-
| x > y
| x value is greater than y value
|-
| x >= y
| x value is greater than or equal to y value
|}
{| border="1" cellspacing="0" cellpadding="5" align="center"
|-
| string methods (s1 and s2 are strings)
| conditions when true
|-
| s1.startswith(s2) String s1 starts with s2
|-
| s1.endswith(s2)
| String s1 ends with s2
|-
| s1.isalnum()
| All characters in s1 are alphanumeric and there is >= 1 character
|-
| s1.isalpha()
| All characters in s1 are alphabetic and there is >= 1 character
|-
| s1.isdigit()
| All characters in s1 are digits and there is >= 1 character
|-
| s1.islower()
| All cased characters in s1 are lowercase and there is >= 1 cased character
|-
| s.isupper()
| All cased characters in s1 are uppercase and there is >= 1 cased character
|}


== Python operators ==
== Python operators ==


<center>[[Python|To Python]]</center>
<center>[[Python|To Python]]</center>

Revision as of 11:07, 3 April 2013

Python basics

Escape sequences

Insert list or link to list of escape sequences

Type conversions

int() float()

Conditionals

Operator Conditions when true
x == y x and y have same value
x != y x and y don't have same value
x < y x value is less than y value
x <= y x value is less than or equal to y value
x > y x value is greater than y value
x >= y x value is greater than or equal to y value
string methods (s1 and s2 are strings) conditions when true
s1.startswith(s2) String s1 starts with s2
s1.endswith(s2) String s1 ends with s2
s1.isalnum() All characters in s1 are alphanumeric and there is >= 1 character
s1.isalpha() All characters in s1 are alphabetic and there is >= 1 character
s1.isdigit() All characters in s1 are digits and there is >= 1 character
s1.islower() All cased characters in s1 are lowercase and there is >= 1 cased character
s.isupper() All cased characters in s1 are uppercase and there is >= 1 cased character

Python operators

To Python