OnlineNursingOwl
← All nursing posts

Physics · Studypool

Physics Question

Overview

Please resolve all in-class examples/exercises given in the lectures dated as: 8/21/2025, and 8/26/2025. Whiteboard snapshots are provided in the modules section

For this HW assignment, please write down your solution on your notebook, scan it, then upload it to Canvas.

These HW assignments consist of resolving/practicing the same exercises demonstrated by the instructor in class, enabling students to review, practice the same problems independently, and enhance their mastery and understanding, and motivate them to ask questions. This assignment type is expected to encourage students to ask questions during class and office hours, to motivate students to participate in-class, and it will strengthen students’ understanding of the taught material/exercises in a direct way and motivate students to gain full understanding. Each assignment of these will be graded out of 1 point as either 0 or 1 point depending on the student’s submitted solution quality.


BASIC PROGRAMMING ASSIGNMENT:

In this exercise, you’ll be following the steps below to creating your own conversation application named Loki. This application will be very basic but will help you practice typing in code and understand concepts we covered from Chapter 1 through 3 so far.

Once you have completed the writing the code like instructed, be sure to run the application to see if you have any existing errors that need to be corrected.

If it runs without errors, enter response to Loki for it to response back to you. Take a screenshot of it running properly and submit it for credit!

If you have any issues, please do not hesitate to contact me with a screenshot of your error message. Remember, this is just an exercise which is to build your learning muscle.

Step 1: On line 1, 2, and 3, greet the user of the program by using a print( ) keyword statement and gather their name with input( ) keyword statement. Store their entry into a variable called name, then make another print( ) keyword statement displaying their name in a message:

print ( ‘Welcome to your buddy Loki!’ ) name = input ( ‘Please enter your name here, then press enter:’ ) print ( ‘Hi’ , name , ‘talk to me!’ )

Step 2: On line 4 and 5, create a while loop that will be infinite (non-ending). Within the loop, it will constantly prompt the user a keyboard entry by using the input( ) keyword statement. The entry will be stored into a variable called entry:

while True : entry = input ( ‘Type here:’ )

Step 3 (note, make sure ‘e’ from entry (line 5) and ‘i’ from if are aligned before continuing): While still inside the block from line 5, line 6 through 16 we will create Loki’s responses by creating a branching if-else statements. These statements will check if the value of variable called entrymatches to value being checked in each if statement evaluation. Also we will create a break statement to final end the endless loop:

if ( entry == ‘Hello’ or entry == ‘hello' ) : print ( ‘Hello to you, how are you doing?’ ) elif ( entry == ‘Hi’ or entry == ‘hi’ ) : print ( ‘Hi, my name is Loki!’ ) elif ( entry == ‘Loki’ or entry == ‘loki’ ) : print ( ‘No, that is my name! Your name is’ , name ) elif ( entry == ‘Bye’ or entry == ‘bye’ ) : print ( ‘Nice talking to you, see you later!’ ) break else : print ( ‘Sorry, I do not understand this:’ , entry )

Step 4 (note, make sure ‘w’ from while (line 4) and ‘p’ from print are aligned before continuing): Outside the block from line 16, on line 17 we will write a message indicating this is the last line of code for the program using a print( ) keyword statement:

print ( ‘This is the end of the program!’ )

Step 5: Save your work as exercise3[ your last name ].pyand run your application. While it’s running type in your name and press enter. Type in various responses to get a response back. Type in bye to end the conversation. Your application should work like the screenshot below: