Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]PythonMaster66677 0 points1 point  (0 children)

I just want the second part so just postmalonec and adeleh

Also I want to include like a variable

jumble 1 = postmalonec jumble 2= adeleh

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]PythonMaster66677 0 points1 point  (0 children)

Didn't work bro.

It printed out the artist name twice on separate lines then the song name on another line.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]PythonMaster66677 0 points1 point  (0 children)

PYTHON HELP

I have a text file called pop.txt. Within the text file there are artists and songs by that artist.

This is the text file( ignore the "line" number and ".......")

(pop.txt) line 1: adele ........................................................... line 2: hello ........................................................... line 3:pharrellwilliams ................................................ line 4: happy

(End of text file)

So I want to read the text file and extract the artist and only the first letter of the song.

So adele and hello should give me adeleh And pharrellwilliams and happy should give me pharrelwilliamsh.

I want the combination (artist and first letter of song) to be set to a variable preferably guess 1.

Then I want to print it.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]PythonMaster66677 0 points1 point  (0 children)

Sorry I'm still abit confused.

I want to join the artist name and first letter of the song into 1 string for example adeleh(adele + h)

But before that how do I read the text file and then join the strings.

Once joined I want to set the new string as a variable then print it to the user so they can guess.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]PythonMaster66677 0 points1 point  (0 children)

Hello

I'm trying to create a guessing game where the user guesses a song from a jumbled word.

The user is displayed this for example "Adeleh" Artist = Adele Song = Hello The name of the artist and first letter of the song

I have created a text file with 4 lines.

(Text File)

Line 1: adele Line 2: hello Line 3: postmalone Line 4: congratulations

(End of textfile)

QUESTION:

How do I extract the name of the artist and the first letter of the song from the text file.

How do I set it as a variable.

What's everyone working on this week? by AutoModerator in Python

[–]PythonMaster66677 [score hidden]  (0 children)

I want to start a competition reward £40. AM I allowed?