Question
WIkipedia pages have a specific webpage address. Any address starts with https://en.wikipedia.org/wiki/ and then continues with the topic for that page e.g. Computer_science , Java_(programming_language)
WIkipedia pages have a specific webpage address. Any address starts with https://en.wikipedia.org/wiki/ and then continues with the topic for that page e.g. Computer_science, Java_(programming_language). See examples below:
https://en.wikipedia.org/wiki/Computer_science
https://en.wikipedia.org/wiki/Java_(programming_language)
https://en.wikipedia.org/wiki/Imagine_Dragons
Write a program that reads a string from the user. If it is a valid wikipedia webpage, it extracts and prints the topic for that page. If it is not a valid address it prints the message Not a valid wikipedia webpage address. Hint: How can the fact that all valid addresses start with the same text before the topic name help you extract the topic name? You do NOT need to handle the case where the webpage address is correct, but it is written in uppercase letters. You can assume it is all lowercase.
the text is all in lowercase and
if the address is valid, then it will have at least one more character for the topic. That is, you do not need to handle an input like: https://en.wikipedia.org/wiki/.
---- Sample run 1
This program will extract the topic from a valid Wikipedia webpage address.
Enter a web address: https://en.wikipedia.org/wiki/Computer_science
Topic: Computer_science
Bye.
---- Sample run 2
This program will extract the topic from a valid Wikipedia webpage address.
Enter a web address: http://vlm1.uta.edu/~alex/courses/1310/homework/hw02.html
Not a valid wikipedia webpage address.
Bye.
---- Sample run 3
This program will extract the topic from a valid Wikipedia webpage address.
Enter a web address: https://en.wikipedia.org/wiki/
Topic:
Bye.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started