Answer:
Explanation:
The program first asks the user for the sequence of words. Then it splits the sequence into an array of words. Then it loops through the array checking each word to see if it is a palindrome. If it is it prints the word, the boolean value, and adds 1 to the palindrome_count variable. Otherwise it prints the word, false, and moves on to the next word in the list. Finally, it prints out the total value of palindrome_count.
word = input("Enter sequence of words: ")
word_list = word.split(' ')
print(word_list)
palindrome_count = 0
for word in word_list:
print('\n\n')
reverse = word[::-1]
if word == reverse:
print(word, end='\n')
print(True, end="\n")
palindrome_count += 1
else:
print(word, end='\n')
print(False, end='\n')
print("\n\nNumber of Palindromes in Sequence: " + str(palindrome_count))
Answer:
C. Purpose
Explanation:
The purpose of website should be determined and then text fonts and layout should be selected. The target audience of the website should be determined and it should be identified their preference so that website layout is designed in a way which impresses the audience and leaves an impact on them.
MAC address
....................
Answer:
import java.io.*;
public class Main
{
public static void main(String[] args) throws IOException {
BufferedReader bufferObject=new BufferedReader(new InputStreamReader(System.in));
String stringObject=bufferObject.readLine();
while(!stringObject.equals("99:99AM")){
System.out.println(convertedTime(stringObject));
stringObject=bufferObject.readLine();
}
}
public static String convertedTime(String stringObject){
String s=stringObject.substring(stringObject.length()-2);
String[] timeObject=stringObject.substring(0,5).split(":");
if(s.equals("AM")){
if(timeObject[0].equals("12")) return "00"+timeObject[1];
else return timeObject[0]+timeObject[1];
}
else{
if(timeObject[0].equals("12")) return "12"+timeObject[1];
else{
int hours=Integer.valueOf(timeObject[0]);
timeObject[0]=String.valueOf(12+hours);
return timeObject[0]+timeObject[1];
}
}
}
}
Explanation:
- Inside the main method run a while loop until stringObject is not equal to the string "99:99AM".
- Call the convertedTime method and display the results.
- Use the same hours and minutes except for 12th hour If the time is in AM.
- Use "00" instead of 12, if it is 12th hour.
- Add hours to 12, if the time is in PM and don't change anything in case of 12.