# python – Books or resources for solving university programming questions

It’s my first semester as a CSE student. I have a course that teaches Python. I understand basics. But when it comes to solving questions like the ones shared, I literally can’t do anything. Is it from a lack of practice? or did I miss some kind of manual. Can anyone recommend me any book or website that teaches how to approach or solve these kinds of questions. I’m getting very demotivated from constant failure.

Don’t worry. These are questions from my previous quizes.

``````π€ππ²πππΆπΌπ» 1:
Write a python program that will run a loop until the user gives the input
βSTOPβ. Then based on the user inputs print the pattern as shown in the
examples. The output should be printed AFTER the END OF GIVING INPUT.
(You are not allowed to use String multiplication for this task)
================================

Sample Input 1:
a
b
c
d
STOP

Sample Output 1:
aaaa
bbb
cc
d

Explanation of Output 1:
Here use gives 4 inputs before βSTOPβ so the output consists of 4 lines.
The first input was βaβ so the program prints βaaaaβ in the first line. The
second input was βbβ so the program prints βbbbβ in the second line. The
third input was βcβ so the program prints βccβ in the third line. The
fourth input was βdβ so the program prints βdβ.
================================
Sample Input 2:
a
b
c
STOP

Sample Output 2:
aaa
bb
c

Explanation of Output 2:
Here use gives 3 inputs before βSTOPβ so the output consists of 3 lines.
The first input was βaβ so the program prints βaaaβ in the first line. The
second input was βbβ so the program prints βbbβ in the second line. The
third input was βcβ so the program prints βcβ in the third line.
``````
``````π€ππ²πππΆπΌπ» 2:
Take a word and a single character as user inputs. Print βYesβ if and only
if the word starts and ends with the character and the character is not
present anywhere in the rest of the word. Otherwise, print βNoβ.

(You are not allowed to use any built-in function including count() for
string except len(). Cannot use string slicing)
=============================================================
Sample Input 1:
hello
o
Sample Output 1:
No
Explanation 1:
=============================================================
Sample Input 2:
lol
l
Sample Output 2:
Yes
Explanation 2:
The word starts and ends with βlβ. Also, βlβ doesnβt appear anywhere in the
rest of the substring.
=============================================================
Sample Input 3:
astrazeneca
a
Sample Output 3:
No
Explanation 3:
The word starts and ends with βaβ but βaβ is present in the substring
βstrazenecβ.
``````