Question

for python-3 I want to prompt the user to enter their first name and then Call...

for python-3

I want to prompt the user to enter their first name and then Call the is_field_blank function to see if nothing was entered.and If nothing was entered i want it to display the following message "First Name must be Entered" and then re-prompt the user to enter the first name. I want it to do this repeatedly until the user enters a first name.

this is what i have so far


def main():
    yourFirst = input("What is your first name? ")
    is_feild_blank(yourFirst)


def is_feild_blank(yourFirst):
    if yourFirst == "":
        print("First Name must be Entered")
      

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def is_field_blank(s):
    if(len(s)==0):
        return True
    else:
        return False

def main():
    fn = input("Enter your first name: ")
    while(is_field_blank(fn)):
        print("First Name must be Entered")
        fn = input("Enter your first name: ")

main()

Add a comment
Know the answer?
Add Answer to:
for python-3 I want to prompt the user to enter their first name and then Call...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Python script in that will prompt the user to enter a string. After the...

    Write a Python script in that will prompt the user to enter a string. After the user enters their string print its length and the ordinal value of the first, third, and seventh character. Assume the input will be of sufficient length. Use "nice" input and output

  • Create a Python list (use first three letters of your name followed by the letter L...

    Create a Python list (use first three letters of your name followed by the letter L as the name of the list.) with the following data: 10, 20.0, 50.00, 7000, 7500, 7700, 7800, 8000, 9000, ‘python’. Display the entire list with an appropriate message. Display the 4th element in the list with an appropriate message. Display the first 3 values of the list only. Display all the values starting from the sixth element to the end of the list. Change...

  • Complete the Python program below that performs the following operations. First prompt the user to input...

    Complete the Python program below that performs the following operations. First prompt the user to input two integers, n and m. If n<m, then print the odd positive integers that are less than m (in order, on a single line, separated by spaces). If man, then print the even positive integers that are less than n (in order, on a single line, separated by spaces). If neem, then print nothing. For instance, if the user enters 5 followed by 10,...

  • Python Error: Writing a program to complete the following: Prompt the user for the name of...

    Python Error: Writing a program to complete the following: Prompt the user for the name of an input file. Open that file for input. (reading) Read the file using a "for line in a file" loop For each line,  o print the line and compute and print the average word length for that line. Close the input file Sample output: MY CODE IS WRONG AND NEED HELP CORRECTING IT!!! ------------------------------------------------------------------------------------------------------------------------ DESIRED OUTPUT: Enter input file name: Seasons.txt Thirty days hath September...

  • PYTHON CODING Create a program that prompts the user twice. The first prompt should ask for...

    PYTHON CODING Create a program that prompts the user twice. The first prompt should ask for the user's most challenging course at Wilmington University. The second prompt should ask for the user's second most challenging course. The red boxes indicate the input from the user. Your program should respond with two copies of an enthusiastic comment about both courses. Be sure to include the input provided by the user to display the message. There are many ways to display a...

  • Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anythi...

    Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anything. No code outside of a function! Median List Traversal and Exception Handling Create a menu-driven program that will accept a collection of non-negative integers from the keyboard, calculate the mean and median values and display those values on the screen. Your menu should have 6 options 50% below 50% above Add a number to the list/array...

  • 3,4,5,6,7,8 please 1. Enter the code to prompt a user to enter their name into a...

    3,4,5,6,7,8 please 1. Enter the code to prompt a user to enter their name into a script and save to name. imputl name) 2. Enter the code to display their name to the command window using "disp" function. 3. Enter the code to display their name using the "fprintf" function ame 4. What is the main difference between the "disp and "fprintf" commands? on 5. What is the main difference between the "fprintf" and "sprintf" commands? 6. What is a...

  • Write a "PYTHON" program to prompt the user to enter a fist name, last name, student...

    Write a "PYTHON" program to prompt the user to enter a fist name, last name, student ID and GPA. Create a dictionary with the data. Print out the data. Then remove the GPA and print again.

  • In python Prompt user to input the number of the month they were born. Using a...

    In python Prompt user to input the number of the month they were born. Using a while loop, continue prompting for the month until the user inputs a valid month number. Figure out the number of days in the month the user entered. Then prompt the user to input the day they were born. Using a while loop, continue prompting until they input a day that is within the range of the number of days in their month. Assume 28...

  • in Python: Write a program that allows the user to enter a number between 1-5 and...

    in Python: Write a program that allows the user to enter a number between 1-5 and returns an animal fact based on what the user entered. The program should 1. Continue to run until the user enters “quit” to terminate the program, and 2. Validate the user’s input (the only acceptable input is 1, 2, 3, 4, 5 or “quit”). You can use the following animal facts: An octopus is a highly intelligent invertebrate and a master of disguise. Elephants...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT