Computer Science, asked by shreyanshak47, 9 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.

Answers

Answered by poojan
0

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