Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Can anyone write the codes for these questions using python (jupyter notebook)??

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Create a Python class my_family, which will have the following attributes:
my_first_name -> default set to 'John' by __init__
my_family_name -> default set to 'Wick' by __init__
my_fathers_name -> default set to 'unknown' by __init__
my_mothers_name -> default set to 'unknown' by __init__
my_sisters_name -> default set to 'unknown' by __init__
my_brothers_name -> default set to 'unknown' by __init__

the class should also contain the following methods:

1. __init__(self, first_name = 'John', second_name = 'Wick') (1 marks)
This function will assign:
• first_name to my_first_name
• second_name to my_family_name
• my_fathers_name, my_mothers_name, my_sisters_name and my_brothers_name will all
be set to the string ‘unknown’

2. return_my_name(self) (1 marks)
• the function will return a list containing two elements in the following order my_first_name,

3. add_parents_names(self, mothers_first_name, fathers_first_name) (1 marks)
• assign mothers_first_name to my_mothers_name
• assign fathers_first_name to my_fathers_name

4. add_siblings_names(self, sisters_first_name, brothers_first_name) (1 marks)
• assign sisters_first_name to my_sisters_name
• brothers_first_name to my_brothers_name

5. return_all_first_names(self) (1 marks)
• this function will return a dictionary as follows: {‘me’:my_first_name,
‘my_mum’:my_mothers_name, ‘my_dad’:my_fathers_name,
‘my_sister’:my_sisters_name, ‘my_brother’:my_brothers_name}

6. check_if_my_sisters_name(self, name) (1 marks)
test whether name is equal to my_sisters_name
– if yes return True
– if not return False
We don't have time for this. We've gotta save the moon! Or check this out:
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic