Code in Python

Write a while loop that prints user_num divided by 2 until user_num is less than 1. The value of user_num changes inside of the loop.

Sample output with input: 20
10.0
5.0
2.5
1.25
0.625


Note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds and report "Program end never reached." The system doesn't print the test case that caused the reported message.

My code, it only passes one test with correct outputs
what am I forgetting?

Code In PythonWrite A While Loop That Prints User_num Divided By 2 Until User_num Is Less Than 1. The

Answers

Answer 1

You're setting the value of user_num to 20. Doing this won't allow the other test cases to run. Simply delete that line and your code should work. This is the code I wrote:

user_num = int(input())

while user_num>=1:

   user_num/=2

   print(user_num)

I wrote my code in python 3.8. I hope this helps.


Related Questions

to copy and paste the image in MS Word the dash option is used​

Answers

ur answer hope this will helps u

Let ∑ = {a,b}, and let L be the language over ∑:
L ={ w € ∑+ |w is even, and w contains at least one a in the first half and exactly one b in the second half }
Give a context-free grammar (CFG) for L, and briefly explain how it works to correctly represent the language. There are no additional requirements for your solution other than what is stated here, except the usual guidance to make sure your answer is clear and understandable and avoids too much unnecessary complexity. In particular, there is no credit for the grammar being unambiguous (if possible.)

Answers

Answer:

Explanation:

From the information given, By applying a CFG for L:

Because each state generates two symbols or null, the length will be equal and even.

1st Condition:

throughout the first half, at least one (a)

2nd:

exactly one (b) within the second half

Dear Student, there is a technical error that occurred when submitting this question. This makes us unable to submit the complete solution to the question but curb that effect, we've attached an image below that shows the complete algorithm and a detailed explanation of the question.

Best Regards.

Another method that might be desired is one that updates the Goalie's jerseyNumber. This method will receive a new number of Jersey and set this number to the Goalie's current jerseyNumber. What methods would accomplish this?

Answers

Answer:

A setter method

Explanation:

A setter method will accomplish this. A setter method is a method that takes in a value as an argument and grabs an object's instance variable and modifies it with the value passed as an argument. In this scenario, the argument value would be the current JerseyNumber. The setter method will grab the object's jerseyNumber variable and change its value to be the value of the passed argument. Setter methods are common practice in all object classes as well as the getter methods to retrieve instance variables.

How do you write a poem on the topic 'I am good at singing'? answer and get 100 points

Answers

Answer:

ur mom

Explanation:

Which of these is a good thing to consider when naming variables?
The name should be readable and make sense
Keep it short, less typing
Use only letters
O Sentences are Tood variable names.

Answers

Answer:

The name should be readable and make sense

Explanation:

Aside the rules involved in naming variables, there are also some good tips which should be considwred when given names to our variables. These means there are some variables which are acceptable by our program but may be avoided in other to make our codes easier to read by us and others and it also makes debugging easier when we run into errors. Using short variables are acceptable on code writing as far as the rules are followed. However, it is more advisable to use names that are descriptive and readable such that it relates to the program or code being worked on. This ensures that we and others can follow through our lines of code at a much later time without making mistakes or forgetting what the variable stands for.

The following implementations of the method reverse are intended to reverse the o rder of the elements in a LinkedList.

