Answers for "fun python exercises"

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 function exercises

Exercise 1: Create a function that can accept two arguments name and 
  age and print its value
Exercise 2: Write a function func1() such that it can accept a variable 
  length of  argument and print all arguments value
Exercise 3: Write a function calculation() such that it can accept two 
  variables and calculate the addition and subtraction of them. And a
  lso it must return both addition and subtraction in a single return 
  call
Exercise 4: Create a function showEmployee() in such a way that it 
  should accept employee name, and its salary and display both. 
  If the salary is missing in the function call assign default value 
  9000 to salary
Exercise 5: Create an inner function to calculate the addition in the 
  following way
Exercise 6: Write a recursive function to calculate the sum of numbers 
  from 0 to 10
Exercise 7: Assign a different name to function and call it through the 
  new name
Exercise 8: Generate a Python list of all the even numbers between 4 to 
  30
Exercise 9: Return the largest item from the given list
  
⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️ GOTO URL FOR PRACTICE ⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️
https://pynative.com/python-functions-exercise-with-solutions/
Posted by: Guest on April-08-2021
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