Question

Use python and use if, elif and else statements. Thank you! The program should first ask...

Use python and use if, elif and else statements. Thank you!

The program should first ask the user if they are a hero or a villain.

If they enter “villain”, the program should ask them their name;

if they enter “hero”, it should ask how many people they have saved, and respond to that information. Using decision structures, have your program execute certain print statements following these rules:

If they enter that they are a villain Ask for their name and print out “NAME sounds pretty evil!”

If they enter that they are a hero Ask how many people they have saved

If they have saved 10 or fewer people, print: Go on more patrols!

If they have saved more than 10, but less than 100 people, print: ▪ Sounds like you're making a difference!

If they have saved 100 or more people, print: Wow, great job saving the city!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ch=input("Your hero or Vilan: ")

#checking if he is hero or villan

if(ch=="vilan"):

  name=input("Enter your name: ")

  print("NAME sounds Pretty evil!")

else:

#reading number of people he saved

  saved=int(input("Enter how many you saved: "))

#printing messaged based on given number

  if(saved<=10):

    print("Go on more patrols!")

  elif(saved>10 and saved<=100):

    print("Sounds like you're making a difference!")

  else:

    print("Wow,great job saving the city!")

Note : If you like my answer please rate and help me it is very Imp for me

Add a comment
Know the answer?
Add Answer to:
Use python and use if, elif and else statements. Thank you! The program should first ask...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Multiple Conditional Statements Summary In this lab, you complete a Python program that calculates an employee's...

    Multiple Conditional Statements Summary In this lab, you complete a Python program that calculates an employee's annual bonus. Input is an employee's first name, last name, salary, and numeric performance rating. If the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. If the rating is 4 or higher, the rate is 0. The employee bonus is calculated by multiplying the bonus rate by the annual salary. Variables have been declared for you,...

  • Hello, I am trying to solve the following problem using python: Assignment 3: Chatbot A chatbot...

    Hello, I am trying to solve the following problem using python: Assignment 3: Chatbot A chatbot is a computer program designed to emulate human conversation. For this program you will use if statements, user input, and random numbers to create a basic chatbot. Here is the scenario: You have decided to start an online website. You are creating a prototype to show investors so you can raise money and launch your website. You should ask the user at least 5...

  • python - Write a program that asks the user to enter how much their dinner bill...

    python - Write a program that asks the user to enter how much their dinner bill was. Then ask them how many people were in their party. If there were more than 6 people in their party automatically calculate a 20% tip. If there were 6 or less people in their party ask them what percentage they would like to tip. In all cases, print out the total amount of the tip at the end of the program.

  • Propose: In this lab, you will complete a Python program with one partner. This lab will...

    Propose: In this lab, you will complete a Python program with one partner. This lab will help you with the practice modularizing a Python program. Instructions (Ask for guidance if necessary): To speed up the process, follow these steps. Download the ###_###lastnamelab4.py onto your desktop (use your class codes for ### and your last name) Launch Pyscripter and open the .py file from within Pyscripter. The code is already included in a form without any functions. Look it over carefully....

  • This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named...

    This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named Budgeter.java. To use a Scanner for console input, you must import java.util.*; in your code. This program prompts a person for income and expense amounts, then calculates their net monthly income. Below are two example logs of execution from the program. This program’s behavior is dependent on the user input (user input is bold and underlined below to make it stand out and differentiate...

  • This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named...

    This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named Budgeter.java. To use a Scanner for console input, you must import java.util.*; in your code. This program prompts a person for income and expense amounts, then calculates their net monthly income. Below are two example logs of execution from the program. This program’s behavior is dependent on the user input (user input is bold and underlined below to make it stand out and differentiate...

  • PYTHON CODING Create a program that prompts the user twice. The first prompt should ask for...

    PYTHON CODING Create a program that prompts the user twice. The first prompt should ask for the user's most challenging course at Wilmington University. The second prompt should ask for the user's second most challenging course. The red boxes indicate the input from the user. Your program should respond with two copies of an enthusiastic comment about both courses. Be sure to include the input provided by the user to display the message. There are many ways to display a...

  • Hi. Please help me solve this in python using only while loops, if statements. Can't use...

    Hi. Please help me solve this in python using only while loops, if statements. Can't use for loops and lists. In this programming assignment, you will be writing a program that prints out several shapes via text. In this PA, you will be required to use functions and parameters. This is both to reduce redundancy and to make your code clean and well-structured. Name your program shaper.py Your program should have the capability to print out three different shapes: An...

  • Write a Python program (rock_paper_scissors.py) that allows two players play the game rock paper scissors. Remember...

    Write a Python program (rock_paper_scissors.py) that allows two players play the game rock paper scissors. Remember the rules: 1. Rock beats scissors 2. Scissors beats paper 3. Paper beats rock The program should ask the users for their names, then ask them for their picks (rock, paper or scissors). After that, the program should print the winner's name. Note, the players may pick the same thing, in this case the program should say it's tie. when the user input an...

  • (IN PYTHON) Download file homeruns.txt from Canvas. Your program must ask the user for the file...

    (IN PYTHON) Download file homeruns.txt from Canvas. Your program must ask the user for the file name the read that file. Your program must catch an exception if the file isn’t found. It is a comma-delimited file with 2 fields on each line, a year and a number of home runs. Your program should have functions to determine the year with the most home runs, the year with the fewest number of home runs, and the average home runs for...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT