Python Basic Exercises, Practice, Solution
Write a Python program to get the Python version you are using
Write a Python program to print the following string in a specific format
Write a Python program to display the current date and time
Write a Python program which accepts the radius of a circle from the user and compute the area.
Write a Python program to print first and last name in reverse order with a space between them
Write a python program to generate a list and tuple with comma-separated numbers
Write a Python program to accept a filename from the user and print the extension of that
Write a Python program to display the first and last colors from the following list
Write a Python program to display the examination schedule
Write a Python program that accepts an integer n and computes the value of n+nn+nnn
Write a Python program to print the calendar of a given month and year
Write a Python program to calculate number of days between two dates.
Write a Python program to get the volume of a sphere with radius 6
Write a Python program to test whether a number is within 100 of 1000 or 2000
Write a Python program to calculate the sum of three given numbers
Write a Python program to count the number 4 in a given list.
Write a Python program to test whether a passed letter is a vowel or not
Write a Python program that checks whether a specified value is contained within a group of values.
Write a Python program to create a histogram from a given list of integers.
Write a Python program that concatenates all elements in a list into a string and returns it.
Write a Python program that will accept the base and height of a triangle and compute its area.
Write a Python program that computes the greatest common divisor (GCD) of two positive integers.
Write a Python program to find the least common multiple (LCM) of two positive integers.
Write a Python program to add two objects if both objects are integers.
Write a Python program that displays your name, age, and address on three different lines.
Write a Python program to calculate the distance between the points (x1, y1) and (x2, y2).
Write a Python program to check whether a file exists.
Write a Python program to determine if a Python shell is executing in 32bit or 64bit mode on OS.
Write a Python program to get OS name, platform and release information.
Write a Python program to locate Python site packages.
Write a Python program that calls an external command.
Write a Python program to retrieve the path and name of the file currently being executed
Write a Python program to find out the number of CPUs used
Write a Python program to parse a string to float or integer.
Write a Python program to list all files in a directory.
Write a Python program to print without a newline or space.
Write a Python program to determine the profiling of Python programs.
Write a Python program to print to STDERR.
Write a Python program to access environment variables.
Write a Python program to get the current username.
Write a Python program to find local IP addresses using Python’s stdlib.
Write a Python program to get the height and width of the console window
Write a Python program to get the execution time of a Python method.
Write a Python program to sum the first n positive integers.
Write a Python program to convert height (in feet and inches) to centimeters.
Write a Python program to calculate the hypotenuse of a right angled triangle
Write a Python program to convert the distance (in feet) to inches, yards, and miles.
Write a Python program to convert all units of time into seconds.
Write a Python program to get an absolute file path
Write a Python program that retrieves the date and time of file creation and modification.
Write a Python program that converts seconds into days, hours, minutes, and seconds.
Write a Python program to calculate the body mass index.
Write a Python program to calculate sum of digits of a number.
Write a Python program to sort three integers without using conditional statements and loops.
Write a Python program to sort files by date.
Write a Python program to get a directory listing, sorted by creation date.
Write a Python program to get the details of the math module.
Write a Python program to calculate the midpoints of a line.
Write a Python program to hash a word.
Write a Python program to find the available built-in modules.
Write a Python program to get the size of an object in bytes.
Write a Python program to get the current value of the recursion limit.
Write a Python program to concatenate N strings.
Write a Python program to test whether all numbers in a list are greater than a certain number.
Write a Python program to count the number of occurrences of a specific character in a string.
Write a Python program to check whether a file path is a file or a directory.
Write a Python program to get the ASCII value of a character.
Write a Python program to get the size of a file.
Given variables x=30 and y=20, write a Python program to print “30+20=50”.
Write a Python program to create a copy of its own source code.
Write a Python program to swap two variables.
Write a Python program to define a string containing special characters in various forms.
Write a Python program to get the Identity, Type, and Value of an object.
Write a Python program to convert the bytes in a given string to a list of integers.
Write a Python program to check whether a string is numeric.
Write a Python program to print the current call stack.
Write a Python program to list the special variables used in the language.
Write a Python program to get system time.
Write a Python program to clear the screen or terminal.
Write a Python program to get the name of the host on which the routine is running.
Write a Python program to access and print a URL’s content to the console.
Write a Python program to get system command output.
Write a Python program to extract the filename from a given path.
Write a Python program to get the users environment
Write a Python program to divide a path by the extension separator.
Write a Python program to retrieve file properties.
Write a Python program to find the path to a file or directory when you encounter a path name.
Write a Python program to find the path to a file or directory when you encounter a path name
Write a Python program to get numbers divisible by fifteen from a list using an anonymous function.
Write a Python program to make file lists from the current directory using a wildcard.
Write a Python program to remove the first item from a specified list.
Write a Python program that inputs a number and generates an error message if it is not a number.
Write a Python program to filter positive numbers from a list.
Write a Python program to compute the product of a list of integers (without using a for loop).
Write a Python program to print Unicode characters.
Write a Python program to create a bytearray from a list.
Write a Python program to round a floating-point number to a specified number of decimal places.
Write a Python program to format a specified string and limit the length of a string.
Write a Python program to determine if a variable is defined or not.
Write a Python program to empty a variable without destroying it.
Write a Python program to determine the largest and smallest integers, longs, and floats.
Write a Python program to check whether multiple variables have the same value.
Write a Python program to sum all counts in a collection.
Write a Python program to get the actual module object for a given object.
Write a Python program to check whether an integer fits in 64 bits.
Write a Python program to check whether lowercase letters exist in a string.
Write a Python program to add leading zeroes to a string.
Write a Python program that uses double quotes to display strings.
Write a Python program to split a variable length string into variables.
Write a Python program to list the home directory without an absolute path.
Write a Python program to input two integers on a single line.
Write a Python program to print a variable without spaces between values.
Write a Python program to find files and skip directories in a given directory.
Write a Python program to extract a single key-value pair from a dictionary into variables.
Write a Python program to convert true to 1 and false to 0
Write a Python program to validate an IP address.
Write a Python program to convert an integer to binary that keeps leading zeros.
Write a python program to convert decimal to hexadecimal.
Write a Python program to check whether a variable is an integer or string.
Write a Python program to test if a variable is a list, tuple, or set.
Write a Python program to find the location of Python module sources.
Write a Python function to find the maximum and minimum numbers from a sequence of numbers