Help
Contact
For teachers and institutes
Search courses, problems, tests…
A
A
>_
StemPy Lab
Courses ▾
Problems ▾
Practice ▾
Mock Tests
Classes
Community ▾
A
A
Quizzes
/
A product code is sliced, searched and changed in three ways. What does the program print?
Python Programming
Medium
High School (11–12)
Python Basics › Strings
Class 12 Board
PCAP (Python Institute)
+3 more exams
AP
A-Level
IB
AP
A-Level
IB
PCAP (Python Institute)
Created by
StemPy Lab
Stuck? Show a hint
A product code is sliced, searched and changed in three ways.
code = "AB-12" print(code[-2:] * 2, "B-" in code, code[:2].lower() + code[2:])
What does the program print?
24 True ab-12
1212 True ab
1212 True ab-12
1212 False ab-12
Check Answer
Log in to save
Tag someone
⚑ Report
← All Quizzes
← A program reads numbers from the keyboard until the input ends. The user types 5, then -2, then 9, and then closes the input, so there are no more lines. What does the program print?
This program should print bat, but it stops with an error. Which change to the second line makes the program print bat? →
More on
Python Basics › Strings
Discussion (0)
Log in
to join the discussion.
Loading…
All questions on this topic →
Problems on this topic
For the text "the cat sat on the mat", write the program lines that show: how many times at occurs…
Medium
A student wants to change the name "Rahul" to "Raju" and writes…
Medium
The variable word = "elephant" has eight letters…
Easy
The name is "asha rao". Show its initials in capital letters: AR.
Hard
All problems on this topic →