Programming Funda

Programming Funda

Share

Programming Funda is an educational site that provides content on many programming languages to all p

Python While Loop Questions and Answers ( September, 2024 ) 29/09/2024

25+ Python While Loop Questions and Answers:

1. Simple Countdown
Write a Python program that counts from 10 to 1 and print each number with the help of the while loop.

count = 10
while count > 0:
print(count)
count -= 1
print("Blast off!")

2. The sum of Positive Numbers

Create a Python while loop program that continuously asks the user for a positive number and keeps a running total. The loop must stop when the user enters a negative number.

total = 0
while True:
number = float(input("Enter a positive number (or a negative number to stop): "))
if number < 0:
break
total += number
print("Total sum of positive numbers:", total)

3. Password Validation

correct_password = "ProgrammingFunda@1"
user_input = ""

while user_input != correct_password:
user_input = input("Enter the password: ")
print("Access granted!")

4. Fibonacci Sequence

The Fibonacci Sequence in Python is one of the most asked questions during the Python interviews. I faced this question so many times in Python interviews.

Fibonacci Sequence:- The Fibonacci Sequence is a sequence of some numbers where one is the sum of two preceding numbers like 0, 1, 1, 2, 3, etc

Let’s write a Python code to generate the Fibonacci series in Python.

num = int(input("Enter a number:- "))

if num > 0:
i = 0
a = 0
b = 1
while i < num:
print(a, end=' ')
a, b = b, a + b
i = i + 1

Learn more about :- https://www.programmingfunda.com/python-while-loop-questions-and-answers/

💯Follow Programming Funda for more Python's content.

Thanks

Python While Loop Questions and Answers ( September, 2024 ) Hi, In this article we are about to explore Python while loop questions and answers with the help of the examples.

30/08/2024

If you are a data analyst or a data engineer, Then you must have knowledge of Pandas data selection. Pandas provide two ways to select data from DataFrame.

In this article, I have explained all about Pandas loc and iloc along with proper examples.

👉 Click Here to learn:- https://www.programmingfunda.com/loc-and-iloc-in-pandas/

PySpark RDD Actions with Examples » Programming Funda 16/03/2024

PySpark RDD Actions with Examples ✅

===========================

What are PySpark RDD Actions?

PySpark RDD actions trigger the ex*****on of computations on the RDDs and return values to the driver program or write data to an external storage system.

PySpark RDD count():-

from pyspark.sql import SparkSession

spark = (

SparkSession.builder.appName("ProgrammingFunda.com")

.master("local[*]")

.getOrCreate()

)

sc = spark.sparkContext

key_value_dataset = [

("Math", 40),

("Physics", 71),

("Math", 60),

("English", 80),

("Chemistry", 75),

("English", 65),

("Physics", 62),

("Chemistry", 55),

("Social Science", 75),

("Math", 73),

]

rdd = sc.parallelize(key_value_dataset, 3)

print(rdd.count())

-------------------------------------------------

PySpark RDD first():-

from pyspark.sql import SparkSession

spark = (

SparkSession.builder.appName("ProgrammingFunda.com")

.master("local[*]")

.getOrCreate()

)

sc = spark.sparkContext

key_value_dataset = [

("Math", 40),

("Physics", 71),

("Math", 60),

("English", 80),

("Chemistry", 75),

("English", 65),

("Physics", 62),

("Chemistry", 55),

("Social Science", 75),

("Math", 73),

]

rdd = sc.parallelize(key_value_dataset, 3)

print(rdd.first())

=================================

💯Follow Programming Funda for more free Data analysis content.

👉 Visit here for more information: https://www.programmingfunda.com/pyspark-rdd-actions-with-examples/

PySpark RDD Actions with Examples » Programming Funda In today's article, we will see PySpark RDD Actions and all useful PySpark RDD Actions methods with the help of examples.

PySpark RDD ( Resilient Distributed Datasets ) Tutorial 25/02/2024

PySpark RDD ( Resilient Distributed Datasets ) Tutorial:

💯Follow Programming Funda for more free Data analysis content.
👉 Visit here for more content:- https://www.programmingfunda.com/pyspark-rdd-tutorial/

PySpark RDD ( Resilient Distributed Datasets ) Tutorial Hi, In this tutorial, you will learn everything about the PySpark RDD ( Resilient Distributed Datasets ) with the help of the examples. By the end of this

How to Format a String in PySpark DataFrame using Column Values 24/02/2024

How to Format a String in PySpark DataFrame using Column Values

💯Follow Programming Funda for more free Data analysis content.

👉 Visit here for more content:- https://www.programmingfunda.com/how-to-format-a-string-in-pyspark-dataframe-using-column-values/

How to Format a String in PySpark DataFrame using Column Values In this PySpark article, we will see how to format a string in PySpark DataFrame using column values with the help of an example. PySpark provides a string

How to Explode Multiple Columns in Pandas 14/01/2024

Read this complete tutorial to explode single or multiple columns in Pandas DataFrame.

How to Explode Multiple Columns in Pandas In this article, we will see How to explode multiple columns in Pandas with the help of the example. The explode() method is the Pandas DataFrame method that

Want your business to be the top-listed Computer & Electronics Service in Noida?
Click here to claim your Sponsored Listing.

Address


Noida
201301