Answers for "python exercises questions"

17

python beginner practice problems

1,000+ Python Practice Challenges // Edabit
go to : https://edabit.com/challenges/python3
Posted by: Guest on June-06-2020
10

python practice problems

Solve Python | HackerRank

Go to : https://www.hackerrank.com/domains/python
Posted by: Guest on April-09-2020
6

python exercises for beginners

# Let me know if there's any mistakes or errors as this is original :)

# This look a ton of effort to make and this is mainly for beginners to practice.
# Good luck and have fun!

'Predict the following output for the questions below.'

# Question 1:
num1 = 5
num2 = 6
print(sum(num1, num2))

# Question 2:
def f2(x, y):
  return ((y * 2) // y) - ((y - x) * y)
print(f1(1, 2))

# Question 3:
from math import floor

try:
  print(math.floor(3.31))
except:
  print(floor(33.1))

# Question 4:
my_list = [1, 2, 3, 4, 5]
print([my_list**2 for i in my_list if i % 2 == 0])

# Question 5:
for i in range(10):
  if i == 10:
    print('hit')
    break
else:
  print('no hit')
  
# Question 6:
stuff = [i for i in range(6)]
if not any(stuff):
  print('no stuff inside.')
else:
  print('there is stuff inside.')

# Question 7:
def f7(*num):
  return [i for x, i in enumerate(num) if x == 1]
print(f7(1, 2, 3, 4, 5)[0])

# Question 8:
print(True ** (True + True) - True + True == True)

# Question 9:
print( (lambda *x: sum(x))(2, 4, 6, 8) )

# <ANSWERS>
(1) 11
(2) 0
(3) 33
(4) my_list = [1, 4, 3, 16, 5]
(5) 'no hit'
(6) 'there is stuff inside'
(7) 2
(8) True OR 1
(9) 20
Posted by: Guest on July-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language