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.
If im not wrong, is B)
string=str(1/3) ---- this is equal a 0.3333333333
dummy=''
>>> for character in string:
dummy=character+dummy
>>> dummy
'3333333333333333.0'
print(dummy[-1])----- this is 0
dummy = character + dummy: Adds the current character to the BEGINNING of the dummy string, effectively reversing the order of characters.
print(dummy[-1]): Prints the last character of the reversed string, which is the first character of the original string.
It outputs 0.
string=str(1/3)
print("string=",string)
dummy=''
for character in string:
print("character=",character)
dummy=character+dummy
print("dummy=",dummy)
print(dummy[-1])
Answer is B:
string = str(1/3)
dummy = ''
for character in string:
dummy = dummy + character
print(dummy[-1]) # 3
# In python all types are classses
print(type(dummy)) # <class 'str'>
If there is: for character in strong: Answer is A
If there is: for character in string: Answer is B
upvoted 2 times
...
Log in to ExamTopics
Sign in:
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.
Efren
Highly Voted 2 years, 5 months agozantrz
Most Recent 2 months, 2 weeks agoseaverick
2 months, 3 weeks agoCC_DC
9 months, 1 week agokontra
11 months agoSiva_2022
1 year, 11 months agomacxsz
1 year, 11 months agoDTL001
2 years, 4 months agogrinha
2 years, 1 month agoTon123
2 years agolukaki
2 years, 4 months ago