Practice Questions of Python - Your Class

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

 About Courses Discussion Practice Blog  Sign Up  Login

Download Our App.


Practice questions on Your class?

Level 1

Level 1

1. Create a Cricle class and intialize it with radius. Make two methods getArea and getCircumference inside
this class. New Questions
 what is the output of the
following code segment? - Java

class Circle(): HOW TO SEARCH A WORD


def __init__(self,radius): FROM EXCEL FILE USING
self.radius = radius JAVA - Java
def getArea(self):
return 3.14*self.radius*self.radius
Write a program that takes two
def getCircumference(self):
integer values as input
return self.radius*2*3.14
(therefore declare two integer
variables). Get input in those
variables using scanf function.
F -C

2. Create a Temprature class. Make two methods :


This website uses cookies to ensure you get1.the
convertFahrenheit
best experience -on
It will
our take celsius
website. andmore
Learn will print it into Fahrenheit. write a java program that
Gotwill
it!
2. convertCelsius - It will take Fahrenheit and will convert it into Celsius. take person's name ,age
,salary and display it. - Java

Find the output of the following
code * 5 points Captionless
Image -C
3. Create a Student class and initialize it with name and roll number. Make methods to :
1. Display - It should display all informations of the student.
While solving the question 4 of
2. setAge - It should assign age to student
level 2 in "let's start" topic I
3. setMarks - It should assign marks to the student. cant print the exact pattern.
 The third star never lies in
between the 2 stars, it is - C

Sum of two numbers -C


class Student():
def __init__(self,name,roll): A s k Yo u r s
self.name = name
self.roll= roll
def display(self):
print self.name
print self.roll
def setAge(self,age):

  

self.age=age
def setMarks(self,marks):
self.marks = marks
  

4. Create a Time class and initialize it with hours and minutes.


Select Language ▼
1. Make a method addTime which should take two time object and add them. E.g.- (2 hour and 50 min)+(1
hr and 20 min) is (4 hr and 10 min)
2. Make a method displayTime which should print the time.
3. Make a method DisplayMinute which should display the total minutes in the Time. E.g.- (1 hr 2 min) Recent Posts
should display 62 minute.

Multithreading in Python

Multiprocessing in Python:
Process vs Pool Class

Multiprocessing using
Pool in Python

Introduction to
Multiprocessing and
Process in Python

P o s t Yo u r s

CATEGORIES KEEP IN TOUCH

ABOUT  help@codesdope.com
BLOG
COURSES
PRACTICE
FOLLOW US
DISCUSSION

     CONTACT US
TERMS OF USE
PRIVACY POLICY

© 2016-19 | www. codesdope.com | All rights reserved.

You might also like