0% found this document useful (0 votes)
109 views4 pages

Academia Middle Section Class: VII, Subject: ICT Chapter: 10 (Coding Club: Python Basics) Study Material-3, March 23, 2021 Q/A

This document contains questions and answers about Python programming basics. It introduces Python as an interactive, object-oriented programming language useful for beginners and large programs. It defines standard data types like numbers, strings, lists, and tuples, giving examples of each. It also provides code snippets to demonstrate operations like string concatenation, list printing, remainder calculation, exponentiation, comparison operators, user input, and subtracting numbers entered by the user.

Uploaded by

Sakib Mahmud
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views4 pages

Academia Middle Section Class: VII, Subject: ICT Chapter: 10 (Coding Club: Python Basics) Study Material-3, March 23, 2021 Q/A

This document contains questions and answers about Python programming basics. It introduces Python as an interactive, object-oriented programming language useful for beginners and large programs. It defines standard data types like numbers, strings, lists, and tuples, giving examples of each. It also provides code snippets to demonstrate operations like string concatenation, list printing, remainder calculation, exponentiation, comparison operators, user input, and subtracting numbers entered by the user.

Uploaded by

Sakib Mahmud
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ACADEMIA

Middle Section
Class: VII, Subject: ICT
Chapter: 10 (Coding club: Python Basics)
Study material-3, March 23, 2021
Q/A

Q1. What is Python? Why is it so useful?


Ans: Python: Python is a general purpose, interactive, object-oriented and high-level programming language. It
provides a better structure and support for large programs.
It is so useful for the followings:
i. It is a great language for the beginner-level programmers.
ii. It is easy to learn as it has few keywords, simple structure and a clearly defined syntax.
iii. This allows the students to pick up the language quickly.
iv. It supports the development of a wide range of applications from simple text processing to WWW
browsers to games.
Q2. Explain the standard data types with examples.
Ans: Standard data types:
i. Number: It stores numeric values:
Example: var1=5, var2=4.5
ii. String: Set of characters represented within quotation marks. The plus sign (+) is the string
concatenation operator and the asterisk (*) is the repetition operator.
Example: str=”Hello students!!!”
print (str*3)
Output: Hello students!!!” Hello students!!!” Hello students!!!”
iii. List: A list contains items separated by commas and enclosed within square brackets[].
Example: list=[‘red’, ’blue’, ‘green’, ‘yellow’, ‘pink’, ‘cyan’]
print (list)
Output: =[‘red’, ’blue’, ‘green’, ‘yellow’, ‘pink’, ‘cyan’]
iv. Tuple: It is similar to the list. A tuple consists of a number of values separated by commas. Tuples
are enclosed in parenthesis () and their elements can not be changed.
Example: tuple= (‘Dhaka’, 1, ‘Chittagong’, 2, ‘Sylhet’, 3)
print (tuple)
Output: (‘Dhaka’, 1, ‘Chittagong’, 2, ‘Sylhet’, 3)
Q3. Write the codes for the following problems.
a. 11,12,13,14,15,16 (separate the values with a’ *’ and end with ‘@’ sign)
b. The reminder of 177/7
c. 5⁴ ( 5 to the power of 4)
Ans: a. print (11, 12, 13,14,15,16, sep=’*’,end=’@’
b. print (“177 divided by 7=”, 177/7,” reminder:”, 177%7)
c. print (“5 to the power of 4=”, 5**4)
Q4. Compare the two values and print the result.
Ans.: If, x=30
y=20
print( ‘x > y is’ , x > y)
print( ‘x < y is’ , x < y)
print( ‘x == y is’ , x == y)
print( ‘x != y is’ , x != y)
print( ‘x >= y is’ , x > =y)
print( ‘x <= y is’ , x <=y)

Q5. Write a code to ask the user to enter your name and display it on screen.
Ans: name_1= input (“Write your name: ”)
Write your name: Ar-ruh
print (name_1)

Q6. Write a program to subtract two numbers provided by the user.


Ans: num1=input(“Enter the first number: ”)
Enter the first number: 150
num2=input(“Enter the 2nd number: ”)
Enter the 2nd number: 100

sub= int(num1)- int(num2)


print(sub)

You might also like