# 6 Python Exercise Problems for Beginners – from CodingBat (Python Tutorial #14)

///6 Python Exercise Problems for Beginners – from CodingBat (Python Tutorial #14)

## 6 Python Exercise Problems for Beginners – from CodingBat (Python Tutorial #14)

6 Python exercise problems for beginners. Let’s go!
Also, Python book recommendations / what projects to work on:

Find me on Instagram:

Resources I mentioned in this video:
CodingBat:
Python 2 vs 3:
Project Euler:
Python book recommendations / what projects to work on:

source

By |2020-08-10T08:49:45+00:00August 10th, 2020|Python Video Tutorials|32 Comments

1. CS Dojo August 10, 2020 at 8:49 am - Reply

Here’s my other video about what Python projects to work on: https://youtu.be/-1j0_SVaAJM
Also, some timestamps:
1:30: Problem 1
4:54: Problem 2
7:10: Problem 3
8:36: Problem 4
11:49: Problem 5
16:18: Problem 6
Oh btw, I recently set up a subreddit for you guys for asking each other any programming-related questions. Feel free to use it any way you’d like: https://www.reddit.com/r/csdojo/

2. def count_even(set_s):

total_r = 0

for i in set_s:

if i % 2 == 0:

total_r += 1

i += 1

3. Mb_3s August 10, 2020 at 8:49 am - Reply

18:24 i found another solution !
def count_evens(nums):
result = 0
for i in nums :
n = (i – 2)/2
n= round(n)
if i == 2*n + 2 :
result += 1
return result
# it works 100%

what is difference between return anf print?

5. Vinayak M August 10, 2020 at 8:49 am - Reply

I am big fan

6. Vinayak M August 10, 2020 at 8:49 am - Reply

Hi

hello YK can we test palindrome number in python

8. MUSIC LIFE August 10, 2020 at 8:49 am - Reply

how to print if shows the input is error
sir

9. Shilpa Sarkar August 10, 2020 at 8:49 am - Reply

Need ur assistance. Without knowing basics of algorithm i cannot learn python
Basics of algorithm and data structure lectures can u make it or could u plzzz share any book so that I can go through and really want to develop applications with python or whatever skills required
I have really lessss time in hand but want to do be success in coding
I'm suffering from a disease which I dnt wanna reveal so mentions( less time)

Plz brother need ur assistance

10. Drew G August 10, 2020 at 8:49 am - Reply

That codingbat site is far too difficult for beginners.

11. bennykasdfora3 ora3 August 10, 2020 at 8:49 am - Reply

ok

12. Jean Jacques August 10, 2020 at 8:49 am - Reply

#Exercise 1
def sleep_in(weekday, vacation):
return not weekday or vacation
#Exercise 2
def string_times(str, n):
return str*n
#Exercise 3
def hello_name(name):
return f"Hello, {name}."
#Exercise 4
def first_last6(list):
return list[0] == 6 or list[len(list) -1] == 6
#Exercise 5
def double_car(string, n):
new_string = ''
for c in string:
new_string += c * n
return new_string

#Exercise 6
def count_evens(list):
count = 0
for j in list:
if j % 2 == 0:
count += 1
return count

13. SK HASIBUR RAHAMAN August 10, 2020 at 8:49 am - Reply

If possible solve this
Magic constant generator:
Write the function definition for the generator named 'generator_Magic', which takes a single parameter 'n1'.
Define the above Generator such that it should yield the Magic constant (s) for the values starting from 3 to 'n1'.

For the sleep_in problem, couldn't you put !weekday instead of not weekday? Or am I wrong…?

15. KRATI SHARMA August 10, 2020 at 8:49 am - Reply

thaankkk youuuu!!!!!! 🙂 <3

16. S Watson August 10, 2020 at 8:49 am - Reply

It's the best video for beginers I have ever seen.

17. Md Mojammal August 10, 2020 at 8:49 am - Reply

Boss you are very brilliant…. Next time more video…

18. UNKNOWN USER 31 August 10, 2020 at 8:49 am - Reply

At 12.30
Is this is correct

a="abc"
for i in a:
print(i*2)

19. christian Isika August 10, 2020 at 8:49 am - Reply

Is this the last video of the series please?

20. Al Alo August 10, 2020 at 8:49 am - Reply

Thank you from the bottom of my heart.

21. Younes El Hachi August 10, 2020 at 8:49 am - Reply

#For the last exercise:
def even_count(nums):
return len(nums) – sum([x%2 for x in nums])

22. Rajat Gupta August 10, 2020 at 8:49 am - Reply

# Don't know whay i am obsessed with .append() haha
def even_count(lst):

mylist = []

for item in lst:

if item%2 == 0:

mylist.append(item)

return len(mylist)

23. Rajat Gupta August 10, 2020 at 8:49 am - Reply

# I had this in mind first, just a begineer right now
def double_char(strng):

mylist = []

for letter in strng:

letter = letter*2

mylist.append(letter)

return "".join(mylist)

24. Aaron Daly August 10, 2020 at 8:49 am - Reply

For problem #4, @ 8.36, I have an issue.
No matter which numbers I enter in nums,
The function always returns True, in all cases.
def first_last_6(nums):

if nums[0] or nums[-1] == 6:

return True

else:

return False

25. inFaze August 10, 2020 at 8:49 am - Reply

nobody:
hihihihihihihihhi

26. Answering with Python August 10, 2020 at 8:49 am - Reply

hey this is the same type of thing i am doing on my youtube channel.

27. Raiyan Ahmed August 10, 2020 at 8:49 am - Reply

You should try hackerrank also

28. Dan The Man August 10, 2020 at 8:49 am - Reply

ok I know this is just basics but, I really didn't understand the last one

29. We the VLOGGERS August 10, 2020 at 8:49 am - Reply

@CS Dojo i think the problems at coding bat are way easy. Don't you think?

30. Thee Greatest Ever August 10, 2020 at 8:49 am - Reply

First Day As Python coder and loving these

31. J Khan August 10, 2020 at 8:49 am - Reply

This codingbat.com sucks on mobile version.