vamsipenumaka6

vamsipenumaka6

Lv1

Vamsi Penumaka

0 Followers
0 Following
0 Helped

ANSWERS

Published4

Subjects

History1Computer Science2Chemistry1
Answer: Step-by-step explanation:Example 1: Boiling waterEvent: I boiled water...
Answer: Step-by-step explanation:Here are a few troubleshooting steps that you...
Answer: Step-by-step explanation:The New Deal had a significant impact on the ...

you're going to see 1 on the terminal because the index is 1.

print("Hello World"[1]) # Output: e

The float function is used to convert a string to a float value.

first = float(input("Enter the first number: "))

We can also change this expression to first + second, which is another way to write this piece of code.

The lower method is used to convert a string to lowercase or to find a character or a sequence of characters.

string = "Hello World"print(string.lower()) # Output: hello worldprint(string.find('o')) # Output: 4print(string.replace('o','a')) # Output: Hella Warld

The in operator can be used to check if a string contains a character.

string = "Python is a programming language for beginners."print('language' in string) # Output: True

Arithmetic Operators in Python

Python has various arithmetic operators that we can use, such as addition (+), subtraction (-), multiplication (*), and division (/).

print(10 + 3) # Output: 13

We also have an augmented assignment operator in Python that means incrementing a variable by a value.

x = 5x += 3 # Output: 8

Operator precedence in Python is similar to math, but we can always use parentheses to change the order of operations.

x = 10 + 3 * 2 # Output: 16

Multiplication and division have a higher order, so they are evaluated first. That's why the answer is 16.

x = 10 + 3 / 2print(x) # Output: 11.5

When we print x, we get 11.5.

x += 3print(x) # Output: 14.5

When we run x += 3, we get 14.5 as the result. When we run x == 13, it will store False in the x variable.

x = 1000 # Output: 1000

Answer: Step-by-step explanation:Yes, you're correct about the first statement...

Weekly leaderboard

Start filling in the gaps now
Log in