The document outlines various topics related to Python programming, including key features, data types, and variable scopes. It also provides a series of programming tasks and questions focused on string manipulation, variable assignment, and mathematical calculations. Additionally, it covers concepts such as comments, escape characters, and string formatting.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
9 views
Assignment-1 (Variables, String, int, float)
The document outlines various topics related to Python programming, including key features, data types, and variable scopes. It also provides a series of programming tasks and questions focused on string manipulation, variable assignment, and mathematical calculations. Additionally, it covers concepts such as comments, escape characters, and string formatting.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Topics: Variables, String, int, float
1. What are the key features of Python?
2. What are the Data Types in Python? 3. What are local variables and global variables in Python? 4. How do you write comments in python? And Why Comments are important? 5. How to comment on multiple lines in python? 6. What do you mean by Python literals? 7. What are different ways to assign value to variables? 8. What are the Escape Characters in python? 9. Which are the different ways to perform string formatting? Explain with example. 10. Write a program to print every character of a string entered by the user in a new line using a loop 11. Write a program to find the length of the string "machine learning" with and without using len function. 12. Write a program to check if the word 'orange' is present in the "This is orange juice". 13. Write a program to find the number of vowels, consonants, digits, and white space characters in a string. 14. Write a Python program to count Uppercase, Lowercase, special character, and numeric values in a given string. 15. Write a program to make a new string with all the consonants deleted from the string "Hello, have a good day". 16. Write a Python program to remove the nth index character from a non-empty string. 17. Write a Python program to change a given string to a new string where the first and last characters have been exchanged. 18. Write a Python program to count the occurrences of each word in a given sentence. 19. How do you count the occurrence of a given character in a string? 20. Write a program to find last 10 characters of a string? 21. WAP to convert a given string to all uppercase if it contains at least 2 uppercase characters in the first 4 characters. Topics: Variables, String, int, float 22. Write a Python program to remove a newline in Python. 23. Write a Python program to swap commas and dots in a string ○ Sample string: "32.054,23" ○ Expected Output: "32,054.23" 24. Write a Python program to find the first repeated character in a given string 25. Write a Python program to find the second most repeated word in a given string 26. Python program to Count Even and Odd numbers in a string 27. How do you check if a string contains only digits? 28. How do you remove a given character/word from String? 29. Write a Python program to remove the characters which have odd index values of a given string 30. Write a Python function to reverses a string if its length is a multiple of 5 31. Write a Python program to format a number with a percentage(0.05 >> 5%) 32. Write a Python program to reverse words in a string 33. Write a Python program to swap cases of a given string 34. Write a Python program to remove spaces from a given string 35. Write a Python program to remove duplicate characters of a given string 36. Write a Python Program to find the area of a circle 37. Python Program to find Sum of squares of first n natural numbers 38. Python Program to find cube sum of first n natural numbers 39. Python Program to find simple interest and compound interest 40. Python program to check whether a number is Prime or not