Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how can i do this in python please answer all the 5 questions :( 2. Use string methods to remove all the spaces from the

how can i do this in python please answer all the 5 questions :(
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
2. Use string methods to remove all the spaces from the following string and print out the result: 3. Write Python code that prompts the user for their first and last names, and then welcomes them by their first name (only use string methods ). For example, Please enter your first and last nane: ja Hello, Jane. Now print the user's name starting with last name first, and first name last, with a comma and a space in between the first and last name, and the first letter of their names capitalized. For example, The user's name is: Smith, Jane 4. Write Python code that prompts the user to enter a telephone number in the form ( xxx)xxxxxxx and then reformats it and prints it out in the form XXX.XXX.XXXX. 4. Write Python code that prompts the user to enter a telephone number in the form (xxx)xxxxxxx and then reformats it and prints it out in the form xxx.xxx.xxxx. For example: Enter a phone number [(xxx)xxxxxxx]: : 3 The reformatted phone number is: 305.867.5309 5. Using the statement: Economics, the delightful elaboration of the Only use the print function and string methods (no for or while loops, or if statements) to answer the following: a. Store the statement in a variable, then using the print function print out the statement. b. Write code that counts, and prints out, the number of characters in the statement, excluding blank spaces. c. Using the variable from part (a), print the statement with the first and last letters exchanged, making sure the 'new' first letter is in upper case. Careful, the exclamation point is not a letter. d. Print the statement from part (a) with every other character removed, making sure the 'new' first character is in upper case. 7:13 .1I 5G Using the statement: Economics, the delightful elaboration of the Only use the print function and string methods (no for or while loops, or if statements) to answer the following: a. Store the statement in a variable, then using the function print out the statement. b. Write code that counts, and prints out, the number of characters in the statement, excluding blank spaces. c. Using the variable from part (a), print the statement with the first and last letters exchanged, making sure the 'new' first letter is in upper case. Careful, the exclamation point is not a letter. d. Print the statement from part (a) with every other character removed, making sure the 'new' first character is in upper case. e. Print the statement from part (a) in reverse, making sure the 'new' first letter is in upper case. Again, careful with the exclamation point. f. Print the statement from part (a) but replace the word 'delightful' with 'painful' without changing the original variable. g. Write code that counts, and prints out, the number of words in the statement from part (f). courses.alrodrig.com 6. Most websites where you have to log-in as a user require you to create a password. These passwords have certain restrictions. Write code that generates a random password with the following restrictions: - password must be longer than 6 characters but no longer than 18 characters; - password must have at least one lower-case letter, one upper-case letter, one number, and one special character; - finally, the password must begin with a number and end with an upper case letter; Hint: using the random Python standard library (import random) will help. Only use strings, string methods, f-string formatting, the random module, and the print function (no for or while loops, or if statements, or other modules) to answer this

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

How is Scrum used?

Answered: 1 week ago