Question

In: Computer Science

using python 3 1. Two-line input: print a prompt (e.g Enter your first name) and then...

using python 3

1. Two-line input: print a prompt (e.g Enter your first name) and then assign the input to a variable

print ("Enter your first name")# the word prompt is the message the user should see

firstName = input()

print (firstName)

Solutions

Expert Solution

Below are the code for two line input and one line input.

if __name__ == '__main__':

    # Below is the example of two line input:
    print("Enter your first name : ") # Message to user for entering input
    firstName = input() # system input and assign to the variable
    print(firstName) # print the output

    # Below is the example of one line input:
    firstName = input("Enter your first name : ")  # system input and assign to the variable
    print(firstName)  # print the output


Related Solutions

Write a C++ Program to print the first letter of your first and last name using...
Write a C++ Program to print the first letter of your first and last name using stars. Note: 1) Using nested For Loop 2) The number of lines is given by user. 3) Using one Outer loop to print your letters. 4) Print the letters beside each other.
PYTHON 1- First, initialize the constant NUMS as 3: NUMS=3 2- Print the title of the...
PYTHON 1- First, initialize the constant NUMS as 3: NUMS=3 2- Print the title of the application. >---=== Python Temperature Analyzer ===---< 3- Using a for loop, prompt the user to enter the high and low values for each of NUMS days. The values entered must be between -40 and 40, and high must be greater than low. Print the following messages: > * Read the high value. > Enter the high value for day 1: < (or day 2,...
*******************In Python please******************* (1) Prompt the user to enter a string of their choosing. Store the...
*******************In Python please******************* (1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt) Enter a sample text: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes; more volunteers, more civilians, more teachers in space. nothing ends here; our hopes and our journeys continue! You entered: we'll continue our quest in space. there will be more shuttle flights and more...
Answer using Jupyter Python #Prompt the user to enter a passing grade and store the value...
Answer using Jupyter Python #Prompt the user to enter a passing grade and store the value from #the input() into a variable. #Refer to the variable in problem 2 to complete the following: #Use the if statement to evaluate the only the first element in the #grades list using index notation. #If the grade is passing, display PASSED, otherwise display FAILED. """Problem 1d""" #Use the for statement to iterate on each element in the #grades list (from problem 1a) and...
Answer using Jupyter Python #Prompt the user to enter a passing grade and store the value...
Answer using Jupyter Python #Prompt the user to enter a passing grade and store the value from #the input() into a variable. #Refer to the variable in problem 2 to complete the following: #Use the if statement to evaluate the only the first element in the #grades list using index notation. #If the grade is passing, display PASSED, otherwise display FAILED. """Problem 1d""" #Use the for statement to iterate on each element in the #grades list (from problem 1a) and...
Write a Python program that has the user enter their name.   Using the user's name calculate...
Write a Python program that has the user enter their name.   Using the user's name calculate the following: 1. How many letters are in the user's name? 2. Print the user's name in REVERSE both in capital letters and lowercase letters 3. Print the ASCII value for each letter of the user's name. 4. Print the SUM of all of the letters of the user's name (add each letter from #3)
8.30 LAB*: Program: Authoring assistant. PYTHON PLEASE!! (1) Prompt the user to enter a string of...
8.30 LAB*: Program: Authoring assistant. PYTHON PLEASE!! (1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt) Ex: Enter a sample text: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes; more volunteers, more civilians, more teachers in space. nothing ends here; our hopes and our journeys continue! You entered: we'll continue our quest in space. there will be...
Create a table with two columns. Name the table First Initial _ Last Name (e.g. John...
Create a table with two columns. Name the table First Initial _ Last Name (e.g. John Dow will create table j_dow). You have to audit all DML statements on your table. To do this you write two triggers: 1. To log any DML statements that users might run on this table. The results must be stored in the First Initial _ Last Name _ Log table (e.g. John Dow will create table j_dow_log). The table should have unique event ID,...
Using Python Question 1 Write an input function. Then use it to supply the input to...
Using Python Question 1 Write an input function. Then use it to supply the input to following additional functions: i) Print multiplication table of the number from 1 to 12. ii) Print the sum of all the numbers from 1 to up the number given. iii) Print if the number supplied is odd or even. Question 2 Write function that asks for input from a user. If the user types 'end', the program exits, otherwise it just keeps going.
print("1. Change Team: ") print("2. Choose Position") print("3. Quit") imp = input("Choose an option: ") if...
print("1. Change Team: ") print("2. Choose Position") print("3. Quit") imp = input("Choose an option: ") if imp == 1: chooseTeam() elif imp == 2: choosePosition() elif imp == 3: print("Goodbye") else: print("Invalid option") imp2 = input("Choose an option (1-3): ") This is my current code however I want it to loop back up to the top if an invalid option is input so it can reset the function
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT