Write a Python program that inputs a user's first and last name and prints them in reverse order with a space in between.For example, if the program inputs the first name "Joe" and the last name "Bakers," it should output:Bakers Joe
Question
Write a Python program that inputs a user's first and last name and prints them in reverse order with a space in between.For example, if the program inputs the first name "Joe" and the last name "Bakers," it should output:Bakers Joe
Solution
Claro, aquí tienes un programa que cumple con lo solicitado:
# Solicitar el nombre y apellido del usuario
first_name = input("Introduce tu nombre: ")
last_name = input("Introduce tu apellido: ")
# Imprimir el nombre y apellido en orden inverso
print(last_name + " " + first_name)
Este programa primero solicita al usuario que introduzca su nombre y apellido. Luego, imprime el apellido seguido del nombre, separados por un espacio.
Similar Questions
ou are given the firstname and lastname of a person on two different lines. Your task is to read them and print the following:Hello firstname lastname! You just delved into python.
python program to reverse a string
Given an input string s, reverse the order of the words.A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.Return a string of the words in reverse order concatenated by a single space.Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string should only have a single space separating the words. Do not include any extra spaces. Example 1:Input: s = "the sky is blue"Output: "blue is sky the"Example 2:Input: s = " hello world "Output: "world hello"Explanation: Your reversed string should not contain leading or trailing spaces.Example 3:Input: s = "a good example"Output: "example good a"Explanation: You need to reduce multiple spaces between two words to a single space in the reversed string. Constraints:1 <= s.length <= 104s contains English letters (upper-case and lower-case), digits, and spaces ' '.There is at least one word in s. Follow-up: If the string data type is mutable in your language, can you solve it in-place with O(1) extra space?
Write a program that takes a string of lowercase characters as input and prints it in uppercase, reversed.
Write a python program to take full name of 2 users separately(name 1 and name 2), and print the number of letters in name 1, then printname 2 number of times equal to the number of letters in name 1.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.