Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLZ answer asap I will upvote! COMP 2067 Lab 3 OBJECTIVES: i. To explore str data types and its built-in methods in detail ii. To

PLZ answer asap I will upvote!

image text in transcribed

COMP 2067 Lab 3 OBJECTIVES: i. To explore str data types and its built-in methods in detail ii. To accept user input entered through the keyboard 1. Write a Python program (with comments) to do the following: a. Assign the value '30//6' to a variable str1. b. Use the eval() function to evaluate strland assign the result to a variable numl. Print numl with a suitable message. c. Ask the user to input their favorite city in lowercase and save the response in a variable city. Print city with a suitable message. d. Determine the first letter of city assign it to a variable x and display it with a suitable message. e. Determine the ASCII code for the first letter of city and display it with a suitable message. HINT: Use the built-in ord() function. See pg. 78-79 of textbook. f. Determine how many times x (i.e. 1st letter of city) occurs in city and display the result with a suitable message. g. Print the first 4 letters of city in uppercase. The letters should be centered in a string of length 30, with "*' as the fill character for the remaining positions. HINT: Use built-in str.center() method. 2. Save your code to a file with name lab3sol.py. 3. Submit your Python code (i.e. lab3sol.py file) through BB

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

7. Where Do We Begin?

Answered: 1 week ago

Question

a. What is the purpose of the team?

Answered: 1 week ago