Lab 1 | CMPT120 - D4 (2024)

Directions for Labs

  • Submitting your completed lab file online to CourSys (not Canvas). Labs are marked on completion, not correctness, so complete each part to the best of your ability and learn!
  • It is recommended that students attend in-person lab sections for lots of help!
    • If you would like to attend an in-person lab section, you are welcome to come to any (or more than one) lab section.
    • There is no need to attend the section you are enrolled in.
    • There is no need to attend any lab sections: there is no attendance taken.
    • You can complete the lab on your own time or own computer if you like.
  • While completing these labs, you are encouraged to help your classmates and receive as much help as you like. Assignments, however, are individual work and you must not work with another person on assignments.

You may not work on assignments if you are in the CSIL lab during CMPT 120 tutorial times.

1. Inspirational Quote

  1. Open VS Code (or the Python IDE of your choice) and your cmpt120 folder:
    • (Recommended) Install VS Code and Python on your computer [video].
    • (Recommended) Or, use an SFU computer in the CSIL lab [guide].
    • If you don't want to install anything on your computer, follow this guide on remotely connecting to an SFU server through your browser (via VDI).
    • If you are unable to connect to SFU, you can use an online website to write your code; however, this is not a recommended long term solution. Please ask a TA or the instructor for help
  2. Inside your cmpt120 folder create a new folder named lab1.
  3. Inside your lab1 folder, create a new file name lab1.py.
  4. Make your lab1.py print to the screen an inspirational quote.
    • Print to the screen the quote, along with who said it.
    • No requirements about formatting; just a chance to start using the print() statement.
  5. Run your program to ensure that it works!

2. Advice Chatbot

