0
1. Write a program that asks the user for their name and how many times to print it. The program should print out the user’s nam
1. Write a program that asks the user for their name and how many times to print it. The program should print out the user’s name the specified number of times. 2. The Fibonacci numbers are the sequence below, where the first two numbers are 1, and each number thereafter is the sum of the two preceding numbers. Write a program that asks the user how many Fibonacci numbers to print and then prints that many. 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 . x=eval(input("Type name: "), sep="") y=eval(input("how many times to print it: "), sep="" for i in range(y): print(x, sep="") print(y, sep=""))
8 odpowiedzi
+ 2
# Program to print the first n Fibonacci numbers
# Ask the user for the number of Fibonacci numbers to print
num = int(input("How many Fibonacci numbers would you like to print? "))
# Initialize the first two numbers of the sequence
a = 0
b = 1
# Print the first n Fibonacci numbers
for i in range(num):
print(b)
temp = a
a = b
b = temp + b
+ 1
it worked, thankyouuu
0
whats the problem?
0
for i in range(2):
print("1", end="")
for i in range(2,x,2):
x=eval(input("how many times to print fibonacci numbers: "))
print(i, sep="")
0
I can't run both 1 and 2
the codes above is what I've been doing
0
# Program to print user's name
name = input("Please enter your name: ")
times = int(input("How many times would you like to print your name? "))
for i in range(times):
print(name)
0
I think it's not like that
number 2 asks the user on how many times the sequence will continue
0
x=eval(input("Type name: "), sep="")
y=eval(input("how many times to print it: "), sep=""
for i in range(y):
print(x, sep="")
print(y, sep=""))