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
Step2247 [10]
3 years ago
14

I need help please :(((( I need it in python

Computers and Technology
1 answer:
Bezzdna [24]3 years ago
7 0
Take this one step at a time. Your teacher has given you the code for step 1. Now write step 2. Then 3, and so on.

For step 2: if you're using Python v2.x you'd use a line like

guess = int( raw_input( "Take another guess: " ) )

For Python v3.x it would be:

guess = int( input( "Take another guess: " ) )

Break it down into small pieces, it's not a complicated assignment.
You might be interested in
Write a small program that takes in two numbers from the user. Using an if statement and an else statement, compare them and tel
ArbitrLikvidat [17]

Answer:

4. Conditionals

4.1. The modulus operator

The modulus operator works on integers (and integer expressions) and yields the remainder when the first operand is divided by the second. In Python, the modulus operator is a percent sign (%). The syntax is the same as for other operators:

>>> quotient = 7 / 3

>>> print quotient

2

>>> remainder = 7 % 3

>>> print remainder

1

So 7 divided by 3 is 2 with 1 left over.

The modulus operator turns out to be surprisingly useful. For example, you can check whether one number is divisible by another—if x % y is zero, then x is divisible by y.

Also, you can extract the right-most digit or digits from a number. For example, x % 10 yields the right-most digit of x (in base 10). Similarly x % 100 yields the last two digits.

4.2. Boolean values and expressions

The Python type for storing true and false values is called bool, named after the British mathematician, George Boole. George Boole created Boolean algebra, which is the basis of all modern computer arithmetic.

There are only two boolean values: True and False. Capitalization is important, since true and false are not boolean values.

>>> type(True)

<type 'bool'>

>>> type(true)

Traceback (most recent call last):

 File "<stdin>", line 1, in <module>

NameError: name 'true' is not defined

A boolean expression is an expression that evaluates to a boolean value. The operator == compares two values and produces a boolean value:

>>> 5 == 5

True

>>> 5 == 6

False

In the first statement, the two operands are equal, so the expression evaluates to True; in the second statement, 5 is not equal to 6, so we get False.

The == operator is one of the comparison operators; the others are:

x != y               # x is not equal to y

x > y                # x is greater than y

x < y                # x is less than y

x >= y               # x is greater than or equal to y

x <= y               # x is less than or equal to y

Although these operations are probably familiar to you, the Python symbols are different from the mathematical symbols. A common error is to use a single equal sign (=) instead of a double equal sign (==). Remember that = is an assignment operator and == is a comparison operator. Also, there is no such thing as =< or =>.

4.3. Logical operators

There are three logical operators: and, or, and not. The semantics (meaning) of these operators is similar to their meaning in English. For example, x > 0 and x < 10 is true only if x is greater than 0 and less than 10.

n % 2 == 0 or n % 3 == 0 is true if either of the conditions is true, that is, if the number is divisible by 2 or 3.

Finally, the not operator negates a boolean expression, so not(x > y) is true if (x > y) is false, that is, if x is less than or equal to y.

4.4. Conditional execution

In order to write useful programs, we almost always need the ability to check conditions and change the behavior of the program accordingly. Conditional statements give us this ability. The simplest form is the ** if statement**:

if x > 0:

   print "x is positive"

The boolean expression after the if statement is called the condition. If it is true, then the indented statement gets executed. If not, nothing happens.

The syntax for an if statement looks like this:

if BOOLEAN EXPRESSION:

   STATEMENTS

As with the function definition from last chapter and other compound statements, the if statement consists of a header and a body. The header begins with the keyword if followed by a boolean expression and ends with a colon (:).

The indented statements that follow are called a block. The first unindented statement marks the end of the block. A statement block inside a compound statement is called the body of the statement.

Each of the statements inside the body are executed in order if the boolean expression evaluates to True. The entire block is skipped if the boolean expression evaluates to False.

There is no limit on the number of statements that can appear in the body of an if statement, but there has to be at least one. Occasionally, it is useful to have a body with no statements (usually as a place keeper for code you haven’t written yet). In that case, you can use the pass statement, which does nothing.

if True:          # This is always true

   pass          # so this is always executed, but it does nothing

4 0
3 years ago
Window frame will expand to fill the entire desktop when you
SVETLANKA909090 [29]
It will expand to fill the entire desktop when you <span>click the title bar button marked with a single square. The single square expands while a double square makes it smaller again.</span>
3 0
3 years ago
On a network, which protocol is responsible for dividing files into chunks, adding headers containing information for reassembli
andrew11 [14]

Answer:

TCP

Explanation:

TCP (Transmission Control Protocol) is a standard that defines how to establish and maintain a network conversation through which application programs can exchange data. TCP works with the Internet Protocol (IP), which defines how computers send packets of data to each other.

4 0
3 years ago
What do u think a creative app must have? <br><br> Please answer the question ASAP!!
jarptica [38.1K]

Answer:

  1. Responsive
  2. Identifies a Target Demographic
  3. Encourages User Engagement
  4. Beautiful UI Design
  5. Follows Platform Design Gipuidelines
  6. Use of Familiar Screens
  7. Functionless Navigation Feature

Explanation:

ÔwÔ

3 0
3 years ago
Where could an identity theft access your personal information?
Naily [24]
They can hack into you email or your phone number thats all they need to find where you live how old you are and etc hope this helps

8 0
3 years ago
Read 2 more answers
Other questions:
  • Create a function average_temp(s) that accepts a file name s that contains temperature readings. Each line in the file contains
    15·1 answer
  • How do solar cells translate heat energy into mechanical energy
    13·1 answer
  • An option button is a square button that enables you to make one choice among two or more options.
    15·1 answer
  • _____ refers to the busiest calling hour of the day, week, month or year. And _____ refers to the average length of time the sub
    14·1 answer
  • What is a geam in the ggplot2 system?
    5·1 answer
  • I still haven't figured out how to award someone branliest will someone help me? If you explain to me how to do it i will do awa
    14·1 answer
  • How network diagram help in scheduling a project? Draw activity network diagram as per given
    7·1 answer
  • 6
    9·1 answer
  • Ema Company for business .
    14·1 answer
  • Which of the following is an example of an incremented sequence?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!