PY101-CH004- Hello World

Introduction to Simple Integers

Simple Integers: Examples

Exercise - Simple Integers

# Exercise1: Following are the scores of three players in a match

#

# Player1: 75

# Player2: 80

# Player3: 60

#

# Write a program that prints:

# a. The total score of three players

# b. The average score of three players


#

# Exercise2: There is a bag having balls of different colors, as mentioned below

#

# Black Balls: 5

# White Balls: 3

# Green Balls: 2

#

# Only one ball is selected from the bag at random. Write a program that calculates the probability of

# a. A black ball gets selected

# b. A White ball gets selected

# c. A Green ball gets selected

It is strongly recommended to solve these questions before moving to the next video.


Solutions to the Exercises

Exercise 1

Exercise 2

Advanced Integers

Exercise - Advanced Integers

# Exercise 1: Write a program to swap the value of two integer variables.


# Exercise 2: Write a program to swap the value of two integer variables without using

# any third variable.

It is strongly recommended to solve these questions before moving to the next video.


Advanced Integers Exercise 1

Advanced Integers Exercise 2