diff --git a/Challenge questions/faisalmaqsood/task1.py b/Challenge questions/faisalmaqsood/task1.py new file mode 100644 index 0000000..a7ed44c --- /dev/null +++ b/Challenge questions/faisalmaqsood/task1.py @@ -0,0 +1,19 @@ +def string_manipulation(word): + words = word.split() + first_conversion = " " + second_conversion = " " + + for i in words: + name = i.capitalize() + first_conversion += name + + for i in words: + name = i.lower() + second_conversion = second_conversion + " " + name + + print("word", word) + print("1st Conversion", first_conversion.strip()) + print("2nd Conversion", second_conversion.strip().capitalize()) + + +string_manipulation('My name is faisal') diff --git a/Challenge questions/faisalmaqsood/task4.py b/Challenge questions/faisalmaqsood/task4.py new file mode 100644 index 0000000..6372b8d --- /dev/null +++ b/Challenge questions/faisalmaqsood/task4.py @@ -0,0 +1,11 @@ +def read_csv(filename): + import csv + with open(filename, 'r') as csvFile: + reader = csv.reader(csvFile, delimiter=';') + for row in reader: + print(row) + break + csvFile.close() + + +read_csv('sample.csv') diff --git a/Challenge questions/faisalmaqsood/task5.py b/Challenge questions/faisalmaqsood/task5.py new file mode 100644 index 0000000..96875a7 --- /dev/null +++ b/Challenge questions/faisalmaqsood/task5.py @@ -0,0 +1,11 @@ +import re + +input = "45 >= 67 25==70 30 <= 78" +text = re.findall('(\d+\s?(<|=|>)=\s?\d+)', input) +output = "" +for i in text: + if eval(i[0]): + output += "1" + else: + output += "0" +print(output)