0% found this document useful (0 votes)
94 views2 pages

Assignment

The document contains instructions for writing Python programs to perform various tasks like calculating area of a circle, reversing names, checking if a number is within a range, counting characters in a string, and more. It provides sample inputs and outputs for each task.

Uploaded by

Luke Robinson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views2 pages

Assignment

The document contains instructions for writing Python programs to perform various tasks like calculating area of a circle, reversing names, checking if a number is within a range, counting characters in a string, and more. It provides sample inputs and outputs for each task.

Uploaded by

Luke Robinson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

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.
Twinkle, twinkle, little star,
How I wonder what you are

Write a Python program which accepts the radius of a circle from the user and
compute the area.
Sample Output :
r = 1.1
Area = 3.8013271108436504

Write a Python program which accepts the user's first and last name and print them
in reverse order with a space between them

Write a Python program to accept a filename from the user and print the extension
of that.
Sample filename : abc.java
Output : java

Write a Python program to display the first and last colors from the following
list.
color_list = ["Red","Green","White" ,"Black"]

Write a Python program to display the examination schedule. (extract the date from
exam_st_date).
exam_st_date = (11, 12, 2014)
Sample Output : The examination will start from : 11 / 12 / 2014

Write a Python program to test whether a number is within 100 of 1000 or 2000

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 to sum of two given integers. However, if the sum is
between 15 to 20 it will return 20.

Write a Python program to convert seconds to day, hour, minutes and seconds.

Given variables x=30 and y=20, write a Python program to print t "30+20=50".

Write a Python program to check if a string is numeric

Python Program to Swap Two Variables

Python Program to Check Leap Year

Write a Python program to calculate the length of a string

Write a Python program to count the number of characters (character frequency) in


a string.
Sample String : google.com'
Expected Result : {'o': 3, 'g': 2, '.': 1, 'e': 1, 'l': 1, 'm': 1, 'c': 1}

Write a Python function to create the HTML string with tags around the word(s).
Sample function and result :
add_tags('i', 'Python') -> '<i>Python</i>'
add_tags('b', 'Python Tutorial') -> '<b>Python Tutorial </b>'

Write a Python program to remove duplicate characters of a given string.

You might also like