1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alex
2 years ago
12

Special words are those words that start and end with the same letter. [14]

Computers and Technology
1 answer:
wel2 years ago
3 0

Answer:

<em>This program is written in python programming language</em>

<em>The program uses few comments (See Explanation for further explanation of each line)</em>

<em>See attachment for proper format view of the source code</em>

<em>Program starts here</em>

<em></em>

#Prompt user for Input

inpstring = input("Enter a string: ")

#Reverse user input

revstring = inpstring[::-1]

#Calculate length of user input

i = len(inpstring)

if(inpstring.upper() == revstring.upper()):

     print("The input string is Palindrome")

else:

     if(inpstring[0].upper() == inpstring[i-1].upper()):

           print("The input string is a Special Word")

     else:

           print("The input string is neither Palindrome nor Special")

Explanation:

inpstring = input("Enter a string: ")-> This line accepts input from user

revstring = inpstring[::-1]-> This line reverses user input

i = len(inpstring)-> This line calculates the length of user input

The following if statement checks for palindromes; i.e. if input string is equal to reversed string

if(inpstring.upper() == revstring.upper()):

     print("The input string is Palindrome")

If the above is statement is not true, the following is executed (to check for special word)

else:

The following if statement checks if the first letter of the input string is equal to its last letter

     if(inpstring[0].upper() == inpstring[i-1].upper()):

           print("The input string is a Special Word")

If the above statement if not true, then input string is not a special word and it's not palindromic.

Hence, the its accompanying else statement will be executed

     else:

           print("The input string is neither Palindrome nor Special")

You might be interested in
Everybody at a company is assigned a unique 9 digit ID. How many unique IDs exist?
Brut [27]
If you include all zeroes, then it should be 1,000,000,000. Otherwise it’s 999,999,999.

Think of how between 0-9 theres 10 numbers, and use that logic towards 000000000-999999999
3 0
3 years ago
How to see how many words you have on google docs?
liberstina [14]
In the menu bar, click Tools > Word Count or hit Ctrl/Cmd + Shift + C.
4 0
3 years ago
What can save a computer from damage by sudden increases in voltage?
Simora [160]
Surge protector :) hope this helps
7 0
3 years ago
php Exercise 3: Function Write a function named word_count that accepts a string as its parameter and returns the number of word
Bingel [31]

Answer:

<?php  

function word_count($string){   // function that takes a string a parameter and returns the number of words in that string

   $space = 0;   // this variable is used in order to detect space, new line and tab spaces in a string

   $words = 1; // this variable is used to identify word presence in string

   $include = $space;  //used to maintain the state of $words and $space

   $counter = 0;  // this counts the number of words in the string

   $i = 0;  //this moves through each character of the string

   while ($i < strlen($string)){  // iterates through every character of string until the last character of string is reached

       if ($string[$i] == " "||$string[$i] == "\n" || $string[$i] == "\t")  //if the space or new line or tab space is identified in the string

           $include = $space;  //set the state of include as space if the next character is a space newline or a tab space

       else if ($include == $space) {  //if next character is a word and current state i.e. $include holds $space

           $include = $words;   //  then set the state i.e. $include as $words

           ++$counter; } //increments i to move to next character at each iteration

       ++$i;  } //returns the number of words in a string

   return $counter; }

$str = "Hello, how are you ";  //sample string

echo "Words: " . word_count($str);  // calls word_count function to return number of words in str.

?>  

Explanation:

The program has a function word_count that accepts a string as its parameter and returns the number of words in the string. In the function there are three variables $space and $words and $include used as state variables. For instance $space identifies space, new line and tab spaces in the $string so it specifies that a space has occurred. $words identifies words in the $string so it specifies that a word has occurred. $include holds this state information. $i moves through every character of the $string and when a space occurs in the $string then the state $include is set to $space. When a word occurs then state $include is set to $words. $counter variable, which is used to count the number of words is incremented to 1 when previous state is $space and next character is a word character. Every time a word is seen in the string, this variable is incremented to 1 to keep track of number of words in the string. When $i reaches the end of the string then this loop stops and counter returns the number of words in the $string.

5 0
3 years ago
PLSS HELP ME!!
Nady [450]

Answer:

1 no. USB port?!?

2no. Hard Disk Drive?!?

3no. Firmware.

7 0
2 years ago
Other questions:
  • Linux distributions overview? information​
    7·1 answer
  • True or False, PDF documents have many benefits, but their main disadvantage is that the formatting of their text and graphic el
    15·1 answer
  • If you enter 234.567 into a cell that is formatted to display 1 decimal point place, what is the value stored in the cell
    9·1 answer
  • You will be given a string, containing both uppercase and lowercase alphabets(numbers are not allowed).
    14·1 answer
  • Using bearings will cause more friction. Group of answer choices True False
    10·1 answer
  • A network administrator is configuring the triggering mechanism for the network-based IPS by defining a pattern of web surfing a
    10·2 answers
  • Two system administrators who work in two different buildings for the same company want to open a communication channel between
    8·1 answer
  • Factoring of integers. Write a python program that asks the user for an integer and then prints out all its factors. For example
    13·1 answer
  • Write a technical term for following statements
    15·1 answer
  • Question 12 (2 points)
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!