Question: Please answer ASAP I will upvote!! . Write a Python program (with comments) to do the following: a. Assign the value '30//6' to a variable
Please answer ASAP I will upvote!!

. 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 num1. 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
