coding

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/59

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:24 PM on 5/18/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

60 Terms

1
New cards

integer input

variable = int(input("Enter number: "))

2
New cards

float input

variable = float(input("Enter number: "))

3
New cards

output/display/print

print(variable)

4
New cards

print message

print("Message")

5
New cards

variable example

score = 0
name = "Ali"
height = 1.75

6
New cards

convert to string

str(value)

7
New cards

convert to integer

int(value)

8
New cards

convert to float

float(value)

9
New cards

addition

total = total + number

10
New cards

subtraction

score = score - 1

11
New cards

multiplication

answer = num1 * num2

12
New cards

division

average = total / amount

13
New cards

quotient/integer division

result = 10 // 3

14
New cards

modulus/remainder

result = 10 % 3

15
New cards

powers/exponents

result = 2 ** 3

16
New cards

concatenation/joining strings

fullName = firstName + " " + lastName

17
New cards

basic if statement

if condition:
    print("True")

18
New cards

if else statement

if condition:
    print("Yes")
else:
    print("No")

19
New cards

if elif else statement

if condition1:
    print("Option 1")

elif condition2:
    print("Option 2")

else:
    print("Other")

20
New cards

equal to comparison

==

21
New cards

not equal comparison

!=

22
New cards

greater than comparison

>

23
New cards

less than comparison

<

24
New cards

greater than or equal comparison

>=

25
New cards

less than or equal comparison

<=

26
New cards

logical and

if age >= 18 and age <= 65:

27
New cards

logical or

if answer == "Y" or answer == "y":

28
New cards

for loop fixed repetitions

for i in range(5):
    print(i)

29
New cards

for loop through list

for item in items:
    print(item)

30
New cards

while loop

while condition:
    print("Running")

31
New cards

validation/password while loop

password = ""

while password != "computer":
    password = input("Enter password: ")

32
New cards

total algorithm

total = 0

for i in range(amount):
    number = int(input())

    total = total + number

33
New cards

average algorithm

average = total / amount

34
New cards

counting algorithm

count = 0

if condition:
    count = count + 1

35
New cards

largest value algorithm

largest = 0

if number > largest:
    largest = number

36
New cards

smallest value algorithm

smallest = number

if number < smallest:
    smallest = number

37
New cards

validation loop

age = int(input())

while age < 0 or age > 120:
    age = int(input("Enter again: "))

38
New cards

string length

len(word)

39
New cards

string slicing

word[start:end]

40
New cards

string slicing example

word[0:3]

41
New cards

create list/array

names = ["Ali", "Bob", "Sam"]

42
New cards

access item in list

print(names[0])

43
New cards

append/add item to list

names.append("John")

44
New cards

linear search algorithm

found = False

for item in items:

    if item == target:
        found = True

if found:
    print("Found")

else:
    print("Not found")

45
New cards

function template

def functionName(parameter):

    return value

46
New cards

function example

def triple(number):
    return number * 3

47
New cards

procedure template

def procedureName(parameter):

    print(parameter)

48
New cards

global variable

global score

49
New cards

open file for reading

file = open("file.txt", "r")

50
New cards

read one line from file

line = file.readline()

51
New cards

read entire file line by line

for line in file:
    print(line.strip())

52
New cards

close file

file.close()

53
New cards

open file for writing

file = open("file.txt", "w")

54
New cards

write to file

file.write("Hello\n")

55
New cards

nested if statement

if condition1:

    if condition2:
        print("Yes")

56
New cards

nested loops

for i in range(3):

    for j in range(3):
        print(i, j)

57
New cards

import random module

import random

58
New cards

random integer

random.randint(1, 10)

59
New cards

boolean false

found = False

60
New cards

boolean true

found = True