Professional Documents
Culture Documents
Python Q
Python Q
1. Name: John
Age: 30
2. Name: Miky
Age: 26
Adress: Yangon
Id no: 123456
3. Create a variable named carname and assign the value Volvo to it and print value.
4. Create two variables named employeName and address and then assign the value Mike
and Yangon to it and print value.
5. Write a program to accept name and address from the user and then print value.
name=
address=input
print()
print()
6. Write a program to accept two numbers from the user and calculate multiplication
7. Display three string “Name”, “Is”, “James” as “Name**Is**James”
8. Accept any three string from one input() call. Write a program to take three names as
input from a user in the single input() function call.
Expected Output
Name1: Emma
Name2: Jessa
Name3: Kelly
9. Initial String:
GeeksForGeeks//Hello
First character of String is:
G
Last character of String is:
S
12. Create a variable named string1 from the user enter input string. And then print first
character and last character of this input.
13. Create a variable named my_name and assign the string value “Kyaw Kyaw” to it and
print reverse a string.
Output is : wayK wayK
14.
Deleting a character
17. Initial String:
Hello, I'm a Geek
Deleting character at 2nd Index:
Traceback (most recent call last):
File "e:\GFG\Python codes\Codes\demo.py", line 9, in <module>
del String1[2]
TypeError: 'str' object doesn't support item deletion
18. We will first slice the string up to the character that we want to delete and then
concatenate the remaining string next from the deleted character.
Initial String:
Hello, I'm a Geek
Deleting character at 2nd Index:
Helo, I'm a Geek
Python String Exercise with Solutions – String Programs for Practice (pynative.com)