I.
public static void reverse (LinkedList alist)( LinkedList temp = new LinkedList (); while (aList.size ()>0) temp.addLast (aList.removeFirst ) aList.addFirst (temp.removeFirst ) while (temp.size ()> o)
II.
public static void reverse (LinkedList alist) while (aList.size () >0) while (Itemp.isEmpty 0) QueuecSomeType> temp new LinkedList 0: temp.add (alist.removeFirst ()): aList.addFirst (temp.remove ():

IlI.
public static void reverse (LinkedList alist) while (aList.size ()>0) while (Itemp.isEmpty()) Stack temp new Stack ( temp.push (aList.removeLast ()) aList.addFirst (temp.pop ());

Which of the choices above perform the intended task successfully? Why?

a. I only
b. Il only
c. Ill only
d. Il and Ill only
e. I, ll, and IlI

Answers

Answer:

c. Ill only

Explanation:

All of the code snippets provided are missing small details such as brackets in the correct places and '=' to signal an assignment. These are crucial when coding in Java and the code will not run without it. Regardless, the only implementation that is correct in the options would be implementation III. It is the only code snippet that is correctly structured to reverse the order of the elements. It will still need debugging in order to get it to work.

IlI.

public static void reverse (LinkedList alist) while (aList.size ()>0) while (Itemp.isEmpty()) Stack temp new Stack ( temp.push (aList.removeLast ()) aList.addFirst (temp.pop ());

what are the events?

Answers

Answer:

a thing that happens or takes place, especially one of importance.

which one of the following can be used in a Document name,when saving?
1.Numbers
2.Semi-colon
3.Forward dash
4.Question mark​

Answers

Answer:

3. forward dash would you like an explanation?

Only number can be used in a Document name.

File names are shown in alphabetical order in the folder structure. It is critical to also include the zero for numbers 0-9. This helps to maintain the numerical order when file names contain numbers.

Most software packages are case sensitive, so use lowercase wherever possible. Instead of using commas and underscores, use a hyphen.

So, Option "1" is the correct answer to the following question.

Learn more:

https://brainly.com/question/17429689?referrer=searchResults

¿sharpness or unbreaking people?​

Answers

Really hard decision, but ultimately, it depends on your personal prefrence. I would choose un breakin, however, for some people if you want to kill mobs quicker, than sharpness would be the way to go.

what is the different between information and data

Answers

Answer:

Information is the act of imparting knowledge and data is the recorded observation that are usually presented in a structured format

what is the mean of debugging​

Answers

Answer:

the process of identifying and removing errors from computer hardware or software

Explanation:

Essentially just fixing programming errors, mainly in coding or software

how computer user interact with an application programs​

Answers

Answer:

computer users interact with their programs and applications through external devices called hardware, which allow the user to issue commands to computer programs, while also allowing these programs to issue responses to those commands. Thus, for example, the user interacts with the computer through the keyboard, by means of which he sends commands to certain programs that in turn respond, for example, through the monitor or the speakers.

What does the following code print?
public class { public static void main(String[] args) { int x=5 ,y = 10; if (x>5 && y>=2) System.out.println("Class 1"); else if (x<14 || y>5) System.out.println(" Class 2"); else System.out.println(" Class 3"); }// end of main } // end of class.

Answers

Answer:

It throws an error.

the public class needs a name.

like this:

public class G{ public static void main(String[] args) {

   int x=5 , y = 10;

   if (x>5 && y>=2) System.out.println("Class 1");

   else if (x<14 || y>5) System.out.println(" Class 2");

   else System.out.println(" Class 3"); }// end of main

   }

if you give the class a name and format it, you get:

Class 2

Explanation:

In the following cell, we've loaded the text of Pride and Prejudice by Jane Austen, split it into individual words, and stored these words in an array p_and_p_words. Using a for loop, assign longer_than_five to the number of words in the novel that are more than 5 letters long. Hint: You can find the number of letters in a word with the len function.

Answers

Answer:

Explanation:

Since the array is not provided, I created a Python function that takes in the array and loops through it counting all of the words that are longer than 5. Then it returns the variable longer_than_five. To test this function I created an array of words based on the synapse of Pride and Prejudice. The output can be seen in the attached picture below.

def countWords(p_and_p_words):

   longer_than_five = 0

   for word in p_and_p_words:

       if len(word) > 5:

           longer_than_five += 1

   return longer_than_five

A database designer wants to create three tables: Supplier, Product, and Country. The Supplier table has a Countryld column with values that must appear in the Country table's Countryld column. The Product table has an auto-increment column.
Which table's CREATE TABLE statement(s) must specify a FOREIGN KEY?
a. Supplier
b. Product
c. Country
d. Supplier and Country

Answers

Answer:

(a) Supplier

Explanation:

In database design, two tables are linked together using a FOREIGN KEY. A foreign key is formed from one or more columns of one table that reference or match another key (often called a primary key) in another table. In other words, when a column or a combination of columns on one table points to a primary key of another table, the column(s) will specify the foreign key.

PS: A primary key is used to make each entry of a table unique.

In the given tables - Supplier, Product, Country -  since the Supplier table has a column called CountryId referencing the CountryId column of the Country table, then CountryId is a primary key in Country table but a foreign key in Supplier table.

Therefore, the CREATE TABLE statement(s) of the Supplier table must specify a foreign key.

A database management system often reads and writes data in a database, and makes sure there is consistency and availability. The supplier table's CREATE TABLE statement(s) must specify a FOREIGN KEY.

The database system often guards data when a lot of transactions is taking place.   it often hinders multiple transactions with the same data at the same time.

The Select SQL statement does not alter any database data. A supplier database is made up of different list of service, product or materials providers who can meet orders quickly.

Learn more from

https://brainly.com/question/15281828

Explain why robots are better at some jobs than human workers are.

Answers

Answer:

Because humans have human minds meaning there are chances of errors, and or mistakes. and they do the same thing over and over with precise precision

Explanation:

hope this helps :)

Why is it best to serve cheese with plain breads or crackers?

Answers

Answer:Here's why it works: Club crackers are engineered to be the perfect amount of buttery and salty, which means that, sometimes, they're all you can taste if paired with the wrong cheese.

Explanation:

what is a web client ​

Answers

Answer:

Web client:

it is an application(web browser,program etc ) that requests for service from a web server.

stay safe healthy and happy

Construct a SQL query that displays a list of colleges, their sity/state, the accrediting agency, and whether or not the school is distance only. Only show the first 10 records.

Answers

Answer:

SELECT college, city_state, accre_agency, distance LIMIT 10

Explanation:

Given

Table name: College

See attachment for table

Required

Retrieve top 10 college, state, agency and school distance from the table

To retrieve from a table, we make use of the SELECT query

The select statement is then followed by the columns to be selected (separated by comma (,))

So, we have:

SELECT college, city_state, accre_agency, distance

From the question, we are to select only first 10 records.

This is achieved using the LIMIT clause

i.e. LIMIT 10 for first 10

So, the complete query is:

SELECT college, city_state, accre_agency, distance LIMIT 10

How do I find error corrections in an EAN-8 barcode?

Answers

Answer: I am not sure if I remember but I believe if the single digit matches the last digit on the barcode then the barcode is correct or valid.

But, If the digit is different from the one on your computer then their is an error. I recommend In order to check for error is to remove the received check digit and recalculate it based on the 12-digit identification code. (This I use for EAN-13 but since Ean-8 is basically short version of 13 try it)

lasses give programmers the ability to define their own types.

a. True
b. False

Answers

Answer:

TRUE.

Explanation:

By the 1970s, the acceleration of airplane travel led to fears that an epidemic would leapfrog the globe much faster than the pandemics of the Middle Ages, fears that were confirmed beginning in the 1970s by the worldwide spread of:________
a. the Zika virus.
b. the HIV infection
c. severe acute respiratory syndrome (SARS)
d. the Asian flu virus
e. Ebola

Answers

Answer:

b. the HIV infection.

Explanation:

Around the 1970s, an increase in the use of airplane travel led to fears that an epidemic would leapfrog the globe much faster than the pandemics such as tuberculosis, leprosy, smallpox, trachoma, anthrax, scabies, etc., that were evident during the Middle Ages, fears that were later confirmed by the worldwide spread of the HIV infection, beginning in the 1970s in the United States of America.

STD is an acronym for sexually transmitted disease and it can be defined as diseases that are easily transmissible or contractable from another person through sexual intercourse. Thus, STD spread from an infected person to an uninfected person while engaging in unprotected sexual intercourse. Some examples of STDs are gonorrhea, chlamydia, syphilis, HIV, etc.

HIV is an acronym for human immunodeficiency virus and it refers to a type of disease that destabilizes or destroy the immune system of a person, thus, making it impossible for antigens to effectively fight pathogens.

Generally, contracting STDs has a detrimental effect to a patient because it causes an opening (break) or sore in the body of the carrier (patient) and as such making them vulnerable to diseases that are spread through bodily fluids e.g human immunodeficiency virus (HIV), Hepatitis, staphylococcus, AIDS, etc.

Suppose that you are asked to modify the Stack class to add a new operation max() that returns the current maximum of the stack comparable objects. Assume that pop and push operations are currently implemented using array a as follows, where item is a String and n is the size of the stack. Note: if x andy are objects of the same type, use x.compareTo(y) to compare the objects x and y public void push String item ) { [n++] = iten; } public String pop { return al--n]; } Implement the max operation in two ways, by writing a new method using array a (in 8.1), or updating push and pop methods to track max as the stack is changed (in 8.2). Q8.1 Implement method maxi 5 Points Write a method max() using Out) space and Oin) running time. public String max() {...} Enter your answer here Q8.2 Update push() and popo 5 Points Write a method max() using On) space and 011) run time. You may update the push and pop methods as needed public void push {...} public String pop() {...} public String max() {...}

