Python Flashcards
1
Q
How do you print out “Hello!”?
A
> > > print(‘Hello!’)
Hello!
2
Q
> > > “2” + “1”
What the output?
A
21
3
Q
> > > print(“spam” * 3)
what the output?
A
spamspamspam
4
Q
> > > int(“2”) + int(“1”)
What the output?
A
3
5
Q
What is short for else if?
A
elif
6
Q
nums = [5, 9, 15, 12, 8, 20]
print(len(nums))
what would the system print?
A
6
7
Q
numbers = list(range(39, 50, 2))
print(numbers)
What numbers would print?
A
> > > [39, 41, 43, 45, 47, 49]
8
Q
for i in range(6):
print(“Your Welcome!”)
What would be the outcome?
A
Your Welcome! Your Welcome! Your Welcome! Your Welcome! Your Welcome! Your Welcome!
9
Q
A method use to add an item to the end of a existing line?
A
apprend
10
Q
A method use to add an item to any position of an existing line?
A
insert