Goal of the script here for python

Assignment Help Basic Computer Science
Reference no: EM131835550

I need help with an assignment. The goal of the script here for Python is to make a program that lets users enter their information as long as they want. The information I need is sex, age, and name. Then I have to print the number of males/number of females and an average age. Finally, the user has to be able to exit the program. Additionally, there must be an exception for spelling male or female wrong and an exception for ages outside of the 18-65 range. This is what I have so far but loops, lists and exceptions is quite confusing.

name = " "

gender = " "

age = " "

maleVariable = []

femaleVariable = []

ageVariable = []

name = raw_input ("Enter name here or press enter to end script:")

while True:

   if name == "enter":

       break

   else:

       age = raw_input ("Enter age here:")

       gender = raw_input ("Enter gender here (male or female):")

   if gender == "male":

       maleCount == maleCount + 1

       MaleInfo.append ((name, age))

   if gender == "female":

       femaleCount = femaleCount + 1

       FemaleInfo.append ((name, age))

name = ""

list = [ ]

while name <> " ":

   name = raw_input ("What is your name: ")

age = ""

list = [ ]

while age <> " ":

   age = raw_input ("How old are you: ")

sex = ""

list = [ ]

while sex <> " ":

   sex = raw_input ("Are you a male or female: ")

for i in MaleInfo:

   print i[0] + " is " + i[1] + " year old."

for i in FemaleInfo:

   print i [0] + " is " + i [1] + "years old."

cont = 'y'

cont not in "yes or no"

print femaleCount

print femaleAge/femaleCount

print maleCount

print maleAge/maleCount

print "Loop completed"

maleVariable = []

femaleVariable = []

Reference no: EM131835550

Questions Cloud

What are the tools available and limitations : You have found out that your team is not familiar with the Active Directory Tools. What are the tools available and limitations.
Analyze the business-level strategies : Assess your satisfaction with the Aldi's and make recommendations about how that company could modify its business-level strategy to both increase.
How about the expected return to equity owners and rE : A firm requires $L to pay for a single project that it wants to invest in. How about the expected return to equity owners, rE,?
Evaluate the two evaluation instruments used in the fabrics : Evaluate the two evaluation instruments used in the Fabrics, Inc. case. Discuss how the evaluation results should be used.
Goal of the script here for python : I need help with an assignment. The goal of the script here for Python is to make a program that lets users enter their information as long as they want
To calculate the number of years until maturity : To calculate the number of years until maturity, assume that it is currently January 15, 2016. What is the coupon rate for the Williams Co. bond?
Discuss one of the foreign health care systems : Compare one of the foreign health care systems outlined in your text or in other sources, and point out the major differences with the health care system.
Retrieve details of all the students : Write SQL statement to retrieve details of all the students who have registered for the module 'CSE1016Y'. The details to be retrieved are the student id
Find problems inherent in simpson wacc calculation : Find problems inherent in Simpson’s WACC calculation. 2. What can you suggest to solve problems found in Question 1?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Find the ratio of total transistor area in the nand gate

Size the transistors in a three-input, static complementary NAND gate so that the gate's rise and fall times are approximately equal.

  What might happen if this bandwidth were exceeded

Suppose IP's maximum segment lifetime (MSL) is 60 seconds; that is, delayed packets can arrive up to 60 seconds late but no later. What might happen if this bandwidth were exceeded?

  How long is a nanoyear in seconds

Here are some questions for practicing unit conversions: (a) How long is a nanoyear in seconds? (b) Micrometers are often called microns. How long is a megamicron?

  What you think you should do to protect your work

What you think you should do to protect your work on the computer. Discussed back up plans and any devices that you use for the back up of your information.

  Initially presents a menu of choices for the user

Write a C program that initially presents a menu of choices for the user. The menu should consist of the following choices: A. Create an initial linked list of students and grades.

  Psychological factors affecting human computer interaction

What are the psychological factors affecting human computer interaction. (at least 400 words)

  Development method affect your requirements gathering

How might using the Agile development method affect your requirements gathering? What are the pros and cons of this?

  Health insurance portability and accountability act

The case described in the Introduction is not atypical, even with as much emphasis as there is on information security; it is a good example of where an organization has violated the HIPAA and/or state laws.

  Creates a series of random 2d objects

Part 1: Create a program (OpenGL, or DirectX) that creates a series of random 2D objects, (or 3D objects that only move in 2D), about 25 is probably good but you may need more or less and has them move around on the screen, they should wrap around..

  Compare the unstandardized and standardized coefficients

Reanalyze the final nonrecursive model of turnover intention (see Figure 14.2 for the initial model) by constraining to equality the direct effects of the feedback loop. Compare the unstandardized and standardized coefficients.

  Find the change to be dispensed from a vending machine

An item in the machine can cost between 25 cents and a dol-lar, in 5-cent increments (25, 30, 35 ..... 90, 95, or 100), and the machine accepts only a single dollar bill to pay for the item. For example, a possible dialogue with the user might be

  Knowledge and background on hacktivists and hacktivist

Now that you know a little knowledge and background on hacktivists and hacktivist, let's explore another case study.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd