This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python exercise: https://www.w3resource.com/python-exercises/python-basic-exercises.php | |
# | |
# 4. Write a Python program that calculates the area of a circle based on the radius entered by the user. | |
# | |
# Some online compilers do not allow importing sys. | |
# Remove the following line in such case, and set sysIsAvailable to False. | |
from sys import exit | |
isSysAvailable = True | |
from math import pi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python exercise: https://www.w3resource.com/python-exercises/python-basic-exercises.php | |
# | |
# Write a Python program to print the following string in a specific format (see the output). | |
# Sample String : "Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what you are" | |
# Output : | |
# | |
# Twinkle, twinkle, little star, | |
# How I wonder what you are! | |
# Up above the world so high, | |
# Like a diamond in the sky. |