hgn330 💋🍓
Ir al canal en Telegram
Projects with source code | Android | java |website development | Website : https://updategadh.com Admin https://t.me/Rishabhsaini0204 New project https://www.youtube.com/c/decodeit2 Buy ads: https://telega.io/c/projectswithsourcecode
Mostrar más4 310
Suscriptores
Sin datos24 horas
-587 días
-28130 días
Archivo de publicaciones
4 310
https://updategadh.com/how-to/how-to-become-a-front-end-developer/
How to Become a Front-End Developer
how to become a front-end developer roadmap,
how to become a front-end developer without a degree,
front end developer salary,
front-end developer course,
back end developer,
front end developer jobs,
front-end developer skills required,
how to become a front end developer in 3 months,
how to become a front end developer with no experience,
how to become a front end developer without a,
4 310
https://updategadh.com/html/introduction-to-web-development/
introduction to web development pdf,
introduction to web development notes,
introduction to web development ppt,
introduction to web development course,
what is web development,
introduction to web development w3schools,
introduction to web development coursera,
introduction to web development with html, css, javascript coursera answers,
4 310
Project: College Management System in PHP with Free Source Code
Download College Management System in PHP Overview of the College Management System Features of the College Management System About the System How to Run the Projecthttps://updategadh.com/free-projects/college-management-system/ —————————————————————— college-management-system project in php github college management system project in php source code free download college management system project in php with source code college-management-system project in html with source code college management system free download college management system project with source code college management system project in php and mysql free download with source code college-management system project with source code github college management system in php with source code college management system in php pdf college management system in php example college management system project in html with source code
4 310
Online Clothing Store using PHP With Free Source Code
👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻
https://updategadh.com/free-projects/clothing-store-using-php/
4 310
Library Management System in C With Free Source Code
https://updategadh.com/free-projects/library-management-system-in-c/
4 310
These exercises cover basic function practices, working with function arguments, return values, lambda functions, and advanced lambda usage with functions like
map(), filter(), and reduce().
### 1. Basic Function Practice
#### a. is_even(): Check if a number is even
def is_even(number):
return number % 2 == 0
# Example usage:
print(is_even(4)) # Output: True
print(is_even(7)) # Output: False
#### b. factorial(): Calculate the factorial using a loop
def factorial(n):
result = 1
for i in range(2, n + 1):
result *= i
return result
# Example usage:
print(factorial(5)) # Output: 120
print(factorial(0)) # Output: 1
### 2. Function Arguments
#### a. greet_user(): Greeting with keyword arguments
def greet_user(first_name, last_name):
print(f"Hello, {first_name} {last_name}!")
# Example usage with keyword arguments:
greet_user(first_name="John", last_name="Doe")
# Output: Hello, John Doe!
#### b. calculate_area(): Calculate the area of a circle with a default argument
def calculate_area(radius, pi=3.14159):
return pi * radius * radius
# Example usage:
print(calculate_area(5)) # Output: 78.53975
print(calculate_area(5, 3.14)) # Output: 78.5 (using a different value of pi)
### 3. Working with Return Values
#### a. find_max(): Find the maximum value in a list
def find_max(numbers):
if not numbers:
return None
max_value = numbers[0]
for number in numbers:
if number > max_value:
max_value = number
return max_value
# Example usage:
print(find_max([1, 2, 3, 4, 5])) # Output: 5
print(find_max([-10, -20, -30])) # Output: -10
#### b. reverse_string(): Reverse a string
def reverse_string(s):
return s[::-1]
# Example usage:
print(reverse_string("hello")) # Output: "olleh"
print(reverse_string("world")) # Output: "dlrow"
### 4. Lambda Functions
#### a. List of squares using map()
squares = list(map(lambda x: x ** 2, range(1, 11)))
# Example usage:
print(squares) # Output: [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
#### b. Filter words shorter than 5 characters using filter()
words = ["apple", "banana", "pear", "kiwi", "grape"]
long_words = list(filter(lambda word: len(word) >= 5, words))
# Example usage:
print(long_words) # Output: ['apple', 'banana']
### 5. Advanced Lambda Usage
#### a. reduce(): Find the product of all elements in a list
from functools import reduce
numbers = [1, 2, 3, 4, 5]
product = reduce(lambda x, y: x * y, numbers)
# Example usage:
print(product) # Output: 120
#### b. Combine map() and filter(): Squares of even numbers from 1 to 20
squares_of_even_numbers = list(map(lambda x: x ** 2, filter(lambda x: x % 2 == 0, range(1, 21))))
# Example usage:
print(squares_of_even_numbers) # Output: [4, 16, 36, 64, 100, 144, 196, 256, 324, 400]4 310
Top 10 Spring Boot Projects You Must Try: Detailed Guide
👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻
https://updategadh.com/projects/collage-projects/top-10-spring-boot/
4 310
Here’s another coding quiz question for you:
Question: What will be the output of the following Java code?
public class Test {
public static void main(String[] args) {
int a = 5;
int b = 10;
System.out.println(a++ + --b);
System.out.println(a + " " + b);
}
}
Options:
a) 14 6 10
b) 14 6 9
c) 15 6 9
d) 14 5 10
Which option do you think is correct?4 310
Certainly! Here are some coding questions related to control structures, including conditional statements, loops, and list comprehensions.
### 1. Question: FizzBuzz Challenge
Write a Python program that prints the numbers from 1 to 50. For multiples of three, print "Fizz" instead of the number, and for the multiples of five, print "Buzz". For numbers that are multiples of both three and five, print "FizzBuzz".
#### Solution:
for num in range(1, 51):
if num % 3 == 0 and num % 5 == 0:
print("FizzBuzz")
elif num % 3 == 0:
print("Fizz")
elif num % 5 == 0:
print("Buzz")
else:
print(num)
### 2. Question: Calculate Factorial
Write a Python function to calculate the factorial of a number using a while loop.
#### Solution:
def factorial(n):
result = 1
while n > 0:
result *= n
n -= 1
return result
# Test the function
print(factorial(5)) # Output: 120
### 3. Question: List of Even Numbers
Using list comprehension, write a Python program that generates a list of even numbers between 1 and 100.
#### Solution:
even_numbers = [x for x in range(1, 101) if x % 2 == 0]
print(even_numbers)
### 4. Question: Grade Calculator
Write a Python program that takes a numerical score as input and prints the corresponding letter grade based on the following scale:
- A: 90-100
- B: 80-89
- C: 70-79
- D: 60-69
- F: Below 60
#### Solution:
def get_grade(score):
if score >= 90:
return "A"
elif score >= 80:
return "B"
elif score >= 70:
return "C"
elif score >= 60:
return "D"
else:
return "F"
# Test the function
score = 85
print(f"Score: {score}, Grade: {get_grade(score)}") # Output: Score: 85, Grade: B
### 5. Question: Sum of Digits
Write a Python program that takes a number and returns the sum of its digits. Use a while loop to achieve this.
#### Solution:
def sum_of_digits(num):
total = 0
while num > 0:
total += num % 10
num //= 10
return total
# Test the function
print(sum_of_digits(1234)) # Output: 10
### 6. Question: Multiplication Table
Write a Python program to print the multiplication table for a given number using a for loop.
#### Solution:
def multiplication_table(n):
for i in range(1, 11):
print(f"{n} x {i} = {n * i}")
# Test the function
multiplication_table(5)
Output:
5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 5 x 4 = 20 5 x 5 = 25 5 x 6 = 30 5 x 7 = 35 5 x 8 = 40 5 x 9 = 45 5 x 10 = 50### 7. Question: Filter Words by Length Write a Python program using list comprehension to filter a list of words and return only those that are longer than a given length. #### Solution:
words = ["apple", "banana", "cherry", "date", "elderberry", "fig", "grape"]
length = 5
filtered_words = [word for word in words if len(word) > length]
print(filtered_words) # Output: ['banana', 'cherry', 'elderberry']
### 8. Question: Check Prime Number
Write a Python program that checks whether a given number is prime. Use a for loop and conditional statements.
#### Solution:
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
# Test the function
print(is_prime(11)) # Output: True
print(is_prime(25)) # Output: False
### 9. Question: Find Common Elements
Write a Python program to find the common elements between two lists using list comprehension.
#### Solution:
list1 = [1, 2, 3, 4, 5]
list2 = [4, 5, 6, 7, 8]
common_elements = [x for x in list1 if x in list2]
print(common_elements) # Output: [4, 5]
### 10. Question: Reverse a String
Write a Python program to reverse a string using a for loop.
#### Solution:
def reverse_string(s):
reversed_s = ""
for char in s:
reversed_s = char + reversed_s
return reversed_s
# Test the function
print(reverse_string("hello")) # Output: "olleh"
---