Programming 2 Flashcards

get better at python

1
Q

can you combine strings and numbers in python ?

A

you cant do it directly unless u add str before the number

eg : (“yoyo” + str(123))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where should normal arguements be placed ?

A

Normal arguements should be placed before variable arguements , ALWAYS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the special case called where you add another statement apart from “if” and “else” statements

A

“elif” statements are used , these statements allow us to add more than one condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Collection

A

grouping multiple items tgt and storing them in a single name (variable)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List

A

groups pieces of data tgt in a certain order and assigns the collection a name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Should you add comma at the end of a list/array ?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Mutable & Immutable values

A

  • mutable = values that can be changed after their created
  • immutable = values that cant be changed once created
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Iteration

A

repeats the same procedure multiple times until it ends

  • loop is a code that iterates
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Module

A

Python file that contains code, like variable or functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Python Libraries

A

  1. machine learning tasks
    * TensorFlow
    * pandas
  2. Math stuff
    * Numpy
    * Scipy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Python Frameworks

A

used for web development management

  • Django
  • Flask
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Concatenate

A

combine multiple strings into one string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Slicing

A

getting part of a string value

string[start:end]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

String methods

(making changes/finding strings etc)

A

newstringname.stringname.methodname()

  • the new string name is the new name u give the string
  • the stringname is the string that u want to add the function or wtv to
  • the “.” is used to tell python that a method/change is coming next
  • method name is what u wanna do to the string
  • always end with ()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Regular Expression

A

aka Regex

Allows you to create a description of a pttern that you want to match

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

6 ways to make a description of patterns you want using regular expressions

A

  1. /content\ : enclose in slashes for specific content
  2. \d : indicates digits that your looking for
  3. \w : indicates words that your looking for
  4. . : indicates any character
    • : to indicate 1 or more occurences of the preceding pattern
    • : indicates zero or more occurences of the preceding pattern*
  5. ? : indicates zero or one occurences of the preceding pattern
16
Q

Class

A

describes the type of attributes and behaviours an object can have

17
Q

Memory Management

A

code that decides what kept in memory and whats not

alternatively u can use garbage collection - automated memory management process which clears unnecessary items

18
Q

Algorithm

A

set of instructions that are used to describe the exact result

19
Q

Memory Allocation types

A

  • Static : compile time, before the execution of the program
  • Dynamic : runtime happens during executin of the program
20
Q

Deallocation

A

disposes of memory when its no longer useful

21
Q

Manual Memory Management and Automatic Memory Management

A

  • MMM - developers have to write code to allocate and deallocate memory
  • AMM - allocating and deallocating of memory is done automatically by the program
22
Q

Stack, Stack overflow, Call stack

A

variables created by other functions are stored by stacks, when functions call other functions , it stores memory temporarily by creating new stack record

stacks hv max no of records, record hv a max limit

  • Stack : special data type that follows last in first out principle
  • Stack overflow : when the data exceeds the max limit of records
  • Call stack : order of the functions
23
Q

Interpreters and Compilers

A

  • Interpreters - translate line by line and execute instructions
  • Compilers - take the whole file and turn it into machine code
24
Q

bytecode

A

the codes that get interpreted line by line

25
Q

what takes up more space, int or float values ?

A

  • float values bc of the point, it has to store memore in 2 diff places , one place is before the point and one is after the point
26
Q
A