Python Programming Assignment 02
Python Programming Assignment 02
Example Input: Enter a string: python Enter an integer: 25 Enter a float: 3.14 Enter a boolean
(True/False): True
Example Output: Uppercase String: PYTHON The number 25 is Odd Doubled float: 6.28
Solution 01:
# Take user input in string format
input_string = input("Enter a string: ")
# Convert input_string into upper case by using upper() function
uppercase_string = input_string.upper()
# Print the ouput
print("Uppercase String:", uppercase_string)
Example Input: Enter the first number: 10 Enter the second number: 3
Solution 02:
# Take user input first number
first_number = int(input("Enter first number: "))
# Take user input second number
second_number = int(input("Enter second number: "))
Addition: 30
Subtraction: 10
Multilication: 200
Division: 2.0
Modulus: 0
Floor: 2
First number is greater than second number: True
First number is equal to second number: False
Both conditions are true: True
Question 3: Loops
Problem: Write a Python program that:
Solution 03:
# Take user input list of numbers
int_list = list(map(int, input("Enter a list of numbers separated by
spaces: ").split()))
else:
print(number)
# print after loops end
print("The loops ended naturally")
5
10
Skipping 10 12
Skipping 10 15
Breaking at 20
The loops ended naturally