0% found this document useful (0 votes)
15 views6 pages

STD 6

Uploaded by

Orin
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)
15 views6 pages

STD 6

Uploaded by

Orin
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/ 6

NextGen International Coding and Engineering

(NICE) School & College


Worksheet
Class: STD-VI
Student’s Name: Subject: Python Programming Language Date: 22.04.24

Teacher’s Name: Jahanara Taznina Orin Roll: Submission date:

Q.Trace the following source code and find out the outputs:
a.Code:
var1 = input ('Enter the first variable:')
var2 = input ('Enter the second variable:')
temp = var1
var1 = var2
var2 = temp
print ('The value of the first variable after swapping:', var1)
print ('The value of the second variable after swapping:', var2)
Output:

b. Code:
#This is a simple program
#to output simple statements
#print(“Such as”)
print(“Take every chance”)
print(“Drop every fear”)
Output:

c. Code:
a=int(input(“input the 1st value:”))
b=int(input(“input the 2nd value:”))
s=a+b
print(“The sum=”,s)
Output:
Q. Use the code to answer the following questions:
1. Value1=5.1
2. Value2=678
3. ABC="Bangladesh"
4. DCE="Apple"
5. print( Value1+8)
6. print( ABC,"=",DCE)
7. print( Value2)
8. print( "Value1"+"8")
9. print( "Value1"+"Value2")
a. What data type are each of the variables? b. Write what each line will print out:
i. num_1: i. Line5:
ii. num_2: ii. Line 6:
iii. Line 7:
iii. food_1:
iv. Line 8:
iv. food_2 : v. Line 9:

Program with output:


1. Write a Python program using arithmetic operators(+,-,-,*,/,//,**,%)
2. Write a Python Program to Convert Celsius to Fahrenheit using the following formula: fahrenheit = (celsius *
5/9) + 32
3. Write a Python Program for calculating the area and Perimeter of a Square.
4. Write a Python Program for calculating the area and Perimeter of a triangle.
5. Write a python program which:
a. Has four variable: Var1,Var2, Var3 and Var4
b. Assign the following values: 120 to var1 and “Umm Al-Qura University” to Var2,
c. Input values from the Keyboard and assign them to Var3 and Var4.
d. print the variable.
Q. Write down the “True” and “False”:
A) Python is a case-sensitive language.
B) In Python, anything written after # is printed as it is.
C) You need to pay to use the Python software.
D) main() is a predefined function in c.
E) Python uses (\) character to denote that a line should continue.
F) You can save the program in the interactive mode of Python.
G) Arithmetic Operators are used to evaluate a mathematical expression.
H) Keywords may be used as variables.
I) The string values cannot be multiplied together.
J) In Python only one type of data can be stored in memory.
K) print() function is used to accept the value of a variable from the user.
L) A variable name can consist of alphabets, digits, and underscore.
M) To evaluate an arithmetic expression, it is not necessary to use print() function.
NextGen International Coding and Engineering
(NICE) School & College
Worksheet
Class: STD-VI
Student’s Name: Subject: Python Programming Language Date: 21.04.24

Teacher’s Name: Jahanara Taznina Orin Roll: Submission date: 22.04.24

Q. Rewrite the following code in Python after removing all errors and in order to get the output.
a.Code:
PI=3.14
radius = float(input("Enter the radius of the circle: ")
area = PI * (radius ** 2)
perimeter = 2 * PI * radius
print("Area of the circle:" area)
print("Perimeter of the circle:",perimete)
Correct code:

Output:

b. Code:
Side=int(input("Enter the value of Side:")
Area=side*side
Perimeter= 4*Side
print("Perimeter of a Square:", perimeter)
print("Area of a Square:" Area)
Correct Code:

Output:
Q. Sort the given program:-
a.Code:
Perimeter= 2*(Length+Width)
Length=int(input("Enter the the value of Length:"))
Area=Length*Width
print("Perimeter of a Rectangle:", Perimeter)
print("Area of a Rectangle:", Area)
Width=int(input("Enter the the value of Width:"))\
Correct code:

Output:

c.Code:
print("Perimeter of a Triangle :", Perimeter)
Area=1/2*(Base* Height)
Side2=int(input("Enter the value of Side2:"))
Base=int(input("Enter the value of Base:"))
Height=int(input("Enter the value of Height:"))
Side1=int(input("Enter the value of Side1:"))
print("Area of a Triangle :", Area)
Side3=int(input("Enter the value of Side3:"))
Perimeter= Side1+Side2+Side3
Output:

Q. Write down the correct answer:


1. a = 10
b = 20
print (a>10 and b<40) 4. a = 10
b = 20
Output:- True/ False/both 0 and 1/ 1 print(a+b+a+b)

Ans: Output:- 1020/30 a+b /60/30

2. a = 10 Ans:
b = 20
print(a+b) 5. x = 10
print ('a+b') y = 20
print(x>=y)
Output:- 1020/30 a+b / 'a+b'/abc
Output:- True/ False/both 0 and 1/ 1
Ans:
Ans:
3. a =10100
b =10100
print(a & b)

Output:- 10100/ 10101/ 10111/ 00100

Ans:

You might also like