I currently studying Python coding and I can't wait to master it. I have two weeks now in and I'm doing some exercises. So that's why this question (and other's what I might ask in the future :D ) might be trivial for your.
So, the goal here's to ask first name and last name from the user. After that print first letter from the first name as many times there's characters in that name (Jack = 4*J) and last name in the reserved order (Dullname = emanlluD).
Well I nailed that part, but now I just can't find a resolution how do I print this all in the one line. Because first name comes from the list and the print is:
Give your first name: Jack
Give your last name: Dullname
J
J
J
J
emanlluD
when result should be Jack Dullname = JJJJ emanlluD.
firstname = str(input("Give your first name: "))
lastname = str(input("Give your last name: "))
for i in range(len(firstname)):
print(firstname[0])
def reverse(x):
return x[::-1]
output = reverse(lastname)
print(output)
The problem here is the For loop part. I now it should be function and result should be printed with second output, but I just can't figure out how .sort that result.
Thanks for the help!
Edit: Whoa! That was fast! I really appreciate all the answers! My training code is now working!