{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


for a in rangeage print happy birthday you what

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: w_input("What is your name? ") age = int(raw_input("How old are you? ")) for a in range(age): print "Happy Birthday", you, "!" >>> What is your name? Penelope How old are you? 4 Happy Birthday Penelope ! Happy Birthday Penelope ! Happy Birthday Penelope ! Happy Birthday Penelope ! page 3 22. Write a Python function, called fooey(word), that decides whether a particular string contains the letter "z". For examples: fooey("drat") = False fooey("") = False fooey("zebra") = True def fooey(word): for a in word: if a == "z": return True return False def fooey(word): for i in range(len(word)): if word[i] == "z": return True return False 23. What does this program print? Remember that "%" is the integer remainder operator. for i in range(6): ! if (i % 2 > 0): ! ! print i 1 3 5 Monty Python • Bonus Question (1-point) What is the Python language named for? ____________________________...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online