Computers and Technology

Write a function called name_facts that will take a firstname (string) as an input parameter, and print out various facts about the name, including:

1) its length,

2) whether it starts with the letter A, and

3) whether it contains a Z or X.

To gain full credit for this exercise, you must use string formatting to print out the result.

Hints:

You will probably want to convert the string to lowercase when checking conditions 2 and 3. You can get by without it, but you'll have to make sure you check both lower and uppercase versions of the letters
You will have to use the in operator for condition 3
You will also probably want to make a separate message for conditions 2 and 3 (depending on the answer) and use string formatting to join them into the final message
Example output:

Given "Allegra" as input: Your name is 7 letters long, does start with the letter A, and does not contain a Z or X
Given "Xander" as input: Your name is 6 letters long, does not start with the letter A, and does contain a Z or X

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:30, kylabreanne120
How are natural numbers, whole numbers, integers, and rational numbers related
Answers: 3
image
Computers and Technology, 22.06.2019 01:50, divine134
A.) generate scaffolding to create database for your application. develop all the entities identified in assignment #2. add any additional that may be identified later. b.) add data validation rules to the models that are appropriate for your application and data. c.) create links for each scaffold in the header section. part 2: application updates [30 points] a.) add two additional views to the "home" controller you created in assignment #1. b.) the two views should be named as “privacy" and "". c.) link the two newly created views in the footer section. hint: you would need to modify the “home" controller definition and create “privacy. html. erb" and “.html. erb" files in appropriate locations.
Answers: 3
image
Computers and Technology, 22.06.2019 23:00, brookerebman15
Which type of tab stop is most for weights and measurements?
Answers: 1
image
Computers and Technology, 23.06.2019 14:00, shawn423
How are stop motion special effects in animated films created
Answers: 1
Do you know the correct answer?
Write a function called name_facts that will take a firstname (string) as an input parameter, and pr...

Questions in other subjects:

Konu
Mathematics, 30.01.2021 01:50
Konu
Mathematics, 30.01.2021 01:50
Konu
Chemistry, 30.01.2021 01:50