Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam PCAP topic 1 question 44 discussion

Actual exam question from Python Institute's PCAP
Question #: 44
Topic #: 1
[All PCAP Questions]

How many stars (*) does the snippet print?

  • A. the code is erroneous
  • B. five
  • C. four
  • D. two
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
seaverick
2 months, 4 weeks ago
Selected Answer: A
s='*****' s= s - s[2] #TypeError: unsupported operand type(s) for -: 'str' and 'str' print(s) #For strings, only + ( concatenate ) and * (multiply) is allowed. TypeError will be returned #TypeError: unsupported operand type(s) for -: 'str' and 'str' #Ans: the code is erroneous
upvoted 1 times
...
Arulkumar
1 year ago
For strings, only + ( concatenate ) and * (multiply) is allowed. TypeError will be returned Ans: A
upvoted 1 times
...
Suvabrata
1 year, 10 months ago
A is correct. strings support concatenation. '-' is not supported in strings
upvoted 1 times
...
666_m
1 year, 11 months ago
A. the code is erroneous is correct
upvoted 1 times
...
macxsz
1 year, 11 months ago
Selected Answer: A
A. the code is erroneous
upvoted 2 times
...
smarty_arse
2 years, 3 months ago
Selected Answer: A
Correct. TypeError will be thrown
upvoted 3 times
...
Noarmy315
2 years, 3 months ago
-(minus) is not supported b/n 'str' and 'str', if +(plus) then it works, ex. s=s+s[2] then '******' six stars
upvoted 1 times
...
pypaul
3 years, 5 months ago
A is answers. The snippet wiill generate a TypeError
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...