Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 74737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:24:19+00:00 2026-05-10T20:24:19+00:00

WARNING: I have been learning Python for all of 10 minutes so apologies for

  • 0

WARNING: I have been learning Python for all of 10 minutes so apologies for any stupid questions!

I have written the following code, however I get the following exception:

Message File Name Line Position Traceback Node 31 exceptions.TypeError: this constructor takes no arguments

class Computer:      name = 'Computer1'     ip = '0.0.0.0'     screenSize = 17       def Computer(compName, compIp, compScreenSize):         name = compName         ip = compIp         screenSize = compScreenSize          printStats()          return      def Computer():         printStats()          return      def printStats():         print 'Computer Statistics: --------------------------------'         print 'Name:' + name         print 'IP:' + ip         print 'ScreenSize:' , screenSize // cannot concatenate 'str' and 'tuple' objects         print '-----------------------------------------------------'         return  comp1 = Computer() comp2 = Computer('The best computer in the world', '27.1.0.128',22) 

Any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:24:19+00:00Added an answer on May 10, 2026 at 8:24 pm

    I’m going to assume you’re coming from a Java-ish background, so there are a few key differences to point out.

    class Computer(object):     '''Docstrings are used kind of like Javadoc to document classes and     members.  They are the first thing inside a class or method.      You probably want to extend object, to make it a 'new-style' class.     There are reasons for this that are a bit complex to explain.'''      # everything down here is a static variable, unlike in Java or C# where     # declarations here are for what members a class has.  All instance     # variables in Python are dynamic, unless you specifically tell Python     # otherwise.     defaultName = 'belinda'     defaultRes = (1024, 768)     defaultIP = '192.168.5.307'      def __init__(self, name=defaultName, resolution=defaultRes, ip=defaultIP):         '''Constructors in Python are called __init__.  Methods with names         like __something__ often have special significance to the Python         interpreter.          The first argument to any class method is a reference to the current         object, called 'self' by convention.          You can use default function arguments instead of function         overloading.'''         self.name = name         self.resolution = resolution         self.ip = ip         # and so on      def printStats(self):         '''You could instead use a __str__(self, ...) function to return this         string.  Then you could simply do 'print(str(computer))' if you wanted         to.'''         print 'Computer Statistics: --------------------------------'         print 'Name:' + self.name         print 'IP:' + self.ip         print 'ScreenSize:' , self.resolution //cannot concatenate 'str' and 'tuple' objects         print '-----------------------------------------------------' 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 259k
  • Answers 259k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer How exactly did you add that context menu item? You… May 13, 2026 at 11:16 am
  • Editorial Team
    Editorial Team added an answer SELECT name FROM people WHERE age > 15 May 13, 2026 at 11:16 am
  • Editorial Team
    Editorial Team added an answer You could try implementing a game loop. https://learn.microsoft.com/archive/blogs/tmiller/my-last-post-on-render-loops-hopefully The basic… May 13, 2026 at 11:16 am

Related Questions

I have been reading a lot about Reinforcement Learning lately, and I have found
In the past I've worked with -Wall and other switches for gcc to eliminate
I've been learning about gems lately, and one error I get is: WARNING: Installing
I am learning C and I am playing around with pointers and arrays. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.