1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Licemer1 [7]
3 years ago
15

If we were ever to use this pizza ordering program again, we would want to use mainline logic to control its execution. The way

it is written, it will automatically execute as soon as it is imported.
Re-write this program, enclosing the top level code into the main function. Then execute the main function. Enter appropriate input so the output matches that under Desired Output.
# Define Function
def pizza(meat="cheese", veggies="onions"):
print("You would like a", meat, "pizza with", veggies)
# Get the User Input
my_meat = input("What meat would you like? ")
my_veggies = input("What veggie would you like? ")
# Call the Function
pizza(meat=my_meat, veggies=my_veggies)
desired output:
What meat would you like? cheese
What veggie would you like? onions
You would like a cheese pizza with onions
2) We want to generate 5 random numbers, but we need the random module to do so. Import the random module, so the code executes.
# Define main function
def main():
print("Your random numbers are:")
for i in range(5):
print(random.randint(1, 10))
# Call main function
main()
desired output:
Your random numbers are:
[x]
[x]
[x]
[x]
[x]
Computers and Technology
1 answer:
Maru [420]3 years ago
7 0

Answer:

Explanation:

The Python program has been adjusted. Now the pizza ordering function is called from the main() method and not as soon as the file is imported. Also, the random package has been imported so that the random.randint(1,10) can correctly create the 5 random numbers needed. The code has been tested and the output can be seen in the attached image below, correctly matching the desired output.

import random

def pizza(meat="cheese", veggies="onions"):

   print("You would like a", meat, "pizza with", veggies)

def main():

   # Get the User Input

   my_meat = input("What meat would you like? ")

   my_veggies = input("What veggie would you like? ")

   # Call the Function

   pizza(meat=my_meat, veggies=my_veggies)

   print("Your random numbers are:")

   for i in range(5):

       print(random.randint(1, 10))

# Call main function

main()

You might be interested in
Create your code from the story using code blocks.You must include at least one of each of the following blocks. You can draw or
Mazyrski [523]

Answer:

Como puedo hacerlo.

Explanation:

Me enseñas como hacerlo

6 0
3 years ago
Read 2 more answers
For which task would you most likely use word-processing software? question 5 options: formatting text with various fonts, sizes
dexar [7]

The tasks for which word-processing software is required are formatting text with various fonts, sizes and styles, placing text in rows and columns for sorting and filtering, and placing numeric data in rows and columns for statistical analysis. The correct options are A, B, and D.

<h3>What is word processing software?</h3>

A word processor is a hardware or computer program that allows for the input, editing, formatting, and output of text, along with other functions.

The act of creating, editing, saving, and printing documents on a computer is referred to as word processing. Word processing requires the use of specialized software known as a Word Processor.

Word processing software is used to edit text documents such as resumes and reports. You basically enter text by typing, and the software provides tools for copying, deleting and various types of formatting.

Today, the word processor is one of the most frequently used software programs on a computer, with Microsoft Word being the most popular word processor.

Thus, the correct options are a, b, and d.

For more details regarding word processing software, visit:

brainly.com/question/20910519

#SPJ2

3 0
1 year ago
Read 2 more answers
Who are the four main antagonists in fnaf 1
ikadub [295]

Answer:

lol it's foxy freddy bonnie and chica

5 0
3 years ago
Read 2 more answers
Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A
harina [27]

Answer:

se explaination

Explanation:

//Design a class named Person

public class Person

{

//A person has a name, address, phone number, and email address.

String name;

String address;

String phone;

String email;

//Constructor with arguments

public Person(String pname,String paddress,String phNum,String pemail)

{

name=pname;

address=paddress;

phone=phNum;

email=pemail;

}

// toString() method to return the name

public String toString()

{

return getClass().getName()+" "+name;

}

}

---------------------------------------------------------

//Student.java

public class Student extends Person

{

//A student has a class status

//(freshman,sophomore, junior, or senior).

//Define the status as a constant.

final int freshman =1;

final int sophomore =2;

final int junior=3;

final int senior=4;

String status="freshman";

//Constructor with arguments

public Student(String name, String address,String phonenumber, String email, int Status)

{

super(name,address,phonenumber,email);

if(Status == 1)

{

status = "freshman";

}

if(Status == 2)

{

status = "sophomore";

}

if(Status == 3)

{

status = "junior";

}

if(Status == 4)

{

status = "Senior";

}

status = "Student";

}

public String toString()

{

return super.toString() + " " + status;

}

}

------------------------------------------------------

//Employee.java

public class Employee extends Person

{

//An employee has an office, salary, and date hired.

String office;

double salary;

java.util.Date dateHired;

//Constructor with arguments

public Employee(String name,String address,String phonenumber,String email,String off,double sal)

{

super(name,address,phonenumber,email);

office=off;

salary=sal;

}

public String toString()

{

return (super.toString() + " " + office +" " + salary);

}

}

--------------------------------------------------------

//Faculty.java

public class Faculty extends Employee

{

//A faculty member has office hours and a rank.

String officeHours;

String rank;

//Constructor with arguments

public Faculty(String name,String address,String phonenumber,String email,String off,int salary,String offHours,String ranks)

{

super(name,address,phonenumber,email,off,salary);

officeHours=offHours;

rank=ranks;

}

public String toString()

{

return (super.toString() + " " + officeHours +" " + rank);

}

}

-----------------------------------------------------------------------------

//Staff.java

public class Staff extends Employee

{

//A staff member has a title

String title;

//Constructor with arguments

public Staff(String name,String address,String phonenumber,String email,String off,int salary,String ti t)

{

super(name,address,phonenumber,email,off,salary);

title=ti t;

}

public String toString()

{

return (super.toString() + " " + title);

}

}

3 0
4 years ago
The house belives that works should be compensated for the loss of jobs due to automation? Describe it in against motion of the
Dima020 [189]

well they should because without a job people cant live a good life and if they took that from them then they should compensate them at least.

5 0
4 years ago
Other questions:
  • Computer-integrated manufacturing (CIM) includes manufacturing systems that have:
    7·1 answer
  • A banker would like to present a spreadsheet as part of a presentation to potential clients. The spreadsheet makes use of severa
    14·1 answer
  • The process that uses 3D modeling software to create a representation of a three dimensional object is called 3D modeling.
    15·2 answers
  • How to type in color on clash royale
    15·2 answers
  • Hey im trying to get a refund because i got charged 24$ for the yearly plan and i didnt know i would get charged can i get the y
    11·1 answer
  • Describe the GRANT statement and explain how it relates to security. What types of privileges may be granted? How are they revok
    15·1 answer
  • A BufferedReader has a constructor that takes a single InputStreamReader parameter. InputStreamReader has a constructor that tak
    8·1 answer
  • Say you find a module in a package that does a lot of awesomely useful things, but the name of it is module_that_does_many_aweso
    12·1 answer
  • Andrew works for a company that develops for a company that develops optic-fiber cables for transmission of data. which layer of
    14·1 answer
  • Which statements are true? Select 4 options.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!