Level 6 Flashcards

If ELSE or and elif formating slicing for loop while loop

1
Q

Get client input

A

name=input(“What is your name ? “)
print(name)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

if statement

A

if name == “Chris” :
print(name)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

elif

A

name=input(“name please”)
if name==”Chris” :
print(name)
elif :
print(“Ranine”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

else
or

A

name=input(“name please”)
if name==”Chris or name ==”Ranine”
print(“married”)
else:
print(“Don’t know you”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

match
case

A

good_not_good = input(“Are you good or evil? “)

match good_not_good:
case (“good”):
print(“good”)
case (“evil”):
print(“evil”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

formating /n

A

Get user input on new line
name=print(“Whats your name?\n”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

formating (f)

A

name=print(“Whats your name?\n”)
print(f”Yourname is {name})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

formating (f”……………/.2f”)

A

Add 2 digets after decimal after number
number = 800
print(f”Number is {number:.2f}”)

Answer is 800.00

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Slicing
# Printing specifc letters in a word eg,
Name=(“Titanic”)
print(name[6])

A

c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Slicing
# Printing specifc letters in a word eg,
Name=(“Titanic”)
print(name[-1])

A

c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Slicing
Name=(“Titanic”)
print(name[5:])

A

ic
the 5th letter then print till the rest till the end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

listing items
[……]

A

jedi = [“Dart Vader”, “Rey”, “Yoda”, “Leia”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

for loop

A

jedi = [“Dart Vader”, “Rey”, “Yoda”, “Leia”]
for x in jedi:
print(x + (“ is a jedi”))

Dart Vader is a jedi
Rey is a jedi
Yoda is a jedi
Leia is a jedi

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly