0% found this document useful (0 votes)
9 views1 page

Assignment 1

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

Assignment 1

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

ASSIGNMENT-1

Total Marks:10

Submit your codes as a word file.

1. Write a Python program that prints the numbers from 1 to 50, but:
 For multiples of 3, print "Fizz" instead of the number.
 For multiples of 5, print "Buzz" instead of the number.
 For multiples of both 3 and 5, print "FizzBuzz".

2. Ask the user to input a number. Write a Python program to check if


the number is a prime number or not.
 The program should use a loop to check divisibility and condition
statements to determine primality.

3. Write a Python program that takes an input n and prints the


following pattern:
1
12
123
1234
...
 The program should continue this until it prints n rows.

4. Set a secret number in your code (e.g., secret_number = 7). Write a


program that asks the user to guess the number and provides
feedback:
 If the guess is too low, print "Too low, try again!"
 If the guess is too high, print "Too high, try again!"
 The loop should continue until the user guesses the correct
number.

5. Ask the user to input a string. Write a program that counts how
many vowels (a, e, i, o, u) are in the string.

You might also like