manutd1233
Badges: 4
Rep:
?
#1
Report Thread starter 3 years ago
#1
Hey
I was wondering if a question asks divide you prgoram into sub programs and i use a dictionary is that a sub program and if not what is a sub program
0
reply
nerak99
Badges: 11
Rep:
?
#2
Report 3 years ago
#2
No a dictionary is not a sub program, it is a data structure.

A sub program is something like this (BTW, the TSR editor may kill indents)


def my_function( parameters ):
#do some stuff with the parameters that evaluates to something
return something

You then call it by name from your program

function_result = my_function(a, b, c ...)

function_result would end up containing 'something' depending on what my_function did with the parameters a, b, c, ...
0
reply
atomc19
Badges: 8
Rep:
?
#3
Report 3 years ago
#3
By 'subprogram' do you mean 'subroutine'? A subroutine can be either a procedure or a function.

A dictionary is a data structure.
0
reply
manutd1233
Badges: 4
Rep:
?
#4
Report Thread starter 3 years ago
#4
(Original post by nerak99)
No a dictionary is not a sub program, it is a data structure.

A sub program is something like this (BTW, the TSR editor may kill indents)


def my_function( parameters ):
#do some stuff with the parameters that evaluates to something
return something

You then call it by name from your program

function_result = my_function(a, b, c ...)

function_result would end up containing 'something' depending on what my_function did with the parameters a, b, c, ...
Thank you very much!
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

University open days

  • Regent's University London
    Postgraduate Open Evening Postgraduate
    Thu, 19 Sep '19
  • Durham University
    Pre-Application Open Days Undergraduate
    Fri, 20 Sep '19
  • Loughborough University
    Undergraduate Open Day Undergraduate
    Fri, 20 Sep '19

What's your favourite genre?

Rock (197)
24.32%
Pop (196)
24.2%
Jazz (33)
4.07%
Classical (46)
5.68%
Hip-Hop (153)
18.89%
Electronic (54)
6.67%
Indie (131)
16.17%

Watched Threads

View All