Question

In: Computer Science

Write a Python program that takes information from the user about a spider seen in North...

Write a Python program that takes information from the user about a spider seen in North America and returns whether it is likely to be a dangerous spider. The only two spiders in North America that are actually dangerous are the widow and recluse. The program will ask the user for the following information: color and special markings.

printWelcome – prints program information

printColorMenu – Color menu options should be brown, black, other

printSpecialMarkingsMenu – Special markings options should be hour glass on underside, violin shape on head, other

main – takes in color option and returns spider information as follows:

  • Brown and hourglass on underside: brown widow is dangerous
  • Black and hourglass on underside: black widow is dangerous
  • Brown and violin shape on head: brown recluse is dangerous
  • Other selected for color or special markings: likely not dangerous

Solutions

Expert Solution

def printWelcome ():
print('''This program takes information from the user about a spider seen in North America and returns
whether it is likely to be a dangerous spider. The only two spiders in North America that are actually
dangerous are the widow and recluse.\nThe program will ask the user for the following information: color
and special markings.''')
print('\n')
def printColorMenu ():
print('Select color:')
print('1: brown\n2: black\n3: other')
def printSpecialMarkingsMenu():
print('Select special markings:')
print('1: hour glass on underside\n2: violin shape on head\n3: other')
def main():
printWelcome()
printColorMenu()
col = int(input(">> "))
printSpecialMarkingsMenu()
mark=int(input(">> "))
if col==1:
if mark==1:
print('brown widow is dangerous')
elif mark==2:
print('brown recluse is dangerous')
else:
print('likely not dangerous')
elif col==2:
if mark==1:
print('black widow is dangerous')
else:
print('likely not dangerous')
else:
print('likely not dangerous')
main()


Related Solutions

write a Python program that takes information from the user about a spider seen in North...
write a Python program that takes information from the user about a spider seen in North America and returns whether it is likely to be a dangerous spider. The only two spiders in North America that are actually dangerous are the widow and recluse. The program will ask the user for the following information: color and special markings. printWelcome – prints program information printColorMenu – Color menu options should be brown, black, other printSpecialMarkingsMenu – Special markings options should be...
Python Program 1: Write a program that takes user input in the form of a string...
Python Program 1: Write a program that takes user input in the form of a string Break up the string into a list of characters Store the characters in a dictionary The key of the dictionary is the character The value of the dictionary is the count of times the letter appears Hint: remember to initialize each key before using Output of program is the count of each character/letter Sort the output by key (which is the character) Python Program...
In PYTHON: Write a program that asks for a password from a user and checks if...
In PYTHON: Write a program that asks for a password from a user and checks if it satisfies the conditions: Contains at least one lowercase letter (a-z). Contains at least one uppercase letter (A-Z). Contains at least one digit (0-9). Minimum length 6 characters. Contains no spaces. If the password is valid, then the program prints “password accepted”. Otherwise, it keeps asking for more passwords from the user until a valid password is obtained. Hint: You might like to check...
how to write a cpp program that takes a number from a user, and print the...
how to write a cpp program that takes a number from a user, and print the sum of all numbers from one to that number on screen? using loop interation as basic as possible.
Write a program that takes a string input from the user and then outputs the first...
Write a program that takes a string input from the user and then outputs the first character, then the first two, then the first three, etc until it prints the entire word. After going up to the full word, go back down to a single letter. LastNameUpDown. Input: Kean Output: K Ke Kea Kean Kea Ke K
c# language Write a program that takes in a number from the user. Then it prints...
c# language Write a program that takes in a number from the user. Then it prints a statement telling the user if the number is even or odd. If the number is odd, it counts down from the number to 0 and prints the countdown on the screen, each number on a new line. If the number is even, it counts down from the number to 0, only even numbers. For example, if the user enters 5, the output will...
In python. Projectile motion: Write a python program that will ask the user for      an...
In python. Projectile motion: Write a python program that will ask the user for      an initial height y0, initial velocity v, launch angle theta, and mass m.      Create two functions, one that will calculate max height      of the projectile, and one that will calculate the range. Ask the     user which one he/she would like to calculate, then present them with the answer. (use kg, m and m/s)
Calculating Delivery Cost Program in Python write a program in Python that will ask a user...
Calculating Delivery Cost Program in Python write a program in Python that will ask a user to enter the purchase total, the number of the items that need to be delivered and delivery day. Then the system displays the cost of delivery along with the total cost. Purchase total > $150 Yes Number of the items (N) N<=5 N>=6 Delivery day Same Day Next Day Same Day Next Day Delivery charges ($) 8 N * 1.50 N * 2.50 N...
Write a Java program that takes an array of 10 "Int" values from the user and...
Write a Java program that takes an array of 10 "Int" values from the user and determines if all the values are distinct or not. Return TRUE if all the values of the array are distinct and FALSE if otherwise.
2. Write a c++ program that takes from the user the ​number of courses​ and constructs...
2. Write a c++ program that takes from the user the ​number of courses​ and constructs 3 ​dynamic 1D arrays​ with size courses+1. Each array represents a student. Each cell in the array represents a student’s mark in a course. In the last cell of each 1D array you should calculate the average mark of that student. Then output the average mark of all students in each course. Delete any allocated memory. Example Number of courses : 4 50 60...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT