Assignment query

Need assistance for below queries:

1)write a program for recursicve function to calculate the sum of numbers from 1-10.
2)How to genrate ramdom captcha and to shuffle them ?

1). # Python program to find the sum of natural using recursive function

def recur_sum(n):
if n <= 1:
return n
else:
return n + recur_sum(n-1)

change this value for a different result

num = 16

if num < 0:
print(“Enter a positive number”)
else:
print(“The sum is”,recur_sum(num))

2). https://www.dev2qa.com/how-to-generate-random-captcha-in-python/
This link will guide you further.

1 Like

Write a program to check that a string contains only a certain set of characters (in this case a-z , A-Z , 0-9).
please solve this question … i am not understand this question…

2 Likes

Hi brother can you provide some link for python programming?

This program asks you to take an input from the user with validation. When the user enters an input, it should have only the letters a-z, A-Z or the numbers 0 to 9. This program helps to understand how to write code for a user password. Generally password contains limited characters so user cannot enter all special symbols in password . These kind of programs are called as regular expressions, the program can be to enter valid password, atm pin, otp, email id, captcha etc.

Sir any hint for this question, Its tough to solve.

hlo andi in module 2 ASSIGNMENT i need 7 question amswers