Computer Science > QUESTIONS & ANSWERS > COP 1000C Final Questions and Answers Graded A (All)
COP 1000C Final Questions and Answers Graded A Algorithm ✔✔1.) Step by step instructions of how to solve a problem. 2.) Written in human language, can be English or any other language. 3.)NOT... executed by a computer. Print statement ✔✔print("jadan is an idiot") Input statement ✔✔input ( prompt ) Comments ✔✔# this is the first comment Identifiers/Variables ✔✔1.) Names within a program, variables and function names like main. 2.) In Python they are case-sensitive. Valid Python Identifiers 1.) Begin with a letter or underscore "_" 2.) Can NOT be reserved word like Print. 3.) Can be followed by letters, digits, or "_" 4.) Can NOT use any other characters i.e. %, space, !, etc. Variable ✔✔1.) An identifier that labels a value for future reference. 2.) The value of a variable can be changed through an assignment statement. 3.) In X = 5, X is the variable. 4.) A variable is basically a box where a value can be assigned. Literal ✔✔Notation for writing a value in a programming language. Examples: 1.) 5 2.) "hello" Operator ✔✔A function for combining expressions into more complex expressions. Examples: +, -, %, /,*,**,//,= Accessor ✔✔1.) A method which allows you to get or "access" the data in an object 2.)Get the values of an object without altering it's state Example: p = Point(100,10) p.getX() is an accessor method that returns the data stored in the instance variable x of the Point object p Mutator ✔✔Allow you to modify the internal state of an object. Some examples are used on lists insert, append, pop, sort. The simplest form of mutator function is one that sets a variable directly to a new value. What happens when you call a function? ✔✔1. Calling program is suspended. 2. The values of actual parameters are assigned to the formal parameters. 3. The body of the function is executed 4. Control returns to the line immediately AFTER the function call in the calling program. The value returned by the function is used as the expression result. Why do we use functions? ✔✔1.) To avoid repeating code. 2.) To make the code more organized. 3.) To make the code more readable. 4.) To make the code easier to maintain. What do functions look like in python? ✔✔Function calls always have parenthesis after them even if there are no parameters! def myFunction() name=input("What is your nam [Show More]
Last updated: 2 years ago
Preview 1 out of 10 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Oct 23, 2022
Number of pages
10
Written in
This document has been written for:
Uploaded
Oct 23, 2022
Downloads
0
Views
84
In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·