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
  • Phython For this program you will be writing a program that will use if-else or if-elif-else...

    Phython For this program you will be writing a program that will use if-else or if-elif-else statements. Read-It-All bookstore has a book sales club where customers can earn reward points that can be used for their next purchase. If a customer purchases 0 books, he/she earns 0 points. If a customer purchases 1-3 books, he/she earns 5 points. If a customer purchases 4-6 books, he/she earns 10 points. If a customer purchases 7-8 books, he/she earns 15 points. If a...

  • 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...

  • design a program (.js extension) using JS Language The program should ask the user for their...

    design a program (.js extension) using JS Language The program should ask the user for their name. The program should than print "hello, name.. what is your age?" The program should than calculate age * 365 and print you have lived for over ... days An if statement should than be added after stating that if the user is over 21 years of age it should print, "You are an adult" if the user is under 21 years of age....

  • In this lab, you add the input and output statements to a partially completed Python program....

    In this lab, you add the input and output statements to a partially completed Python program. When completed, the user should be able to enter a year, a month, and a day. The program then determines if the date is valid. Valid years are those that are greater than 0, valid months include the values 1 through 12, and valid days include the values 1 through 31. Instructions Notice that variables have been declared for you. Write input statements to...

  • 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.

  • 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...

  • 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...

  • 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...

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