Question
For a given number n, print numbers divisible by 3 up to that number(n included) Example: if n=15, print 3,6,9,12,15 Hint you can use modulus
For a given number n, print numbers divisible by 3 up to that number(n included) Example: if n=15, print 3,6,9,12,15 Hint you can use modulus statement (if (i%3==0)) n=15
Question 2:
Generate 10 numbers between 0 and 1 and add into list. Print first three elements of that list.
Question 3:
write a for loop or method to calculate summation of first n numbers i.e if n=3, it will print or return 6 (1+2+3)
Question 4:
Write a method to calculate age for a given date of birth year. Use this method in order to calculate age of person if date of birth is 1944 if age is the name of function, print(age(1944))
For a given number n, print numbers divisible by 3 up to that number(n included) Example: if n=15, print 3,6,9,12,15 Hint you can use modulus statement (if (i%3==0)) n=15
Question 2:
Generate 10 numbers between 0 and 1 and add into list. Print first three elements of that list.
Question 3:
write a for loop or method to calculate summation of first n numbers i.e if n=3, it will print or return 6 (1+2+3)
Question 4:
Write a method to calculate age for a given date of birth year. Use this method in order to calculate age of person if date of birth is 1944 if age is the name of function, print(age(1944))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started