Answers

Answer:

Following are the code to the given points:

Explanation:

For point 8.1:

public String max()//defining a method max

{

   String maxVal=null;//defining a string variable that holds a value

   for(int x=0;x<n;x++)

   {

       if(maxVal==null || a[i].compareTo(maxVal)>0)//defining if blok to comare the value

       {

           maxVal=a[i];//holding value in maxVal variable

       }

   }

   return maxVal;//return maxVal variable value

}

For point 8.2:

public void push(String item)//defining a method push that accepts item value in a parameter

{

       a[n]=item;//defining an array to hold item value

       if(n==0 || item.compareTo(maxVals[n-1])>0)//use if to comare item value

       {

               maxVals[n]=item;//holding item value in maxVals variable

       }

       else

       {

               maxVals[n]=maxVals[n-1];//decreasing the maxVals value

       }

       n++;//incrementing n value

}

public String pop()//defining a method pop

{

       return a[--n];//use return value

}

public String max()//defining a method max

{

       return maxVals[n-1];//return max value

}

In the first point, the max method is declared that compares the string and returns its max value.In the second point, the push, pop, and max method are declared that works with their respective names like insert, remove and find max and after that, they return its value.

How can getchar function be used to read multicharacter strings?​

Answers

69696969696969969696969696966969696969696V69696969696969969696969696966969696969696VVVV696969696969699696969696969669696969696966969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696V6969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696VVVV696969696969699696969696969669696969696966969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696V6969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696VVVV696969696969699696969696969669696969696966969696969696996969696969696696969696969669696969696969969696969696966969696969696V69696969696969969696969696966969696969696V69696969696969969696969696966969696969696

