Section 1

Preview this deck

.format vs print(f"

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (6)

Section 1

(6 cards)

.format vs print(f"

Front

string method - print('My number is: {one}, and my name is: {two}'.format(one=num,two=name)) or print('My number is: {}, and my name is: {}'.format(num,name)) best way is print(f"He said his name is {name}")

Back

% operator with strings

Front

# % operator text = "%d little pigs come out or I'll %s and %s and %s" % (3, 'huff', 'puff', 'blow down')

Back

.split() method for strings

Front

default splits on white space but can split on any designated - my_string.split(i) - splits the string on the letter i

Back

concatenation of strings

Front

x = x + " it's a beautiful day"

Back

pop

Front

removes an element from a list, defaults to remove last limit. list.pop() vs list.pop([0])

Back

.sort()

Front

list method that sorts alphabetically

Back