# Popcorn Hack #1

lyrics = """
Twinkle, twinkle, little star,
How I wonder what you are!
Up above the world so high,
Like a diamond in the sky.

Twinkle, twinkle, little star,
How I wonder what you are!
When the blazing sun is gone,
When he nothing shines upon.

Then you show your little light,
Twinkle, twinkle, all the night.
Twinkle, twinkle, little star,
How I wonder what you are!

In the dark blue sky you keep,
And often through my curtains peep,
For you never shut your eye
Till the sun is in the sky.

Twinkle, twinkle, little star,
How I wonder what you are!
"""


title = "Twinkle, twinkle, little star"
title_count = lyrics.lower().count(title.lower())
print("The title '" + title + "' appears " + str(title_count) + " times in the lyrics.")


words = lyrics.split()
if len(words) >= 50:
    index_50th_word = lyrics.find(words[49])
    print("The index of the 50th word is '" + words[49] + "' at index " + str(index_50th_word) + ".")
else:
    print("The lyrics do not contain 50 words.")


verses = lyrics.strip().split("\n\n")
first_verse = verses[0]
last_verse = verses[-1]
lyrics_modified = lyrics.replace(first_verse, last_verse, 1)
print("\nModified Lyrics:")
print(lyrics_modified)


if len(verses) > 2:
    new_verse = verses[1] + "\n\n" + verses[2]
    print("\nNew Verse:")
    print(new_verse)
else:
    print("Not enough verses to create a new verse.")
The title 'Twinkle, twinkle, little star' appears 4 times in the lyrics.
The index of the 50th word is 'Twinkle,' at index 1.

Modified Lyrics:

Twinkle, twinkle, little star,
How I wonder what you are!

Twinkle, twinkle, little star,
How I wonder what you are!
When the blazing sun is gone,
When he nothing shines upon.

Then you show your little light,
Twinkle, twinkle, all the night.
Twinkle, twinkle, little star,
How I wonder what you are!

In the dark blue sky you keep,
And often through my curtains peep,
For you never shut your eye
Till the sun is in the sky.

Twinkle, twinkle, little star,
How I wonder what you are!


New Verse:
Twinkle, twinkle, little star,
How I wonder what you are!
When the blazing sun is gone,
When he nothing shines upon.

Then you show your little light,
Twinkle, twinkle, all the night.
Twinkle, twinkle, little star,
How I wonder what you are!
const flower = "Tulip";
const animal = "Dog";
const newCreature = `${flower}-${animal}`;

console.log("Introducing the new creature:", newCreature);

let creatureName = "Tulipup";
let habitat = "magical garden";

let story = `
In a dense ${habitat}, where the sunlight filtered through the trees and vibrant flowers blossomed, lived a unique creature known as the ${creatureName}. This fascinating being combined the beauty of a ${flower} with the cleverness of a ${animal}.

One day, a traveler named Pranav, exploring the ${habitat}, came across the ${creatureName}. Curious, he approached and asked, "What makes you so special?"

The ${creatureName} replied with a smile, "I blend the charm of a ${flower} with the sharpness of a ${animal}. I can guide you through these woods and show you hidden wonders!"

Intrigued, Pranav agreed. Together, they set off on an adventure, discovering hidden glades and sparkling streams. The ${creatureName} shared stories about the garden, revealing its secrets.
`;

console.log(story);
  Cell In[7], line 1
    const flower = "Tulip";
          ^
SyntaxError: invalid syntax
def text_analyzer():
    original_string = input("Enter a sentence or a series of words: ")
    print("\nOriginal String:", original_string)
    print("Total Characters (including spaces):", len(original_string))
    
    words = original_string.split()
    longest_word = max(words, key=len)
    print("Longest Word:", longest_word, "with", len(longest_word), "characters")
    
    print("Reversed String:", original_string[::-1])
    
    cleaned_string = ''.join(filter(str.isalnum, original_string))
    mid_index = len(cleaned_string) // 2
    middle_character = cleaned_string[mid_index] if len(cleaned_string) % 2 != 0 else cleaned_string[mid_index-1:mid_index+1]
    print("Middle Character(s):", middle_character)
    
    if input("\nReplace a word? (yes/no): ").strip().lower() == 'yes':
        word_to_replace = input("Word to replace: ")
        print("Modified String:", original_string.replace(word_to_replace, input("Replace with: ")) if word_to_replace in original_string else f"The word '{word_to_replace}' is not found.")

text_analyzer()
Original String: Hi, my name is Pranav Santhosh and I enjoy Coding!
Total Characters (including spaces): 50
Longest Word: Santhosh with 8 characters
Reversed String: !gnidoC yojne I dna hsohtnaS vanarP si eman ym ,iH
Middle Character(s): t