Skip to content

Instantly share code, notes, and snippets.

View thambaru's full-sized avatar
🏠
Working from home

Thambaru Wijesekara thambaru

🏠
Working from home
View GitHub Profile
@thambaru
thambaru / twinkleTwinkle.py
Created December 27, 2023 04:42
Python program to print "Twinkle Twinkle Little Star" in a specific format
# 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.
@thambaru
thambaru / areaByRadius.py
Created December 28, 2023 15:19
Python program that calculates the area of a circle based on the radius entered by the user.
# 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