Answer:
In Python:
loop = True
while(loop):
nm1 = float(input("Number 1: "))
nm2 = float(input("Number 2: "))
nm3 = float(input("Number 3: "))
if (nm1 >= 0 and nm2 >= 0 and nm3 >= 0):
result = nm2 * nm3 + nm1
print("Result: "+str(result))
loop = True
else:
print("All inputs must be greater than or equal to 0")
loop = True
Explanation:
First, we set the loop to True (a boolean variable)
loop = True
This while loop iterates, indefinitely
while(loop):
The next three lines prompt user for three numbers
nm1 = float(input("Number 1: "))
nm2 = float(input("Number 2: "))
nm3 = float(input("Number 3: "))
The following if condition checks if all of the numbers are greater than or equal to 0
if (nm1 >= 0 and nm2 >= 0 and nm3 >= 0):
If yes, the result is calculated
result = nm2 * nm3 + nm1
... and printed
print("Result: "+str(result))
The loop is then set to true
loop = True
else:
If otherwise, the user is prompted to enter valid inputs
print("All inputs must be greater than or equal to 0")
The loop is then set to true
loop = True
A year with 366 days is called a leap year. Leap years are necessary to keep the calendar in sync with the sun, because the earth revolves around the sun once very 365.25 days. As a result, years that are divisible by 4, like 1996, are leap years. However, years that are divisible by 100, like 1900, are not leap years. But years that are divisible by 400, like 2000, are leap years. Write a program named leap_year.py that asks the user for a year and computes whether that year is a leap year.
Answer:
Follows are the code to this question:
y = int(input("Enter a year: "))#input year value
if((y%4==0) and (y%100==0) or y%400==0):#defining if block for check leap year condition
print("Given year {0}, is a leap year".format(y))#print value
else:#else block
print("Given year {0}, is not a leap year".format(y))#print value
Output:
Enter a year: 1989
Given year 1989, is not a leap year
Explanation:
In the python code, the y variable uses the input method for input the value from the user-end. In the next step, if a conditional block is used, that's checks the leap-year condition. if the condition is true it will print leap year value with the message, otherwise, it will go to else block that prints not a leap year message.
KM typically means the same thing across different types of businesses.
Answer:
If this is a true or false question, I believe the answer is the answer is false
Explanation:
Answer:
false
Explanation:
Consider an entity set Person, with attributes social security number (ssn), name, nickname, address, and date of birth(dob). Assume that the following business rules hold: (1) no two persons have the same ssn; (2) no two persons have he same combination of name, address and dob. Further, assume that all persons have an ssn, a name and a dob, but that some persons might not have a nickname nor an address.
A) List all candidate keys and all their corresponding superkeys for this relation.
B) Write an appropriate create table statement that defines this entity set.
Answer:
[tex]\pi[/tex]
Explanation:
Computer science pls awnser
Answer: Secure shell (SSH)
Explanation:
Write a program that rolls two dice until the user gets snake eyes. You should use a loop and a half to do this. Each round you should roll two dice (Hint: use the randint function!), and print out their values. If the values on both dice are 1, then it is called snake eyes, and you should break out of the loop. You should also use a variable to keep track of how many rolls it takes to get snake eyes.
Sample Run:
Rolled: 6 5
Rolled: 5 2
Rolled: 3 6
Rolled: 6 2
Rolled: 1 2
Rolled: 5 3
Rolled: 1 4
Rolled: 1 1
It took you 8 rolls to get snake eyes.
I have most of the code but when it prints it say you rolled 0 times every time.
import random
# Enter your code here
num_rolls = 0
import random
# Enter your code here
while True:
roll_one = random.randint(1,6)
roll_two = random.randint(1,6)
print ("Rolled: " +str(roll_one) +"," + str(roll_two))
if (roll_one == 1 and roll_two == 1):
print ("it took you " + str(num_rolls) + " rolls")
break
output:
Rolled: 3,5
Rolled: 6,4
Rolled: 2,4
Rolled: 3,6
Rolled: 5,2
Rolled: 1,1
it took you 0 rolls
suppose to say:
It took you (however many rolls) not 0
import random
num_rolls = 0
while True:
r1 = random.randint(1, 6)
r2 = random.randint(1, 6)
print("Rolled: " + str(r1) + "," + str(r2))
num_rolls += 1
if r1 == r2 == 1:
break
print("It took you "+str(num_rolls)+" rolls")
I added the working code. You don't appear to be adding to num_rolls at all. I wrote my code in python 3.8. I hope this helps.
The program uses loops and conditional statements.
Loops perform repetitive operations, while conditional statements are statements used to make decisions
The program in Python where comments are used to explain each line is as follows:
#This imports the random module
import random
#This initializes the number of rolls to 0
num_rolls = 0
#The following loop is repeated until both rolls are 1
while True:
#This simulates roll 1
roll_one = random.randint(1,6)
#This simulates roll 2
roll_two = random.randint(1,6)
#This prints the outcome of each roll
print ("Rolled: " +str(roll_one) +"," + str(roll_two))
#This counts the number of rolls
num_rolls+=1
#When both rolls are the 1
if (roll_one == 1 and roll_two == 1):
#This exits the loop
break
#This prints the number of rolls
print ("it took you " + str(num_rolls) + " rolls")
Read more about similar programs at:
https://brainly.com/question/14912735
Plz go sub 2 "Shyy096" he is a 11 y/o boy and makes music fortnite vids, it would rly help him if u subscribe cuz he only has 8. tysm:)
Answer:
OKK
Explanation:
Write a program that calculates the tip and total amount to pay per person given the bill. The program gets the bill, tip percentage and number of people as input and outputs the amount of tip per person and total per person. Check the Programming Guideline document on Blackboard to know what to submit. Sample run given below where the red bold numbers are the inputs from the user: TIP CALCULATOR Enter the bill : 20.25 Enter the percentage of the tip : 20 Enter the number of people : 3 Tip per person is $1.35 and total per person is $8.10.
Answer:
Answered below.
Explanation:
#program is written in Python programming language
#Get inputs
bill = float(input('Enter bill: "))
tip = float(input("Enter tip percentage: "))
people = float(input ("Enter number of people: ")
#calculations
amount_per_person = bill / people
tip_per_person = amount_per_person * tip
total_per_person = amount_per_person + tip_per_person
#output
print(tip_per_person)
print (total_per_person)
In Cloud9, create a new file called function.cpp. If you aren't sure how to create a new .cpp file in the Cloud9 environment, refer Slide 24 of the Cloud9SetUpSlides (Links to an external site.). In this new file write a function called swapInts that swaps (interchanges) the values of two integers that it is given access to via pointer parameters. Write a main function that asks the user for two integer values, stores them in variables num1 and num2, calls the swap function to swap the values of num1
Answer:
#include <iostream>
using namespace std;
void swapInts(int* x, int* y) {
*x = *x + *y;
*y= *x - *y;
*x = *x - *y;
}
int main(){
int num1, num2;
cout << "Before swap:";
cin>>num1; cin>>num2;
swapInts(&num1, &num2);
cout<<"After swap:"<<num1<<" "<<num2;
}
Explanation:
The function begins here:
This line defines the function
void swapInts(int* x, int* y) {
The next three line swap the integer values
*x = *x + *y;
*y= *x - *y;
*x = *x - *y;
}
The main begins here:
int main(){
This line declares two integer variables
int num1, num2;
This line prompts the user for inputs before swap
cout << "Before swap:";
This line gets user inputs for both integers
cin>>num1; cin>>num2;
This line calls the function
swapInts(&num1, &num2);
This prints the numbers after swap
cout<<"After swap:"<<num1<<" "<<num2;
}
Julie I'm here so help me I'm red
Answer:
hey hey hey hey hey hey hey hey
Explanation:
hey hey hey hey hey hey hey hey
Write a program that accepts two numbers R and H, from Command Argument List (feed to the main method). R is the radius of the well casing in inches and H is the depth of the well in feet (assume water will fill this entire depth). The program should output the number of gallons stored in the well casing. For your reference: The volume of a cylinder is pi;r2h, where r is the radius and h is the height. 1 cubic foot
Answer:
Answered below.
Explanation:
#Answer is written in Python programming language
#Get inputs
radius = float(input("Enter radius in inches: "))
height = float(input("Enter height in feet: "))
#Convert height in feet to height in inches
height_in_inches = height * 12
#calculate volume in cubic inches
volume = 3.14 * (radius**2) * height_to_inches
#convert volume in cubic inches to volume in gallons
volume_in_gallons = volume * 0.00433
#output result
print (volume_in_gallons)
when you look directly at a camera lens, it may seen like there is only one lens, but entering light actually passes through a series of lenses, or_____, that bend the light and send it on its way to be focused on the film or digital. chip
Frame
Optics
Flash
SD cARD
Answer:
The answer should be optics...
Explanation:
If aa person is known to have look at a camera lens straight and light passes via a number of lenses, or Optics.
What is Optics?This is known to be an aspect of physics that looks at the attributes and properties of light, such as its relationship with matter, etc.
Therefore, If a person is known to have look at a camera lens straight and light passes via a number of lenses, or Optics.
Learn more about Optics from
https://brainly.com/question/18300677
#SPJ9
Green Fields Landscaping Company sells evergreen trees which are priced by height. Customers have a choice of purchasing a tree and taking it home with them or purchasing a tree and having it delivered. Write a program that asks the user the number of trees purchased, the height of the trees, and if they want the trees delivered. Based on that information the program should then generate an invoice. Assume that ALL the trees purchased by a customer are the same height.
Answer:
Answered below
Explanation:
//Program is written in Python programming //language.
number_of_trees = int(input ("Enter number of trees purchased: "))
height_of_trees = float(input("Enter height of trees: "))
delivery_status = input("Do you want trees delivered? enter yes or no ")
price_of_two_meters = 20
total_price = number_of_trees * price_of_two_meters
//Invoice
print (number_of_trees)
print(height_of_trees)
print (total_price)
print (delivery_status)
Write a program named BinaryToDecimal.java that reads a 4-bit binary number from the keyboard as a string and then converts it into decimal. For example, if the input is 1100, the output should be 12. (Hint: break the string into substrings and then convert each substring to a value for a single bit. If the bits are b0, b1, b2, b3, then decimal equivalent is 8b0 4b1 2b2 b3)
Answer:
import java.util.*;
public class BinaryToDecimal
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String binaryNumber;
int decimalNumber = 0;
System.out.print("Enter the binary number: ");
binaryNumber = input.nextLine();
for(int i=0; i<binaryNumber.length(); i++){
char c = binaryNumber.charAt(binaryNumber.length()-1-i);
int digit = Character.getNumericValue(c);
decimalNumber += (digit * Math.pow(2, i));
}
System.out.println(decimalNumber);
}
}
Explanation:
Create a Scanner object to be able to get input from the user
Declare the variables
Ask the user to enter the binaryNumber as a String
Create a for loop that iterates through the binaryNumber. Get each character using charAt() method. Convert that character to an integer value using Character.getNumericValue(). Add the multiplication of integer value and 2 to the power of i to the decimalNumber variable (cumulative sum)
When the loop is done, print the decimalNumber variable
Suppose that each country completely specializes in the production of the good in which it has a comparative advantage, producing only that good. In
this case, the country that produces rye will produce million bushels per week, and the country that produces jeans will produce
million pairs per week.
Answer:
In this case, the country that produces rye will produce 24 million bushels per week, and the country that produces jeans will produce 64 million pairs per week.
Explanation:
Total labor hour = 4 million hour
Number of bushes produce in 1 hour = 6
⇒total bushes produce = 6*4 = 24 million
∴ we get
The country that produces rye will produce 24 million bushels per week
Now,
Total labor hour = 4 million hour
Number of pairs produce in 1 hour = 16
⇒total bushes produce = 16*4 = 64 million
∴ we get
The country that produces jeans will produce 64 million pairs per week.
25. In which cloud service model, virtual machines are provisioned? Iaas
Answer:
Infrastructure as a Service (IaaS).
Explanation:
Cloud computing can be defined as a type of computing that requires shared computing resources such as cloud storage (data storage), servers, computer power, and software over the internet rather than local servers and hard drives.
Generally, cloud computing offers individuals and businesses a fast, effective and efficient way of providing services.
Cloud computing comprises of three (3) service models and these are;
1. Platform as a Service (PaaS).
2. Software as a Service (SaaS).
3. Infrastructure as a Service (IaaS).
An Infrastructure as a service (IaaS) provides virtualized computing resources for end users over the internet. For example, the provisioning of On-demand computing resources such as storage, network, virtual machines (VMs) etc., so as to enable the end users install various software applications or programs, database and servers.
Hence, the cloud service model in which virtual machines are provisioned is IaaS.
What is the difference of using Selection Tool and Direct Selection Tool?
Answer:
The Selection tool will always select the object as a whole. Use this tool when you want to manipulate the entire object. The Direct Selection tool will always select the points or segments that make up a frame
Explanation:
Write a program that will perform a few different String operations. The program must prompt for a name, and then tell the user how many letters are in the name, what the first letter of the name is, and what the last letter of the name is. It should then end with a goodbye message. A sample transcript of what your program should do is below:
Enter your name: Jeremy
Hello Jeremy!
Your name is 6 letters long.
Your name starts with a J.
Your name ends with a y.
Goodbye!
Answer:
Follows are the code to this question:
import java.util.*;//import package for user input
public class Main//defining a class Main
{
public static void main(String[] asp)//main method
{
String n;//defining String variable
Scanner oxr=new Scanner(System.in);//creating Scanner class Object
System.out.print("Enter your name: ");//print message
n=oxr.next();//input value
System.out.println("Hello "+n+"!");//print message with value
System.out.println("Your name is "+n.length()+" letters long.");//print message with value
System.out.println("Your name starts with a "+n.charAt(0)+".");//print message with value
System.out.println("Your name ends with a "+n.charAt(n.length()-1)+".");//print message with value
System.out.print("Goodbye!");//print message
}
}
Output:
Please find the attached file.
Explanation:
In the above-given code, A string variable "n" is declared, that uses the Scanner class object for input the value from the user-end.
In the next step, the multiple print method has used, which calculates the length, first and the last latter of the string value, and uses the print method to print the calculated value with the given message.
Imagine that you are designing an application where you need to perform the operations Insert, DeleteMaximum, and Delete Minimum. For this application, the cost of inserting is not important, because itcan be done off-line prior to startup of the time-critical section, but the performance of the two deletionoperations are critical. Repeated deletions of either kind must work as fast as possible. Suggest a datastructure that can support this application, and justify your suggestion. What is the time complexity foreach of the three key operation
Answer:
A stack data structure should be used. The time complexity of the insert, delete minimum and maximum operation is O(1).
Explanation:
The stack data structure is an indexed structure that holds data in an easily retrievable way. Data is held in a first-in last-out method as elements in the structure are popped out from the end of the stack when retrieved sequentially.
The worst-case time complexity of getting the minimum and maximum elements in a stack and deleting it is O(1), this is also true for inserting elements in the stack data structure.
describe a sub routine
Explanation:
A routine or subroutine, also referred to as a function procedure and sub program is code called and executed anywhere in a program. FOr example a routine may be used to save a file or display the time.
Type two statements. The first reads user input into person_name. The second reads user input into person_age. Use the int() function to convert person_age into an integer. Below is a sample output for the given program if the user's input is: Amy 4 In 5 years Amy will be 9 Note: Do not write a prompt for the input values, use the format: variable_name = input()
Answer:
Follows are the code to this question:
person_name='' #defining string variable
person_age=0 #defining integer variable
person_name = input()#use person_name variable that use input method for input value
person_age = int(input())#use person_age variable that use input method for input value
print('In 5 years',person_name,'will be',person_age+5)#print value with message
Output:
Amy
4
In 5 years Amy will be 9
Explanation:
In this code, two variable "person_name and person_age" is defined, that uses the input method for user-input value and use the print method to print its input value with the given message.
Answer:
person_name = input()
person_age = int(input())
Explanation:
pretty self explanatory, but CODING is a whole different language so it is hard.
What is the value of numC at the end of this loop?
numC = 12
while numC > 3:
numC = numC / 2
numC =
Answer: 3
Explanation:
What is the value of numC at the end of this loop?
numC = 12
while numC > 3:
numC = numC / 2
numC =
The initial numC value = 12
Condition : while numC is greater than 3 ; 12 > 3 (condition met)
The expression numC / 2 is evaluated
numC / 2 = 12 / 2 = 6
numC then becomes 6 ;
Condition : while numC is greater than 3 ; 6 > 3 (condition met)
numC / 2 = 6 /2 = 3
numC = 3
Condition : while numC is greater than 3 ; 3 > 3 (condition not met)
Loop terminates
numC = 3
In which cloud service model, virtual machines are provisioned? Iaas
Answer:
SaaS is the cloud service in which virtual machines are provisioned
If you set your margins to be 0.5" all around, you would say these are ____
margins.
a. wide
b. standard
c. narrow
d. custom
Answer:
Narrow
Explanation:
Output values below an amount
Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value.
Ex: If the input is:
5 50 60 140 200 75 100
the output is:
50 60 75
The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75.
For coding simplicity, follow every output value by a space, including the last one. Such functionality is common on sites like Amazon, where a user can filter results.
Answer:
Explanation:
The following code is written in Python and it is a function called filter, which takes in the requested inputs. It then places the threshold in its own variable and pops it out of the array of inputs. Then it loops through the array comparing each element with the threshold and printing out all of the ones that are less than or equal to the threshold.
def filter():
num_of_elements = input("Enter a number: ")
count = 0
arr_of_nums = []
while count <= int(num_of_elements):
arr_of_nums.append(input("Enter a number: "))
count += 1
threshold = arr_of_nums[-1]
arr_of_nums.pop(-1)
print(threshold)
for element in arr_of_nums:
if int(element) < int(threshold):
print(element)
else:
continue
Help please
What is the missing line of code?
>>> math.sqrt(16)
4.0
>>> math.ceil(5.20)
6
Answer:
import math
Explanation:
If you get the answers to questions right, please add them to future other questions.
A fast way to add up a column of numbers is to click in the cell below the numbers and then: Click Subtotals on the Data menu. View the sum in the formula bar. Click the AutoSum button on the Standard toolbar, then press ENTER. None of these are correct
Answer:
Click the AutoSum button on the Standard toolbar, then press ENTER
Explanation:
Excel offers a range of options to perform various mathematical operations. When numeric values are being inputted into cells, either columns or rows, the AutoSum function which is located in the home Taskbar allows for a very fast addition of the total values in the column or rows. Once the cell after the last cell value is selected, the AutoSum function is selected and the ENTER button is pressed, this will use the sum function of excel to quickly provide the total sum of all the values in the column.
Answer:
A. Click the AutoSum button the Standard toolbar, then press ENTER
Explanation:
took the test good luck :)
Keisha is creating an input mask and needs to ensure that the user will only enter digits into the field. Which two
characters do NOT enforce this rule?
0 0 and 9
09 and ?
O ? and L
O Land 0
Answer:
? and L
Explanation:
magine that you are designing an application where you need to perform the operations Insert, DeleteMaximum, and Delete Minimum. For this application, the cost of inserting is not important, because itcan be done off-line prior to startup of the time-critical section, but the performance of the two deletionoperations are critical. Repeated deletions of either kind must work as fast as possible. Suggest a datastructure that can support this application, and justify your suggestion. What is the time complexity foreach of the three key operations
Answer:
Use the stack data structure with both best-case and worst-case time complexity of O(1) for insertion and deletion of elements.
Explanation:
The stack data structure is used in programs to hold data for which the last data in the stack is always popped out first when retrieving the data sequentially, that it, first-in, last-out.
The elements in the stack are located in an index location, which means that they can be retrieved directly by choice with constant time complexity of 1 or O(1) for best and worst-case.
So inserting, and deleting the minimum and maximum elements in the stack data structure executes at a speed of the constant 1 (big-O notation, O(1) ).
Energy Drink Consumption A soft drink company recently surveyed 16,500 of its customers and found that approximately 15 percent of those surveyed purchase one or more energy drinks per week. Of those customers who purchase energy drinks, approximately 58 percent of them prefer citrus-flavored energy drinks. Write a program that displays the following: The approximate number of customers in the survey who purchase one or more energy drinks per week The approximate number of customers in the survey who prefer citrus-flavored energy drinks.
Answer:
Follows are the code to this question:
#include <iostream>//header file
using namespace std;
int main()//defining a main method
{
int customer= 16508;//defining an integer variable
int E_drink, C_drink;//defining an integer variable
double buy_Energy_drink,buy_cold_drink;//defining a double variable
buy_Energy_drink= 0.15;//use double variable to assign value
buy_cold_drink= buy_Energy_drink *0.58;//use double variable to calculate value
E_drink = customer*buy_Energy_drink;//calculating value of E_drink
C_drink= customer*buy_cold_drink;//calculating value of E_drink
cout<<"\t\t\t -:Energy Drink Consumption:-"<<endl;//print message
cout<<"According to A soft drink company surveyed 16,500 of its customers."<<endl;//print message
cout<<E_drink <<" customer purchase one or more energy drinks per week."<<endl;//print message with value
cout<<C_drink <<" customer who prefer citrus-flavored energy drinks."<<endl;//print message with value
return 0;
}
Output:
Please find the attached file.
Explanation:
In this code, three integer variable "customer, E_drink, and C_drink" is defined, in which the first variable is used to hold a value, and the next two variables are used for calculating the value.
In the next step, two double variables "buy_Energy_drink, buy_cold_drink" is defined that calculate the given percentage value and passed into the integer variable to calculate the value and print the value with the given message.
The first and second numbers in the Fibonacci sequence are both 1. After that, each subsequent number is the sum of the two preceding numbers. The first several numbers in the sequence are: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, etc. Write a function named fib that takes a positive integer parameter and returns the number at that position of the Fibonacci sequence. For example fib(1)
Answer:
In Python:
def fib(nterms):
n1, n2 = 1, 1
count = 0
while count < nterms:
term = n1
nth = n1 + n2
n1 = n2
n2 = nth
count += 1
return term
Explanation:
This line defines the function
def fib(nterms):
This line initializes the first and second terms to 1
n1, n2 = 1, 1
This line initializes the Fibonacci count to 0
count = 0
The following while loops gets the number at the position of nterms
while count < nterms:
term = n1
nth = n1 + n2
n1 = n2
n2 = nth
count += 1
This returns the Fibonnaci term
return term