programing

Subdecks (8)

Cards (230)

  • procedure prints data
  • function returns data
  • add = +
  • subtract = -
  • divide = /
  • multiply = *
  • modulus (remainder)= %
  • integer division (round down)= //
  • power =**
  • != not equal to
  • selection= decision (select)
  • What does the function print() do in Python?

    Displays text on the screen
  • What is the purpose of the input() function in Python?

    It prompts a user to enter data via the keyboard
  • What does the int() function specify in Python?

    That the data you want is an integer(number)
  • What does the str() function specify in Python?

    That the data you want is a string
  • What does the float() function specify in Python?

    That the data you want is a float
  • What is the function of help() in Python?

    It provides a built-in help system
  • How would you use the help() function in Python?

    By typing help(print) in the shell
  • What does the len() function do in Python?

    Tells you the length of an object
  • How can you test the len() function in Python?

    By trying len("duuude") in the shell
  • What does the type() function do in Python?

    Tells you the type of an object
  • How can you test the type() function in Python?

    By trying type(1) or type(1.1) in the shell
  • What is the purpose of the range() function in Python?

    It allows a range of numbers to be used
  • How is the range() function frequently used in Python?

    With a for loop
  • What does the list() function do in Python?

    Can take a string and convert it to a list
  • What are the main functions discussed in the study material?
    • print(): Displays text on the screen
    • input(): Prompts user to enter data
    • int(): Specifies integer data
    • str(): Specifies string data
    • float(): Specifies float data
    • help(): Built-in help system
    • len(): Tells length of an object
    • type(): Tells type of an object
    • range(): Allows a range of numbers
    • list(): Converts a string to a list
  • Write a program that reads the base and the height of a right-angled triangle and prints the area.

    height=int(input())
    base=int(input())
    print(height*base/2)
  • Write a program that greets the person by printing the word "Hi" and the name of the person

    name = input()
    print("Hi",(name))
  • What is the main component of a computer program?
    Sequence
  • What does sequence refer to in programming?
    Ordered list of instructions in a program
  • What is iteration in programming?
    Looping or repeating of code
  • How would you print "Hello" 5 times using iteration?
    By looping the print instruction 5 times
  • What is selection in programming?
    Making decisions in code
  • What does a condition do in selection?
    Checks which direction the selection code takes
  • What is a variable used for in programming?
    To store values in code
  • How does a variable work with user input?
    Stores user input for later use
  • What is decomposition in programming?
    Breaking down a large problem into smaller problems
  • Why is decomposition useful?
    Makes it easier to solve complex problems
  • What is abstraction in programming?
    Removing unnecessary information from a problem
  • How does abstraction help in programming?
    Focuses on the core issue of a problem