Task 5 -Variables and String
Create a new repo on your GitHub with the name (Task5) and Create a project on your PC and a file task5.py inside. Solve the questions below in task5.py Push your project into your remote repo Put the link of this repo here in classroom task5
Ask the user to input his (name, age, street, city, and country) (related to question 1) Print the output on the console, it should look like this: "Name: Lama" "Age: 20" "Address: 159, Gaza, Palestine"
-Note: Print the double quotes (“) and the Colon (:)
(related to question 1) Print the next output with dynamic data: "Hello {Lama} Your age is 15 Years Old, Your Address is 159, Gaza, Palestine." -hint: (age - 5)
(related to question 1) Print the type of the above 5 variables: <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'>
(related to question 1) Print the next output with dynamic data:
"Hello Lama, How Are You? \ """ Your Age Is "15"" + And Your Country Is: Palestine
-Note: You Must Print the above string Exactly with all symbols (“ ‘, ? \ “”” + : )
نسخ الكود
Print the same previous output (in question 5 ) but with a multi-line string.
"Hello 'Lama', How Are You?
""" Your Age Is "15"" + And
Your City Is: Gaza
Create a variable( name = 'ITF Gsg Python') and print the next output:
First Letter Is "I" Third Letter Is "F" Last Letter Is "n" نسخ الكود-hint: use indexing.
(related to question 7) Print the next output:
hon ITF IFGg nohtyP نسخ الكود-hint: use slicing.
Remove the symbols (before and after) the name: name = "$&$&Mohammed$&$&"
Output should be:
Mohammed
Create a variable with the next value, Replace all matches of the symbol (%7) with the (Love) word.
msg = "I %7 Python And Although I %7 GSG with Zakaria"
############Needed To be Output
I Love Python And Although I Love GSG with Zakaria
Create 6 variables with the next values, and print the next output:
num1 = "4" num2 = "56" num3 = "963" num4 = "385" num5 = "8719" num6 = "87190"
Needed To be Output
00004 00056 00963 00385 87190 What is the difference between (title) and (capitalize) methods in Python string methods? (give me 2 examples to clarify the point)
Create a variable with your name value, and print the next output:
first_name = "Dana"
***Dana ***Dana*** Dana***
Create 2 variables with the next values, and print the next output: name_one = "SaMER" name_two = "Abed"
sAmer aBED samer ABED
(related to question 14) How can we Check if name_one contains Only Upper Case letters, and name_two contains Only Lower Case letters?
Bonus (+2 Marks) (related to question 14) How can we Check if name_one starts with (S) letters or Not ? and name_two ends with (HD) letters or Not? Create a variable with the next value, and print how many times (Love) word and the letter (t) within the string: msg = "I Love Python And Although I Love GSG with Zakaria"
Number of is: 2 Number of is:3
Create a variable with the next value, and replace Only the first match of the symbol (%7) with the (Love) word: msg = "I %7 Python And Although I %7 GSG with Zakaria"
I Love Python And Although I %7 GSG with Zakaria
Given a string. check if the string is symmetrical and palindrome or not. A string is said to be symmetrical if both the halves of the string are the same and a string is said to be a palindrome string if one half of the string is the reverse of the other half or if a string appears the same when read forward or backward. Hint: Ignore the spaces, dots, or commas in the string. test1 = "ZakZak" test2 = "Zakaria" test3 = "A war at Tarawa." test4 = "madam"
ZakZak is symmetrical, but ZakZak is NOT a palindrome. ################################ Zakaria is NOT symmetrical, and Zakaria is NOT a palindrome. ################################