Which type of query enables a user to move, append, or update matching records in a table?
action query
select query
static query
parameter query

Answers

Answer:

the query that allows these things is called an action query

Answer:

The answer is A-action query just finshed the review on edg 2021

Explanation:

Which of the following was most likely used to apply red background and font to some of the cells in column D?

Answers

Answer:

d. conditional formatting

Explanation:

The option that would most likely be used to accomplish this would be conditional formatting. This is an option in which, if a condition is met, the cell is given certain format changes. In this scenario, the condition would be if a cell is located in column D, then apply a red background and specific font. This would be automatic throughout the entire document so that if any new cell is created in column D it would automatically be formatted according to the conditional formatting that was used.

The probability that the price of a commodity is increasing is 0.62 and the probability that the price is decreasing is 0.18 . What is the probability that the price of the commodity remains constant. Solved numerically​

Answers

bahug ka itlog hduxuwlowv heusuowjdd

I bring my _____ computer to work
a. in box
b. ebook
c. attachment
d.blog.
e. delete
f. document
g. download
h. ebook
I. email address
j. file
k. inbox
l. keyboard
m. laptop
n. link
o. online
p. password
q. sign in​

Answers

Answer:

I think it's laptop or sign in

hope this helps

have a good day :)

Explanation:

Pick which one you think is the best choice

Therese would now like to preview her slide show to make sure everything is working. She should___.
• switch to Normal slide view
•click on the first slide in the slide pane
• switch to Slide Show view
• click on Slide Show layout in the side pane

Answers

Answer:

c

Explanation:

Which of the following is not a way to build customer loyalty

Answers

Answer: are there option choices? If not I would say

1. not giving back enough change

2. Being rude

3. not giving the right prices

4. Not answering questions

Explanation: hope this helps, have a great day!!

Other Questions
Explain how political, economic, and social changes affected society during spirit of reform. Be sure to focus on why changes generated strong feelings. ILL GIVE BRAINLIEST What is Limit of g (x) as x approaches 1, if it exists?07,000,000700,000,000DNE 90 POINTSQuestionWhat is the best description of how an electric motor works?Question 4 options:Metal electrodes in a solution generate positive and negative ions to turn chemical energy into electrical energy.One magnet is pushed towards another magnet, causing it to move.A current runs through a loop of wire in a magnet field; the force from the magnet causes the wire to rotate.A magnet moves through a stationary coil of wire, causing an electric current to flow through it. what are the laws that protect citizens against human trafficking 5 gal- 1 qt = _____ gal ______ qt As Gus becomes sicker, his extended family shows up. Why does Hazel feel the need to model " appropriate behavior" to his half sisters?The fault in our stars [tex] \sf\sqrt{256} [/tex][tex] \\ \\ \\ [/tex] What people groups were involved in the process of amending the Constitution? The table shows the median annual salaries of a librarian associated with two levels of education.Based on the data in the table, how much more money would a person with a masters degree earn than a person with a bachelors degree over 15-year career? How many molecules are there in 122 grams of NO2? Yo can someone help me with this im bad with coordinates and if u answer I need an explanation with it as well. ty Find the area of the figure and round to the nearest hundredth PLEASE HELP FAST 1 How might the world lookdifferent if colonization did nothappen? PLZ HELP ME YOU WILL GET GOOD KARMA PLZZZZZZ PLEASE HELPPP!!!!Explain how richard wilbur uses metaphors and similes to develop the tone and theme of his poem "The Writer." An electrician earns $45 per hour for doing a house call. Which expression can be used to find how much an electrician earns for any number of hours, h? A. 45h B. h + 45 C. 45 + h D. 45 h What is the area?Write your answer as a fraction or as a whole or mixed number. Which source of energy is the most important in driving the water cycle? A. Geothermal energy changes water to steam so condensation can occur. B. Wind helps change surface water into water vapor during the process of evaporation. C. Gravity is necessary to pull water downhill when it rains, thus allowing water to flow into rivers and streams. D. The Sun heats up Earth's surface water creating the process of evaporation. Develop a workout appropriate for class.Write the directions for the workout. how to find molecular weight