Created
March 6, 2015 13:15
-
-
Save Humoud/6cf11a86cd7c8855454b to your computer and use it in GitHub Desktop.
simple python code - request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is a comment | |
a = 1 | |
print a | |
print "value of a is: "+ str(a) | |
# define function, take no arguments, just print | |
def func1(): | |
print "func1 called" | |
# call function | |
func1() | |
# define function that takes argument " variable " then returns it | |
def func2(variable): | |
return variable | |
# call function, cast returned value to string then print it | |
print str( func2("hello func2") ) | |
name = " very long name" | |
# print char at 5 in string name | |
print name[5] | |
# create a list | |
listOfStuff = [1,2, "Luna", "coffee", "kuwait"] | |
# print list | |
print listOfStuff | |
# for each loop through listOfStuff | |
for element in listOfStuff: | |
print "awesome: "+ str(element) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment