-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathString and ConsoleOutput
More file actions
35 lines (28 loc) · 881 Bytes
/
Copy pathString and ConsoleOutput
File metadata and controls
35 lines (28 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Print string and variales
print "I'm a string"
print "I\'m " + "Alex " + "Li"
variable01 = "I'm a variable"
print variable01
# Backslash to escape problematic string
print 'This isn\'t flying, this is falling with style!'
# len, lower and upper
my_string = "Darcular"
print len(my_string)
print my_string.lower()
print my_string.upper()
# Print non-string into string
pi = 3.14
print str(pi)
print "The value of pi is around " + str(pi)
#Print Index
fifth_letter = "MONTY"[4]
print fifth_letter
#String format
string_1 = "Beijing"
string_2 = "city"
print "Let's go to %s. It is a beautiful %s." % (string_1, string_2)
name = raw_input("What is your name?")
job = raw_input("What is your job?")
team = raw_input("What is your favorite super rugby team?")
print "Ah, so your name is %s, your job is %s, " \
"and your favorite super rugby team is %s." % (name, job, team)