Pick a fictional personality who can give (good? bad?) advice, such as from a movie, a book or a fairy tale. Make it fun! You are going to create a chatbot that speaks in their "voice". Need some ideas: Big Bad Wolf, Fairy Godmother, HAL 9000, Ironman, Jarvis, Dobby, Snape, Glinda, Rocky, Wicked Witch of the West, ...

  1. After the inspiration quote from above, print a greeting message from your chosen personality.
  2. Ask the user for their name, and then have your personality greet the user by name, such as "Pleased to make your acquaintance, Brian."
    • Remember that input() reads from the keyboard:
    • You'll need to store the user's name in a variable so you can use it later.
    • Remember that you can put a + between two strings to concatenate them together.
  3. Tell the user which direction to travel to seek their fortune:
    • Create a list of four strings; one for each direction (North, East, ...)
    • Recall that a list might look like ["apple", "bean", "cherry"].
    • Randomly pick one of the directions from the list.
      • Hint: use random.choice() on a list to pick one.
      • Remember to import random.
    • Tell the user that their fortune awaits in that randomly chosen direction.
      • Hint: When you use random.choice() on you list of directions, store that direction in a variable.
      • Concatenate that direction with a message and print it to the user.
    • Recall the lecture notes included an example that used random selection from a list.
  4. Ask the user a yes/no question and print out a unique message in either case.
    • Put the input() statement before the if statement to get the user's input and store it in a variable.
    • Use an if-else statement to decide which of the messages to print out.
    • Have the if statement check the user's input to see if it equals (==) "yes"; don't worry about handling upper case vs lower case.
    • You'll need one print statement for when the if statement is true, and another one in the else for when it is false.
  5. Change your if statement to handle not only yes/no, but also yup/nope:
    • Currently, your if statement likely checks for one word, and uses an else to handle the other case.
    • Change the if statement to check if the user's input equals "yup" in addition to "yes".
    • To check if the input equals one of two things, you'll need to use an or.
    • Recall lecture uses an example with or.
    • One statement from the in-class example is:
      if reply == "Good" or reply == "good" or reply == "great":
      • It is checking for different words and different capitalizations of a word. In this lab you only need to check for two words ("yes"/"yup"; or "no"/"nope"), so it will be a little simpler.
      • Change this statement to check for "yes" and "yup".
      • Notice that this statement repeats the variable name reply when checking it for different values.
    • The structure you'll end up with is (assuming the variable name is myInput):
      if myInput == "..." or myInput == "...": print(...)else: print(...)
    • (Optional) Once you have it working with or, experiment by changing to and. Does it work? Can you explain to yourself why? (Hint: You'll need to use or).
  6. Run your program a few times to ensure that:
    • It generates random directions correctly:
      • Each run it should be randomly picking between "North", "East", ....
      • When you run your program a few times expect to see different directions each time. Since it's random you may see the same direction a couple times in a row just like if you were flipping a coin.
    • It does the right thing when you type in "yup", "yes", "nope", or "no".
      • Run the program once and test for "yes". Ensure it shows you the correct output.
      • Run it again with input "yup"; it should give the same output.
      • Run again for "no", then again for "nope".
    • What happens when you run it and enter "oops"? Can you explain why? (You don't have to make it work correctly for inputs such as "oops", but you are welcome to do so!).
  7. (Optional) You are welcome to expand on the above steps! Have fun!
    • You are welcome to add more to your program, making it more complicated!
    • Your final submission should still meet the above required behaviour for the inputs "yes", "yup", "no", and "nope"; any additional behaviour is great!
    • Maybe try making it handle other cases such as:
      • "oops"
      • "No" (capital N)
      • "NO" (all capitals)
    • Maybe try making it ask the user another question. Do you want it to be a yes/no question? How about open ended like "What is your goal in life?" Can your personality give fun advice?
    • Experiment with other things covered in lecture, such as an if-elif-else statement.

Submission

Submit your lab1.py file to CourSys by Sunday midnight. Remember you can submit up to 3 days late with no penalty if needed (but please plan to get it done on time to stay up to date on the course!)

Tools

Discord for office hours
CourSys assignment/lab submissions; grades

Lectures

Mon/Wed/Fri 11:30am-12:20pm
In person SRYE1002
(Building west of Central City Skytrain)
Lecture Recordings

Instructor

Dr. Brian (Fraser)
bfraser@sfu.ca
Office Hours
M/W/F: In Lab: 1pm-2:30pm (SRYE 4013)

TAs

Lingxuan
lfa27@sfu.ca
Office Hours (Discord)
Tue 7pm-9:30pm
Wed 7pm-9:30pm
Sun 6pm-11pm

Shedrach
see4@sfu.ca
Open Lab (SRYE 4013):
Wed 12:30pm-6:20pm
Fri 12:30pm-3:20pm

Shiva
ssanei@sfu.ca
Open Lab (SRYE 4013):
Wed 12:30pm-6:20pm
Office Hours (Discord)
Mon 6pm-8pm
Fri 6pm-8pm

Wenxiang
wha61@sfu.ca
Open Lab (SRYE 4013):
Wed 12:30pm-3:20pm
Office Hours (Discord)
Thur 7pm-11pm
Sat 9pm-11pm

CS Peer Tutoring
Peer tutoring info

Dates (Fall 2024; tentative)

  • Sept 4: First class (no tutorial this week)
  • Sept 27: Quiz 1
  • Sept 30: No class (Day for Truth and Reconciliation)
  • Oct 11: Quiz 2
  • Oct 14: No class (Thanksgiving)
  • Oct 15: Tuesday class! Normal time
  • Oct 25: Midterm
  • Nov 8: Quiz 3
  • Nov 11: No class (Remembrance day)
  • Nov 22: Quiz 4 (likely)
  • Dec 2: Quiz 5 (likely); Last class
  • Final Exam: TBA
Lab 1 | CMPT120 - D4 (2024)

FAQs

What is the labcorp test code for alpha 1 antitrypsin serum? ›

LOINC Map
Order CodeOrder Code NameResult Code
001982Alpha-1-Antitrypsin, Serum001982

What is lab 1? ›

Lab 1 is the leading exposed data intelligence platform that can tell you what you don't know, quicker than anyone else. Get Started.

What is alpha-1 antitrypsin lab test? ›

This is a type of blood test. It helps find out if you have a genetic disorder called alpha-1 antitrypsin deficiency. This disorder is linked to abnormally low levels or a lack of alpha-1 antitrypsin (AAT) protein in the blood. The disorder can cause liver and lung diseases.

What is the code for alpha-1 antitrypsin? ›

E88. 01 is a billable/specific ICD-10-CM code that can be used to indicate a diagnosis for reimbursem*nt purposes. The 2024 edition of ICD-10-CM E88.

What are lab test codes? ›

Lab Test Codes are used in transactions capturing lab analysis and results from blood, feed, or ingredient samples. The process is used to identify levels of disease or contamination within the entities.

What is a Level 1 lab? ›

BSL-1. If you work in a lab that is designated a BSL-1, the microbes there are not known to consistently cause disease in healthy adults and present minimal potential hazard to laboratorians and the environment. An example of a microbe that is typically worked with at a BSL-1 is a nonpathogenic strain of E. coli.

What do lab numbers mean? ›

But how do you know what that number means? To answer that question, your lab report tells you whether your test result is in a normal range called a reference range or "normal values." A reference range is a set of numbers that are the high and low ends of the range of results that's considered to be normal.

What is the labcorp test code for alpha 1 fetoprotein? ›

002253: α-Fetoprotein (AFP), Tumor Marker | Labcorp.

What is the labcorp test code for serum? ›

790730: Tin, Serum or Plasma | Labcorp.

What is the code 511881 for labcorp? ›

511881: α1-Antitrypsin Deficiency, DNA Analysis | Labcorp.

What is the diagnosis code for alpha 1? ›

ICD-10-CM Code for Alpha-1-antitrypsin deficiency E88. 01.

Top Articles
‘Vanderpump Rules’ star Lala Kent on life after Randall Emmett
Atlantic Union Bank, Review
Funny Roblox Id Codes 2023
Golden Abyss - Chapter 5 - Lunar_Angel
Www.paystubportal.com/7-11 Login
Joi Databas
DPhil Research - List of thesis titles
Shs Games 1V1 Lol
Evil Dead Rise Showtimes Near Massena Movieplex
Steamy Afternoon With Handsome Fernando
Which aspects are important in sales |#1 Prospection
Detroit Lions 50 50
18443168434
Zürich Stadion Letzigrund detailed interactive seating plan with seat & row numbers | Sitzplan Saalplan with Sitzplatz & Reihen Nummerierung
Grace Caroline Deepfake
978-0137606801
Nwi Arrests Lake County
Justified Official Series Trailer
London Ups Store
Committees Of Correspondence | Encyclopedia.com
Pizza Hut In Dinuba
Jinx Chapter 24: Release Date, Spoilers & Where To Read - OtakuKart
How Much You Should Be Tipping For Beauty Services - American Beauty Institute
Free Online Games on CrazyGames | Play Now!
Sizewise Stat Login
VERHUURD: Barentszstraat 12 in 'S-Gravenhage 2518 XG: Woonhuis.
Jet Ski Rental Conneaut Lake Pa
Unforeseen Drama: The Tower of Terror’s Mysterious Closure at Walt Disney World
Ups Print Store Near Me
C&T Wok Menu - Morrisville, NC Restaurant
How Taraswrld Leaks Exposed the Dark Side of TikTok Fame
Dashboard Unt
Access a Shared Resource | Computing for Arts + Sciences
Black Lion Backpack And Glider Voucher
Gopher Carts Pensacola Beach
Duke University Transcript Request
Lincoln Financial Field, section 110, row 4, home of Philadelphia Eagles, Temple Owls, page 1
Jambus - Definition, Beispiele, Merkmale, Wirkung
Netherforged Lavaproof Boots
Ark Unlock All Skins Command
Craigslist Red Wing Mn
D3 Boards
Jail View Sumter
Nancy Pazelt Obituary
Birmingham City Schools Clever Login
Thotsbook Com
Vérificateur De Billet Loto-Québec
Funkin' on the Heights
Vci Classified Paducah
Www Pig11 Net
Ty Glass Sentenced
Latest Posts
Article information

Author: Rueben Jacobs

Last Updated:

Views: 5724

Rating: 4.7 / 5 (57 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Rueben Jacobs

Birthday: 1999-03-14

Address: 951 Caterina Walk, Schambergerside, CA 67667-0896

Phone: +6881806848632

Job: Internal Education Planner

Hobby: Candle making, Cabaret, Poi, Gambling, Rock climbing, Wood carving, Computer programming

Introduction: My name is Rueben Jacobs, I am a cooperative, beautiful, kind, comfortable, glamorous, open, magnificent person who loves writing and wants to share my knowledge and understanding with you.