The exercise contains the outline of the function first_character. Please complete it so that it prints out the first character of the string it takes as its argument. def first character (text): #write your code here #testing the function: if name == "__main__": first character('python') first character ('yellow') first character('tomorrow') first character('heliotrope') first character ('open') first character('night') PytOF Р У h n -- Sample output

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question

Can you use Python programming language to to this question?

Thanks

The exercise contains the outline of the function first_character. Please complete it
so that it prints out the first character of the string it takes as its argument.
def first character (text):
# write your code here.
#testing the function:
if name
PY I OC
р
y
t
h
n
3
min
1 def first character (text):
2 # write your code here
"__main__":
first_character('python')
first character ('yellow')
first character('tomorrow')
first character('heliotrope')
first character('open')
character ('night')
first
——
4
#
#testing the function:
5 if name == "___main__":
6 first character('python')
first character('yellow')
first character('tomorrow')
first character('heliotrope')
7
8
9
10 first character('open')
11 first character('night')
Sample output
Transcribed Image Text:The exercise contains the outline of the function first_character. Please complete it so that it prints out the first character of the string it takes as its argument. def first character (text): # write your code here. #testing the function: if name PY I OC р y t h n 3 min 1 def first character (text): 2 # write your code here "__main__": first_character('python') first character ('yellow') first character('tomorrow') first character('heliotrope') first character('open') character ('night') first —— 4 # #testing the function: 5 if name == "___main__": 6 first character('python') first character('yellow') first character('tomorrow') first character('heliotrope') 7 8 9 10 first character('open') 11 first character('night') Sample output
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning