Computer Science, asked by pankajkumar7812, 10 months ago

Write a simple python program to take 2 inputs from the user and declare a tuple of them. Print it twice and print starting character's of all it's contents.


# The required output is as: Please input the first word
Please input the second word
Twice of the is ('E and ICT', 'Academy', 'E and ICT', 'Academy')
The first character of both parts of is as:
E and A​

Answers

Answered by akshayamca14
2

Answer:

print("Please input the first word")

userinput1=input();

print("Please input the second word")

userinput2=input();                

tup = userinput1, userinput2

for x in tup:

 print(x)

for x in tup:

 print(x)  

print(tup[1][0:1])  

print(tup[2][0:1])

Explanation:

Answered by poojan
34

Program:

Tuple = (input("Please input the first word "), input("Please input the second word "))

#Printing the tuple for twice.

print("Twice of the tuple is ", Tuple*2)

#Extracting the first letters of each name.

print("The first character of both parts of is as: ", Tuple[0][0],"  and ", Tuple[1][0])

Input:

Please input the first word  E and ICT

Please input the second word  Academy

Output:

Twice of the tuple is ('E and ICT', 'Academy', 'E and ICT', 'Academy')

The first character of both parts of is as:  E and A​

Note:

You can check the type of the literal Tuple, by using the type() method

type(Tuple)    

<class 'tuple'>

If you want to print the tuple twice as two different/separated ones, you can use the statement

print(Tuple, Tuple)

and it gives the output

('E and ICT', 'Academy')  ('E and ICT', 'Academy')

Learn more:

1. Write a simple python program to take input from user calculate it's the length and print it in abbreviation form with a full stop after each character. For example, if the user inputs his name as abc then the output produced have to be a . b . c . # The required output format is as- Please input your name your name is 3 characters long a . b . c .

https://brainly.in/question/16355159

2. Printing all the palindromes formed by a palindrome word.

brainly.in/question/19151384

Similar questions