Santa Claus Chapter 7( More on Python ) Class -7th - SSC GK.in

Sunday, January 18

Chapter 7( More on Python ) Class -7th

Chapter 7: More on Python

Exercises (Pgs. 127-129)

A. Tick (✓) the correct answers.

1. b

2. a

3. b

4. c

5. c

B. Fill in the blanks.

1. float( )

2. Boolean

3. True

4. precedence

5. equal

C. Write T for True and F for False.

1. T

2. F

3. T

4. F

5. T

D. Answer the following questions.

Q.1    What is the purpose of the input() function 

Ans:- The `input()` function in Python lets users enter data during program execution. It displays a prompt, waits for user input, and returns the entered value as a string, making programs interactive and dynamic.


Q.2    How can you convert a string input into an integer or float in python ?

Ans:-     In Python, you can convert a string input into an integer or float using the built-in functions int() and float().

You can use the int() function to convert a string that represents a whole number into an integer.

string_input = “123”

integer_value = int(string_input)

print(integer_value) # Output: 123

You can use the float() function to convert a string that represents a number with decimals into a float.

string_input = “123.45”

float_value = float(string_input)

print(float_value) # Output: 123.45


Q.3    What are operators in Python ? 

Ans:-   Operator in Python:

An operator is a symbol used to perform operations on values or variables.

Types of operators in Python:
There are 7 types of operators:

  1. Arithmetic

  2. Relational (Comparison)

  3. Logical

  4. Assignment

  5. Bitwise

  6. Membership

  7. Identity


Q.4    Explain About  string in Python ? 

Ans:-    In Python, a string is a data type used to store a sequence of characters. Strings are written inside single quotes (' '), double quotes (" "), or triple quotes (''' ''' or """ """). They are immutable, meaning their values cannot be changed after creation.


Q.5   What is BODMAS and PEDMAS in Python ? 

Ans:-    BODMAS:- BODMAS rule explains the correct order of operations in mathematics: Brackets, Orders, Division, Multiplication, Addition, and Subtraction. Following this order from left to right ensures accurate calculations, prevents mistakes, and produces correct and consistent results in coding and mathematics.

PEDMAS :-    PEDMAS rule explains the order of operations in mathematics: Parentheses first, then Exponents, followed by Division and Multiplication, and finally Addition, ensuring expressions are evaluated correctly and consistently.

No comments:
Write Comments

Please ask any question about gk related

Total Pageviews

Popular Posts

© 2014 SSC GK.in . Designed by Bloggertheme9 | Distributed By Gooyaabi Templates
Powered by Blogger.