211k views
2 votes
Assume that given, middle and family are three variables of type String that have been assigned values. Write an expression whose value is a String consisting of the first character of given followed by a period followed by the first character of middle followed by a period followed by the first character of family followed by a period: in other words, the initials of the name. So if the values of these three variables were "John" "Fitzgerald" "Kennedy", then the expression's value would be "J.F.K.".

1 Answer

4 votes

Answer:

#program in Python

#variables

given="John"

middle="Fitzgerald"

family="Kennedy"

#find first character of each variable and ptint

print("{}.{}.{}".format(given[0],middle[0],family[0]))

Step-by-step explanation:

Declare and initialize variables "given" with "John","middle" with "Fitzgerald" and "family" wit "Kennedy".Print the first character of each variables separated by a "." in between of each character.

Output:

J.F.K

User Akshay Maldhure
by
7.5k points

No related questions found