Python/Basic Code

From r00tedvw.com wiki
(Difference between revisions)
Jump to: navigation, search
Line 32: Line 32:
 
:variable = raw_input("display message")
 
:variable = raw_input("display message")
 
  name=raw_input("display message")
 
  name=raw_input("display message")
 +
;Comparators
 +
:<nowiki>==, !=, <, <=, >, or >=</nowiki>

Revision as of 01:56, 8 April 2013

variables
variables can be integers, floats, or boolean. Integers are whole numbers, floats are numbers with remainders, boolean is either True of False.
variable=integer
arithmetic operators
add/subtract/multiply/divide/exponentiation/modulo
exponentiation (exponential, similar to square roots)
2 ** 3=8   (2*2*2)
modulo (remainder)
5 % 2=1  (5/2 = 2 with a remainder of 1)
comments
# for single like quote or """ quote """ for multi line quote
#quote
"""quote
quote"""
print
display output
print "Hello World"
remove character value
like with regular expression, you can remove a characters normal value by adding \ in front, however this does not work with all characters in python
'Help! Help! I\'m being repressed!'
string methods
len() ; lower() ; upper() ; str()
len() = get length of string - applies to anything within the parentheses
len(length)   =   6
lower() = convert to lowercase - applies to only the value after the .
LOWERCASE.lower()   =   lowercase
upper() = convert to uppercase - applies to only the value after the .
uppercase.upper()   =   UPPERCASE
str() = convert to string - applies to anything within the parentheses
str(3.14)   =   "3.14"
user input
variable = raw_input("display message")
name=raw_input("display message")
Comparators
==, !=, <, <=, >, or >=
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Open Source Products
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
2020 Election
Volkswagen
Covid
NCDMV
Toolbox