PDF Google Drive Downloader v1.1


Báo lỗi sự cố

Nội dung text Python Fundamentals Problems.pdf

Python Fundamentals Problems Find the errors: 1. print(a = b = 5) 2. a = input("Value: ") b = a / 2 print(a/b) Find the output: Q1. name = input("What is your name: ") print('Hi',name) print('How are you doing') Q2. a,b,c = 2,3,4 a,b,c = a*a,b*b,c*c print(a,b,c) Q3. x = 40 y = x+1 x = 20,y+x print(x,y) Programs: P1. Write a program to input a number and print its first five multiples P2. Write a program to read three numbers in three variables and swap first two variables with the sums of first and second, second and third respectively.
Answers: 1. print(a = b = 5) a = b = 5 print(a,b) or print(‘a = b = 5’) 2. a = float(input("Value: ")) b = a / 2 print(a/b) Find the output: Q1. name = input("What is your name: ") print('Hi',name) print('How are you doing') Output: Hi Sundar How are you doing Q2. a,b,c = 2,3,4 a,b,c = a*a,b*b,c*c print(a,b,c) Output: a = 2, b = 3, c = 4 a = a*a b = b*b c = c*c 4 9 16
Q3. x = 40 y = x+1 x = 20,y+x print(x,y) Output: y = 41 x = 20, 41+40 (20 81) 41 P1. Write a program to input a number and print its first five multiples num = int(input('Enter a number: ')) a = num*1,num*2,num*3,num*4,num*5 print(a) or num = int(input('Enter a number: ')) a,b,c,d,e = num*1,num*2,num*3,num*4,num*5 print(a,b,c,d,e) or num = int(input('Enter a number: ')) a=num*1 b=num*2 c=num*3 d=num*4 e=num*5 print(a,b,c,d,e)
P2. Write a program to read three numbers in three variables and swap first two variables with the sums of first and second, second and third respectively. num1 = int(input('Enter a number: ')) num2 = int(input('Enter a number: ')) num3 = int(input('Enter a number: ')) print(num1,num2) num1,num2 = num1+num2,num2+num3 print(num1,num2) Output: Enter a number: 10 Enter a number: 20 Enter a number: 30 10 20 30 50

Tài liệu liên quan

x
Báo cáo lỗi download
Nội dung báo cáo



Chất lượng file Download bị lỗi:
Họ tên:
Email:
Bình luận
Trong quá trình tải gặp lỗi, sự cố,.. hoặc có thắc mắc gì vui lòng để lại bình luận dưới đây. Xin cảm ơn.