WGU C859/ C859 WGU / Introduction to Programming in Python C859 Updated 2023 -2024 with open('/my_path/my_file.txt','r') as f: --------- Correct Answer -------- opens a file, performs operations and automatically closes file title() --------- Correct Answer -------- capitalizes first letter of each word islower() --------- Correct Answer -------- determines if the string consists of lowercase characters count() --------- Correct Answer -------- totals number of times an argument is found within a predefined value format() --------- Correct Answer -------- inserts variable data in a string def --------- Correct Answer -------- keyword used to create functions def myfunction(): --------- Correct Answer -------- syntax for function declaration return --------- Correct Answer -------- defines output of a function if age < 16: --------- Correct Answer -------- creates an if statement else: --------- Correct Answer -------- else statement, used in conjunction with if statement or if/elif statement elif age >= 16 and age <= 18: --------- Correct Answer -------- elif statement, used in conjunction with if statement True an d False --------- Correct Answer -------- False: and operation will always be false unless both sides are true True or False --------- Correct Answer -------- True: or operation will always be true unless both sides are false not(True and False) --------- Correct Answer -------- True: Boolean not operation will produce the inverse value. myNumbers = [1, 4.8, 7, 9 .2, 3, 0] --------- Correct Answer -------- creates a list mylist[0] --------- Correct Answer -------- accesses first element from a list mylist[ -1] --------- Correct Answer -------- accesses last element from a list mylist[1:3] --------- Correct Answer -------- slices list including second and third element mylist[:3] --------- Correct Answer -------- slices list beginning with first element and including through the third element. Index position 3 is not included in selection. mylist[3:] --------- Correct Answer -------- slices list beginning with fourth element and include remainder of the list 9.2 in myNumbers --------- Correct Answer -------- looks for a match and returns Boolean value 9.2 not in myNumbers --------- Correct Answer -------- ensure s a match does not exist in list len() --------- Correct Answer -------- counts items in list var1, var2, var3 = 1, 2, 3 --------- Correct Answer -------- multiple variable assignment 12 --------- Correct Answer -------- integer 1.2 --------- Correct Answer -------- float 'twelve' --------- Correct Answer -------- string "twelve" --------- Correct Answer -------- string True or False --------- Correct Answer -------- Boolean value type() --------- Correct Answer -------- determines type of an object (integer, boolean, etc) int() --------- Correct Answer -------- converts to int eger object float() --------- Correct Answer -------- converts to float object str() --------- Correct Answer -------- converts to string object print() --------- Correct Answer -------- displays a message + --------- Correct Answer -------- addition (integer) or concatenation (string) - --------- Correct Answer -------- subtraction
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller johnwachi22. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $17.99. You're not tied to anything after your purchase.