Session 2 - Strings Flashcards

Strings (12 cards)

1
Q

String Length (2mins)

Ask the user to enter any word, and print how many characters it has.

Input: banana

Output:
Length: 6

A

A

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

Uppercase (2mins)

Ask the user for a sentence and print it in uppercase.
Input: Python is fun

Output:
PYTHON IS FUN

A

A

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

Lowercase (2mins)

Ask the user for two numbers and print their sum.

Input 1: HELLO THERE

Output:
hello there

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

Replace a Word (2mins)

Ask the user for a sentence and replace the word “Java” with “Python”.

Input 1: I love Java

Output:
I love Python

A

A

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

Slice a String (2mins)

Ask the user for a word and print only the first 3 letters.

Input 1: Programming

Output:
Pro

A

A

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

Substring Check (2mins)

Ask the user to enter a sentence and check if the word “Python” is in it.

Input 1: I am learning Python today

Output:
True

A

A

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

Reverse a String (2mins)

Ask the user to enter a word and print it reversed.

Input 1: hello

Output: olleh

A

A

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

Count Letters (2mins)

Ask the user to enter a sentence and count how many times the letter “a” appears.

Input 1: Apples are amazing

Output:
The letter ‘a’ appears 4 times.

A

A

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

Combine Input and Formatting (2mins)

Ask the user for their city and print a welcome message.

Input 1: Toronto

Output:
Welcome to Toronto!

A

A

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

Split a Sentence into Words (2mins)

Split a sentence into a list of words.

Input 1: Split this sentence

Output:
[‘Split’, ‘this’, ‘sentence’]

A

A

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

Join a List of Words into a Sentence (2mins)

Join words from a list into one space-separated string.

Input 1: [“Python”, “is”, “awesome”]

Output:
Python is awesome

A

A

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

Join a List of Words into a Sentence separated by commas (2mins)

Ask the user to input strings separated by commas

Input 1: Python,is,awesome

Output:
Python is awesome

A

A

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