1 / 5

What will the following print out? x = ‘ rachel ’ y = x[0] + x[2] + x[4:] print y rachel rce rcel

What will the following print out? x = ‘ rachel ’ y = x[0] + x[2] + x[4:] print y rachel rce rcel r+c+el. What will the following print out? x = ‘ evan ’ for y in x: print chr ( ord (y)+1), e v a n f w b o e v a n e v a n n a v e d u z o a e n v.

robert
Download Presentation

What will the following print out? x = ‘ rachel ’ y = x[0] + x[2] + x[4:] print y rachel rce rcel

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. What will the following print out? x = ‘rachel’ y = x[0] + x[2] + x[4:] print y • rachel • rce • rcel • r+c+el

  2. What will the following print out? x = ‘evan’ for y in x:print chr(ord(y)+1), • e v a n • f w b o • e v a n e v a n • n a v e • d u z o • a e n v

  3. What will the following print out? num = 12 if num == 12:print ‘a’, elif num == 12 or num == 15print ‘b’, else:print ‘c’ • a • a b • a b c • a c

  4. a a e a e f (error) What will the following print out? num = 12 if num == 12:print ‘a’, elif num == 12 or num == 15:print ‘b’, else:print ‘c’ if num == 27:print ‘d’, elif num == 19 or num == 12:print ‘e’ print f

  5. g q z l m q z q z z l m q z l (error) What will the following print out? for letter in ‘meal’:if letter > ‘g’: print letter,elif letter > ‘d’: print ‘q’,else: print ‘z’,

More Related