Santa Claus Class-8 Chapter 7( Conditional Statements in Python) - SSC GK.in

Featured Post

Thursday, November 13

Class-8 Chapter 7( Conditional Statements in Python)

 Chapter 7: Conditional Statements in Python

Exercises (Pgs. 130-132)

A. Tick (✓) the correct answers.

1. b

2. b

3. b

4. b

5. b

B. Fill in the blanks.

1. loop

2. condition

3. else

4. sequential

5. Slicing

C. Write T for True and F for False.

1. T

2. T

3. F

4. T

5. F



A. Answer the following questions in short .

Q.1        What is Python ?

 Ans:-    Python is a programing language. We can create mobile app, website and software using it's code. 


Q.2        Who developed Python and When ?

Ans:-    Guido Van Rossum developed Python in February 1991


Q.3        Name any four app or website developed in Python. Ab

Ans:-    Youtube , Google, Quara and Dropbox  is developed using python language. 


Q.4        Why Python is most popular then other language ?

Ans:-    It is simple to read and write. All codes are written in English meaningful. 


Q.5       Name the latest version of Python ?

Ans:-   Its latest version is "Python 3.14.0 in  October 2025"


Q.6    Write features of python . 

Ans:-    Some features of Python are :


Easy to use 
Object Oriented
Expressive Language
Interpreter Language
It's Completeness
Cross-platform Language
Free and Open Source
Variety of Usage /Application 

B. Answer the following questions in long.

Q.1    Explain the purpose of conditional statements in Python Programming .

Ans:- The conditional statements enable decision-making by choosing a block of code to execute based on the outcome of the given condition. Every decision involves an option between two alternatives ‘Yes’ and ‘No’.


Q.2    What is the difference between an if statement and an if-else statement ?

Ans:- 'if ' statement :- Executes a block of code if a condition is `True`. If the condition is `False`, the code inside the `if` block is skipped, and no alternative is provided.

'if-else' statement:- Executes one block of code if the condition is `True`, and another block if the condition is `False`, ensuring that exactly one block of code runs based on the condition.

Q.3    How do iterative statement differ from sequential statement in Python ?

Ans:-    Iterative statements :- in Python, such as `for` and `while` loops, allow code to be executed repeatedly as long as a specified condition holds true. They are useful for repetitive tasks or when the number of iterations is unknown or dynamic.


Sequential statements:- On the other hand, execute instructions one after another in the exact order they appear in the code. Each line of code runs once, without any repetition or looping. Sequential statements are the default flow of control in Python.


Q.4    Describe the purpose and usage of the append() ,insert() , and remove () methods in Python lists. 

Ans:-    . Python provides several built-in methods to manipulate lists. Here are some common ones:

append( ):- Adds an element to the end of the list.

           Example:-  my _ list.append(‘orange’) # Adds ‘orange’ to the end of the list


• insert( ):- Inserts an element at the specified position.

            Example:-  my _ list.insert(2, ‘grape’) # Inserts ‘grape’ at index 2


remove( ):- Removes the first occurrence of the specified element.

           Example:-  my _ list.remove(‘apple’) # Removes the first occurrence of ‘apple’


Q.5    What is the pop() method in Python , and how can it be useful when modifying lists ? 

Ans:-    The pop( ) method removes and returns an element at the specific index. If no index is provided, it removes the last item. 

removed _ item = my _ list.pop(2) # Removes and returns the item at index 2



Python Programs 


1. Add Two Numbers


num1 = 1

num2 = 6

sum = num1 + num2

print('The sum of two number is ', sum)


2. Add the Numbers with User Input


num1 = input('Enter first number')

num2 = input('Enter second number')

Sum = float(num1) + float(num2)

print('the sum of two number is', sum)


3 . Checking Even or Odd Number

num = int(input("Enter a number"))
if num % 2 == 0 :
        print("The number is even")
else :
       print("The number is odd")

4. Checking Age

age = int(input("Enter your age"))
if age >= 18 :
        print("You are an adult")
else :
        print("You are not an adult")

5. Checking Temperature

temperature = int(input("Enter the temperature"))
if temperature > 30 :
        print("It's a hot day")
else :
        print("It's a cool day")


6. Find single or double digit number in python by user input.


a = int(input("Enter your number"))

if (a < 9) :

        print("this is single digit number")

else :

        print("this is double digit number")


Output

Enter your number - 2

This is single digit number


7.    Print your name and class


print ("Ayushi Bharti")

print ("class-7")


Output

Ayushi Bharti

class-7


8.    Add Two Strings

fname = "Shree"

sname = "  Ram"

Tname = fname + " " + sname

print (Tname)


Output

Shree Ram


9.    Print any string in Uppercase by user Input.

text = input ("Enter a string: ")

print ("Uppercase: ", text.upper())


Output

Enter a string: ram

RAM


10.    Print any string in lowercase by user Input.

text = input("Enter a string :")

print("lowercase :",text.lower())


Output

Enter a string : RAM

ram


11.    Make a grading system using python program.


Marks = Int(input("enter your marks"))

if (Marks >= 90):

    print("Grade A+")

elif (Marks >= 75):

    print("Grade A")

elif (Marks >= 60):

    print("Grade B")

elif (Marks >= 40):

    print("Grade C")

else:

    print("fail")


Output

Enter your marks 90

Grade A+



12.    Multiply a string by user input


a = input("Enter your name:-")

z = a * 3

print(z)


Output

Enter your name :- Raghav

RaghavRaghavRaghav









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.