Suppose s1 = 'ant' s2 = 'bat' s3 = 'cod' Write Python expressions using s1, s2, and s3 and operators + and * that evaluate to:
View the step-by-step solution to:

Question

1.    Suppose

s1 = 'ant'

s2 = 'bat'

s3 = 'cod'

Write Python expressions using s1, s2,

and s3 and operators + and * that evaluate to:

a)   'ant bat cod'

b)  'ant ant ant ant ant ant ant ant ant ant '

c)   'ant bat bat cod cod cod'

d)  'ant bat ant bat ant bat ant bat ant bat ant bat ant bat '

e)  'batbatcod batbatcod batbatcod batbatcod batbatcod '

Top Answer

View the full answer
Screenshot from 2019-09-23 20-55-02.png

51 = 'ant'
52 = 'bat'
5
$3 = 'cod'
6
7
#a)
'ant bat cod'
8
print (s1, $2, $3)
9
10 #b) 'ant ant ant ant ant ant ant ant ant ant
11
print((s1+' ') *10)
12
13
#c) 'ant bat bat cod cod cod'
14
15...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question