Individual or other words user and attackers
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:
<em>t</em><em>h</em><em>e</em><em> </em><em>f</em><em>i</em><em>r</em><em>s</em><em>t</em><em> </em><em>m</em><em>i</em><em>n</em><em>i</em><em>c</em><em>o</em><em>m</em><em>p</em><em>u</em><em>t</em><em>e</em><em>r</em><em> </em><em>w</em><em>a</em><em>s</em><em> </em><em>i</em><em>n</em><em>t</em><em>r</em><em>o</em><em>d</em><em>u</em><em>c</em><em>e</em><em> </em><em>b</em><em>y</em><em> </em><em>d</em><em>i</em><em>g</em><em>i</em><em>t</em><em>a</em><em>l</em><em> </em><em>e</em><em>q</em><em>u</em><em>i</em><em>p</em><em>m</em><em>e</em><em>n</em><em>t</em><em> </em><em>c</em><em>o</em><em>r</em><em>o</em><em>p</em><em>o</em><em>r</em><em>a</em><em>t</em><em>i</em><em>o</em><em>n</em><em> </em><em>(</em><em>D</em><em>E</em><em>C</em><em>)</em><em>a</em><em>f</em><em>t</em><em>e</em><em>r</em><em> </em><em>t</em><em>h</em><em>e</em><em>s</em><em>e</em><em> </em><em>I</em><em>B</em><em>M</em><em> </em><em>c</em><em>o</em><em>r</em><em>p</em><em>o</em><em>r</em><em>a</em><em>t</em><em>i</em><em>o</em><em>n</em><em> </em><em>a</em><em>l</em><em>s</em><em>o</em><em> </em><em>m</em><em>i</em><em>n</em><em>i</em><em>c</em><em>o</em><em>m</em><em>p</em><em>u</em><em>t</em><em>e</em><em>r</em><em> </em><em>f</em><em>o</em><em>r</em><em> </em><em>e</em><em>x</em><em>a</em><em>m</em><em>p</em><em>l</em><em>e</em><em> </em><em>P</em><em>D</em><em>P</em><em>–</em><em>1</em><em>1</em>
Answer:
<?php
$mysqli = new mysqli("127.0.0.1:3307", "myUser", "myPass", "databasename");
$query = "SELECT * FROM users ORDER BY name";
if($result = $mysqli->query($query))
{
echo '<ul>';
while ($obj = $result->fetch_object())
{
echo '<li>'.$obj->name.'</li>';
}
$result->free();
echo '</ul>';
}
else
{
die("nothing found");
}
$mysqli->Close();
?>
Explanation:
This should get you started.