When the following code is run: def myFunction(aStr): result = aStr return result[3:9:2] greetings = 'hello, world' print(myFunction(greeting)) What will appear on the screen? ? l,wr ? l,w ? Error: two strings concatenated illegally ? Error: cannot slice a result ? None of the above
Added by David G.
Close
Step 1
Step 1: Define the function `myfunction` that takes in a string `astr` as a parameter. Show more…
Show all steps
Your feedback will help us improve your experience
Sanchit Jain and 94 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
What is a correct syntax to output "Hello World" in Python?
Sanchit J.
The following code snippet: def func1(a): return None def func2(a): if a > 2: return func1(a) * func1(a) else: return func1(a * 4) print(func2(4)) a. Will output None. b. Will output 16. c. Will cause a runtime error. d. Will output 4.
Madhur L.
The greeter greets people entering a hotel. The boss should be greeted with 'Hello, {name}', while everyone else should be greeted with 'Welcome, {name}'. If multiple people enter, only the person who entered last should be greeted. If no one has entered since the last greeting, a call to greet() should return None. For example, the following code should display 'Welcome, John': g = Greeter('Chuck') g.enters('John') print(g.greet()) Implement the greeter.
Aarya B.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD